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