fix: do not reset the backend after selecting a gguf file
This commit is contained in:
@@ -258,7 +258,10 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const modelInfo = onSelectModel(selectedModel, props.source);
|
const modelInfo = onSelectModel(selectedModel, {
|
||||||
|
source: props.source,
|
||||||
|
defaultBackend: form.current?.getFieldValue?.('backend')
|
||||||
|
});
|
||||||
|
|
||||||
form.current?.setFieldsValue?.({
|
form.current?.setFieldsValue?.({
|
||||||
..._.omit(modelInfo, ['name']),
|
..._.omit(modelInfo, ['name']),
|
||||||
@@ -323,13 +326,17 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
form.current?.resetFields(resetFields);
|
form.current?.resetFields(resetFields);
|
||||||
const modelInfo = onSelectModel(item, props.source);
|
const modelInfo = onSelectModel(item, {
|
||||||
|
source: props.source
|
||||||
|
});
|
||||||
form.current?.setFieldsValue?.({
|
form.current?.setFieldsValue?.({
|
||||||
...defaultFormValues,
|
...defaultFormValues,
|
||||||
...modelInfo,
|
...modelInfo,
|
||||||
categories: getCategory(item)
|
categories: getCategory(item)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('modelInfo:', modelInfo);
|
||||||
|
|
||||||
let warningStatus: MessageStatus = {
|
let warningStatus: MessageStatus = {
|
||||||
show: true,
|
show: true,
|
||||||
title: '',
|
title: '',
|
||||||
@@ -359,7 +366,9 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
requestModelId: updateRequestModelId()
|
requestModelId: updateRequestModelId()
|
||||||
});
|
});
|
||||||
handleCancelFiles();
|
handleCancelFiles();
|
||||||
const modelInfo = onSelectModel(item, props.source);
|
const modelInfo = onSelectModel(item, {
|
||||||
|
source: props.source
|
||||||
|
});
|
||||||
|
|
||||||
if (
|
if (
|
||||||
evaluateStateRef.current.state === EvaluateProccess.model &&
|
evaluateStateRef.current.state === EvaluateProccess.model &&
|
||||||
|
|||||||
@@ -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.
|
// just for setting the model name or repo_id, and the backend, Since the model type is fixed.
|
||||||
const { gpuOptions } = data;
|
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];
|
let name = _.split(selectModel.name, '/').slice(-1)[0];
|
||||||
const reg = /(-gguf)$/i;
|
const reg = /(-gguf)$/i;
|
||||||
name = _.toLower(name).replace(reg, '');
|
name = _.toLower(name).replace(reg, '');
|
||||||
@@ -512,7 +516,7 @@ export const useSelectModel = (data: { gpuOptions: any[] }) => {
|
|||||||
const modelTaskData = recognizeAudioModel(selectModel, source);
|
const modelTaskData = recognizeAudioModel(selectModel, source);
|
||||||
|
|
||||||
const backend = checkCurrentbackend({
|
const backend = checkCurrentbackend({
|
||||||
defaultBackend: backendOptionsMap.vllm,
|
defaultBackend: defaultBackend || backendOptionsMap.vllm,
|
||||||
isAudio: modelTaskData.type === modelTaskMap.audio,
|
isAudio: modelTaskData.type === modelTaskMap.audio,
|
||||||
isGGUF: selectModel.isGGUF,
|
isGGUF: selectModel.isGGUF,
|
||||||
gpuOptions: gpuOptions
|
gpuOptions: gpuOptions
|
||||||
|
|||||||
Reference in New Issue
Block a user