chore: allow switch backend between vllm and mindie

This commit is contained in:
jialin
2025-04-14 19:29:55 +08:00
parent b108d4e287
commit 3d32ec7210
7 changed files with 53 additions and 22 deletions
@@ -68,6 +68,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
modelSourceMap.huggingface_value,
modelSourceMap.modelscope_value
];
console.log('hasLinuxWorker---------:', hasLinuxWorker);
const [isEvaluating, setIsEvaluating] = useState<boolean>(false);
const [current, setCurrent] = useState<string>('');
const currentRef = useRef<string>('');
+1 -1
View File
@@ -529,7 +529,7 @@ const Models: React.FC<ModelsProps> = ({
const config = modalConfig[item.key];
const hasLinuxWorker = workerList.some(
(worker) => worker.labels?.os === 'linux'
(worker) => _.toLower(worker.labels?.os) === 'linux'
);
if (config) {
+21 -7
View File
@@ -169,8 +169,13 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
const isEndwithGGUF = _.endsWith(value, '.gguf');
const isBlobFile = value.split('/').pop().includes('sha256');
let backend = backendOptionsMap.llamaBox;
const isVllmOrAscend = [
backendOptionsMap.vllm,
backendOptionsMap.ascendMindie
].includes(form.getFieldValue('backend'));
if (!isEndwithGGUF || !isBlobFile) {
backend = backendOptionsMap.vllm;
backend = isVllmOrAscend ? formData!.backend : backendOptionsMap.vllm;
}
form.setFieldValue('backend', backend);
handleBackendChange?.(backend);
@@ -399,6 +404,13 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
);
}, [warningStatus.show, warningStatus.type, warningStatus.isDefault]);
const isVllmOrAscend = useMemo(() => {
return (
formData?.backend === backendOptionsMap.vllm ||
formData?.backend === backendOptionsMap.ascendMindie
);
}, [formData?.backend]);
useEffect(() => {
if (open && formData) {
setOriginalFormData();
@@ -563,7 +575,8 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
label: backendLabelMap[backendOptionsMap.vllm],
value: backendOptionsMap.vllm,
disabled:
formData?.source === modelSourceMap.local_path_value
formData?.source === modelSourceMap.local_path_value ||
isVllmOrAscend
? false
: isGGUF
},
@@ -571,7 +584,8 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
label: backendLabelMap[backendOptionsMap.ascendMindie],
value: backendOptionsMap.ascendMindie,
disabled:
formData?.source === modelSourceMap.local_path_value
formData?.source === modelSourceMap.local_path_value ||
isVllmOrAscend
? false
: isGGUF
},
@@ -579,14 +593,14 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
label: backendLabelMap[backendOptionsMap.voxBox],
value: backendOptionsMap.voxBox,
disabled:
formData?.source === modelSourceMap.local_path_value
? false
: isGGUF
formData?.source !== modelSourceMap.local_path_value ||
!isVllmOrAscend
}
]}
disabled={
action === PageAction.EDIT &&
formData?.source !== modelSourceMap.local_path_value
formData?.source !== modelSourceMap.local_path_value &&
!isVllmOrAscend
}
></SealSelect>
</Form.Item>
+3
View File
@@ -19,6 +19,7 @@ type AddModalProps = {
open: boolean;
source: string;
width?: string | number;
hasLinuxWorker?: boolean;
workersList: Global.BaseOption<number>[];
onOk: (values: FormData) => void;
onCancel: () => void;
@@ -31,6 +32,7 @@ const DownloadModel: React.FC<AddModalProps> = (props) => {
open,
onOk,
onCancel,
hasLinuxWorker,
source,
width = 600
} = props || {};
@@ -172,6 +174,7 @@ const DownloadModel: React.FC<AddModalProps> = (props) => {
>
<ColumnWrapper>
<SearchModel
hasLinuxWorker={hasLinuxWorker}
modelSource={props.source}
onSelectModel={handleOnSelectModel}
isDownload={true}