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
32 changed files with 72 additions and 52 deletions

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"