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
@@ -14,8 +14,6 @@ const useFinishFailed = (options: FinishFailedOptions) => {
const handleOnFinishFailed = (errorInfo: any) => { const handleOnFinishFailed = (errorInfo: any) => {
const { errorFields } = errorInfo; const { errorFields } = errorInfo;
console.log('Finish failed:', errorInfo);
if (errorFields && errorFields.length > 0) { if (errorFields && errorFields.length > 0) {
const collapseKeys: { sort: number; key: string }[] = []; const collapseKeys: { sort: number; key: string }[] = [];
const names = errorFields.map((item: any) => item.name[0]); const names = errorFields.map((item: any) => item.name[0]);
@@ -40,7 +40,6 @@ const VersionInfoModal: React.FC<VersionInfoModalProps> = ({
...builtInVersions, ...builtInVersions,
...currentData.version_configs ...currentData.version_configs
}; };
const versionList: VersionListItem[] = Object.entries(versions).map( const versionList: VersionListItem[] = Object.entries(versions).map(
([key, value]: [string, any]) => ({ ([key, value]: [string, any]) => ({
version_no: key, version_no: key,
@@ -223,6 +223,7 @@ const useColumnSettings = (options: {
<AutoTooltip <AutoTooltip
ghost ghost
minWidth={20} minWidth={20}
maxWidth={'max-content'}
showTitle={text > 0} showTitle={text > 0}
title={<InfoColumn fieldList={fieldList} data={record}></InfoColumn>} title={<InfoColumn fieldList={fieldList} data={record}></InfoColumn>}
> >
@@ -146,7 +146,7 @@ const CatalogItem: React.FC<CatalogItemProps> = (props) => {
}} }}
> >
{data.activated_size {data.activated_size
? `${data.size}${data.size_unit || 'B'}-A${data.activated_size}${data.size_unit || 'B'}` ? `${data.size}${data.size_unit || 'B'}-A${data.activated_size}B`
: `${data.size}${data.size_unit || 'B'}`} : `${data.size}${data.size_unit || 'B'}`}
</AutoTooltip> </AutoTooltip>
</> </>
@@ -27,6 +27,7 @@ const AdvanceConfig: React.FC<{
setYamlValue: (values: any) => { setYamlValue: (values: any) => {
console.log('setYamlValue:', values); console.log('setYamlValue:', values);
editorRef.current?.setValue(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( const apiTokensList = _.get(currentData, 'api_tokens', []).map(
(item: any) => item.hash || '' (item: any) => item.hash || ''
); );
const customConfigYaml = json2Yaml(
_.omit(currentData.config, ['type', 'openaiCustomUrl']) || {}
);
form.setFieldsValue({ form.setFieldsValue({
...currentData, ...currentData,
api_key: apiTokensList?.[0] || '', api_key: apiTokensList?.[0] || '',
api_tokens: apiTokensList?.slice(1) || [], api_tokens: apiTokensList?.slice(1) || [],
proxy_enabled: !!currentData.proxy_url, proxy_enabled: !!currentData.proxy_url,
custom_config: json2Yaml( custom_config: customConfigYaml
_.omit(currentData.config, ['type', 'openaiCustomUrl']) || {}
)
}); });
advanceRef.current?.setYamlValue?.(customConfigYaml);
} }
}, [form, currentData, action]); }, [form, currentData, action]);
+3 -3
View File
@@ -38,18 +38,18 @@ const Basic = () => {
})} })}
rules={[ rules={[
{ {
required: true, required: false,
message: getRuleMessage('select', 'models.form.categories') message: getRuleMessage('select', 'models.form.categories')
} }
]} ]}
> >
<CategorySelect <CategorySelect
required={true} allowNull
options={[ options={[
...categoryOptions, ...categoryOptions,
{ {
label: intl.formatMessage({ id: 'common.option.other' }), label: intl.formatMessage({ id: 'common.option.other' }),
value: 'other' value: null
} }
]} ]}
label={intl.formatMessage({ id: 'models.form.categories' })} label={intl.formatMessage({ id: 'models.form.categories' })}
+1 -1
View File
@@ -9,7 +9,7 @@ export const GPUDriverMap = {
ILUVATAR: 'corex', ILUVATAR: 'corex',
CAMBRICON: 'neuware', CAMBRICON: 'neuware',
METAX: 'maca', METAX: 'maca',
THEAD: 'ppu' THEAD: 'hggc'
}; };
export const ManufacturerMap = { export const ManufacturerMap = {