chore: check default backend deploy from local path

This commit is contained in:
jialin
2025-04-24 18:09:54 +08:00
parent 84d4c7a6f2
commit 9a6b907c11
2 changed files with 22 additions and 15 deletions
+13 -7
View File
@@ -13,7 +13,11 @@ import {
} from '../config'; } from '../config';
import { FormContext } from '../config/form-context'; import { FormContext } from '../config/form-context';
import { FormData, SourceType } from '../config/types'; import { FormData, SourceType } from '../config/types';
import { useCheckCompatibility, useSelectModel } from '../hooks'; import {
checkOnlyAscendNPU,
useCheckCompatibility,
useSelectModel
} from '../hooks';
import ColumnWrapper from './column-wrapper'; import ColumnWrapper from './column-wrapper';
import CompatibilityAlert from './compatible-alert'; import CompatibilityAlert from './compatible-alert';
import DataForm from './data-form'; import DataForm from './data-form';
@@ -219,10 +223,13 @@ const AddModal: FC<AddModalProps> = (props) => {
source: source source: source
}); });
} else { } else {
const backend = let backend = checkOnlyAscendNPU(props.gpuOptions)
source === modelSourceMap.ollama_library_value ? backendOptionsMap.ascendMindie
? backendOptionsMap.llamaBox : backendOptionsMap.vllm;
: backendOptionsMap.vllm;
if (source === modelSourceMap.ollama_library_value) {
backend = backendOptionsMap.llamaBox;
}
form.current?.setFieldValue?.('backend', backend); form.current?.setFieldValue?.('backend', backend);
setIsGGUF(source === modelSourceMap.ollama_library_value); setIsGGUF(source === modelSourceMap.ollama_library_value);
} }
@@ -233,7 +240,6 @@ const AddModal: FC<AddModalProps> = (props) => {
}, [warningStatus.show, warningStatus.type]); }, [warningStatus.show, warningStatus.type]);
const displayEvaluateStatus = () => { const displayEvaluateStatus = () => {
console.log('displayEvaluateStatus===');
setWarningStatus({ setWarningStatus({
show: true, show: true,
title: '', title: '',
@@ -256,7 +262,7 @@ const AddModal: FC<AddModalProps> = (props) => {
message: [] message: []
}); });
}; };
}, [open]); }, [open, props.gpuOptions.length]);
return ( return (
<Drawer <Drawer
@@ -34,6 +34,7 @@ import _ from 'lodash';
import React, { useCallback, useEffect, useMemo, useState } from 'react'; import React, { useCallback, useEffect, useMemo, useState } from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { import {
checkCurrentbackend,
useGenerateFormEditInitialValues, useGenerateFormEditInitialValues,
useGenerateModelFileOptions useGenerateModelFileOptions
} from '../../llmodels/hooks'; } from '../../llmodels/hooks';
@@ -373,7 +374,7 @@ const ModelFiles = () => {
worker_id: value worker_id: value
}); });
}; };
const generateInitialValues = (record: ListItem) => { const generateInitialValues = (record: ListItem, gpuOptions: any[]) => {
const isGGUF = _.includes(record.resolved_paths?.[0], 'gguf'); const isGGUF = _.includes(record.resolved_paths?.[0], 'gguf');
const isOllama = !!record.ollama_library_model_name; const isOllama = !!record.ollama_library_model_name;
const audioModelTag = identifyModelTask( const audioModelTag = identifyModelTask(
@@ -403,12 +404,12 @@ const ModelFiles = () => {
} }
: {}, : {},
name: extractFileName(name), name: extractFileName(name),
backend: backend: checkCurrentbackend({
isGGUF || isOllama isGGUF: !audioModelTag && (isGGUF || isOllama),
? backendOptionsMap.llamaBox isAudio: !!audioModelTag,
: audioModelTag gpuOptions: gpuOptions,
? backendOptionsMap.voxBox defaultBackend: backendOptionsMap.vllm
: backendOptionsMap.vllm, }),
isGGUF: !audioModelTag && (isGGUF || isOllama) isGGUF: !audioModelTag && (isGGUF || isOllama)
}; };
}; };
@@ -438,7 +439,7 @@ const ModelFiles = () => {
getGPUList() getGPUList()
]); ]);
const dataList = generateModelFileOptions(modelFileList, workersList); const dataList = generateModelFileOptions(modelFileList, workersList);
const initialValues = generateInitialValues(record); const initialValues = generateInitialValues(record, gpuList);
setOpenDeployModal({ setOpenDeployModal({
...openDeployModal, ...openDeployModal,
modelFileOptions: dataList, modelFileOptions: dataList,