Skip to content

Commit 96d7a99

Browse files
committed
fix: fix autofilled models are not correct
1 parent 24be9de commit 96d7a99

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

web/default/src/pages/Channel/EditChannel.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ const EditChannel = () => {
8383
data.model_mapping = JSON.stringify(JSON.parse(data.model_mapping), null, 2);
8484
}
8585
setInputs(data);
86+
setBasicModels(getChannelModels(data.type));
8687
} else {
8788
showError(message);
8889
}
@@ -99,9 +100,6 @@ const EditChannel = () => {
99100
}));
100101
setOriginModelOptions(localModelOptions);
101102
setFullModels(res.data.data.map((model) => model.id));
102-
setBasicModels(res.data.data.filter((model) => {
103-
return model.id.startsWith('gpt-3') || model.id.startsWith('text-');
104-
}).map((model) => model.id));
105103
} catch (error) {
106104
showError(error.message);
107105
}
@@ -137,6 +135,9 @@ const EditChannel = () => {
137135
useEffect(() => {
138136
if (isEdit) {
139137
loadChannel().then();
138+
} else {
139+
let localModels = getChannelModels(inputs.type);
140+
setBasicModels(localModels);
140141
}
141142
fetchModels().then();
142143
fetchGroups().then();
@@ -355,7 +356,7 @@ const EditChannel = () => {
355356
<div style={{ lineHeight: '40px', marginBottom: '12px' }}>
356357
<Button type={'button'} onClick={() => {
357358
handleInputChange(null, { name: 'models', value: basicModels });
358-
}}>填入基础模型</Button>
359+
}}>填入相关模型</Button>
359360
<Button type={'button'} onClick={() => {
360361
handleInputChange(null, { name: 'models', value: fullModels });
361362
}}>填入所有模型</Button>

0 commit comments

Comments
 (0)