diff --git a/packages/global/core/ai/prompt/AIChat.ts b/packages/global/core/ai/prompt/AIChat.ts index 656aa1c1442d..cbeecf4baa52 100644 --- a/packages/global/core/ai/prompt/AIChat.ts +++ b/packages/global/core/ai/prompt/AIChat.ts @@ -1,15 +1,15 @@ import { PromptTemplateItem } from '../type.d'; - +import { i18nT } from '../../../../web/i18n/utils'; export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [ { - title: '标准模板', - desc: '标准提示词,用于结构不固定的知识库。', + title: i18nT('app:template.standard_template'), + desc: i18nT('app:template.standard_template_des'), value: `{{q}} {{a}}` }, { - title: '问答模板', - desc: '适合 QA 问答结构的知识库,可以让AI较为严格的按预设内容回答', + title: i18nT('app:template.qa_template'), + desc: i18nT('app:template.qa_template_des'), value: ` {{q}} @@ -18,14 +18,14 @@ export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [ ` }, { - title: '标准严格模板', - desc: '在标准模板基础上,对模型的回答做更严格的要求。', + title: i18nT('app:template.standard_strict'), + desc: i18nT('app:template.standard_strict_des'), value: `{{q}} {{a}}` }, { - title: '严格问答模板', - desc: '在问答模板基础上,对模型的回答做更严格的要求。', + title: i18nT('app:template.hard_strict'), + desc: i18nT('app:template.hard_strict_des'), value: ` {{q}} @@ -37,7 +37,7 @@ export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [ export const Prompt_QuotePromptList: PromptTemplateItem[] = [ { - title: '标准模板', + title: i18nT('app:template.standard_template'), desc: '', value: `使用 标记中的内容作为你的知识: @@ -55,7 +55,7 @@ export const Prompt_QuotePromptList: PromptTemplateItem[] = [ 问题:"""{{question}}"""` }, { - title: '问答模板', + title: i18nT('app:template.qa_template'), desc: '', value: `使用 标记中的问答对进行回答。 @@ -72,7 +72,7 @@ export const Prompt_QuotePromptList: PromptTemplateItem[] = [ 问题:"""{{question}}"""` }, { - title: '标准严格模板', + title: i18nT('app:template.standard_strict'), desc: '', value: `忘记你已有的知识,仅使用 标记中的内容作为你的知识: @@ -94,7 +94,7 @@ export const Prompt_QuotePromptList: PromptTemplateItem[] = [ 问题:"""{{question}}"""` }, { - title: '严格问答模板', + title: i18nT('app:template.hard_strict'), desc: '', value: `忘记你已有的知识,仅使用 标记中的问答对进行回答。 diff --git a/packages/global/core/workflow/node/constant.ts b/packages/global/core/workflow/node/constant.ts index 79cdced16237..e34813f1b5e5 100644 --- a/packages/global/core/workflow/node/constant.ts +++ b/packages/global/core/workflow/node/constant.ts @@ -1,5 +1,5 @@ import { WorkflowIOValueTypeEnum } from '../constants'; - +import { i18nT } from '../../../../web/i18n/utils'; export enum FlowNodeInputTypeEnum { // render ui reference = 'reference', // reference to other node output input = 'input', // one line input @@ -167,23 +167,23 @@ export const FlowValueTypeMap = { value: WorkflowIOValueTypeEnum.any }, [WorkflowIOValueTypeEnum.chatHistory]: { - label: '历史记录', + label: i18nT('common:core.chat.History'), value: WorkflowIOValueTypeEnum.chatHistory }, [WorkflowIOValueTypeEnum.datasetQuote]: { - label: '知识库引用', + label: i18nT('common:core.workflow.Dataset quote'), value: WorkflowIOValueTypeEnum.datasetQuote }, [WorkflowIOValueTypeEnum.selectApp]: { - label: '选择应用', + label: i18nT('common:plugin.App'), value: WorkflowIOValueTypeEnum.selectApp }, [WorkflowIOValueTypeEnum.selectDataset]: { - label: '选择知识库', + label: i18nT('common:core.chat.Select dataset'), value: WorkflowIOValueTypeEnum.selectDataset }, [WorkflowIOValueTypeEnum.dynamic]: { - label: '动态输入', + label: i18nT('common:core.workflow.dynamic_input'), value: WorkflowIOValueTypeEnum.dynamic } }; diff --git a/packages/web/i18n/en/app.json b/packages/web/i18n/en/app.json index b65b30487bcb..05e6482798b6 100644 --- a/packages/web/i18n/en/app.json +++ b/packages/web/i18n/en/app.json @@ -27,9 +27,9 @@ "confirm_delete_folder_tip": "Confirm to delete this folder? All apps and corresponding conversation records under it will be deleted. Please confirm!", "copy_one_app": "Create Duplicate", "create_copy_success": "Duplicate Created Successfully", - "create_empty_app": "Create Blank App", - "create_empty_plugin": "Create Blank Plugin", - "create_empty_workflow": "Create Blank Workflow", + "create_empty_app": "Create Default App", + "create_empty_plugin": "Create Default Plugin", + "create_empty_workflow": "Create Default Workflow", "cron": { "every_day": "Run Daily", "every_month": "Run Monthly", @@ -108,6 +108,15 @@ "template": { "simple_robot": "Simple Robot" }, + "template.hard_strict": "Strict Q&A template", + "template.hard_strict_des": "Based on the question and answer template, stricter requirements are imposed on the model's answers.", + "template.qa_template": "Q&A template", + "template.qa_template_des": "A knowledge base suitable for QA question and answer structure, which allows AI to answer strictly according to preset content", + "template.simple_robot": "Simple robot", + "template.standard_strict": "Standard strict template", + "template.standard_strict_des": "Based on the standard template, stricter requirements are imposed on the model's answers.", + "template.standard_template": "Standard template", + "template.standard_template_des": "Standard prompt words for knowledge bases with unfixed structures.", "templateMarket": { "Search_template": "Search Template", "Template_market": "Template Market", @@ -182,4 +191,4 @@ "user_select": "User Selection", "user_select_tip": "This module can configure multiple options for selection during the dialogue. Different options can lead to different workflow branches." } -} \ No newline at end of file +} diff --git a/packages/web/i18n/en/common.json b/packages/web/i18n/en/common.json index 8718f3b6292c..b437ecf07cef 100644 --- a/packages/web/i18n/en/common.json +++ b/packages/web/i18n/en/common.json @@ -336,7 +336,7 @@ "Random": "Divergent", "Search team tags": "Search Tags", "Select TTS": "Select Voice Playback Mode", - "Select app from template": "Select from Template", + "Select app from template": "Template", "Select quote template": "Select Quote Prompt Template", "Set a name for your app": "Set a Name for Your App", "Setting ai property": "Click to Configure AI Model Properties", @@ -957,6 +957,7 @@ "Run result": "Run Result", "Show result": "Show Result" }, + "dynamic_input": "dynamic input", "inputType": { "JSON Editor": "JSON Input Box", "Manual input": "Manual Input", diff --git a/packages/web/i18n/zh/app.json b/packages/web/i18n/zh/app.json index 2d29524aaa43..637ff8f7505e 100644 --- a/packages/web/i18n/zh/app.json +++ b/packages/web/i18n/zh/app.json @@ -99,7 +99,15 @@ "setting_app": "应用配置", "setting_plugin": "插件配置", "template": { - "simple_robot": "简易机器人" + "simple_robot": "简易机器人", + "standard_template": "标准模板", + "standard_template_des": "标准提示词,用于结构不固定的知识库。", + "qa_template": "问答模板", + "qa_template_des": "适合 QA 问答结构的知识库,可以让AI较为严格的按预设内容回答", + "standard_strict": "标准严格模板", + "standard_strict_des": "在标准模板基础上,对模型的回答做更严格的要求。", + "hard_strict": "严格问答模板", + "hard_strict_des": "在问答模板基础上,对模型的回答做更严格的要求。" }, "templateMarket": { "Search_template": "搜索模板", @@ -182,4 +190,4 @@ "manage": "写权限基础上,可配置发布渠道、查看对话日志、分配该应用权限" } } -} \ No newline at end of file +} diff --git a/packages/web/i18n/zh/common.json b/packages/web/i18n/zh/common.json index e78b9e31b498..62dd73f28c61 100644 --- a/packages/web/i18n/zh/common.json +++ b/packages/web/i18n/zh/common.json @@ -927,6 +927,7 @@ }, "view_chat_detail": "查看对话详情", "workflow": { + "dynamic_input": "动态输入", "Can not delete node": "该节点不允许删除", "Change input type tip": "修改输入类型会清空已填写的值,请确认!", "Check Failed": "工作流校验失败,请检查节点是否正确填值,以及连线是否正常", diff --git a/projects/app/src/components/PromptTemplate/index.tsx b/projects/app/src/components/PromptTemplate/index.tsx index 8ccaef153175..8069ff340ffd 100644 --- a/projects/app/src/components/PromptTemplate/index.tsx +++ b/projects/app/src/components/PromptTemplate/index.tsx @@ -37,10 +37,10 @@ const PromptTemplate = ({ : {})} onClick={() => setSelectTemplateTitle(item)} > - {item.title} + {t(item.title as any)} - {item.desc} + {t(item.desc as any)} ))} diff --git a/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/render/NodeCard.tsx b/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/render/NodeCard.tsx index cc3d70d9e116..ce445d808737 100644 --- a/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/render/NodeCard.tsx +++ b/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/render/NodeCard.tsx @@ -415,7 +415,7 @@ const MenuRender = React.memo(function MenuRender({ leftIcon={} onClick={item.onClick} > - {item.label} + {t(item.label as any)} ))} diff --git a/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/render/RenderInput/templates/TextInput.tsx b/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/render/RenderInput/templates/TextInput.tsx index 5233689349a9..b9846f823b77 100644 --- a/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/render/RenderInput/templates/TextInput.tsx +++ b/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/render/RenderInput/templates/TextInput.tsx @@ -3,14 +3,15 @@ import type { RenderInputProps } from '../type'; import { Input } from '@chakra-ui/react'; import { useContextSelector } from 'use-context-selector'; import { WorkflowContext } from '@/pages/app/detail/components/WorkflowComponents/context'; +import { useTranslation } from 'next-i18next'; const TextInput = ({ item, nodeId }: RenderInputProps) => { const onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode); - + const { t } = useTranslation(); const Render = useMemo(() => { return ( { }} /> ); - }, [item, nodeId, onChangeNode]); + }, [item, nodeId, onChangeNode, t]); return Render; }; diff --git a/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/render/ValueTypeLabel.tsx b/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/render/ValueTypeLabel.tsx index 1852994ac62d..9b60ed300248 100644 --- a/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/render/ValueTypeLabel.tsx +++ b/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/render/ValueTypeLabel.tsx @@ -3,6 +3,7 @@ import { Box } from '@chakra-ui/react'; import { WorkflowIOValueTypeEnum } from '@fastgpt/global/core/workflow/constants'; import MyTooltip from '@fastgpt/web/components/common/MyTooltip'; import React from 'react'; +import { useTranslation } from 'next-i18next'; const ValueTypeLabel = ({ valueType, @@ -12,7 +13,7 @@ const ValueTypeLabel = ({ valueDesc?: string; }) => { const valueTypeData = valueType ? FlowValueTypeMap[valueType] : undefined; - + const { t } = useTranslation(); const label = valueTypeData?.label || ''; return !!label ? ( @@ -29,7 +30,7 @@ const ValueTypeLabel = ({ alignItems={'center'} fontSize={'11px'} > - {label} + {t(label as any)} ) : null;