fix: select same model will clear filename
This commit is contained in:
@@ -54,7 +54,6 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleOnSelectModel = (item: any) => {
|
const handleOnSelectModel = (item: any) => {
|
||||||
handleSelectModelFile({ fakeName: '' });
|
|
||||||
setSelectedModel(item);
|
setSelectedModel(item);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -73,6 +72,10 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
handleSelectModelFile({ fakeName: '' });
|
||||||
|
}, [selectedModel]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
setSelectedModel({});
|
setSelectedModel({});
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ import { modelSourceMap, modelSourceValueMap } from '../config';
|
|||||||
|
|
||||||
const SearchInput: React.FC<{
|
const SearchInput: React.FC<{
|
||||||
modelSource: string;
|
modelSource: string;
|
||||||
|
onChange: (e: any) => void;
|
||||||
onSearch: (e: any) => void;
|
onSearch: (e: any) => void;
|
||||||
}> = (props) => {
|
}> = (props) => {
|
||||||
const { onSearch, modelSource } = props;
|
const { onSearch, onChange, modelSource } = props;
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const inputRef = useRef<any>(null);
|
const inputRef = useRef<any>(null);
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ const SearchInput: React.FC<{
|
|||||||
<Input
|
<Input
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
onPressEnter={onSearch}
|
onPressEnter={onSearch}
|
||||||
|
onChange={onChange}
|
||||||
allowClear
|
allowClear
|
||||||
placeholder={intl.formatMessage(
|
placeholder={intl.formatMessage(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -173,7 +173,9 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
|||||||
},
|
},
|
||||||
[dataSource]
|
[dataSource]
|
||||||
);
|
);
|
||||||
|
const handleSearchInputChange = useCallback((e: any) => {
|
||||||
|
searchInputRef.current = e.target.value;
|
||||||
|
}, []);
|
||||||
const handlerSearchModels = useCallback(
|
const handlerSearchModels = useCallback(
|
||||||
async (e: any) => {
|
async (e: any) => {
|
||||||
searchInputRef.current = e.target.value;
|
searchInputRef.current = e.target.value;
|
||||||
@@ -216,6 +218,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
|||||||
<>
|
<>
|
||||||
<SearchInput
|
<SearchInput
|
||||||
onSearch={handlerSearchModels}
|
onSearch={handlerSearchModels}
|
||||||
|
onChange={handleSearchInputChange}
|
||||||
modelSource={modelSource}
|
modelSource={modelSource}
|
||||||
></SearchInput>
|
></SearchInput>
|
||||||
<div className={SearchStyle.filter}>
|
<div className={SearchStyle.filter}>
|
||||||
|
|||||||
@@ -424,10 +424,10 @@ const Models: React.FC<ModelsProps> = ({
|
|||||||
|
|
||||||
const generateSource = useCallback((record: ListItem) => {
|
const generateSource = useCallback((record: ListItem) => {
|
||||||
if (record.source === modelSourceMap.modelscope_value) {
|
if (record.source === modelSourceMap.modelscope_value) {
|
||||||
return `${modelSourceMap.modelScope}/${record.model_scope_file_path || record.model_scope_model_id}`;
|
return `${modelSourceMap.modelScope}/${record.model_scope_model_id}`;
|
||||||
}
|
}
|
||||||
if (record.source === modelSourceMap.huggingface_value) {
|
if (record.source === modelSourceMap.huggingface_value) {
|
||||||
return `${modelSourceMap.huggingface}/${record.huggingface_filename || record.huggingface_repo_id}`;
|
return `${modelSourceMap.huggingface}/${record.huggingface_repo_id}`;
|
||||||
}
|
}
|
||||||
return `${modelSourceMap.ollama_library}/${record.ollama_library_model_name}`;
|
return `${modelSourceMap.ollama_library}/${record.ollama_library_model_name}`;
|
||||||
}, []);
|
}, []);
|
||||||
@@ -586,7 +586,7 @@ const Models: React.FC<ModelsProps> = ({
|
|||||||
}}
|
}}
|
||||||
render={(text, record: ListItem) => {
|
render={(text, record: ListItem) => {
|
||||||
return (
|
return (
|
||||||
<span style={{ paddingLeft: 7, minWidth: '33px' }}>
|
<span style={{ paddingLeft: 10, minWidth: '33px' }}>
|
||||||
{record.ready_replicas} / {record.replicas}
|
{record.ready_replicas} / {record.replicas}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user