fix: do not update logs when viewing pre page

This commit is contained in:
jialin
2025-01-03 20:38:44 +08:00
parent 472ef1a231
commit 95058f7890
13 changed files with 164 additions and 64 deletions
+19 -1
View File
@@ -23,7 +23,8 @@ import {
EditOutlined,
ExperimentOutlined,
PictureOutlined,
SyncOutlined
SyncOutlined,
WechatWorkOutlined
} from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-components';
import { Access, useAccess, useIntl, useNavigate } from '@umijs/max';
@@ -651,6 +652,23 @@ const Models: React.FC<ModelsProps> = ({
</Tag>
);
}
if (record.categories?.includes(modelCategoriesMap.llm)) {
return (
<Tag
icon={<WechatWorkOutlined />}
style={{
margin: 0,
opacity: 1,
paddingInline: 8,
borderRadius: 12,
transform: 'scale(0.9)'
}}
color="green"
>
LLM
</Tag>
);
}
return null;
},
[intl]
+3 -1
View File
@@ -248,11 +248,13 @@ export const modelCategoriesMap = {
text_to_speech: 'text_to_speech',
speech_to_text: 'speech_to_text',
embedding: 'embedding',
reranker: 'reranker'
reranker: 'reranker',
llm: 'llm'
};
export const modelCategories = [
{ label: 'common.options.auto', value: null, locale: true },
{ label: 'LLM', value: modelCategoriesMap.llm },
{ label: 'Image', value: 'image' },
{ label: 'Text-to-speech', value: 'text_to_speech' },
{ label: 'Speech-to-text', value: 'speech_to_text' },
+2 -1
View File
@@ -1,5 +1,6 @@
import IconFont from '@/components/icon-font';
import HotKeys from '@/config/hotkeys';
import { modelCategoriesMap } from '@/pages/llmodels/config';
import { PageContainer } from '@ant-design/pro-components';
import { useIntl } from '@umijs/max';
import { Button, Space } from 'antd';
@@ -30,7 +31,7 @@ const PlaygroundEmbedding: React.FC = () => {
const getModelListByEmbedding = async () => {
try {
const params = {
categories: 'embedding'
categories: modelCategoriesMap.embedding
};
const res = await queryModelsList(params);
const list = _.map(res.data || [], (item: any) => {
+2 -1
View File
@@ -2,6 +2,7 @@ import IconFont from '@/components/icon-font';
import breakpoints from '@/config/breakpoints';
import HotKeys from '@/config/hotkeys';
import useWindowResize from '@/hooks/use-window-resize';
import { modelCategoriesMap } from '@/pages/llmodels/config';
import { DiffOutlined, HighlightOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-components';
import { useIntl } from '@umijs/max';
@@ -85,7 +86,7 @@ const TextToImages: React.FC = () => {
const getModelList = async () => {
try {
const params = {
categories: 'image',
categories: modelCategoriesMap.image,
with_meta: true
};
const res = await queryModelsList(params);
+2 -1
View File
@@ -2,6 +2,7 @@ import IconFont from '@/components/icon-font';
import breakpoints from '@/config/breakpoints';
import HotKeys from '@/config/hotkeys';
import useWindowResize from '@/hooks/use-window-resize';
import { modelCategoriesMap } from '@/pages/llmodels/config';
import { MessageOutlined, OneToOneOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-components';
import { useIntl } from '@umijs/max';
@@ -79,7 +80,7 @@ const Playground: React.FC = () => {
const getModelList = async () => {
try {
const params = {
categories: '',
categories: modelCategoriesMap.llm,
with_meta: true
};
const res = await queryModelsList(params);
+2 -1
View File
@@ -1,5 +1,6 @@
import IconFont from '@/components/icon-font';
import HotKeys from '@/config/hotkeys';
import { modelCategoriesMap } from '@/pages/llmodels/config';
import { PageContainer } from '@ant-design/pro-components';
import { useIntl } from '@umijs/max';
import { Button, Space } from 'antd';
@@ -32,7 +33,7 @@ const PlaygroundRerank: React.FC = () => {
const getModelListByReranker = async () => {
try {
const params = {
categories: 'reranker'
categories: modelCategoriesMap.reranker
};
const res = await queryModelsList(params);
const list = _.map(res.data || [], (item: any) => {
+3 -2
View File
@@ -2,6 +2,7 @@ import IconFont from '@/components/icon-font';
import breakpoints from '@/config/breakpoints';
import HotKeys from '@/config/hotkeys';
import useWindowResize from '@/hooks/use-window-resize';
import { modelCategoriesMap } from '@/pages/llmodels/config';
import { AudioOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-components';
import { useIntl, useSearchParams } from '@umijs/max';
@@ -102,7 +103,7 @@ const Playground: React.FC = () => {
const getTextToSpeechModels = async () => {
try {
const params = {
categories: 'text_to_speech',
categories: modelCategoriesMap.text_to_speech,
with_meta: true
};
const res = await queryModelsList(params);
@@ -122,7 +123,7 @@ const Playground: React.FC = () => {
const getSpeechToText = async () => {
try {
const params = {
categories: 'speech_to_text',
categories: modelCategoriesMap.speech_to_text,
with_meta: true
};
const res = await queryModelsList(params);
@@ -41,7 +41,7 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
width={600}
styles={{
body: {
height: 420
height: 550
}
}}
footer={null}
@@ -1,7 +1,7 @@
import { GPUStackVersionAtom } from '@/atoms/user';
import { getAtomStorage } from '@/atoms/utils';
import HighlightCode from '@/components/highlight-code';
import { BulbOutlined, WarningOutlined } from '@ant-design/icons';
import { WarningOutlined } from '@ant-design/icons';
import { useIntl } from '@umijs/max';
import { Button, Radio } from 'antd';
import React from 'react';
@@ -31,13 +31,13 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
return commandCode?.registerWorker({
server: origin,
tag: version,
token: props.token
token: '${mytoken}'
});
}
return commandCode?.registerWorker({
server: origin,
tag: `${version}-${activeKey}`,
token: props.token
token: '${mytoken}'
});
}, [versionInfo, activeKey, props.token, origin]);
@@ -78,6 +78,23 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
</Button>
</li>
</ul>
<h3>1. {intl.formatMessage({ id: 'resources.worker.add.step1' })}</h3>
<HighlightCode
code={addWorkerGuide.mac.getToken}
theme="dark"
></HighlightCode>
<h3>
2. {intl.formatMessage({ id: 'resources.worker.add.step2' })}{' '}
<span
className="font-size-12"
style={{ color: 'var(--ant-color-text-tertiary)' }}
dangerouslySetInnerHTML={{
__html: `(${intl.formatMessage({
id: 'resources.worker.add.step2.tips'
})})`
}}
></span>
</h3>
<div className="m-b-20">
<Radio.Group
block
@@ -99,9 +116,8 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
></div>
)}
<HighlightCode theme="dark" code={code}></HighlightCode>
<h3>
<BulbOutlined className="m-r-5"></BulbOutlined>
{intl.formatMessage({ id: 'resources.worker.add.step3' })}
<h3 className="m-b-0">
3. {intl.formatMessage({ id: 'resources.worker.add.step3' })}
</h3>
</div>
);
@@ -1,5 +1,4 @@
import HighlightCode from '@/components/highlight-code';
import { BulbOutlined } from '@ant-design/icons';
import { useIntl } from '@umijs/max';
import React from 'react';
import { addWorkerGuide } from '../config';
@@ -13,11 +12,34 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
return (
<div className="script-install">
<h3>1. {intl.formatMessage({ id: 'resources.worker.add.step1' })}</h3>
<h4>{intl.formatMessage({ id: 'resources.worker.linuxormaxos' })}</h4>
<HighlightCode
code={addWorkerGuide.mac.getToken}
theme="dark"
></HighlightCode>
<h4>Windows </h4>
<HighlightCode
code={addWorkerGuide.win.getToken}
theme="dark"
></HighlightCode>
<h3>
2. {intl.formatMessage({ id: 'resources.worker.add.step2' })}{' '}
<span
className="font-size-12"
style={{ color: 'var(--ant-color-text-tertiary)' }}
dangerouslySetInnerHTML={{
__html: `(${intl.formatMessage({
id: 'resources.worker.add.step2.tips'
})})`
}}
></span>
</h3>
<h4>{intl.formatMessage({ id: 'resources.worker.linuxormaxos' })}</h4>
<HighlightCode
code={addWorkerGuide.mac.registerWorker({
server: origin,
token: props.token
token: '${mytoken}'
})}
theme="dark"
></HighlightCode>
@@ -26,12 +48,11 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
theme="dark"
code={addWorkerGuide.win.registerWorker({
server: origin,
token: props.token
token: '${mytoken}'
})}
></HighlightCode>
<h3>
<BulbOutlined className="m-r-5"></BulbOutlined>
{intl.formatMessage({ id: 'resources.worker.add.step3' })}
<h3 className="m-b-0">
3. {intl.formatMessage({ id: 'resources.worker.add.step3' })}
</h3>
</div>
);