fix: my models status

This commit is contained in:
jialin
2025-10-24 16:11:12 +08:00
parent 0401cf5fb9
commit ba80ade643
15 changed files with 277 additions and 61 deletions
+12 -1
View File
@@ -214,8 +214,19 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
}
};
const getFieldPaths = (obj: Record<string, any>, prefix = ''): string => {
const result = Object.entries(obj).flatMap(([key, value]) => {
const path = prefix ? `${prefix}.${key}` : key;
return typeof value === 'object' && value !== null
? getFieldPaths(value, path)
: [path];
});
return result[0] || '';
};
const handleOnValuesChange = async (changedValues: any, allValues: any) => {
const fieldName = Object.keys(changedValues)[0];
const fieldName = getFieldPaths(changedValues);
if (excludeFields.includes(fieldName)) {
return;
+20
View File
@@ -3,13 +3,32 @@ import SealInputNumber from '@/components/seal-form/input-number';
import SealInput from '@/components/seal-form/seal-input';
import { useIntl } from '@umijs/max';
import { Form } from 'antd';
import { useFormContext } from '../config/form-context';
import { FormData } from '../config/types';
const KVCacheForm = () => {
const intl = useIntl();
const form = Form.useFormInstance();
const { onValuesChange } = useFormContext();
const kvCacheEnabled = Form.useWatch(['extended_kv_cache', 'enabled'], form);
const handleOnChange = async (e: any) => {
if (e.target.checked) {
form.setFieldsValue({
extended_kv_cache: {
enabled: true,
chunk_size: 256,
max_local_cpu_size: 10,
remote_url: ''
}
});
}
await new Promise((resolve) => {
setTimeout(resolve, 200);
});
onValuesChange?.({}, form.getFieldsValue());
};
return (
<>
<div style={{ paddingBottom: 22 }}>
@@ -20,6 +39,7 @@ const KVCacheForm = () => {
style={{ padding: '0 10px', marginBottom: 0 }}
>
<CheckboxField
onChange={handleOnChange}
label={intl.formatMessage({ id: 'models.form.extendedkvcache' })}
></CheckboxField>
</Form.Item>