### What problem does this PR solve? feat: translate name of operator #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)tags/v0.9.0
| @@ -1,4 +1,3 @@ | |||
| import { useTranslate } from '@/hooks/commonHooks'; | |||
| import { ResponseType } from '@/interfaces/database/base'; | |||
| import { DSL, IFlow, IFlowTemplate } from '@/interfaces/database/flow'; | |||
| import i18n from '@/locales/config'; | |||
| @@ -46,7 +45,6 @@ export const EmptyDsl = { | |||
| }; | |||
| export const useFetchFlowTemplates = (): ResponseType<IFlowTemplate[]> => { | |||
| const { t } = useTranslate('flow'); | |||
| const { data } = useQuery({ | |||
| queryKey: ['fetchFlowTemplates'], | |||
| initialData: [], | |||
| @@ -55,8 +53,8 @@ export const useFetchFlowTemplates = (): ResponseType<IFlowTemplate[]> => { | |||
| if (Array.isArray(data?.data)) { | |||
| data.data.unshift({ | |||
| id: uuid(), | |||
| title: t('blank'), | |||
| description: t('createFromNothing'), | |||
| title: 'Blank', | |||
| description: 'Create from nothing', | |||
| dsl: EmptyDsl, | |||
| }); | |||
| } | |||
| @@ -554,7 +554,7 @@ The above is the content you need to summarize.`, | |||
| description: 'Description', | |||
| examples: 'Examples', | |||
| to: 'To', | |||
| message: 'Messages', | |||
| msg: 'Messages', | |||
| messagePlaceholder: 'message', | |||
| messageMsg: 'Please input message or delete this field.', | |||
| addField: 'Add field', | |||
| @@ -591,9 +591,11 @@ The above is the content you need to summarize.`, | |||
| relevant: 'Relevant', | |||
| rewriteQuestion: 'RewriteQuestion', | |||
| rewrite: 'Rewrite', | |||
| Begin: 'Begin', | |||
| begin: 'Begin', | |||
| message: 'Message', | |||
| blank: 'Blank', | |||
| createFromNothing: 'Create from nothing', | |||
| addItem: 'Add Item', | |||
| }, | |||
| footer: { | |||
| profile: 'All rights reserved @ React', | |||
| @@ -515,7 +515,7 @@ export default { | |||
| description: '描述', | |||
| examples: '範例', | |||
| to: '下一步', | |||
| message: '訊息', | |||
| msg: '訊息', | |||
| messagePlaceholder: '訊息', | |||
| messageMsg: '請輸入訊息或刪除此欄位。', | |||
| addField: '新增字段', | |||
| @@ -546,16 +546,17 @@ export default { | |||
| 以上就是你需要總結的內容。`, | |||
| createGraph: '建立圖表', | |||
| createFromTemplates: '從模板創建', | |||
| retrieval: '檢索', | |||
| generate: '產生', | |||
| answer: '回答', | |||
| categorize: '分類', | |||
| relevant: '相關', | |||
| rewriteQuestion: '重組', | |||
| rewrite: '重組', | |||
| retrieval: '知識檢索', | |||
| generate: '生成回答', | |||
| answer: '人機交互', | |||
| categorize: '問題分類', | |||
| relevant: '是否相關', | |||
| rewriteQuestion: '問題最佳化', | |||
| begin: '開始', | |||
| message: '靜態訊息', | |||
| blank: '空', | |||
| createFromNothing: '從無到有', | |||
| addItem: '新增', | |||
| }, | |||
| footer: { | |||
| profile: '“保留所有權利 @ react”', | |||
| @@ -534,7 +534,7 @@ export default { | |||
| description: '描述', | |||
| examples: '示例', | |||
| to: '下一步', | |||
| message: '消息', | |||
| msg: '消息', | |||
| messagePlaceholder: '消息', | |||
| messageMsg: '请输入消息或删除此字段。', | |||
| addField: '新增字段', | |||
| @@ -564,16 +564,17 @@ export default { | |||
| 以上就是你需要总结的内容。`, | |||
| createGraph: '创建图表', | |||
| createFromTemplates: '从模板创建', | |||
| retrieval: '检索', | |||
| generate: '生成', | |||
| answer: '回答', | |||
| categorize: '分类', | |||
| relevant: '相关', | |||
| rewriteQuestion: '重组', | |||
| rewrite: '重组', | |||
| retrieval: '知识检索', | |||
| generate: '生成回答', | |||
| answer: '人机交互', | |||
| categorize: '问题分类', | |||
| relevant: '是否相关', | |||
| rewriteQuestion: '问题优化', | |||
| begin: '开始', | |||
| message: '静态消息', | |||
| blank: '空', | |||
| createFromNothing: '从无到有', | |||
| addItem: '新增', | |||
| }, | |||
| footer: { | |||
| profile: 'All rights reserved @ React', | |||
| @@ -1,8 +1,6 @@ | |||
| import { Handle, Position } from 'reactflow'; | |||
| // import { v4 as uuid } from 'uuid'; | |||
| import { useTranslate } from '@/hooks/commonHooks'; | |||
| import lowerFirst from 'lodash/lowerFirst'; | |||
| import styles from './index.less'; | |||
| const DEFAULT_HANDLE_STYLE = { | |||
| @@ -20,7 +18,6 @@ interface IProps { | |||
| } | |||
| const CategorizeHandle = ({ top, right, text, idx }: IProps) => { | |||
| const { t } = useTranslate('flow'); | |||
| return ( | |||
| <Handle | |||
| type="source" | |||
| @@ -36,9 +33,7 @@ const CategorizeHandle = ({ top, right, text, idx }: IProps) => { | |||
| color: 'black', | |||
| }} | |||
| > | |||
| <span className={styles.categorizeAnchorPointText}> | |||
| {lowerFirst(t(text))} | |||
| </span> | |||
| <span className={styles.categorizeAnchorPointText}>{text}</span> | |||
| </Handle> | |||
| ); | |||
| }; | |||
| @@ -88,7 +88,7 @@ const DynamicCategorize = ({ nodeId }: IProps) => { | |||
| ))} | |||
| <Button type="dashed" onClick={handleAdd} block> | |||
| + Add Item | |||
| + {t('addItem')} | |||
| </Button> | |||
| </div> | |||
| ); | |||
| @@ -38,7 +38,7 @@ const MessageForm = ({ onValuesChange, form }: IOperatorForm) => { | |||
| {fields.map((field, index) => ( | |||
| <Form.Item | |||
| {...(index === 0 ? formItemLayout : formItemLayoutWithOutLabel)} | |||
| label={index === 0 ? t('message') : ''} | |||
| label={index === 0 ? t('msg') : ''} | |||
| required={false} | |||
| key={field.key} | |||
| > | |||