From fb8fcc5028402843f7997dbbba14d5152393f02d Mon Sep 17 00:00:00 2001 From: jialin Date: Fri, 11 Apr 2025 20:26:51 +0800 Subject: [PATCH] fix: set env null after change backend --- src/pages/llmodels/components/data-form.tsx | 10 ++++++---- src/pages/llmodels/components/update-modal.tsx | 7 ++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/pages/llmodels/components/data-form.tsx b/src/pages/llmodels/components/data-form.tsx index 7207fd57..aef876f8 100644 --- a/src/pages/llmodels/components/data-form.tsx +++ b/src/pages/llmodels/components/data-form.tsx @@ -82,9 +82,7 @@ const DataForm: React.FC = forwardRef((props, ref) => { const handleBackendChange = async (val: string) => { const updates = { - backend_version: '', - backend_parameters: [], - env: {} + backend_version: '' }; if (val === backendOptionsMap.llamaBox) { Object.assign(updates, { @@ -92,7 +90,11 @@ const DataForm: React.FC = forwardRef((props, ref) => { cpu_offloading: true }); } - form.setFieldsValue(updates); + form.setFieldsValue({ + ...updates, + backend_parameters: [], + env: null + }); handleSetGPUIds(val); props.onBackendChange?.(val); }; diff --git a/src/pages/llmodels/components/update-modal.tsx b/src/pages/llmodels/components/update-modal.tsx index 16887c0a..fc1b5833 100644 --- a/src/pages/llmodels/components/update-modal.tsx +++ b/src/pages/llmodels/components/update-modal.tsx @@ -126,9 +126,7 @@ const UpdateModal: React.FC = (props) => { const handleBackendChange = (backend: string) => { const updates = { - backend_version: '', - backend_parameters: [], - env: {} + backend_version: '' }; if (backend === backendOptionsMap.llamaBox) { Object.assign(updates, { @@ -136,12 +134,11 @@ const UpdateModal: React.FC = (props) => { cpu_offloading: true }); } - form.setFieldsValue(updates); + form.setFieldsValue({ ...updates, backend_parameters: [], env: null }); handleSetGPUIds(backend); const data = form.getFieldsValue?.(); const res = handleBackendChangeBefore(data); - console.log('res+++++++++++', res); if (res.show) { return; }