Skip to content

Commit 6c82b91

Browse files
committed
pref: Optimize AI setting
1 parent 9668508 commit 6c82b91

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

chat2db-client/src/blocks/Setting/AiSetting/aiTypeConfig.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ const AIFormConfig: Record<AIType, IAiConfigBooleans> = {
2323
},
2424
[AIType.ZHIPUAI]: {
2525
apiKey: true,
26-
apiHost: true,
27-
model: true,
26+
apiHost: 'https://open.bigmodel.cn/api/paas/v3/model-api/',
27+
model: 'chatglm_turbo',
2828
},
2929
[AIType.BAICHUANAI]: {
3030
apiKey: true,
3131
secretKey: true,
32-
apiHost: true,
33-
model: true,
32+
apiHost: 'https://api.baichuan-ai.com/v1/stream/chat/',
33+
model: 'Baichuan2-53B',
3434
},
3535
[AIType.WENXINAI]: {
3636
apiKey: true,
@@ -43,7 +43,7 @@ const AIFormConfig: Record<AIType, IAiConfigBooleans> = {
4343
},
4444
[AIType.OPENAI]: {
4545
apiKey: true,
46-
apiHost: true,
46+
apiHost: 'https://api.openai.com/',
4747
httpProxyHost: true,
4848
httpProxyPort: true,
4949
// model: 'gpt-3.5-turbo',

chat2db-client/src/blocks/Setting/AiSetting/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,16 @@ export default function SettingAI(props: IProps) {
9898

9999
<Form layout="vertical">
100100
{Object.keys(AIFormConfig[aiConfig?.aiSqlSource]).map((key: string) => (
101-
<Form.Item key={key} label={capitalizeFirstLetter(key)} className={styles.title}>
101+
<Form.Item
102+
key={key}
103+
required={key === 'apiKey' || key === 'secretKey'}
104+
label={capitalizeFirstLetter(key)}
105+
className={styles.title}
106+
>
102107
<Input
103108
autoComplete="off"
104109
value={aiConfig[key]}
105-
defaultValue={AIFormConfig[aiConfig?.aiSqlSource]?.[key]}
110+
placeholder={AIFormConfig[aiConfig?.aiSqlSource]?.[key]}
106111
onChange={(e) => {
107112
setAiConfig({ ...aiConfig, [key]: e.target.value });
108113
}}

0 commit comments

Comments
 (0)