chore: get start from deploying

This commit is contained in:
jialin
2025-02-24 11:47:06 +08:00
parent bcbefe29e7
commit 529b3cb18f
9 changed files with 52 additions and 40 deletions
+4 -1
View File
@@ -103,5 +103,8 @@ export default {
'Specify the model directory that contains .safetensors and config.json files, e.g., /usr/local/models/model/.', 'Specify the model directory that contains .safetensors and config.json files, e.g., /usr/local/models/model/.',
'models.localpath.chunks.tips': `Specify the first shard file of the model, e.g., /usr/local/models/model-00001-of-00004.gguf.`, 'models.localpath.chunks.tips': `Specify the first shard file of the model, e.g., /usr/local/models/model-00001-of-00004.gguf.`,
'models.form.replicas.tips': 'models.form.replicas.tips':
'Multiple replicas enable load balancing for inference requests.' 'Multiple replicas enable load balancing for inference requests.',
'models.table.list.empty': 'No Models yet!',
'models.table.list.getStart':
'<span style="margin-right: 5px;font-size: 13px;">Get started with</span> <span style="font-size: 14px;font-weight: 700">DeepSeek-R1-Distill-Qwen-1.5B</span>'
}; };
+4 -1
View File
@@ -99,5 +99,8 @@ export default {
'指向包含 .safetensors, config.json 文件的模型目录,例如 /usr/local/models/model/', '指向包含 .safetensors, config.json 文件的模型目录,例如 /usr/local/models/model/',
'models.localpath.chunks.tips': 'models.localpath.chunks.tips':
'指向模型第一个分片文件,例如 /usr/local/models/model-00001-of-00004.gguf', '指向模型第一个分片文件,例如 /usr/local/models/model-00001-of-00004.gguf',
'models.form.replicas.tips': '多副本数实现推理请求的负载均衡' 'models.form.replicas.tips': '多副本数实现推理请求的负载均衡',
'models.table.list.empty': '暂无已部署模型',
'models.table.list.getStart':
'<span style="margin-right: 5px;font-size: 13px;">一键部署</span><span style="font-size: 14px;font-weight: 700">DeepSeek-R1-Distill-Qwen-1.5B</span><span style="margin-left: 5px;font-size: 13px;">立即使用!</span>'
}; };
@@ -28,7 +28,7 @@ const ListSkeleton: React.FC<{
width: '100%', width: '100%',
position: 'absolute', position: 'absolute',
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'flex-start',
justifyContent: 'center', justifyContent: 'center',
top: 0, top: 0,
left: 0, left: 0,
+2 -1
View File
@@ -668,7 +668,8 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
{ {
label: 'vox-box', label: 'vox-box',
value: backendOptionsMap.voxBox, value: backendOptionsMap.voxBox,
disabled: props.source === modelSourceMap.ollama_library_value disabled:
props.source === modelSourceMap.ollama_library_value || isGGUF
} }
] ]
} }
+22 -29
View File
@@ -60,7 +60,6 @@ import {
} from '../apis'; } from '../apis';
import { import {
InstanceRealtimeLogStatus, InstanceRealtimeLogStatus,
backendOptionsMap,
getSourceRepoConfigValue, getSourceRepoConfigValue,
modelCategories, modelCategories,
modelCategoriesMap, modelCategoriesMap,
@@ -699,9 +698,6 @@ const Models: React.FC<ModelsProps> = ({
}; };
const columns: SealColumnProps[] = useMemo(() => { const columns: SealColumnProps[] = useMemo(() => {
if (isFirstLogin) {
return [];
}
return [ return [
{ {
title: intl.formatMessage({ id: 'common.table.name' }), title: intl.formatMessage({ id: 'common.table.name' }),
@@ -779,31 +775,26 @@ const Models: React.FC<ModelsProps> = ({
) )
} }
]; ];
}, [sortOrder, intl, isFirstLogin]); }, [sortOrder, intl]);
const handleOnClick = async () => { const handleOnClick = async () => {
if (isLoading) { if (isLoading) {
return; return;
} }
const data = catalogList?.find( const data = catalogList?.[0] || {};
(item) => item.backend === backendOptionsMap.llamaBox && item.size === 1.5
);
console.log('catalogList=======', data);
try { try {
if (data) { setIsLoading(true);
setIsLoading(true); const modelData = await createModel({
const modelData = await createModel({ data: data
data: data });
}); writeState(IS_FIRST_LOGIN, false);
writeState(IS_FIRST_LOGIN, false); setIsFirstLogin(false);
setIsFirstLogin(false); setTimeout(() => {
setTimeout(() => { updateExpandedRowKeys([modelData.id]);
updateExpandedRowKeys([modelData.id]); }, 300);
}, 300); message.success(intl.formatMessage({ id: 'common.message.success' }));
message.success(intl.formatMessage({ id: 'common.message.success' })); handleSearch?.();
handleSearch?.();
}
} catch (error) { } catch (error) {
// ingore // ingore
} finally { } finally {
@@ -811,7 +802,7 @@ const Models: React.FC<ModelsProps> = ({
} }
}; };
const renderEmpty = useMemo(() => { const renderEmpty = useMemo(() => {
if (dataSource.length || !isFirstLogin) { if (dataSource.length || !isFirstLogin || !catalogList?.length) {
return null; return null;
} }
return ( return (
@@ -821,19 +812,21 @@ const Models: React.FC<ModelsProps> = ({
> >
<Empty description=""></Empty> <Empty description=""></Empty>
<Typography.Title level={4} style={{ marginBottom: 30 }}> <Typography.Title level={4} style={{ marginBottom: 30 }}>
No Models yet! {intl.formatMessage({ id: 'models.table.list.empty' })}
</Typography.Title> </Typography.Title>
<div> <div>
<Button type="primary" onClick={handleOnClick} loading={isLoading}> <Button type="primary" onClick={handleOnClick} loading={isLoading}>
<span style={{ fontSize: 13 }}>Get started with</span> <span
<span style={{ fontSize: 14, fontWeight: 700 }}> className="flex-center"
DeepSeek-R1-Distill-Qwen-1.5B dangerouslySetInnerHTML={{
</span> __html: intl.formatMessage({ id: 'models.table.list.getStart' })
}}
></span>
</Button> </Button>
</div> </div>
</div> </div>
); );
}, [dataSource.length, isFirstLogin, isLoading]); }, [dataSource.length, isFirstLogin, isLoading, intl]);
return ( return (
<> <>
@@ -566,7 +566,8 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
label: 'vox-box', label: 'vox-box',
value: backendOptionsMap.voxBox, value: backendOptionsMap.voxBox,
disabled: disabled:
props.data?.source === modelSourceMap.ollama_library_value props.data?.source ===
modelSourceMap.ollama_library_value || isGGUF
} }
]} ]}
disabled={ disabled={
+12 -1
View File
@@ -19,6 +19,7 @@ import {
queryModelsList queryModelsList
} from './apis'; } from './apis';
import TableList from './components/table-list'; import TableList from './components/table-list';
import { backendOptionsMap } from './config';
import { ListItem } from './config/types'; import { ListItem } from './config/types';
const Models: React.FC = () => { const Models: React.FC = () => {
@@ -266,7 +267,17 @@ const Models: React.FC = () => {
item.name = name; item.name = name;
return item; return item;
}); });
setCatalogList(list || []); const deepseekr1dstill = _.toLower('DeepSeek-R1-Distill-Qwen-1.5B');
const resultList = list?.filter((item: any) => {
return (
item.backend === backendOptionsMap.llamaBox &&
(_.toLower(item?.huggingface_repo_id)?.indexOf(deepseekr1dstill) >
-1 ||
_.toLower(item?.model_scope_model_id)?.indexOf(deepseekr1dstill) >
-1)
);
});
setCatalogList(resultList || []);
} catch (error) { } catch (error) {
// ignore // ignore
} }
@@ -9,8 +9,8 @@ import useRequestToken from '@/hooks/use-request-token';
import { import {
ClearOutlined, ClearOutlined,
HolderOutlined, HolderOutlined,
InfoCircleOutlined,
PlusOutlined, PlusOutlined,
QuestionCircleOutlined,
SendOutlined SendOutlined
} from '@ant-design/icons'; } from '@ant-design/icons';
import { useIntl } from '@umijs/max'; import { useIntl } from '@umijs/max';
@@ -496,7 +496,7 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
{intl.formatMessage({ {intl.formatMessage({
id: 'playground.input.multiplePaste' id: 'playground.input.multiplePaste'
})} })}
<InfoCircleOutlined className="m-l-4" /> <QuestionCircleOutlined className="m-l-4" />
</Checkbox> </Checkbox>
</Tooltip> </Tooltip>
@@ -607,7 +607,7 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
</span> </span>
} }
> >
<InfoCircleOutlined className="m-l-4" /> <QuestionCircleOutlined className="m-l-4" />
</Tooltip> </Tooltip>
</span> </span>
<AlertInfo <AlertInfo
@@ -5,8 +5,8 @@ import useOverlayScroller from '@/hooks/use-overlay-scroller';
import useRequestToken from '@/hooks/use-request-token'; import useRequestToken from '@/hooks/use-request-token';
import { import {
ClearOutlined, ClearOutlined,
InfoCircleOutlined,
PlusOutlined, PlusOutlined,
QuestionCircleOutlined,
SendOutlined SendOutlined
} from '@ant-design/icons'; } from '@ant-design/icons';
import { useIntl } from '@umijs/max'; import { useIntl } from '@umijs/max';
@@ -523,7 +523,7 @@ const GroundReranker: React.FC<MessageProps> = forwardRef((props, ref) => {
{intl.formatMessage({ {intl.formatMessage({
id: 'playground.input.multiplePaste' id: 'playground.input.multiplePaste'
})} })}
<InfoCircleOutlined className="m-l-4" /> <QuestionCircleOutlined className="m-l-4" />
</Checkbox> </Checkbox>
</Tooltip> </Tooltip>
<Button size="middle" onClick={handleAddText}> <Button size="middle" onClick={handleAddText}>