fix: set null to filename for download non-gguf

This commit is contained in:
jialin
2025-07-11 11:07:54 +08:00
parent c3686579b2
commit fda4786737
4 changed files with 12 additions and 17 deletions
@@ -44,7 +44,6 @@ interface HFModelFileProps {
file: any, file: any,
options: { requestModelId: number; manual?: boolean } options: { requestModelId: number; manual?: boolean }
) => void; ) => void;
updateEvaluteState: (state: 'model' | 'form' | 'file') => number;
onSelectFileAfterEvaluate?: (file: any) => void; onSelectFileAfterEvaluate?: (file: any) => void;
} }
@@ -55,13 +54,8 @@ const includeReg = /\.(safetensors|gguf)$/i;
const filterRegGGUF = /\.(gguf)$/i; const filterRegGGUF = /\.(gguf)$/i;
const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => { const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
const { const { collapsed, modelSource, isDownload, onSelectFileAfterEvaluate } =
collapsed, props;
modelSource,
isDownload,
updateEvaluteState,
onSelectFileAfterEvaluate
} = props;
const intl = useIntl(); const intl = useIntl();
const [isEvaluating, setIsEvaluating] = useState(false); const [isEvaluating, setIsEvaluating] = useState(false);
const [dataSource, setDataSource] = useState<any>({ const [dataSource, setDataSource] = useState<any>({
@@ -56,7 +56,7 @@ interface SearchInputProps {
setLoadingModel?: (flag: boolean) => void; setLoadingModel?: (flag: boolean) => void;
onSourceChange?: (source: string) => void; onSourceChange?: (source: string) => void;
onSelectModel: (model: any, manul?: boolean) => void; onSelectModel: (model: any, manul?: boolean) => void;
onSelectModelAfterEvaluate: (model: any, manual?: boolean) => void; onSelectModelAfterEvaluate?: (model: any, manual?: boolean) => void;
displayEvaluateStatus?: ( displayEvaluateStatus?: (
data: MessageStatus, data: MessageStatus,
options?: WarningStausOptions options?: WarningStausOptions
@@ -153,7 +153,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
if (!item.evaluated || item.isGGUF) { if (!item.evaluated || item.isGGUF) {
onSelectModel(item, manual); onSelectModel(item, manual);
} else { } else {
onSelectModelAfterEvaluate(item, manual); onSelectModelAfterEvaluate?.(item, manual);
} }
setCurrent(item.id); setCurrent(item.id);
currentRef.current = item.id; currentRef.current = item.id;
@@ -338,7 +338,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
// if it is gguf, would trigger a evaluation after select a model file // if it is gguf, would trigger a evaluation after select a model file
if (currentItem && !currentItem.isGGUF) { if (currentItem && !currentItem.isGGUF) {
onSelectModelAfterEvaluate(currentItem); onSelectModelAfterEvaluate?.(currentItem);
} }
} catch (error) { } catch (error) {
// cancel the corrponding request // cancel the corrponding request
+2 -2
View File
@@ -54,7 +54,7 @@ const DownloadModel: React.FC<AddModalProps> = (props) => {
if (source === modelSourceMap.huggingface_value) { if (source === modelSourceMap.huggingface_value) {
const huggingFaceModel = { const huggingFaceModel = {
huggingface_repo_id: selectedModel.name, huggingface_repo_id: selectedModel.name,
huggingface_filename: fileName huggingface_filename: fileName || null
}; };
return huggingFaceModel; return huggingFaceModel;
} }
@@ -62,7 +62,7 @@ const DownloadModel: React.FC<AddModalProps> = (props) => {
if (source === modelSourceMap.modelscope_value) { if (source === modelSourceMap.modelscope_value) {
const modelScopeModel = { const modelScopeModel = {
model_scope_model_id: selectedModel.name, model_scope_model_id: selectedModel.name,
model_scope_file_path: fileName model_scope_file_path: fileName || null
}; };
return modelScopeModel; return modelScopeModel;
} }
@@ -1,10 +1,11 @@
import ScrollerModal from '@/components/scroller-modal';
import { import {
AppleOutlined, AppleOutlined,
LinuxOutlined, LinuxOutlined,
WindowsOutlined WindowsOutlined
} from '@ant-design/icons'; } from '@ant-design/icons';
import { useIntl } from '@umijs/max'; import { useIntl } from '@umijs/max';
import { Modal, Tabs, TabsProps } from 'antd'; import { Tabs, TabsProps } from 'antd';
import React from 'react'; import React from 'react';
import MacOS from './add-worker-macos'; import MacOS from './add-worker-macos';
import ContainerInstall from './container-install'; import ContainerInstall from './container-install';
@@ -58,7 +59,7 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
]; ];
return ( return (
<Modal <ScrollerModal
title={intl.formatMessage({ id: 'resources.button.create' })} title={intl.formatMessage({ id: 'resources.button.create' })}
open={open} open={open}
centered={false} centered={false}
@@ -85,8 +86,8 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
type="card" type="card"
onChange={(key) => setActiveKey(key)} onChange={(key) => setActiveKey(key)}
></Tabs> ></Tabs>
</Modal> </ScrollerModal>
); );
}; };
export default React.memo(AddWorker); export default AddWorker;