fix: set null to filename for download non-gguf
This commit is contained in:
@@ -44,7 +44,6 @@ interface HFModelFileProps {
|
||||
file: any,
|
||||
options: { requestModelId: number; manual?: boolean }
|
||||
) => void;
|
||||
updateEvaluteState: (state: 'model' | 'form' | 'file') => number;
|
||||
onSelectFileAfterEvaluate?: (file: any) => void;
|
||||
}
|
||||
|
||||
@@ -55,13 +54,8 @@ const includeReg = /\.(safetensors|gguf)$/i;
|
||||
const filterRegGGUF = /\.(gguf)$/i;
|
||||
|
||||
const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
|
||||
const {
|
||||
collapsed,
|
||||
modelSource,
|
||||
isDownload,
|
||||
updateEvaluteState,
|
||||
onSelectFileAfterEvaluate
|
||||
} = props;
|
||||
const { collapsed, modelSource, isDownload, onSelectFileAfterEvaluate } =
|
||||
props;
|
||||
const intl = useIntl();
|
||||
const [isEvaluating, setIsEvaluating] = useState(false);
|
||||
const [dataSource, setDataSource] = useState<any>({
|
||||
|
||||
@@ -56,7 +56,7 @@ interface SearchInputProps {
|
||||
setLoadingModel?: (flag: boolean) => void;
|
||||
onSourceChange?: (source: string) => void;
|
||||
onSelectModel: (model: any, manul?: boolean) => void;
|
||||
onSelectModelAfterEvaluate: (model: any, manual?: boolean) => void;
|
||||
onSelectModelAfterEvaluate?: (model: any, manual?: boolean) => void;
|
||||
displayEvaluateStatus?: (
|
||||
data: MessageStatus,
|
||||
options?: WarningStausOptions
|
||||
@@ -153,7 +153,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
||||
if (!item.evaluated || item.isGGUF) {
|
||||
onSelectModel(item, manual);
|
||||
} else {
|
||||
onSelectModelAfterEvaluate(item, manual);
|
||||
onSelectModelAfterEvaluate?.(item, manual);
|
||||
}
|
||||
setCurrent(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 (currentItem && !currentItem.isGGUF) {
|
||||
onSelectModelAfterEvaluate(currentItem);
|
||||
onSelectModelAfterEvaluate?.(currentItem);
|
||||
}
|
||||
} catch (error) {
|
||||
// cancel the corrponding request
|
||||
|
||||
@@ -54,7 +54,7 @@ const DownloadModel: React.FC<AddModalProps> = (props) => {
|
||||
if (source === modelSourceMap.huggingface_value) {
|
||||
const huggingFaceModel = {
|
||||
huggingface_repo_id: selectedModel.name,
|
||||
huggingface_filename: fileName
|
||||
huggingface_filename: fileName || null
|
||||
};
|
||||
return huggingFaceModel;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ const DownloadModel: React.FC<AddModalProps> = (props) => {
|
||||
if (source === modelSourceMap.modelscope_value) {
|
||||
const modelScopeModel = {
|
||||
model_scope_model_id: selectedModel.name,
|
||||
model_scope_file_path: fileName
|
||||
model_scope_file_path: fileName || null
|
||||
};
|
||||
return modelScopeModel;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import ScrollerModal from '@/components/scroller-modal';
|
||||
import {
|
||||
AppleOutlined,
|
||||
LinuxOutlined,
|
||||
WindowsOutlined
|
||||
} from '@ant-design/icons';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { Modal, Tabs, TabsProps } from 'antd';
|
||||
import { Tabs, TabsProps } from 'antd';
|
||||
import React from 'react';
|
||||
import MacOS from './add-worker-macos';
|
||||
import ContainerInstall from './container-install';
|
||||
@@ -58,7 +59,7 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
|
||||
];
|
||||
|
||||
return (
|
||||
<Modal
|
||||
<ScrollerModal
|
||||
title={intl.formatMessage({ id: 'resources.button.create' })}
|
||||
open={open}
|
||||
centered={false}
|
||||
@@ -85,8 +86,8 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
|
||||
type="card"
|
||||
onChange={(key) => setActiveKey(key)}
|
||||
></Tabs>
|
||||
</Modal>
|
||||
</ScrollerModal>
|
||||
);
|
||||
};
|
||||
|
||||
export default React.memo(AddWorker);
|
||||
export default AddWorker;
|
||||
|
||||
Reference in New Issue
Block a user