diff --git a/src/pages/llmodels/components/deploy-modal.tsx b/src/pages/llmodels/components/deploy-modal.tsx index bf0ba2fd..f8022295 100644 --- a/src/pages/llmodels/components/deploy-modal.tsx +++ b/src/pages/llmodels/components/deploy-modal.tsx @@ -258,7 +258,10 @@ const AddModal: FC = (props) => { return; } - const modelInfo = onSelectModel(selectedModel, props.source); + const modelInfo = onSelectModel(selectedModel, { + source: props.source, + defaultBackend: form.current?.getFieldValue?.('backend') + }); form.current?.setFieldsValue?.({ ..._.omit(modelInfo, ['name']), @@ -323,13 +326,17 @@ const AddModal: FC = (props) => { // TODO form.current?.resetFields(resetFields); - const modelInfo = onSelectModel(item, props.source); + const modelInfo = onSelectModel(item, { + source: props.source + }); form.current?.setFieldsValue?.({ ...defaultFormValues, ...modelInfo, categories: getCategory(item) }); + console.log('modelInfo:', modelInfo); + let warningStatus: MessageStatus = { show: true, title: '', @@ -359,7 +366,9 @@ const AddModal: FC = (props) => { requestModelId: updateRequestModelId() }); handleCancelFiles(); - const modelInfo = onSelectModel(item, props.source); + const modelInfo = onSelectModel(item, { + source: props.source + }); if ( evaluateStateRef.current.state === EvaluateProccess.model && diff --git a/src/pages/llmodels/hooks/index.ts b/src/pages/llmodels/hooks/index.ts index 620d88ae..a98605f8 100644 --- a/src/pages/llmodels/hooks/index.ts +++ b/src/pages/llmodels/hooks/index.ts @@ -504,7 +504,11 @@ export const useSelectModel = (data: { gpuOptions: any[] }) => { // just for setting the model name or repo_id, and the backend, Since the model type is fixed. const { gpuOptions } = data; - const onSelectModel = (selectModel: any, source: string) => { + const onSelectModel = ( + selectModel: any, + options: { source: string; defaultBackend?: string } + ) => { + const { source, defaultBackend } = options; let name = _.split(selectModel.name, '/').slice(-1)[0]; const reg = /(-gguf)$/i; name = _.toLower(name).replace(reg, ''); @@ -512,7 +516,7 @@ export const useSelectModel = (data: { gpuOptions: any[] }) => { const modelTaskData = recognizeAudioModel(selectModel, source); const backend = checkCurrentbackend({ - defaultBackend: backendOptionsMap.vllm, + defaultBackend: defaultBackend || backendOptionsMap.vllm, isAudio: modelTaskData.type === modelTaskMap.audio, isGGUF: selectModel.isGGUF, gpuOptions: gpuOptions