chore: add no available models notes
This commit is contained in:
@@ -18,6 +18,7 @@ interface AutoTooltipProps extends Omit<TagProps, 'title'> {
|
|||||||
ghost?: boolean;
|
ghost?: boolean;
|
||||||
title?: React.ReactNode;
|
title?: React.ReactNode;
|
||||||
showTitle?: boolean;
|
showTitle?: boolean;
|
||||||
|
tooltipProps?: React.ComponentProps<typeof Tooltip>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AutoTooltip: React.FC<AutoTooltipProps> = ({
|
const AutoTooltip: React.FC<AutoTooltipProps> = ({
|
||||||
@@ -26,6 +27,7 @@ const AutoTooltip: React.FC<AutoTooltipProps> = ({
|
|||||||
ghost = false,
|
ghost = false,
|
||||||
title,
|
title,
|
||||||
showTitle = false,
|
showTitle = false,
|
||||||
|
tooltipProps,
|
||||||
...tagProps
|
...tagProps
|
||||||
}) => {
|
}) => {
|
||||||
const contentRef = useRef<HTMLDivElement>(null);
|
const contentRef = useRef<HTMLDivElement>(null);
|
||||||
@@ -68,7 +70,10 @@ const AutoTooltip: React.FC<AutoTooltipProps> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip title={isOverflowing || showTitle ? title || children : ''}>
|
<Tooltip
|
||||||
|
title={isOverflowing || showTitle ? title || children : ''}
|
||||||
|
{...tooltipProps}
|
||||||
|
>
|
||||||
{ghost ? (
|
{ghost ? (
|
||||||
<div ref={contentRef} style={tagStyle}>
|
<div ref={contentRef} style={tagStyle}>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -57,5 +57,7 @@ export default {
|
|||||||
'models.table.cpuoffload': 'CPU Offload',
|
'models.table.cpuoffload': 'CPU Offload',
|
||||||
'models.table.layers': 'Layers',
|
'models.table.layers': 'Layers',
|
||||||
'models.form.backend': 'Backend',
|
'models.form.backend': 'Backend',
|
||||||
'models.form.backend_parameters': 'Backend Parameters'
|
'models.form.backend_parameters': 'Backend Parameters',
|
||||||
|
'models.search.gguf.tips': '1. GGUF model backend is llama-box(llama.cpp).',
|
||||||
|
'models.search.vllm.tips': '2. Non-GGUF model backend is vLLM.'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -43,5 +43,8 @@ export default {
|
|||||||
'playground.toolbar.compare6Model': '6-Model Compare',
|
'playground.toolbar.compare6Model': '6-Model Compare',
|
||||||
'playground.input.holder': 'Type <kbd>/</kbd> to input message',
|
'playground.input.holder': 'Type <kbd>/</kbd> to input message',
|
||||||
'playground.compare.apply': 'Apply',
|
'playground.compare.apply': 'Apply',
|
||||||
'playground.compare.applytoall': 'Apply to all models'
|
'playground.compare.applytoall': 'Apply to all models',
|
||||||
|
'playground.model.noavailable': 'No available models.',
|
||||||
|
'playground.model.noavailable.tips':
|
||||||
|
'Please deploy a model first, and it is not an Embedding Only model.'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -56,5 +56,7 @@ export default {
|
|||||||
'models.table.cpuoffload': 'CPU 卸载',
|
'models.table.cpuoffload': 'CPU 卸载',
|
||||||
'models.table.layers': '层',
|
'models.table.layers': '层',
|
||||||
'models.form.backend': '后端',
|
'models.form.backend': '后端',
|
||||||
'models.form.backend_parameters': '后端参数'
|
'models.form.backend_parameters': '后端参数',
|
||||||
|
'models.search.gguf.tips': '1. GGUF 模型后端为 llama-box(llama.cpp)',
|
||||||
|
'models.search.vllm.tips': '2. 非 GGUF 模型后端为 vLLM'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -43,5 +43,8 @@ export default {
|
|||||||
'playground.toolbar.compare6Model': '6 模型对比',
|
'playground.toolbar.compare6Model': '6 模型对比',
|
||||||
'playground.input.holder': '按 <kbd>/</kbd> 开始输入',
|
'playground.input.holder': '按 <kbd>/</kbd> 开始输入',
|
||||||
'playground.compare.apply': '应用',
|
'playground.compare.apply': '应用',
|
||||||
'playground.compare.applytoall': '应用到所有模型'
|
'playground.compare.applytoall': '应用到所有模型',
|
||||||
|
'playground.model.noavailable': '无可用模型',
|
||||||
|
'playground.model.noavailable.tips':
|
||||||
|
'请先部署模型,且不是 Embedding Only 模型'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -161,14 +161,12 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span className="flex-center">
|
<span className="flex-center">
|
||||||
<AutoTooltip
|
<AutoTooltip title={item.name} ghost>
|
||||||
title={renderWorkerInfo(item)}
|
|
||||||
ghost
|
|
||||||
showTitle={true}
|
|
||||||
>
|
|
||||||
<span className="m-r-5">{item.name}</span>
|
<span className="m-r-5">{item.name}</span>
|
||||||
</AutoTooltip>
|
</AutoTooltip>
|
||||||
<InfoCircleOutlined />
|
<Tooltip title={renderWorkerInfo(item)}>
|
||||||
|
<InfoCircleOutlined />
|
||||||
|
</Tooltip>
|
||||||
</span>
|
</span>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button, Empty, Spin, Tag, Tooltip } from 'antd';
|
import { Button, Empty, Spin, Tag, Tooltip } from 'antd';
|
||||||
|
import { some } from 'lodash';
|
||||||
import 'overlayscrollbars/overlayscrollbars.css';
|
import 'overlayscrollbars/overlayscrollbars.css';
|
||||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import SimpleBar from 'simplebar-react';
|
import SimpleBar from 'simplebar-react';
|
||||||
@@ -74,8 +75,9 @@ const ModelCard: React.FC<{
|
|||||||
|
|
||||||
setModelData(modelcard);
|
setModelData(modelcard);
|
||||||
setReadmeText(readme);
|
setReadmeText(readme);
|
||||||
setIsGGUF(modelcard.tags?.includes('gguf'));
|
const isGGUF = modelcard.tags?.includes('gguf');
|
||||||
setIsGGUFModel(modelcard.tags?.includes('gguf'));
|
setIsGGUF(isGGUF);
|
||||||
|
setIsGGUFModel(isGGUF);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setModelData(null);
|
setModelData(null);
|
||||||
setReadmeText(null);
|
setReadmeText(null);
|
||||||
@@ -99,8 +101,12 @@ const ModelCard: React.FC<{
|
|||||||
name: `${data.Data?.Path}/${data.Data?.Name}`
|
name: `${data.Data?.Path}/${data.Data?.Name}`
|
||||||
});
|
});
|
||||||
setReadmeText(data?.Data?.ReadMeContent);
|
setReadmeText(data?.Data?.ReadMeContent);
|
||||||
setIsGGUF(data.Data?.Tags?.includes('gguf'));
|
const isGGUF = some(
|
||||||
setIsGGUFModel(data.Data?.Tags?.includes('gguf'));
|
data?.Data?.Tags,
|
||||||
|
(tag: string) => tag?.indexOf('gguf') > -1
|
||||||
|
);
|
||||||
|
setIsGGUF(isGGUF);
|
||||||
|
setIsGGUFModel(isGGUF);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setModelData(null);
|
setModelData(null);
|
||||||
setReadmeText(null);
|
setReadmeText(null);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { BulbOutlined } from '@ant-design/icons';
|
import { BulbOutlined, InfoCircleOutlined } from '@ant-design/icons';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Checkbox, Select } from 'antd';
|
import { Checkbox, Select, Tooltip } from 'antd';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { queryHuggingfaceModels, queryModelScopeModels } from '../apis';
|
import { queryHuggingfaceModels, queryModelScopeModels } from '../apis';
|
||||||
@@ -234,7 +234,22 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
|||||||
className="m-r-5"
|
className="m-r-5"
|
||||||
checked={filterGGUFRef.current}
|
checked={filterGGUFRef.current}
|
||||||
>
|
>
|
||||||
GGUF
|
<Tooltip
|
||||||
|
overlayInnerStyle={{ width: 'max-content' }}
|
||||||
|
title={
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
{intl.formatMessage({ id: 'models.search.gguf.tips' })}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{intl.formatMessage({ id: 'models.search.vllm.tips' })}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
GGUF
|
||||||
|
<InfoCircleOutlined className="m-l-4" />
|
||||||
|
</Tooltip>
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<Select
|
<Select
|
||||||
allowClear
|
allowClear
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import { useIntl, useNavigate } from '@umijs/max';
|
||||||
|
import { Button, Empty, Typography } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
const EmptyModels: React.FC<{
|
||||||
|
style?: React.CSSProperties;
|
||||||
|
}> = ({ style }) => {
|
||||||
|
const intl = useIntl();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const handleDeployModel = () => {
|
||||||
|
navigate('/models');
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="flex-center justify-center"
|
||||||
|
style={{
|
||||||
|
...style
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Empty
|
||||||
|
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||||
|
description={
|
||||||
|
<div className="flex-column">
|
||||||
|
<Typography.Text type="secondary">
|
||||||
|
{intl.formatMessage({ id: 'playground.model.noavailable' })}
|
||||||
|
</Typography.Text>
|
||||||
|
<Typography.Text type="secondary">
|
||||||
|
{intl.formatMessage({ id: 'playground.model.noavailable.tips' })}
|
||||||
|
</Typography.Text>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Button type="primary" onClick={handleDeployModel}>
|
||||||
|
{intl.formatMessage({ id: 'models.button.deploy' })}
|
||||||
|
</Button>
|
||||||
|
</Empty>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default EmptyModels;
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import AutoTooltip from '@/components/auto-tooltip';
|
||||||
import IconFont from '@/components/icon-font';
|
import IconFont from '@/components/icon-font';
|
||||||
import useOverlayScroller from '@/hooks/use-overlay-scroller';
|
import useOverlayScroller from '@/hooks/use-overlay-scroller';
|
||||||
import { fetchChunkedData, readStreamData } from '@/utils/fetch-chunk-data';
|
import { fetchChunkedData, readStreamData } from '@/utils/fetch-chunk-data';
|
||||||
@@ -369,6 +370,19 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef(
|
|||||||
options={modelFullList}
|
options={modelFullList}
|
||||||
onChange={handleModelChange}
|
onChange={handleModelChange}
|
||||||
value={params.model}
|
value={params.model}
|
||||||
|
optionRender={(data) => {
|
||||||
|
return (
|
||||||
|
<AutoTooltip
|
||||||
|
title={data.label}
|
||||||
|
ghost
|
||||||
|
tooltipProps={{
|
||||||
|
placement: 'right'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{data.label}
|
||||||
|
</AutoTooltip>
|
||||||
|
);
|
||||||
|
}}
|
||||||
></Select>
|
></Select>
|
||||||
</span>
|
</span>
|
||||||
<ReferenceParams usage={tokenResult}></ReferenceParams>
|
<ReferenceParams usage={tokenResult}></ReferenceParams>
|
||||||
|
|||||||
@@ -2,26 +2,24 @@ import IconFont from '@/components/icon-font';
|
|||||||
import HotKeys from '@/config/hotkeys';
|
import HotKeys from '@/config/hotkeys';
|
||||||
import { MessageOutlined, OneToOneOutlined } from '@ant-design/icons';
|
import { MessageOutlined, OneToOneOutlined } from '@ant-design/icons';
|
||||||
import { PageContainer } from '@ant-design/pro-components';
|
import { PageContainer } from '@ant-design/pro-components';
|
||||||
import { useIntl, useSearchParams } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button, Segmented, Space, Tabs, TabsProps } from 'antd';
|
import { Button, Segmented, Space, Tabs, TabsProps } from 'antd';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { queryModelsList } from './apis';
|
import { queryModelsList } from './apis';
|
||||||
|
import EmptyModels from './components/empty-models';
|
||||||
import GroundLeft from './components/ground-left';
|
import GroundLeft from './components/ground-left';
|
||||||
import MultipleChat from './components/multiple-chat';
|
import MultipleChat from './components/multiple-chat';
|
||||||
import './style/play-ground.less';
|
import './style/play-ground.less';
|
||||||
|
|
||||||
const Playground: React.FC = () => {
|
const Playground: React.FC = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [searchParams] = useSearchParams();
|
|
||||||
const selectModel = searchParams.get('model') || '';
|
|
||||||
const [params, setParams] = useState({});
|
|
||||||
const [collapse, setCollapse] = useState(false);
|
|
||||||
const [activeKey, setActiveKey] = useState('chat');
|
const [activeKey, setActiveKey] = useState('chat');
|
||||||
const groundLeftRef = useRef<any>(null);
|
const groundLeftRef = useRef<any>(null);
|
||||||
const [modelList, setModelList] = useState<Global.BaseOption<string>[]>([]);
|
const [modelList, setModelList] = useState<Global.BaseOption<string>[]>([]);
|
||||||
|
const [loaded, setLoaded] = useState(false);
|
||||||
const optionsList = [
|
const optionsList = [
|
||||||
{
|
{
|
||||||
label: intl.formatMessage({ id: 'menu.chat' }),
|
label: intl.formatMessage({ id: 'menu.chat' }),
|
||||||
@@ -74,13 +72,15 @@ const Playground: React.FC = () => {
|
|||||||
setModelList(list);
|
setModelList(list);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
setLoaded(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
getModelList();
|
getModelList();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const renderExtra = () => {
|
const renderExtra = () => {
|
||||||
if (activeKey === 'compare') {
|
if (activeKey === 'compare' || modelList.length === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
@@ -123,12 +123,14 @@ const Playground: React.FC = () => {
|
|||||||
title: (
|
title: (
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
{intl.formatMessage({ id: 'menu.playground' })}
|
{intl.formatMessage({ id: 'menu.playground' })}
|
||||||
<Segmented
|
{modelList.length > 0 && (
|
||||||
options={optionsList}
|
<Segmented
|
||||||
size="middle"
|
options={optionsList}
|
||||||
className="m-l-40"
|
size="middle"
|
||||||
onChange={(key) => setActiveKey(key)}
|
className="m-l-40"
|
||||||
></Segmented>
|
onChange={(key) => setActiveKey(key)}
|
||||||
|
></Segmented>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
@@ -140,7 +142,15 @@ const Playground: React.FC = () => {
|
|||||||
>
|
>
|
||||||
<div className="play-ground">
|
<div className="play-ground">
|
||||||
<div className="chat">
|
<div className="chat">
|
||||||
<Tabs items={items} activeKey={activeKey}></Tabs>
|
{modelList.length > 0 ? (
|
||||||
|
<Tabs items={items} activeKey={activeKey}></Tabs>
|
||||||
|
) : (
|
||||||
|
loaded && (
|
||||||
|
<EmptyModels
|
||||||
|
style={{ height: 'calc(100vh - 72px)', paddingBottom: 100 }}
|
||||||
|
></EmptyModels>
|
||||||
|
)
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</PageContainer>
|
</PageContainer>
|
||||||
|
|||||||
Reference in New Issue
Block a user