fix: provider yaml inital value

This commit is contained in:
jialin
2026-02-12 12:20:05 +08:00
parent 978d327bcd
commit 9cb7145b4e
8 changed files with 12 additions and 11 deletions
@@ -27,6 +27,7 @@ const AdvanceConfig: React.FC<{
setYamlValue: (values: any) => {
console.log('setYamlValue:', values);
editorRef.current?.setValue(values || '');
setFileContent(values || '');
}
}));
+5 -3
View File
@@ -138,15 +138,17 @@ const ProviderForm: React.FC<ProviderFormProps> = forwardRef((props, ref) => {
const apiTokensList = _.get(currentData, 'api_tokens', []).map(
(item: any) => item.hash || ''
);
const customConfigYaml = json2Yaml(
_.omit(currentData.config, ['type', 'openaiCustomUrl']) || {}
);
form.setFieldsValue({
...currentData,
api_key: apiTokensList?.[0] || '',
api_tokens: apiTokensList?.slice(1) || [],
proxy_enabled: !!currentData.proxy_url,
custom_config: json2Yaml(
_.omit(currentData.config, ['type', 'openaiCustomUrl']) || {}
)
custom_config: customConfigYaml
});
advanceRef.current?.setYamlValue?.(customConfigYaml);
}
}, [form, currentData, action]);