diff --git a/src/pages/playground/components/params-settings.tsx b/src/pages/playground/components/params-settings.tsx
index 7390554a..0a344e5b 100644
--- a/src/pages/playground/components/params-settings.tsx
+++ b/src/pages/playground/components/params-settings.tsx
@@ -3,6 +3,7 @@ import SealInput from '@/components/seal-form/seal-input';
import SealSelect from '@/components/seal-form/seal-select';
import { INPUT_WIDTH } from '@/constants';
import { queryModelsList } from '@/pages/llmodels/apis';
+import { useIntl } from '@umijs/max';
import { Button, Form, InputNumber, Slider } from 'antd';
import _ from 'lodash';
import { useEffect, useState } from 'react';
@@ -29,6 +30,7 @@ const ParamsSettings: React.FC
= ({
selectedModel,
setParams
}) => {
+ const intl = useIntl();
const [ModelList, setModelList] = useState([]);
const initialValues = {
seed: null,
@@ -137,17 +139,22 @@ const ParamsSettings: React.FC = ({
onFinishFailed={handleOnFinishFailed}
>
-
Model
+
+ {intl.formatMessage({ id: 'playground.model' })}
+
name="model"
rules={[{ required: true }]}
>
-
+
- Parameters
+ {intl.formatMessage({ id: 'playground.parameters' })}
@@ -195,10 +202,6 @@ const ParamsSettings: React.FC = ({
onChange={(val) => handleFieldValueChange(val, 'max_tokens')}
>
- {/* */}
name="top_p"
diff --git a/src/pages/playground/components/reference-params.tsx b/src/pages/playground/components/reference-params.tsx
index 36ee435e..696aa68e 100644
--- a/src/pages/playground/components/reference-params.tsx
+++ b/src/pages/playground/components/reference-params.tsx
@@ -1,3 +1,4 @@
+import { useIntl } from '@umijs/max';
import { Space, Tooltip } from 'antd';
import '../style/reference-params.less';
@@ -10,6 +11,7 @@ interface ReferenceParamsProps {
}
const ReferenceParams = (props: ReferenceParamsProps) => {
+ const intl = useIntl();
const { usage } = props;
if (!usage) {
return null;
@@ -19,12 +21,21 @@ const ReferenceParams = (props: ReferenceParamsProps) => {
- Completion: {usage.completion_tokens}
- Prompt: {usage.prompt_tokens}
+
+ {intl.formatMessage({ id: 'playground.completion' })}:{' '}
+ {usage.completion_tokens}
+
+
+ {intl.formatMessage({ id: 'playground.prompt' })}:{' '}
+ {usage.prompt_tokens}
+
}
>
- Token Usage: {usage.total_tokens}
+
+ {intl.formatMessage({ id: 'playground.tokenusage' })}:{' '}
+ {usage.total_tokens}
+
);
diff --git a/src/pages/playground/components/view-code-modal.tsx b/src/pages/playground/components/view-code-modal.tsx
index 2bee2d16..b854984a 100644
--- a/src/pages/playground/components/view-code-modal.tsx
+++ b/src/pages/playground/components/view-code-modal.tsx
@@ -1,5 +1,6 @@
import EditorWrap from '@/components/editor-wrap';
import Editor from '@monaco-editor/react';
+import { useIntl } from '@umijs/max';
import { Modal, Spin } from 'antd';
import _ from 'lodash';
import React, { useEffect, useRef, useState } from 'react';
@@ -23,6 +24,7 @@ const ViewCodeModal: React.FC = (props) => {
parameters = {}
} = props || {};
+ const intl = useIntl();
const editorRef = useRef(null);
const [loaded, setLoaded] = useState(false);
const [codeValue, setCodeValue] = useState('');
@@ -34,16 +36,24 @@ const ViewCodeModal: React.FC = (props) => {
{ label: 'Nodejs', value: 'javascript' }
];
- useEffect(() => {
- generateCode();
- }, [lang, systemMessage, messageList, parameters]);
-
+ const formatCode = () => {
+ if (editorRef.current) {
+ setTimeout(() => {
+ editorRef.current
+ ?.getAction?.('editor.action.formatDocument')
+ ?.run()
+ .then(() => {
+ console.log('format success');
+ });
+ }, 100);
+ }
+ };
const generateCode = () => {
if (lang === 'shell') {
const systemList = systemMessage
? [{ role: 'system', content: systemMessage }]
: [];
- const code = `curl ${window.location.origin}/v1/chat/completions \n-H "Content-Type: application/json" \n-H "Authorization: Bearer $\{GPUSTACK_API_KEY}\" \n-d '${JSON.stringify(
+ const code = `curl ${window.location.origin}/v1/chat/completions \n-H "Content-Type: application/json" \n-H "Authorization: Bearer $\{GPUSTACK_API_KEY}" \n-d '${JSON.stringify(
{
...parameters,
messages: [...systemList, ...messageList]
@@ -92,19 +102,6 @@ const ViewCodeModal: React.FC = (props) => {
setLoaded(true);
};
- function formatCode() {
- if (editorRef.current) {
- setTimeout(() => {
- editorRef.current
- ?.getAction?.('editor.action.formatDocument')
- ?.run()
- .then(() => {
- console.log('format success');
- });
- }, 100);
- }
- }
-
const handleOnChangeLang = (value: string) => {
setLang(value);
};
@@ -124,6 +121,10 @@ const ViewCodeModal: React.FC = (props) => {
}
};
+ useEffect(() => {
+ generateCode();
+ }, [lang, systemMessage, messageList, parameters]);
+
return (
<>
= (props) => {
footer={null}
>
- You can use the following code to start integrating your current
- prompt and settings into your application.
+ {intl.formatMessage({ id: 'playground.viewcode.info' })}
= (props) => {
/>
-
- our API Key can be foundhere You should use environment variables or a
- secret management tool to expose your key to your applications.
-
>
);
diff --git a/src/pages/playground/config/index.ts b/src/pages/playground/config/index.ts
index 29368f94..3f6323aa 100644
--- a/src/pages/playground/config/index.ts
+++ b/src/pages/playground/config/index.ts
@@ -5,10 +5,10 @@ export const Roles = {
export const playGroundRoles = [
{
key: 'user',
- label: 'User'
+ label: 'playground.user'
},
{
key: 'assistant',
- label: 'Assistant'
+ label: 'playground.assitant'
}
];
diff --git a/src/pages/resources/components/nodes.tsx b/src/pages/resources/components/nodes.tsx
index 4cf3b94f..e82dd066 100644
--- a/src/pages/resources/components/nodes.tsx
+++ b/src/pages/resources/components/nodes.tsx
@@ -4,6 +4,7 @@ import StatusTag from '@/components/status-tag';
import useTableRowSelection from '@/hooks/use-table-row-selection';
import useTableSort from '@/hooks/use-table-sort';
import { SyncOutlined } from '@ant-design/icons';
+import { useIntl } from '@umijs/max';
import { Button, Input, Space, Table } from 'antd';
import _ from 'lodash';
import { useEffect, useState } from 'react';
@@ -16,6 +17,7 @@ const Models: React.FC = () => {
const { sortOrder, setSortOrder } = useTableSort({
defaultSortOrder: 'descend'
});
+ const intl = useIntl();
const [total, setTotal] = useState(0);
const [loading, setLoading] = useState(false);
const [dataSource, setDataSource] = useState([]);
@@ -86,7 +88,9 @@ const Models: React.FC = () => {
left={
@@ -114,9 +118,13 @@ const Models: React.FC = () => {
onChange: handlePageChange
}}
>
-
+ {
@@ -145,7 +153,7 @@ const Models: React.FC = () => {
}}
/>
{
@@ -177,7 +185,15 @@ const Models: React.FC = () => {
}}
/>
{
+ return ;
+ }}
+ />
+ {
diff --git a/src/pages/resources/index.tsx b/src/pages/resources/index.tsx
index 84fd96be..b4c99633 100644
--- a/src/pages/resources/index.tsx
+++ b/src/pages/resources/index.tsx
@@ -1,4 +1,5 @@
import { PageContainer } from '@ant-design/pro-components';
+import { useIntl } from '@umijs/max';
import type { TabsProps } from 'antd';
import { Tabs } from 'antd';
import { useState } from 'react';
@@ -20,6 +21,8 @@ const items: TabsProps['items'] = [
const Resources = () => {
const [activeKey, setActiveKey] = useState('test');
+ const intl = useIntl();
+
const handleChangeTab = (key: string) => {
setActiveKey(key);
};
@@ -28,7 +31,7 @@ const Resources = () => {