perf: async bug in llm form

This commit is contained in:
Junyan Qin
2025-05-14 15:37:58 +08:00
parent 39f9400de7
commit bf51afedf6

View File

@@ -132,14 +132,17 @@ export default function LLMForm({
>([]);
useEffect(() => {
initLLMModelFormComponent();
initLLMModelFormComponent().then(() => {
if (editMode && initLLMId) {
getLLMConfig(initLLMId).then((val) => {
form.setValue('name', val.name);
form.setValue('model_provider', val.model_provider);
form.setValue('url', val.url);
form.setValue('api_key', val.api_key);
form.setValue('abilities', val.abilities as ('vision' | 'func_call')[]);
form.setValue(
'abilities',
val.abilities as ('vision' | 'func_call')[],
);
// 转换extra_args为新格式
if (val.extra_args) {
const args = val.extra_args.map((arg) => {
@@ -164,6 +167,7 @@ export default function LLMForm({
form.reset();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
});
}, []);
const addExtraArg = () => {