fix: playground edit message
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import LabelSelector from '@/components/label-selector';
|
||||
import ListInput from '@/components/list-input';
|
||||
import SealSelect from '@/components/seal-form/seal-select';
|
||||
import { PageAction } from '@/config';
|
||||
import { PageActionType } from '@/config/types';
|
||||
import { InfoCircleOutlined, RightOutlined } from '@ant-design/icons';
|
||||
import { useIntl } from '@umijs/max';
|
||||
@@ -193,7 +191,7 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
<Form.Item name="backend">
|
||||
{/* <Form.Item name="backend">
|
||||
<SealSelect
|
||||
label={intl.formatMessage({ id: 'models.form.backend' })}
|
||||
options={[
|
||||
@@ -210,8 +208,8 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
||||
]}
|
||||
disabled={action === PageAction.EDIT}
|
||||
></SealSelect>
|
||||
</Form.Item>
|
||||
<Form.Item<FormData> name="backend_parameters">
|
||||
</Form.Item> */}
|
||||
{/* <Form.Item<FormData> name="backend_parameters">
|
||||
<ListInput
|
||||
btnText="common.button.addParams"
|
||||
label={intl.formatMessage({ id: 'models.form.backend_parameters' })}
|
||||
@@ -219,7 +217,7 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
||||
onChange={handleBackendParametersChange}
|
||||
options={paramsConfig}
|
||||
></ListInput>
|
||||
</Form.Item>
|
||||
</Form.Item> */}
|
||||
{scheduleType === 'manual' && (
|
||||
<Form.Item<FormData>
|
||||
name="gpu_selector"
|
||||
|
||||
@@ -220,6 +220,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
||||
>
|
||||
<SealAutoComplete
|
||||
filterOption
|
||||
defaultActiveFirstOption
|
||||
disabled={action === PageAction.EDIT}
|
||||
label={intl.formatMessage({ id: 'model.form.ollama.model' })}
|
||||
placeholder={intl.formatMessage({ id: 'model.form.ollamaholder' })}
|
||||
|
||||
@@ -35,4 +35,4 @@ const GPUCard: React.FC<{
|
||||
);
|
||||
};
|
||||
|
||||
export default GPUCard;
|
||||
export default React.memo(GPUCard);
|
||||
|
||||
@@ -159,7 +159,7 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
|
||||
}
|
||||
);
|
||||
const fileList = _.filter(_.get(data, ['Data', 'Files']), (file: any) => {
|
||||
return filterReg.test(file.path) || _.includes(includeReg, file.path);
|
||||
return filterReg.test(file.Path) || _.includes(includeReg, file.Path);
|
||||
});
|
||||
const list = _.map(fileList, (item: any) => {
|
||||
return {
|
||||
@@ -192,6 +192,7 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
|
||||
}
|
||||
|
||||
const newList = generateGroupByFilename(list);
|
||||
console.log('newList====', newList);
|
||||
const sortList = _.sortBy(newList, (item: any) => {
|
||||
return sortType === 'size' ? item.size : item.path;
|
||||
});
|
||||
@@ -199,6 +200,7 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
|
||||
handleSelectModelFile(sortList[0]);
|
||||
setDataSource({ fileList: sortList, loading: false });
|
||||
} catch (error) {
|
||||
console.log('error======', error);
|
||||
setDataSource({ fileList: [], loading: false });
|
||||
handleSelectModelFile({});
|
||||
}
|
||||
|
||||
@@ -210,6 +210,7 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
|
||||
)}
|
||||
{item?.distributed_servers?.rpc_servers?.length && (
|
||||
<Tooltip
|
||||
trigger={['click']}
|
||||
overlayInnerStyle={{
|
||||
width: '400px'
|
||||
}}
|
||||
|
||||
@@ -31,7 +31,7 @@ const ModelCard: React.FC<{
|
||||
const { onCollapse, setIsGGUF, collapsed, modelSource } = props;
|
||||
const intl = useIntl();
|
||||
const requestSource = useRequestToken();
|
||||
const [modelData, setModelData] = useState<any>({});
|
||||
const [modelData, setModelData] = useState<any>(null);
|
||||
const [readmeText, setReadmeText] = useState<string | null>(null);
|
||||
const requestToken = useRef<any>(null);
|
||||
const axiosTokenRef = useRef<any>(null);
|
||||
@@ -76,7 +76,7 @@ const ModelCard: React.FC<{
|
||||
setIsGGUF(modelcard.tags?.includes('gguf'));
|
||||
setIsGGUFModel(modelcard.tags?.includes('gguf'));
|
||||
} catch (error) {
|
||||
setModelData({});
|
||||
setModelData(null);
|
||||
setReadmeText(null);
|
||||
setIsGGUF(false);
|
||||
setIsGGUFModel(false);
|
||||
@@ -101,7 +101,7 @@ const ModelCard: React.FC<{
|
||||
setIsGGUF(data.Data?.Tags?.includes('gguf'));
|
||||
setIsGGUFModel(data.Data?.Tags?.includes('gguf'));
|
||||
} catch (error) {
|
||||
setModelData({});
|
||||
setModelData(null);
|
||||
setReadmeText(null);
|
||||
setIsGGUF(false);
|
||||
setIsGGUFModel(false);
|
||||
@@ -140,7 +140,7 @@ const ModelCard: React.FC<{
|
||||
size="small"
|
||||
type="link"
|
||||
target="_blank"
|
||||
href={`https://huggingface.co/${modelData.id}`}
|
||||
href={`https://huggingface.co/${modelData?.id}`}
|
||||
>
|
||||
<IconFont type="icon-external-link"></IconFont>
|
||||
</Button>
|
||||
@@ -155,7 +155,7 @@ const ModelCard: React.FC<{
|
||||
size="small"
|
||||
type="link"
|
||||
target="_blank"
|
||||
href={`https://modelscope.cn/models/${modelData.name}`}
|
||||
href={`https://modelscope.cn/models/${modelData?.name}`}
|
||||
>
|
||||
<IconFont type="icon-external-link"></IconFont>
|
||||
</Button>
|
||||
@@ -202,6 +202,11 @@ const ModelCard: React.FC<{
|
||||
</span>
|
||||
</Tag>
|
||||
)}
|
||||
{isGGUFModel && (
|
||||
<Tag className="tag-item" color="magenta">
|
||||
<span style={{ opacity: 0.65 }}>GGUF</span>
|
||||
</Tag>
|
||||
)}
|
||||
</div>
|
||||
{readmeText && isGGUFModel && (
|
||||
<div
|
||||
@@ -222,6 +227,7 @@ const ModelCard: React.FC<{
|
||||
</span>
|
||||
<SimpleBar
|
||||
style={{
|
||||
paddingTop: collapsed ? 12 : 0,
|
||||
maxHeight: collapsed ? 300 : 0
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -32,12 +32,6 @@ const SearchInput: React.FC<{
|
||||
)}
|
||||
prefix={
|
||||
<>
|
||||
{/* <SearchOutlined
|
||||
style={{
|
||||
fontSize: '16px',
|
||||
color: 'var(--ant-color-text-quaternary)'
|
||||
}}
|
||||
/> */}
|
||||
<IconFont
|
||||
className="font-size-16"
|
||||
type={
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BulbOutlined } from '@ant-design/icons';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { Checkbox, Select } from 'antd';
|
||||
import { Select } from 'antd';
|
||||
import _ from 'lodash';
|
||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { queryHuggingfaceModels, queryModelScopeModels } from '../apis';
|
||||
@@ -78,7 +78,8 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
||||
search: {
|
||||
query: searchInputRef.current || '',
|
||||
sort: sort,
|
||||
tags: filterGGUFRef.current ? ['gguf'] : [],
|
||||
// tags: filterGGUFRef.current ? ['gguf'] : [],
|
||||
tags: ['gguf'],
|
||||
task
|
||||
}
|
||||
};
|
||||
@@ -102,9 +103,10 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
||||
const getModelsFromModelscope = useCallback(async (sort: string) => {
|
||||
try {
|
||||
const params = {
|
||||
Name: filterGGUFRef.current
|
||||
? `${searchInputRef.current} gguf`
|
||||
: searchInputRef.current || '',
|
||||
// Name: filterGGUFRef.current
|
||||
// ? `${searchInputRef.current} gguf`
|
||||
// : searchInputRef.current || '',
|
||||
Name: `${searchInputRef.current} gguf`,
|
||||
SortBy: ModelScopeSortType[sort]
|
||||
};
|
||||
const data = await queryModelScopeModels(params, {
|
||||
@@ -115,7 +117,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
||||
path: item.Path,
|
||||
name: `${item.Path}/${item.Name}`,
|
||||
downloads: item.Downloads,
|
||||
id: item.Name,
|
||||
id: `${item.Path}/${item.Name}`,
|
||||
updatedAt: item.LastUpdatedTime * 1000,
|
||||
likes: item.Stars,
|
||||
value: item.Name,
|
||||
@@ -231,13 +233,13 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
||||
</span>
|
||||
</span>
|
||||
<span>
|
||||
<Checkbox
|
||||
{/* <Checkbox
|
||||
onChange={handleFilterGGUFChange}
|
||||
className="m-r-5"
|
||||
checked={filterGGUFRef.current}
|
||||
>
|
||||
GGUF
|
||||
</Checkbox>
|
||||
</Checkbox> */}
|
||||
<Select
|
||||
allowClear
|
||||
value={dataSource.sortType}
|
||||
|
||||
@@ -20,7 +20,6 @@ interface SearchResultProps {
|
||||
}
|
||||
|
||||
const SearchResult: React.FC<SearchResultProps> = (props) => {
|
||||
console.log('SearchResult======');
|
||||
const { resultList, onSelect, source, networkError } = props;
|
||||
const intl = useIntl();
|
||||
|
||||
|
||||
@@ -265,7 +265,6 @@ const Models: React.FC<ModelsProps> = ({
|
||||
);
|
||||
|
||||
const handleModalCancel = useCallback(() => {
|
||||
console.log('handleModalCancel');
|
||||
setOpenAddModal(false);
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user