fix: do not reset the backend after selecting a gguf file

This commit is contained in:
jialin
2025-11-25 17:20:09 +08:00
parent 47cae0134c
commit ede42e99de
2 changed files with 18 additions and 5 deletions
+12 -3
View File
@@ -258,7 +258,10 @@ const AddModal: FC<AddModalProps> = (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<AddModalProps> = (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<AddModalProps> = (props) => {
requestModelId: updateRequestModelId()
});
handleCancelFiles();
const modelInfo = onSelectModel(item, props.source);
const modelInfo = onSelectModel(item, {
source: props.source
});
if (
evaluateStateRef.current.state === EvaluateProccess.model &&
+6 -2
View File
@@ -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