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) => {
|
||||
handleSelectModelFile({ fakeName: '' });
|
||||
setSelectedModel(item);
|
||||
};
|
||||
|
||||
@@ -73,6 +72,10 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
handleSelectModelFile({ fakeName: '' });
|
||||
}, [selectedModel]);
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
setSelectedModel({});
|
||||
|
||||
@@ -8,9 +8,10 @@ import { modelSourceMap, modelSourceValueMap } from '../config';
|
||||
|
||||
const SearchInput: React.FC<{
|
||||
modelSource: string;
|
||||
onChange: (e: any) => void;
|
||||
onSearch: (e: any) => void;
|
||||
}> = (props) => {
|
||||
const { onSearch, modelSource } = props;
|
||||
const { onSearch, onChange, modelSource } = props;
|
||||
const intl = useIntl();
|
||||
const inputRef = useRef<any>(null);
|
||||
|
||||
@@ -23,6 +24,7 @@ const SearchInput: React.FC<{
|
||||
<Input
|
||||
ref={inputRef}
|
||||
onPressEnter={onSearch}
|
||||
onChange={onChange}
|
||||
allowClear
|
||||
placeholder={intl.formatMessage(
|
||||
{
|
||||
|
||||
@@ -173,7 +173,9 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
||||
},
|
||||
[dataSource]
|
||||
);
|
||||
|
||||
const handleSearchInputChange = useCallback((e: any) => {
|
||||
searchInputRef.current = e.target.value;
|
||||
}, []);
|
||||
const handlerSearchModels = useCallback(
|
||||
async (e: any) => {
|
||||
searchInputRef.current = e.target.value;
|
||||
@@ -216,6 +218,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
||||
<>
|
||||
<SearchInput
|
||||
onSearch={handlerSearchModels}
|
||||
onChange={handleSearchInputChange}
|
||||
modelSource={modelSource}
|
||||
></SearchInput>
|
||||
<div className={SearchStyle.filter}>
|
||||
|
||||
@@ -424,10 +424,10 @@ const Models: React.FC<ModelsProps> = ({
|
||||
|
||||
const generateSource = useCallback((record: ListItem) => {
|
||||
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) {
|
||||
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}`;
|
||||
}, []);
|
||||
@@ -586,7 +586,7 @@ const Models: React.FC<ModelsProps> = ({
|
||||
}}
|
||||
render={(text, record: ListItem) => {
|
||||
return (
|
||||
<span style={{ paddingLeft: 7, minWidth: '33px' }}>
|
||||
<span style={{ paddingLeft: 10, minWidth: '33px' }}>
|
||||
{record.ready_replicas} / {record.replicas}
|
||||
</span>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user