fix: provider yaml inital value
This commit is contained in:
@@ -27,6 +27,7 @@ const AdvanceConfig: React.FC<{
|
||||
setYamlValue: (values: any) => {
|
||||
console.log('setYamlValue:', values);
|
||||
editorRef.current?.setValue(values || '');
|
||||
setFileContent(values || '');
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
@@ -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]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user