Skip to content

Commit 530c826

Browse files
committed
Merge branch '1.3.x'
2 parents 10eaa1c + fc4c8db commit 530c826

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

frontend/src/pages/configForm/configUi/components/llm-container.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const LLMContainer = (props) => {
3939
return;
4040
}
4141
const modelData = (config.from === 'graph' ? graphOperator.getConfig(config.defaultValue) : config.defaultValue);
42-
form.setFieldsValue(pick(modelData, ['model', 'temperature', 'systemPrompt']));
42+
form.setFieldsValue(pick(modelData, ['accessInfo', 'model', 'temperature', 'systemPrompt']));
4343
llmRef.current.setPromptValue(modelData.systemPrompt);
4444
}, [config, appConfig]);
4545

frontend/src/pages/configForm/configUi/components/llm.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,7 @@ const LLM = (props) => {
4949
const handleGetModels = (open) => {
5050
if (!open) return;
5151
getModels().then((res) => {
52-
const models = res.models.map((model) => {
53-
return {
54-
...model,
55-
id: model.serviceName + '***' + model.tag
56-
}
57-
})
58-
setModels(models);
52+
setModels(res.models);
5953
})
6054
}
6155

@@ -105,8 +99,9 @@ const LLM = (props) => {
10599
};
106100

107101
// 校验模型是否存在
108-
const checkExist = (rules, value) => {
109-
if (!models.find(item => item.id === value)) {
102+
const checkExist = () => {
103+
const accessInfo = form.getFieldValue('accessInfo');
104+
if (!models.find(item => item.serviceName === accessInfo.serviceName && item.tag === accessInfo.tag)) {
110105
return Promise.reject(new Error(`${t('LLM')}${value}${t('modelNotExistTip')}`));
111106
}
112107
return Promise.resolve();
@@ -118,7 +113,8 @@ const LLM = (props) => {
118113
dispatch(setValidateInfo(appValidateInfo.filter(item => (item.configCheckId !== validateItem.configCheckId) && item.configName !== 'accessInfo')));
119114
})
120115
}
121-
const updateModelInfo = models.find(item => item.id === value);
116+
const updateModelInfo = models.find(item => item.serviceName === value);
117+
form.setFieldValue('accessInfo', { serviceName: updateModelInfo.serviceName, tag: updateModelInfo.tag });
122118
updateData({ model: value, accessInfo: { serviceName: updateModelInfo.serviceName, tag: updateModelInfo.tag } });
123119
};
124120

@@ -160,7 +156,7 @@ const LLM = (props) => {
160156
onChange={(value) => handleUpdateModel(models, value)}
161157
fieldNames={{
162158
label: 'serviceName',
163-
value: 'id'
159+
value: 'serviceName'
164160
}}
165161
>
166162
</Select>

frontend/src/pages/configForm/configUi/components/recommend-container.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const RecommendContainer = (props) => {
3131
dispatch(setConfigItem({ key: config.name, value }));
3232
}
3333
updateData();
34+
setRecommendValues(value);
3435
};
3536

3637
// 新增猜你想问

0 commit comments

Comments
 (0)