Revert "feat(web): update read_all_config select valueKey"

This reverts commit 46f0f3cee9.
This commit is contained in:
zhaoying
2026-01-28 15:20:31 +08:00
parent 46f0f3cee9
commit 102712a16e
4 changed files with 11 additions and 20 deletions

View File

@@ -15,7 +15,7 @@ interface ApiResponse<T> {
interface CustomSelectProps extends Omit<SelectProps, 'filterOption'> { interface CustomSelectProps extends Omit<SelectProps, 'filterOption'> {
url: string; url: string;
params?: Record<string, unknown>; params?: Record<string, unknown>;
valueKey?: string | string[]; valueKey?: string;
labelKey?: string; labelKey?: string;
placeholder?: string; placeholder?: string;
hasAll?: boolean; hasAll?: boolean;
@@ -66,18 +66,11 @@ const CustomSelect: FC<CustomSelectProps> = ({
{...props} {...props}
> >
{hasAll && <Select.Option value={null}>{allTitle || t('common.all')}</Select.Option>} {hasAll && <Select.Option value={null}>{allTitle || t('common.all')}</Select.Option>}
{displayOptions.map((option) => { {displayOptions.map((option) => (
const getValue = () => { <Select.Option key={option[valueKey]} value={option[valueKey]}>
if (typeof valueKey === 'string') return option[valueKey]; {String(option[labelKey])}
return valueKey.find(key => option[key] != null) ? option[valueKey.find(key => option[key] != null)!] : undefined; </Select.Option>
}; ))}
const value = getValue();
return (
<Select.Option key={value} value={value}>
{String(option[labelKey])}
</Select.Option>
);
})}
</Select> </Select>
); );
}; };

View File

@@ -79,7 +79,7 @@ const SelectWrapper: FC<{ title: string, desc: string, name: string | string[],
placeholder={t('common.pleaseSelect')} placeholder={t('common.pleaseSelect')}
url={url} url={url}
hasAll={false} hasAll={false}
valueKey={['config_id_old', 'config_id']} valueKey='config_id'
labelKey="config_name" labelKey="config_name"
/> />
</Form.Item> </Form.Item>
@@ -126,14 +126,12 @@ const Agent = forwardRef<AgentRef>((_props, ref) => {
getApplicationConfig(id as string).then(res => { getApplicationConfig(id as string).then(res => {
const response = res as Config const response = res as Config
let allTools = Array.isArray(response.tools) ? response.tools : [] let allTools = Array.isArray(response.tools) ? response.tools : []
const memoryContent = response.memory?.memory_content
const convertedMemoryContent = memoryContent && !isNaN(Number(memoryContent)) ? Number(memoryContent) : memoryContent
form.setFieldsValue({ form.setFieldsValue({
...response, ...response,
tools: allTools, tools: allTools,
memory: { memory: {
...response.memory, ...response.memory,
memory_content: convertedMemoryContent memory_content: response.memory?.memory_content ? Number(response.memory?.memory_content) : undefined
} }
}) })
setData({ setData({

View File

@@ -200,7 +200,7 @@ export const nodeLibrary: NodeLibrary[] = [
config_id: { config_id: {
type: 'customSelect', type: 'customSelect',
url: memoryConfigListUrl, url: memoryConfigListUrl,
valueKey: ['config_id_old', 'config_id'], valueKey: 'config_id',
labelKey: 'config_name' labelKey: 'config_name'
}, },
search_switch: { search_switch: {
@@ -223,7 +223,7 @@ export const nodeLibrary: NodeLibrary[] = [
config_id: { config_id: {
type: 'customSelect', type: 'customSelect',
url: memoryConfigListUrl, url: memoryConfigListUrl,
valueKey: ['config_id_old', 'config_id'], valueKey: 'config_id',
labelKey: 'config_name' labelKey: 'config_name'
} }
} }

View File

@@ -14,7 +14,7 @@ export interface NodeConfig {
url?: string; url?: string;
params?: { [key: string]: unknown; } params?: { [key: string]: unknown; }
valueKey?: string | string[]; valueKey?: string;
labelKey?: string; labelKey?: string;
defaultValue?: any; defaultValue?: any;