diff --git a/src/pages/backends/config/schema/update-builtin.json b/src/pages/backends/config/schema/update-builtin.json index 6c5773bc..c64e33bb 100644 --- a/src/pages/backends/config/schema/update-builtin.json +++ b/src/pages/backends/config/schema/update-builtin.json @@ -23,7 +23,7 @@ "version_configs": { "type": "object", "patternProperties": { - "^[a-zA-Z0-9._-]+$": { + "^[a-zA-Z0-9._-]+-custom$": { "type": "object", "properties": { "image_name": { @@ -44,7 +44,7 @@ } }, "additionalProperties": false, - "description": "multiple backend versions" + "description": "multiple backend versions ending with -custom" } }, "required": ["version_configs"], diff --git a/src/pages/llmodels/components/deploy-modal.tsx b/src/pages/llmodels/components/deploy-modal.tsx index 7420994f..b7d2a158 100644 --- a/src/pages/llmodels/components/deploy-modal.tsx +++ b/src/pages/llmodels/components/deploy-modal.tsx @@ -197,6 +197,16 @@ const AddModal: FC = (props) => { return categories || null; }; + const { run: onClickModel } = useDeferredRequest(async () => { + const allValues = form.current?.form?.getFieldsValue?.(); + + handleOnValuesChangeBefore({ + changedValues: {}, + allValues: allValues, + source: props.source + }); + }, 100); + const { run: onSelectFile } = useDeferredRequest( async (item: any, modelInfo: any, manual?: boolean) => { unlockWarningStatus(); @@ -342,7 +352,6 @@ const AddModal: FC = (props) => { if (manual) { form.current?.resetFields(resetFields); } - console.log('isgguf==================> select 2', item.isGGUF); // If the item is empty setIsGGUF(item.isGGUF); updateSelectedModel(item); @@ -371,20 +380,13 @@ const AddModal: FC = (props) => { categories: getCategory(item) }; - console.log('newFormValues:', newFormValues); - form.current?.form?.setFieldsValue?.(newFormValues); - handleOnValuesChangeBefore({ - changedValues: {}, - allValues: newFormValues, - source: props.source - }); + onClickModel(); } }; const handleOnOk = async (allValues: FormData) => { - console.log('handleOnOk:', allValues); onOk(allValues); }; @@ -408,19 +410,13 @@ const AddModal: FC = (props) => { if (res.show) { return; } - if (data.local_path || props.source !== modelSourceMap.local_path_value) { - // TODO confirm whether it is gguf by model file not by backend - handleOnValuesChange?.({ - changedValues: {}, - allValues: isGGUF - ? data - : _.omit(data, [ - 'cpu_offloading', - 'distributed_inference_across_workers' - ]), - source: props.source - }); - } + + // TODO: confirm gguf change backend behavior + handleOnValuesChange?.({ + changedValues: {}, + allValues: data, + source: props.source + }); }; const onValuesChange = async (changedValues: any, allValues: any) => { diff --git a/src/pages/llmodels/components/update-modal.tsx b/src/pages/llmodels/components/update-modal.tsx index 7a496f0a..5e25a4d5 100644 --- a/src/pages/llmodels/components/update-modal.tsx +++ b/src/pages/llmodels/components/update-modal.tsx @@ -8,7 +8,6 @@ import React, { useEffect, useMemo, useRef } from 'react'; import ColumnWrapper from '../../_components/column-wrapper'; import { deployFormKeyMap, - modelSourceMap, ScheduleValueMap, updateIgnoreFields } from '../config'; @@ -133,19 +132,11 @@ const UpdateModal: React.FC = (props) => { if (res.show) { return; } - if (data.local_path || data.source !== modelSourceMap.local_path_value) { - handleOnValuesChange?.({ - changedValues: {}, - allValues: - backend === backendOptionsMap.llamaBox - ? data - : _.omit(data, [ - 'cpu_offloading', - 'distributed_inference_across_workers' - ]), - source: data.source - }); - } + handleOnValuesChange?.({ + changedValues: {}, + allValues: data, + source: data.source + }); }; const handleAsyncBackendChange = (backend: string) => { diff --git a/src/pages/llmodels/forms/backend.tsx b/src/pages/llmodels/forms/backend.tsx index d5720d95..0ab6c298 100644 --- a/src/pages/llmodels/forms/backend.tsx +++ b/src/pages/llmodels/forms/backend.tsx @@ -1,5 +1,4 @@ import IconFont from '@/components/icon-font'; -import AutoComplete from '@/components/seal-form/auto-complete'; import SealInput from '@/components/seal-form/seal-input'; import SealSelect from '@/components/seal-form/seal-select'; import SealTextArea from '@/components/seal-form/seal-textarea'; @@ -71,7 +70,7 @@ const BackendFields: React.FC = () => { {backendOptionsMap.custom !== backend && ( - { ) } )} - > + > )} {backend === backendOptionsMap.custom && ( diff --git a/src/pages/llmodels/forms/index.tsx b/src/pages/llmodels/forms/index.tsx index 0c28018a..ec695733 100644 --- a/src/pages/llmodels/forms/index.tsx +++ b/src/pages/llmodels/forms/index.tsx @@ -81,6 +81,7 @@ const DataForm: React.FC = forwardRef((props, ref) => { sourceList, clusterList = [], fields = ['source'], + onBackendChange, onSourceChange, onValuesChange, onOk @@ -190,7 +191,7 @@ const DataForm: React.FC = forwardRef((props, ref) => { backend_parameters: option.default_backend_param || [], ...updateGPUSelector(val) }); - props.onBackendChange?.(val); + onBackendChange?.(val); }; // generate the data is available for the backend including the gpu_ids diff --git a/src/pages/llmodels/forms/local-path-source.tsx b/src/pages/llmodels/forms/local-path-source.tsx index 6d3e21c3..9087f955 100644 --- a/src/pages/llmodels/forms/local-path-source.tsx +++ b/src/pages/llmodels/forms/local-path-source.tsx @@ -34,12 +34,8 @@ const LocalPathForm: React.FC = () => { } const handleOnBlur = (e: any) => { - form.setFieldsValue({ - backend_parameters: [], - backend_version: '', - backend: '', - env: {} - }); + const value = e.target.value; + onValuesChange?.({ local_path: value }, form.getFieldsValue()); }; const handleLocalPathBlur = async (e: any) => { @@ -99,6 +95,7 @@ const LocalPathForm: React.FC = () => { allowClear required onFocus={handleOnFocus} + onBlur={handleOnBlur} label={intl.formatMessage({ id: 'models.form.filePath' })} description={} >