fix(web): optimize i18n name

This commit is contained in:
lcxadml 2024-02-21 10:39:32 +08:00 committed by GitHub
parent 32e1554282
commit 02abcb7218
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 72 additions and 52 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
self.__BUILD_MANIFEST=function(s,c,a,e,t,n,f,d,k,h,i,b,u,j,p,o,g,l,r){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[p,s,c,e,a,h,f,d,o,"static/chunks/9305-f44429d5185a9fc7.js","static/chunks/7299-cb3b5c1ad528f20a.js","static/chunks/pages/index-60038165daa70046.js"],"/_error":["static/chunks/pages/_error-8095ba9e1bf12f30.js"],"/agent":[s,c,a,t,h,n,"static/chunks/pages/agent-ce4aada0ffb26742.js"],"/app":[i,s,c,e,a,t,n,b,u,"static/chunks/7958-ed34baf152e6e252.js",j,"static/chunks/pages/app-90415a5fdf367a91.js"],"/chat":["static/chunks/pages/chat-b09234393c5f8ad7.js"],"/database":[s,c,e,a,t,n,d,k,"static/chunks/7902-94d75aab69ac7c8d.js","static/chunks/pages/database-5b649049b3adcaf7.js"],"/flow":[i,b,u,j,"static/chunks/pages/flow-c83aa1081ec293f9.js"],"/flow/canvas":[p,i,s,c,e,a,f,d,b,k,u,g,o,"static/chunks/4350-1896c46dd5e9afe8.js",j,"static/chunks/pages/flow/canvas-70f324e20b0113c0.js"],"/knowledge":[l,s,c,a,t,h,n,d,k,r,g,"static/chunks/8660-25eebcb95c34109b.js","static/chunks/pages/knowledge-3b36ed0feb6e3138.js"],"/knowledge/chunk":[s,e,t,f,n,"static/chunks/pages/knowledge/chunk-148ca5920e6a3447.js"],"/models":[l,s,c,e,a,k,"static/chunks/3444-30181eacc7980e66.js","static/chunks/pages/models-a019e728f75142a1.js"],"/prompt":[s,c,e,a,f,r,"static/chunks/4733-cc041bf7a3d12e39.js","static/chunks/5396-3e98ef6b437678bd.js","static/chunks/pages/prompt-8ac6786093609ab9.js"],sortedPages:["/","/_app","/_error","/agent","/app","/chat","/database","/flow","/flow/canvas","/knowledge","/knowledge/chunk","/models","/prompt"]}}("static/chunks/7113-c0c4ee5dc30929ba.js","static/chunks/5503-c65f6d730754acc7.js","static/chunks/9479-21f588e1fd4e6b6d.js","static/chunks/1009-f20562de52b03b76.js","static/chunks/4442-2fd5fdaab894a502.js","static/chunks/5813-c6244a8eba7ef4ae.js","static/chunks/4810-1e930464030aee69.js","static/chunks/411-b5d3e7f64bee2335.js","static/chunks/8928-0e78def492052d13.js","static/chunks/4553-5a62c446efb06d63.js","static/chunks/971df74e-7436ff4085ebb785.js","static/chunks/7434-29506257e67e8077.js","static/chunks/9924-5bce555f07385e1f.js","static/css/b4846eed11c4725f.css","static/chunks/29107295-75edf0bf34e24b1e.js","static/chunks/2487-24749b0b156943d8.js","static/chunks/6485-a0f49ba464882399.js","static/chunks/75fc9c18-1d6133135d3d283c.js","static/chunks/8548-e633dfc38edeb044.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
self.__BUILD_MANIFEST=function(s,c,a,e,t,n,f,d,k,h,i,u,b,j,p,o,g,l,r){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[p,s,c,e,a,h,f,d,o,"static/chunks/9305-f44429d5185a9fc7.js","static/chunks/7299-cb3b5c1ad528f20a.js","static/chunks/pages/index-60038165daa70046.js"],"/_error":["static/chunks/pages/_error-8095ba9e1bf12f30.js"],"/agent":[s,c,a,t,h,n,"static/chunks/pages/agent-ce4aada0ffb26742.js"],"/app":[i,s,c,e,a,t,n,u,b,"static/chunks/7958-ed34baf152e6e252.js",j,"static/chunks/pages/app-75e39485cc4a24b3.js"],"/chat":["static/chunks/pages/chat-1434817946faf8ff.js"],"/database":[s,c,e,a,t,n,d,k,"static/chunks/7902-94d75aab69ac7c8d.js","static/chunks/pages/database-5b649049b3adcaf7.js"],"/flow":[i,u,b,j,"static/chunks/pages/flow-c83aa1081ec293f9.js"],"/flow/canvas":[p,i,s,c,e,a,f,d,u,k,b,g,o,"static/chunks/4350-1896c46dd5e9afe8.js",j,"static/chunks/pages/flow/canvas-d313d1fe05a1d9e1.js"],"/knowledge":[l,s,c,a,t,h,n,d,k,r,g,"static/chunks/8660-25eebcb95c34109b.js","static/chunks/pages/knowledge-3b36ed0feb6e3138.js"],"/knowledge/chunk":[s,e,t,f,n,"static/chunks/pages/knowledge/chunk-148ca5920e6a3447.js"],"/models":[l,s,c,e,a,k,"static/chunks/3444-30181eacc7980e66.js","static/chunks/pages/models-a019e728f75142a1.js"],"/prompt":[s,c,e,a,f,r,"static/chunks/4733-cc041bf7a3d12e39.js","static/chunks/5396-3e98ef6b437678bd.js","static/chunks/pages/prompt-8ac6786093609ab9.js"],sortedPages:["/","/_app","/_error","/agent","/app","/chat","/database","/flow","/flow/canvas","/knowledge","/knowledge/chunk","/models","/prompt"]}}("static/chunks/7113-c0c4ee5dc30929ba.js","static/chunks/5503-c65f6d730754acc7.js","static/chunks/9479-21f588e1fd4e6b6d.js","static/chunks/1009-f20562de52b03b76.js","static/chunks/4442-2fd5fdaab894a502.js","static/chunks/5813-c6244a8eba7ef4ae.js","static/chunks/4810-1e930464030aee69.js","static/chunks/411-b5d3e7f64bee2335.js","static/chunks/8928-0e78def492052d13.js","static/chunks/4553-5a62c446efb06d63.js","static/chunks/971df74e-7436ff4085ebb785.js","static/chunks/7434-29506257e67e8077.js","static/chunks/9924-5bce555f07385e1f.js","static/css/b4846eed11c4725f.css","static/chunks/29107295-75edf0bf34e24b1e.js","static/chunks/2487-24749b0b156943d8.js","static/chunks/6485-a0f49ba464882399.js","static/chunks/75fc9c18-1d6133135d3d283c.js","static/chunks/8548-e633dfc38edeb044.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -207,7 +207,18 @@ const en = {
available_resources: ' Available Resources',
edit_new_applications: 'Edit new applications',
collect: 'Collect',
create: '创建',
collected: 'Collected',
create: 'Create',
Agents: 'Agents',
edit_application: 'edit application',
add_application: 'add application',
app_name: 'App Name',
LLM_strategy: 'LLM Strategy',
LLM_strategy_value: 'LLM Strategy Value',
resource: 'Resource',
operators: 'Operators',
Chinese: 'Chinese',
English: 'English',
} as const;
export type I18nKeys = keyof typeof en;
@ -413,6 +424,7 @@ const zh: Resources['translation'] = {
add_resource: '添加资源',
team_modal: '工作模式',
App: '应用程序',
resource: '资源',
resource_name: '资源名',
resource_type: '资源类型',
resource_value: '参数',
@ -421,7 +433,17 @@ const zh: Resources['translation'] = {
available_resources: '可用资源',
edit_new_applications: '编辑新的应用',
collect: '收藏',
collected: '已收藏',
create: '创建',
Agents: '智能体',
edit_application: '编辑应用',
add_application: '添加应用',
app_name: '应用名称',
LLM_strategy: '模型策略',
LLM_strategy_value: '模型策略参数',
operators: '算子',
Chinese: '中文',
English: '英文',
} as const;
i18n.use(initReactI18next).init({

View File

@ -1,6 +1,5 @@
import { apiInterceptors, getAppStrategy, getAppStrategyValues, getResource } from '@/client/api';
import { Button, Card, Divider, Input, Select } from 'antd';
import { log } from 'console';
import { Button, Input, Select } from 'antd';
import React, { useEffect, useMemo, useState } from 'react';
import ResourceCard from './resource-card';
import { useTranslation } from 'react-i18next';
@ -90,7 +89,7 @@ export default function AgentPanel(props: IProps) {
return (
<div>
<div className="flex items-center mb-6 mt-6">
<div className="mr-2 w-16 text-center">Prompt:</div>
<div className="mr-2 w-16 text-center">{t('Prompt')}:</div>
<Input
required
className="mr-6 w-1/4"
@ -99,7 +98,7 @@ export default function AgentPanel(props: IProps) {
updateAgent(e.target.value, 'prompt_template');
}}
/>
<div className="mr-2">LLM Strategy:</div>
<div className="mr-2">{t('LLM_strategy')}:</div>
<Select
value={agent.llm_strategy}
options={strategyOptions}
@ -111,7 +110,7 @@ export default function AgentPanel(props: IProps) {
/>
{strategyValueOptions && strategyValueOptions.length > 0 && (
<>
<div className="mr-2">LLM Strategy Value:</div>
<div className="mr-2">{t('LLM_strategy_value')}:</div>
<Select
value={formatStrategyValue(agent.llm_strategy_value)}
className="w-1/4"

View File

@ -17,11 +17,6 @@ interface IProps {
const { confirm } = Modal;
const languageMap = {
en: '英文',
zh: '中文',
};
export default function AppCard(props: IProps) {
const { updateApps, app, handleEdit, isCollected } = props;
const { model } = useContext(ChatContext);
@ -32,6 +27,11 @@ export default function AppCard(props: IProps) {
const { t } = useTranslation();
const languageMap = {
en: t('English'),
zh: t('Chinese'),
};
const showDeleteConfirm = () => {
confirm({
title: t('Tips'),

View File

@ -33,11 +33,6 @@ interface IProps {
app?: any;
}
const languageOptions = [
{ value: 'zh', label: '中文' },
{ value: 'en', label: '英文' },
];
type TeamModals = 'awel_layout' | 'singe_agent' | 'auto_plan';
export default function AppModal(props: IProps) {
@ -56,6 +51,11 @@ export default function AppModal(props: IProps) {
const [form] = Form.useForm();
const languageOptions = [
{ value: 'zh', label: t('Chinese') },
{ value: 'en', label: t('English') },
];
const onChange = (newActiveKey: string) => {
setActiveKey(newActiveKey);
};
@ -302,7 +302,7 @@ export default function AppModal(props: IProps) {
<div>
<Modal
okText={t('Submit')}
title={type === 'edit' ? 'edit application' : 'add application'}
title={type === 'edit' ? t('edit_application') : t('add_application')}
open={open}
width={'65%'}
onCancel={handleCancel}
@ -327,7 +327,7 @@ export default function AppModal(props: IProps) {
autoComplete="off"
onFinish={handleSubmit}
>
<Form.Item<FieldType> label={'App Name'} name="app_name" rules={[{ required: true, message: t('Please_input_the_name') }]}>
<Form.Item<FieldType> label={t('app_name')} name="app_name" rules={[{ required: true, message: t('Please_input_the_name') }]}>
<Input placeholder={t('Please_input_the_name')} />
</Form.Item>
<Form.Item<FieldType>
@ -353,7 +353,7 @@ export default function AppModal(props: IProps) {
</div>
{curTeamModal !== 'awel_layout' ? (
<>
<div className="mb-5">Agents</div>
<div className="mb-5">{t('Agents')}</div>
<Tabs addIcon={renderAddIcon()} type="editable-card" onChange={onChange} activeKey={activeKey} onEdit={onEdit} items={agents} />
</>
) : (

View File

@ -68,7 +68,7 @@ export default function ResourceCard(props: IProps) {
return (
<Card
className="mb-3 dark:bg-[#232734] border-gray-200"
title={`Resource ${index + 1}`}
title={`${t('resource')} ${index + 1}`}
extra={
<DeleteFilled
className="text-[#ff1b2e] !text-lg"

View File

@ -100,14 +100,14 @@ const AddNodes: React.FC = () => {
<div className="w-[320px] overflow-hidden overflow-y-auto scrollbar-default">
<p className="my-2 font-bold">{t('add_node')}</p>
<Search placeholder="Search node" onSearch={searchNode} />
<h2 className="my-2 ml-2 font-semibold">Operatos</h2>
<h2 className="my-2 ml-2 font-semibold">{t('operators')}</h2>
<Collapse
className="max-h-[300px] overflow-hidden overflow-y-auto scrollbar-default"
size="small"
defaultActiveKey={['']}
items={operatorItems}
/>
<h2 className="my-2 ml-2 font-semibold">Resources</h2>
<h2 className="my-2 ml-2 font-semibold">{t('resource')}</h2>
<Collapse
className="max-h-[300px] overflow-hidden overflow-y-auto scrollbar-default"
size="small"

9
web/package-lock.json generated
View File

@ -9067,9 +9067,8 @@
},
"node_modules/remark-gfm": {
"version": "3.0.1",
"resolved": "https://registry.npm.alibaba-inc.com/remark-gfm/download/remark-gfm-3.0.1.tgz",
"integrity": "sha1-CxgPCV4wNlRend2sDo3z+lz+5U8=",
"license": "MIT",
"resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-3.0.1.tgz",
"integrity": "sha512-lEFDoi2PICJyNrACFOfDD3JlLkuSbOa5Wd8EPt06HUdptv8Gn0bxYTdbU/XXQ3swAPkEaGxxPN9cbnMHvVu1Ig==",
"dependencies": {
"@types/mdast": "^3.0.0",
"mdast-util-gfm": "^2.0.0",
@ -17425,8 +17424,8 @@
},
"remark-gfm": {
"version": "3.0.1",
"resolved": "https://registry.npm.alibaba-inc.com/remark-gfm/download/remark-gfm-3.0.1.tgz",
"integrity": "sha1-CxgPCV4wNlRend2sDo3z+lz+5U8=",
"resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-3.0.1.tgz",
"integrity": "sha512-lEFDoi2PICJyNrACFOfDD3JlLkuSbOa5Wd8EPt06HUdptv8Gn0bxYTdbU/XXQ3swAPkEaGxxPN9cbnMHvVu1Ig==",
"requires": {
"@types/mdast": "^3.0.0",
"mdast-util-gfm": "^2.0.0",

View File

@ -89,12 +89,12 @@ export default function App() {
const items: TabsProps['items'] = [
{
key: 'app',
label: 'App',
label: t('App'),
children: renderAppList({ isCollected: false }),
},
{
key: 'collected',
label: 'Collected',
label: t('collected'),
children: renderAppList({ isCollected: true }),
},
];