balibabu commited on
Commit
12f28d5
·
1 Parent(s): 1b5ca26

feat: translate graph #918 (#1411)

Browse files

### What problem does this PR solve?

feat: translate graph #918

### Type of change


- [x] New Feature (non-breaking change which adds functionality)

web/src/locales/en.ts CHANGED
@@ -565,6 +565,8 @@ The above is the content you need to summarize.`,
565
  componentId: 'component id',
566
  add: 'Add',
567
  operation: 'operation',
 
 
568
  beginDescription: 'This is where the flow begin',
569
  answerDescription: `This component is used as an interface between bot and human. It receives input of user and display the result of the computation of the bot.`,
570
  retrievalDescription: `This component is for the process of retrieving relevent information from knowledge base. So, knowledgebases should be selected. If there's nothing retrieved, the 'Empty response' will be returned.`,
 
565
  componentId: 'component id',
566
  add: 'Add',
567
  operation: 'operation',
568
+ run: 'Run',
569
+ save: 'Save',
570
  beginDescription: 'This is where the flow begin',
571
  answerDescription: `This component is used as an interface between bot and human. It receives input of user and display the result of the computation of the bot.`,
572
  retrievalDescription: `This component is for the process of retrieving relevent information from knowledge base. So, knowledgebases should be selected. If there's nothing retrieved, the 'Empty response' will be returned.`,
web/src/locales/zh-traditional.ts CHANGED
@@ -518,6 +518,28 @@ export default {
518
  messageMsg: '請輸入訊息或刪除此欄位。',
519
  addField: '新增字段',
520
  loop: '環',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
521
  },
522
  footer: {
523
  profile: '“保留所有權利 @ react”',
 
518
  messageMsg: '請輸入訊息或刪除此欄位。',
519
  addField: '新增字段',
520
  loop: '環',
521
+ createFlow: '创建工作流',
522
+ yes: '是',
523
+ no: '否',
524
+ key: 'key',
525
+ componentId: '組件id',
526
+ add: '新增',
527
+ operation: '操作',
528
+ run: '運行',
529
+ save: '儲存',
530
+ beginDescription: '這是流程開始的地方',
531
+ answerDescription: `該組件用作機器人與人類之間的介面。它接收使用者的輸入並顯示機器人的計算結果。`,
532
+ retrievalDescription: `此元件用於從知識庫中檢索相關資訊。選擇知識庫。如果沒有檢索到任何內容,將傳回「空響應」。`,
533
+ generateDescription: `此元件用於呼叫LLM生成文本,請注意提示的設定。`,
534
+ categorizeDescription: `此組件用於對文字進行分類。請指定類別的名稱、描述和範例。每個類別都指向不同的下游組件。`,
535
+ relevantDescription: `此元件用來判斷upstream的輸出是否與使用者最新的問題相關,『是』代表相關,『否』代表不相關。`,
536
+ rewriteQuestionDescription: `此元件用於細化使用者的提問。通常,當使用者的原始提問無法從知識庫中檢索相關資訊時,此元件可協助您將問題變更為更符合知識庫表達方式的適當問題。只有「檢索」可作為其下游。`,
537
+ messageDescription:
538
+ '此元件用於向使用者發送靜態訊息。您可以準備幾條訊息,這些訊息將隨機選擇。',
539
+ keywordDescription: `該組件用於從用戶的問題中提取關鍵字。 Top N指定需要提取的關鍵字數量。`,
540
+ promptText: `請總結以下段落。注意數字,不要胡編亂造。段落如下:
541
+ {input}
542
+ 以上就是你需要總結的內容。`,
543
  },
