balibabu
commited on
Commit
·
1157a9f
1
Parent(s):
1dc6af5
feat: translate name of operator #918 (#1437)
Browse files### What problem does this PR solve?
feat: translate name of operator #918
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
- web/src/hooks/flow-hooks.ts +2 -4
- web/src/locales/en.ts +4 -2
- web/src/locales/zh-traditional.ts +9 -8
- web/src/locales/zh.ts +9 -8
- web/src/pages/flow/canvas/node/categorize-handle.tsx +1 -6
- web/src/pages/flow/categorize-form/dynamic-categorize.tsx +1 -1
- web/src/pages/flow/message-form/index.tsx +1 -1
web/src/hooks/flow-hooks.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
import { useTranslate } from '@/hooks/commonHooks';
|
2 |
import { ResponseType } from '@/interfaces/database/base';
|
3 |
import { DSL, IFlow, IFlowTemplate } from '@/interfaces/database/flow';
|
4 |
import i18n from '@/locales/config';
|
@@ -46,7 +45,6 @@ export const EmptyDsl = {
|
|
46 |
};
|
47 |
|
48 |
export const useFetchFlowTemplates = (): ResponseType<IFlowTemplate[]> => {
|
49 |
-
const { t } = useTranslate('flow');
|
50 |
const { data } = useQuery({
|
51 |
queryKey: ['fetchFlowTemplates'],
|
52 |
initialData: [],
|
@@ -55,8 +53,8 @@ export const useFetchFlowTemplates = (): ResponseType<IFlowTemplate[]> => {
|
|
55 |
if (Array.isArray(data?.data)) {
|
56 |
data.data.unshift({
|
57 |
id: uuid(),
|
58 |
-
title:
|
59 |
-
description:
|
60 |
dsl: EmptyDsl,
|
61 |
});
|
62 |
}
|
|
|
|
|
1 |
import { ResponseType } from '@/interfaces/database/base';
|
2 |
import { DSL, IFlow, IFlowTemplate } from '@/interfaces/database/flow';
|
3 |
import i18n from '@/locales/config';
|
|
|
45 |
};
|
46 |
|
47 |
export const useFetchFlowTemplates = (): ResponseType<IFlowTemplate[]> => {
|
|
|
48 |
const { data } = useQuery({
|
49 |
queryKey: ['fetchFlowTemplates'],
|
50 |
initialData: [],
|
|
|
53 |
if (Array.isArray(data?.data)) {
|
54 |
data.data.unshift({
|
55 |
id: uuid(),
|
56 |
+
title: 'Blank',
|
57 |
+
description: 'Create from nothing',
|
58 |
dsl: EmptyDsl,
|
59 |
});
|
60 |
}
|
web/src/locales/en.ts
CHANGED
@@ -554,7 +554,7 @@ The above is the content you need to summarize.`,
|
|
554 |
description: 'Description',
|
555 |
examples: 'Examples',
|
556 |
to: 'To',
|
557 |
-
|
558 |
messagePlaceholder: 'message',
|
559 |
messageMsg: 'Please input message or delete this field.',
|
560 |
addField: 'Add field',
|
@@ -591,9 +591,11 @@ The above is the content you need to summarize.`,
|
|
591 |
relevant: 'Relevant',
|
592 |
rewriteQuestion: 'RewriteQuestion',
|
593 |
rewrite: 'Rewrite',
|
594 |
-
|
|
|
595 |
blank: 'Blank',
|
596 |
createFromNothing: 'Create from nothing',
|
|
|
597 |
},
|
598 |
footer: {
|
599 |
profile: 'All rights reserved @ React',
|
|
|
554 |
description: 'Description',
|
555 |
examples: 'Examples',
|
556 |
to: 'To',
|
557 |
+
msg: 'Messages',
|
558 |
messagePlaceholder: 'message',
|
559 |
messageMsg: 'Please input message or delete this field.',
|
560 |
addField: 'Add field',
|
|
|
591 |
relevant: 'Relevant',
|
592 |
rewriteQuestion: 'RewriteQuestion',
|
593 |
rewrite: 'Rewrite',
|
594 |
+
begin: 'Begin',
|
595 |
+
message: 'Message',
|
596 |
blank: 'Blank',
|
597 |
createFromNothing: 'Create from nothing',
|
598 |
+
addItem: 'Add Item',
|
599 |
},
|
600 |
footer: {
|
601 |
profile: 'All rights reserved @ React',
|
web/src/locales/zh-traditional.ts
CHANGED
@@ -515,7 +515,7 @@ export default {
|
|
515 |
description: '描述',
|
516 |
examples: '範例',
|
517 |
to: '下一步',
|
518 |
-
|
519 |
messagePlaceholder: '訊息',
|
520 |
messageMsg: '請輸入訊息或刪除此欄位。',
|
521 |
addField: '新增字段',
|
@@ -546,16 +546,17 @@ export default {
|
|
546 |
以上就是你需要總結的內容。`,
|
547 |
createGraph: '建立圖表',
|
548 |
createFromTemplates: '從模板創建',
|
549 |
-
retrieval: '
|
550 |
-
generate: '
|
551 |
-
answer: '
|
552 |
-
categorize: '
|
553 |
-
relevant: '
|
554 |
-
rewriteQuestion: '
|
555 |
-
rewrite: '重組',
|
556 |
begin: '開始',
|
|
|
557 |
blank: '空',
|
558 |
createFromNothing: '從無到有',
|
|
|
559 |
},
|
560 |
footer: {
|
561 |
profile: '“保留所有權利 @ react”',
|
|
|
515 |
description: '描述',
|
516 |
examples: '範例',
|
517 |
to: '下一步',
|
518 |
+
msg: '訊息',
|
519 |
messagePlaceholder: '訊息',
|
520 |
messageMsg: '請輸入訊息或刪除此欄位。',
|
521 |
addField: '新增字段',
|
|
|
546 |
以上就是你需要總結的內容。`,
|
547 |
createGraph: '建立圖表',
|
548 |
createFromTemplates: '從模板創建',
|
549 |
+
retrieval: '知識檢索',
|
550 |
+
generate: '生成回答',
|
551 |
+
answer: '人機交互',
|
552 |
+
categorize: '問題分類',
|
553 |
+
relevant: '是否相關',
|
554 |
+
rewriteQuestion: '問題最佳化',
|
|
|
555 |
begin: '開始',
|
556 |
+
message: '靜態訊息',
|
557 |
blank: '空',
|
558 |
createFromNothing: '從無到有',
|
559 |
+
addItem: '新增',
|
560 |
},
|
561 |
footer: {
|
562 |
profile: '“保留所有權利 @ react”',
|
web/src/locales/zh.ts
CHANGED
@@ -534,7 +534,7 @@ export default {
|
|
534 |
description: '描述',
|
535 |
examples: '示例',
|
536 |
to: '下一步',
|
537 |
-
|
538 |
messagePlaceholder: '消息',
|
539 |
messageMsg: '请输入消息或删除此字段。',
|
540 |
addField: '新增字段',
|
@@ -564,16 +564,17 @@ export default {
|
|
564 |
以上就是你需要总结的内容。`,
|
565 |
createGraph: '创建图表',
|
566 |
createFromTemplates: '从模板创建',
|
567 |
-
retrieval: '
|
568 |
-
generate: '
|
569 |
-
answer: '
|
570 |
-
categorize: '
|
571 |
-
relevant: '
|
572 |
-
rewriteQuestion: '
|
573 |
-
rewrite: '重组',
|
574 |
begin: '开始',
|
|
|
575 |
blank: '空',
|
576 |
createFromNothing: '从无到有',
|
|
|
577 |
},
|
578 |
footer: {
|
579 |
profile: 'All rights reserved @ React',
|
|
|
534 |
description: '描述',
|
535 |
examples: '示例',
|
536 |
to: '下一步',
|
537 |
+
msg: '消息',
|
538 |
messagePlaceholder: '消息',
|
539 |
messageMsg: '请输入消息或删除此字段。',
|
540 |
addField: '新增字段',
|
|
|
564 |
以上就是你需要总结的内容。`,
|
565 |
createGraph: '创建图表',
|
566 |
createFromTemplates: '从模板创建',
|
567 |
+
retrieval: '知识检索',
|
568 |
+
generate: '生成回答',
|
569 |
+
answer: '人机交互',
|
570 |
+
categorize: '问题分类',
|
571 |
+
relevant: '是否相关',
|
572 |
+
rewriteQuestion: '问题优化',
|
|
|
573 |
begin: '开始',
|
574 |
+
message: '静态消息',
|
575 |
blank: '空',
|
576 |
createFromNothing: '从无到有',
|
577 |
+
addItem: '新增',
|
578 |
},
|
579 |
footer: {
|
580 |
profile: 'All rights reserved @ React',
|
web/src/pages/flow/canvas/node/categorize-handle.tsx
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
import { Handle, Position } from 'reactflow';
|
2 |
// import { v4 as uuid } from 'uuid';
|
3 |
|
4 |
-
import { useTranslate } from '@/hooks/commonHooks';
|
5 |
-
import lowerFirst from 'lodash/lowerFirst';
|
6 |
import styles from './index.less';
|
7 |
|
8 |
const DEFAULT_HANDLE_STYLE = {
|
@@ -20,7 +18,6 @@ interface IProps {
|
|
20 |
}
|
21 |
|
22 |
const CategorizeHandle = ({ top, right, text, idx }: IProps) => {
|
23 |
-
const { t } = useTranslate('flow');
|
24 |
return (
|
25 |
<Handle
|
26 |
type="source"
|
@@ -36,9 +33,7 @@ const CategorizeHandle = ({ top, right, text, idx }: IProps) => {
|
|
36 |
color: 'black',
|
37 |
}}
|
38 |
>
|
39 |
-
<span className={styles.categorizeAnchorPointText}>
|
40 |
-
{lowerFirst(t(text))}
|
41 |
-
</span>
|
42 |
</Handle>
|
43 |
);
|
44 |
};
|
|
|
1 |
import { Handle, Position } from 'reactflow';
|
2 |
// import { v4 as uuid } from 'uuid';
|
3 |
|
|
|
|
|
4 |
import styles from './index.less';
|
5 |
|
6 |
const DEFAULT_HANDLE_STYLE = {
|
|
|
18 |
}
|
19 |
|
20 |
const CategorizeHandle = ({ top, right, text, idx }: IProps) => {
|
|
|
21 |
return (
|
22 |
<Handle
|
23 |
type="source"
|
|
|
33 |
color: 'black',
|
34 |
}}
|
35 |
>
|
36 |
+
<span className={styles.categorizeAnchorPointText}>{text}</span>
|
|
|
|
|
37 |
</Handle>
|
38 |
);
|
39 |
};
|
web/src/pages/flow/categorize-form/dynamic-categorize.tsx
CHANGED
@@ -88,7 +88,7 @@ const DynamicCategorize = ({ nodeId }: IProps) => {
|
|
88 |
))}
|
89 |
|
90 |
<Button type="dashed" onClick={handleAdd} block>
|
91 |
-
+
|
92 |
</Button>
|
93 |
</div>
|
94 |
);
|
|
|
88 |
))}
|
89 |
|
90 |
<Button type="dashed" onClick={handleAdd} block>
|
91 |
+
+ {t('addItem')}
|
92 |
</Button>
|
93 |
</div>
|
94 |
);
|
web/src/pages/flow/message-form/index.tsx
CHANGED
@@ -38,7 +38,7 @@ const MessageForm = ({ onValuesChange, form }: IOperatorForm) => {
|
|
38 |
{fields.map((field, index) => (
|
39 |
<Form.Item
|
40 |
{...(index === 0 ? formItemLayout : formItemLayoutWithOutLabel)}
|
41 |
-
label={index === 0 ? t('
|
42 |
required={false}
|
43 |
key={field.key}
|
44 |
>
|
|
|
38 |
{fields.map((field, index) => (
|
39 |
<Form.Item
|
40 |
{...(index === 0 ? formItemLayout : formItemLayoutWithOutLabel)}
|
41 |
+
label={index === 0 ? t('msg') : ''}
|
42 |
required={false}
|
43 |
key={field.key}
|
44 |
>
|