#AI
zhou zhou
14 小时以前 8a3fa0452075df8290d4542e64ced002ff4b476d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import React from "react";
import {
    BooleanInput,
    NumberInput,
    SelectInput,
    TextInput,
} from "react-admin";
import { Grid, Typography } from "@mui/material";
import StatusSelectInput from "@/page/components/StatusSelectInput";
 
const providerChoices = [
    { id: "OPENAI_COMPATIBLE", name: "OPENAI_COMPATIBLE" },
];
 
const AiParamForm = ({ readOnly = false }) => (
    <Grid container spacing={2} width={{ xs: "100%", xl: "80%" }}>
        <Grid item xs={12}>
            <Typography variant="h6">主要配置</Typography>
        </Grid>
        <Grid item xs={12} md={6}>
            <TextInput source="name" label="名称" fullWidth disabled={readOnly} />
        </Grid>
        <Grid item xs={12} md={6}>
            <SelectInput source="providerType" label="提供方类型" choices={providerChoices} fullWidth disabled={readOnly} />
        </Grid>
        <Grid item xs={12}>
            <TextInput source="baseUrl" label="Base URL" fullWidth disabled={readOnly} />
        </Grid>
        <Grid item xs={12} md={6}>
            <TextInput source="apiKey" label="API Key" fullWidth disabled={readOnly} />
        </Grid>
        <Grid item xs={12} md={6}>
            <TextInput source="model" label="模型" fullWidth disabled={readOnly} />
        </Grid>
        <Grid item xs={12} md={3}>
            <NumberInput source="temperature" label="Temperature" fullWidth disabled={readOnly} />
        </Grid>
        <Grid item xs={12} md={3}>
            <NumberInput source="topP" label="Top P" fullWidth disabled={readOnly} />
        </Grid>
        <Grid item xs={12} md={3}>
            <NumberInput source="maxTokens" label="Max Tokens" fullWidth disabled={readOnly} />
        </Grid>
        <Grid item xs={12} md={3}>
            <NumberInput source="timeoutMs" label="Timeout(ms)" fullWidth disabled={readOnly} />
        </Grid>
        <Grid item xs={12} md={6}>
            <BooleanInput source="streamingEnabled" label="启用流式响应" disabled={readOnly} />
        </Grid>
        <Grid item xs={12} md={6}>
            <StatusSelectInput disabled={readOnly} />
        </Grid>
        <Grid item xs={12}>
            <TextInput source="memo" label="备注" fullWidth multiline minRows={3} disabled={readOnly} />
        </Grid>
    </Grid>
);
 
export default AiParamForm;