544
  footer: {
545
  profile: '“保留所有權利 @ react”',
web/src/locales/zh.ts CHANGED
@@ -526,7 +526,7 @@ export default {
526
  flow: {
527
  flow: '工作流',
528
  cite: '引用',
529
- citeTip: 'citeTip',
530
  name: '名称',
531
  nameMessage: '请输入名称',
532
  description: '描述',
@@ -537,27 +537,28 @@ export default {
537
  messageMsg: '请输入消息或删除此字段。',
538
  addField: '新增字段',
539
  loop: '环',
540
- createFlow: 'Create a workflow',
541
- yes: 'Yes',
542
- no: 'No',
543
  key: 'key',
544
- componentId: 'component id',
545
- add: 'Add',
546
- operation: 'operation',
547
- beginDescription: 'This is where the flow begin',
548
- answerDescription: `This component is used as an interface between bot and human. It receives input of user and display the result of the computation of the bot.`,
549
- retrievalDescription: `This component is for the process of retrieving relevent information from knowledge base. So, knowledgebases should be selected. If there's nothing retrieved, the 'Empty response' will be returned.`,
550
- generateDescription: `This component is used to call LLM to generate text. Be careful about the prompt setting.`,
551
- categorizeDescription: `This component is used to categorize text. Please specify the name, description and examples of the category. Every single category leads to different downstream components.`,
552
- relevantDescription: `This component is used to judge if the output of upstream is relevent to user's latest question. 'Yes' represents that they're relevant. 'No' represents they're irrelevant.`,
553
- rewriteQuestionDescription: `This component is used to refine user's quesion. Typically, when a user's original question can't retrieve relevant information from knowledge base, this component help you change the question into a proper one which might be more consistant with the expressions in knowledge base. Only 'Retrieval' can be its downstreams.`,
 
 
554
  messageDescription:
555
- 'This component is used to send user static information.',
556
- keywordDescription:
557
- 'This component is used to send user static information.',
558
- promptText: `Please summarize the following paragraphs. Be careful with the numbers, do not make things up. Paragraphs as following:
559
- {input}
560
- The above is the content you need to summarize.`,
561
  },
562
  footer: {
563
  profile: 'All rights reserved @ React',
 
526
  flow: {
527
  flow: '工作流',
528
  cite: '引用',
529
+ citeTip: '引用',
530
  name: '名称',
531
  nameMessage: '请输入名称',
532
  description: '描述',
 
537
  messageMsg: '请输入消息或删除此字段。',
538
  addField: '新增字段',
539
  loop: '环',
540
+ createFlow: '创建工作流',
541
+ yes: '',
542
+ no: '',
543
  key: 'key',
544
+ componentId: '组件id',
545
+ add: '新增',
546
+ operation: '操作',
547
+ run: '运行',
548
+ save: '保存',
549
+ beginDescription: '这是流程开始的地方',
550
+ answerDescription: `该组件用作机器人与人类之间的接口。它接收用户的输入并显示机器人的计算结果。`,
551
+ retrievalDescription: `此组件用于从知识库中检索相关信息。选择知识库。如果没有检索到任何内容,将返回“空响应”。`,
552
+ generateDescription: `此组件用于调用LLM生成文本,请注意提示的设置。`,
553
+ categorizeDescription: `此组件用于对文本进行分类。请指定类别的名称、描述和示例。每个类别都指向不同的下游组件。`,
554
+ relevantDescription: `该组件用来判断upstream的输出是否与用户最新的问题相关,‘是’代表相关,‘否’代表不相关。`,
555
+ rewriteQuestionDescription: `此组件用于细化用户的提问。通常,当用户的原始提问无法从知识库中检索到相关信息时,此组件可帮助您将问题更改为更符合知识库表达方式的适当问题。只有“检索”可作为其下游。`,
556
  messageDescription:
557
+ '此组件用于向用户发送静态信息。您可以准备几条消息,这些消息将被随机选择。',
558
+ keywordDescription: `该组件用于从用户的问题中提取关键词。Top N指定需要提取的关键词数量。`,
559
+ promptText: `请总结以下段落。注意数字,不要胡编乱造。段落如下:
560
+ {input}
561
+ 以上就是你需要总结的内容。`,
 
562
  },
563
  footer: {
564
  profile: 'All rights reserved @ React',
web/src/pages/flow/header/index.tsx CHANGED
@@ -1,10 +1,9 @@
1
- import { Button, Flex, Space } from 'antd';
2
-
3
  import { useFetchFlow } from '@/hooks/flow-hooks';
4
  import { ArrowLeftOutlined } from '@ant-design/icons';
 
5
  import { Link } from 'umi';
6
  import { useSaveGraph, useSaveGraphBeforeOpeningDebugDrawer } from '../hooks';
7
-
8
  import styles from './index.less';
9
 
10
  interface IProps {
@@ -15,6 +14,7 @@ const FlowHeader = ({ showChatDrawer }: IProps) => {
15
  const { saveGraph } = useSaveGraph();
16
  const handleRun = useSaveGraphBeforeOpeningDebugDrawer(showChatDrawer);
17
  const { data } = useFetchFlow();
 
18
 
19
  return (
20
  <>
@@ -32,10 +32,10 @@ const FlowHeader = ({ showChatDrawer }: IProps) => {
32
  </Space>
33
  <Space size={'large'}>
34
  <Button onClick={handleRun}>
35
- <b>Run</b>
36
  </Button>
37
  <Button type="primary" onClick={saveGraph}>
38
- <b>Save</b>
39
  </Button>
40
  </Space>
41
  </Flex>
 
1
+ import { useTranslate } from '@/hooks/commonHooks';
 
2
  import { useFetchFlow } from '@/hooks/flow-hooks';
3
  import { ArrowLeftOutlined } from '@ant-design/icons';
4
+ import { Button, Flex, Space } from 'antd';
5
  import { Link } from 'umi';
6
  import { useSaveGraph, useSaveGraphBeforeOpeningDebugDrawer } from '../hooks';
 
7
  import styles from './index.less';
8
 
9
  interface IProps {
 
14
  const { saveGraph } = useSaveGraph();
15
  const handleRun = useSaveGraphBeforeOpeningDebugDrawer(showChatDrawer);
16
  const { data } = useFetchFlow();
17
+ const { t } = useTranslate('flow');
18
 
19
  return (
20
  <>
 
32
  </Space>
33
  <Space size={'large'}>
34
  <Button onClick={handleRun}>
35
+ <b>{t('run')}</b>
36
  </Button>
37
  <Button type="primary" onClick={saveGraph}>
38
+ <b>{t('save')}</b>
39
  </Button>
40
  </Space>
41
  </Flex>