From 96f467fa2183062ff47bf5500321ff269957a910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=B8=B9?= <12582130+fit2cloudwangdan@user.noreply.gitee.com> Date: Mon, 20 Jan 2025 11:02:55 +0800 Subject: [PATCH] feat: i18n --- ui/src/components/ai-chat/KnowledgeSource.vue | 11 +- .../ai-chat/ParagraphSourceDialog.vue | 2 +- ui/src/components/app-table/index.vue | 2 +- .../items/MultiSelectConstructor.vue | 2 +- .../items/RadioCardConstructor.vue | 2 +- .../constructor/items/RadioRowConstructor.vue | 2 +- .../items/SingleSelectConstructor.vue | 2 +- .../dynamics-form/items/JsonInput.vue | 2 +- ui/src/components/read-write/index.vue | 2 +- ui/src/components/tags-input/index.vue | 3 +- ui/src/locales/lang/en_US/common.ts | 10 +- ui/src/locales/lang/zh_CN/common.ts | 11 +- .../locales/lang/zh_CN/components/ai-chat.ts | 20 ++- .../lang/zh_CN/components/dynamics-form.ts | 3 +- .../lang/zh_CN/views/application-workflow.ts | 135 +++++++++++++++--- .../locales/lang/zh_CN/views/application.ts | 4 +- .../locales/lang/zh_CN/views/function-lib.ts | 2 +- ui/src/locales/lang/zh_CN/views/template.ts | 3 +- ui/src/locales/lang/zh_TW/common.ts | 10 +- ui/src/views/application-overview/index.vue | 2 +- .../views/dataset/component/ResultSuccess.vue | 2 +- ui/src/views/dataset/index.vue | 2 +- ui/src/views/document/index.vue | 2 +- .../component/FunctionDebugDrawer.vue | 2 +- ui/src/views/hit-test/index.vue | 2 +- .../component/SelectDocumentDialog.vue | 2 +- ui/src/workflow/common/data.ts | 4 +- ui/src/workflow/nodes/ai-chat-node/index.vue | 56 ++++---- .../workflow/nodes/application-node/index.vue | 67 ++++++--- .../component/ApiFieldFormDialog.vue | 14 +- .../component/ApiInputFieldTable.vue | 12 +- .../component/FileUploadSettingDialog.vue | 24 ++-- .../component/UserFieldFormDialog.vue | 11 +- .../component/UserInputFieldTable.vue | 51 ++++--- ui/src/workflow/nodes/base-node/index.vue | 59 +++++--- .../workflow/nodes/condition-node/index.vue | 46 ++++-- .../nodes/document-extract-node/index.vue | 8 +- ui/src/workflow/nodes/form-node/index.vue | 56 +++++--- .../nodes/function-lib-node/index.vue | 22 +-- ui/src/workflow/nodes/function-node/index.vue | 34 +++-- .../workflow/nodes/image-generate/index.vue | 59 +++++--- .../workflow/nodes/image-understand/index.vue | 76 ++++++---- ui/src/workflow/nodes/question-node/index.vue | 55 ++++--- ui/src/workflow/nodes/reply-node/index.vue | 27 ++-- .../reranker-node/ParamSettingDialog.vue | 10 +- ui/src/workflow/nodes/reranker-node/index.vue | 65 ++++++--- .../nodes/search-dataset-node/index.vue | 34 +++-- .../nodes/speech-to-text-node/index.vue | 37 +++-- ui/src/workflow/nodes/start-node/index.vue | 22 ++- .../nodes/text-to-speech-node/index.vue | 37 +++-- 50 files changed, 752 insertions(+), 376 deletions(-) diff --git a/ui/src/components/ai-chat/KnowledgeSource.vue b/ui/src/components/ai-chat/KnowledgeSource.vue index 59bd1ca54..aa1665eb5 100644 --- a/ui/src/components/ai-chat/KnowledgeSource.vue +++ b/ui/src/components/ai-chat/KnowledgeSource.vue @@ -1,10 +1,11 @@ diff --git a/ui/src/components/dynamics-form/constructor/items/RadioRowConstructor.vue b/ui/src/components/dynamics-form/constructor/items/RadioRowConstructor.vue index 2df99b0da..9a4bd4fe4 100644 --- a/ui/src/components/dynamics-form/constructor/items/RadioRowConstructor.vue +++ b/ui/src/components/dynamics-form/constructor/items/RadioRowConstructor.vue @@ -7,7 +7,7 @@ - 添加 + {{ $t('common.add') }} diff --git a/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue b/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue index 5c854aebf..ef9a8208e 100644 --- a/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue +++ b/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue @@ -7,7 +7,7 @@ - 添加 + {{ $t('common.add') }} diff --git a/ui/src/components/dynamics-form/items/JsonInput.vue b/ui/src/components/dynamics-form/items/JsonInput.vue index f5bec2baa..2a2371135 100644 --- a/ui/src/components/dynamics-form/items/JsonInput.vue +++ b/ui/src/components/dynamics-form/items/JsonInput.vue @@ -20,7 +20,7 @@ - + import { ref, watch } from 'vue' import UserApi from '@/api/user' +import { t } from '@/locales' defineOptions({ name: 'TagsInput' }) const props = defineProps({ tags: { @@ -42,7 +43,7 @@ const props = defineProps({ }, placeholder: { type: String, - default: '请输入' + default: t('common.inputPlaceholder') }, limit: { /* 最多生成标签数 */ diff --git a/ui/src/locales/lang/en_US/common.ts b/ui/src/locales/lang/en_US/common.ts index 6c97b3180..993fa95e2 100644 --- a/ui/src/locales/lang/en_US/common.ts +++ b/ui/src/locales/lang/en_US/common.ts @@ -27,7 +27,6 @@ export default { createDate: 'Create date', createTime: 'Create time', operation: 'Operation', - document: 'Documentation', character: 'characters', export: 'Export', exportSuccess: 'Export successful', @@ -40,9 +39,16 @@ export default { required: 'Required', noData: 'No data', result: 'Result', + fileUpload: { + document: 'Documentation', + image: 'Image', + audio: 'Audio', + video: 'Video' + }, status: { label: 'Status', enableSuccess: 'Enable Successful', disableSuccess: 'Disable Successful' - } + }, + inputPlaceholder: 'Please input' } diff --git a/ui/src/locales/lang/zh_CN/common.ts b/ui/src/locales/lang/zh_CN/common.ts index b9b2a8914..b000e6c10 100644 --- a/ui/src/locales/lang/zh_CN/common.ts +++ b/ui/src/locales/lang/zh_CN/common.ts @@ -27,7 +27,7 @@ export default { createDate: '创建日期', createTime: '创建时间', operation: '操作', - document: '文档', + character: '字符', export: '导出', exportSuccess: '导出成功', @@ -40,9 +40,16 @@ export default { required: '必填', noData: '暂无数据', result: '结果', + fileUpload: { + document: '文档', + image: '图片', + audio: '音频', + video: '视频' + }, status: { label: '状态', enableSuccess: '启用成功', disableSuccess: '禁用成功' - } + }, + inputPlaceholder: '请输入' } diff --git a/ui/src/locales/lang/zh_CN/components/ai-chat.ts b/ui/src/locales/lang/zh_CN/components/ai-chat.ts index c82f600d9..cb9ab15b2 100644 --- a/ui/src/locales/lang/zh_CN/components/ai-chat.ts +++ b/ui/src/locales/lang/zh_CN/components/ai-chat.ts @@ -5,19 +5,27 @@ export default { only20history: '仅显示最近 20 条对话', question_count: '条提问', exportReords: '导出聊天记录', + chatId: '对话id', + userInput: '用户输入', passwordValidator: { title: '请输入密码打开链接', errorMessage1: '密码不能为空', errorMessage2: '密码错误' }, - executionDetails: { - title: '执行详情', - paramInput: '参数输入', - paramOutput: '参数输出', - }, tip: { error500Message: '抱歉,当前正在维护,无法提供服务,请稍后再试!', errorIdentifyMessage: '无法识别用户身份', - errorLimitMessage:'抱歉,您的提问已达到最大限制,请明天再来吧!' + errorLimitMessage: '抱歉,您的提问已达到最大限制,请明天再来吧!' + }, + executionDetails: { + title: '执行详情', + paramInput: '参数输入', + paramOutput: '参数输出' + }, + KnowledgeSource: { + title: '知识来源', + referenceParagraph: '引用分段', + consume: '消耗', + consumeTime: '耗时' } } diff --git a/ui/src/locales/lang/zh_CN/components/dynamics-form.ts b/ui/src/locales/lang/zh_CN/components/dynamics-form.ts index d6ca85ffa..3322d95d1 100644 --- a/ui/src/locales/lang/zh_CN/components/dynamics-form.ts +++ b/ui/src/locales/lang/zh_CN/components/dynamics-form.ts @@ -19,7 +19,8 @@ export default { field: { label: '参数', placeholder: '请输入参数', - requiredMessage: '参数 为必填属性' + requiredMessage: '参数 为必填属性', + requiredMessage2:'只能输入字母数字和下划线' }, name: { label: '显示名称', diff --git a/ui/src/locales/lang/zh_CN/views/application-workflow.ts b/ui/src/locales/lang/zh_CN/views/application-workflow.ts index 3a6f684e2..2c4ec1f52 100644 --- a/ui/src/locales/lang/zh_CN/views/application-workflow.ts +++ b/ui/src/locales/lang/zh_CN/views/application-workflow.ts @@ -1,8 +1,8 @@ -import type { result } from 'lodash' - export default { node: '节点', baseComponent: '基础组件', + nodeSetting: '节点设置', + workflow: '工作流', searchBar: { placeholder: '按名称搜索' }, @@ -31,7 +31,8 @@ export default { functionNodeError: '该函数不可用', repeatedNodeError: '节点名称已存在!', cannotCopy: '不能被复制', - copyError: '已复制节点' + copyError: '已复制节点', + paramErrorMessage: '参数已存在: ' }, delete: { confirmTitle: '确定删除该节点?', @@ -50,7 +51,8 @@ export default { Referencing: '引用变量', ReferencingRequired: '引用变量必填', ReferencingError: '引用变量错误', - NoReferencing: '不存在的引用变量' + NoReferencing: '不存在的引用变量', + fieldMessage: '请选择变量' }, condition: { title: '执行条件', @@ -78,12 +80,36 @@ export default { currentTime: '当前时间' }, baseNode: { - label: '基本信息' + label: '基本信息', + fileUpload: { + label: '文件上传', + tooltip: '开启后,问答页面会显示上传文件的按钮。' + }, + FileUploadSetting: { + title: '文件上传设置', + maxFiles: '单次上传最多文件数', + fileLimit: '每个文件最大(MB)', + fileUploadType: { + label: '上传的文件类型', + documentText: '需要使用“文档内容提取”节点解析文档内容', + imageText: '需要使用“图片理解”节点解析图片内容', + audioText: '需要使用“语音转文本”节点解析音频内容' + } + } }, aiChatNode: { label: 'AI 对话', text: '与 AI 大模型进行对话', - answer: 'AI 回答内容' + answer: 'AI 回答内容', + returnContent: { + label: '返回内容', + tooltip: `关闭后该节点的内容则不输出给用户。 + 如果你想让用户看到该节点的输出内容,请打开开关。` + }, + defaultPrompt: `已知信息: +{{知识库检索.data}} +问题: +{{开始.question}}` }, searchDatasetNode: { label: '知识库检索', @@ -91,28 +117,62 @@ export default { paragraph_list: '检索结果的分段列表', is_hit_handling_method_list: '满足直接回答的分段列表', result: '检索结果', - directly_return: '满足直接回答的分段内容' + directly_return: '满足直接回答的分段内容', + selectDatasetText: '关联的知识库展示在这里', + searchParam: '检索参数', + searchQuestion: { + label: '检索问题', + placeholder: '请选择检索问题', + requiredMessage: '请选择检索问题' + } }, questionNode: { label: '问题优化', text: '根据历史聊天记录优化完善当前问题,更利于匹配知识库分段', - result: '问题优化结果' + result: '问题优化结果', + defaultPrompt: `根据上下文优化和完善用户问题:{{开始.question}} +请输出一个优化后的问题。`, + systemDefault: '你是一个问题优化大师' }, conditionNode: { label: '判断器', text: '根据不同条件执行不同的节点', - branch_name: '分支名称' + branch_name: '分支名称', + conditions: { + label: '条件', + info: '符合以下', + requiredMessage: '请选择条件' + }, + valueMessage: '请输入值', + addCondition: '添加条件', + addBranch: '添加分支' }, replyNode: { label: '指定回复', text: '指定回复内容,引用变量会转换为字符串进行输出', - content: '内容' + content: '内容', + replyContent: { + label: '回复内容', + custom: '自定义', + reference: '引用变量' + } }, rerankerNode: { label: '多路召回', text: '使用重排模型对多个知识库的检索结果进行二次召回', result_list: '重排结果列表', - result: '重排结果' + result: '重排结果', + rerankerContent: { + label: '重排内容', + requiredMessage: '请选择重排内容' + }, + higher: '高于', + ScoreTooltip: 'Score越高相关性越强。', + max_paragraph_char_number: '最大引用字符数', + reranker_model: { + label: '重排模型', + placeholder: '请选择重排模型' + } }, formNode: { label: '表单收集', @@ -120,7 +180,14 @@ export default { form_content_format: `你好,请先填写下面表单内容: {{form}} 填写后请点击【提交】按钮进行提交。`, - form_data: '表单全部内容' + form_data: '表单全部内容', + formContent: { + label: '表单输出内容', + requiredMessage: '请表单输出内容', + tooltip: '设置执行该节点输出的内容,{ form } 为表单的占位符。' + }, + formAllContent: '表单全部内容', + formSetting: '表单配置' }, documentExtractNode: { label: '文档内容提取', @@ -130,21 +197,54 @@ export default { imageUnderstandNode: { label: '图片理解', text: '识别出图片中的对象、场景等信息回答用户问题', - answer: 'AI 回答内容' + answer: 'AI 回答内容', + model: { + label: '图片理解模型', + requiredMessage: '请选择图片理解模型' + }, + image: { + label: '选择图片', + requiredMessage: '请选择图片' + } }, imageGenerateNode: { label: '图片生成', text: '根据提供的文本内容生成图片', answer: 'AI 回答内容', - image: '图片' + model: { + label: '图片生成模型', + requiredMessage: '请选择图片生成模型' + }, + prompt: { + label: '提示词(正向)', + tooltip: '正向提示词,用来描述生成图像中期望包含的元素和视觉特点' + }, + negative_prompt: { + label: '提示词(负向)', + tooltip: '反向提示词,用来描述不希望在画面中看到的内容,可以对画面进行限制。', + placeholder: '请描述不想生成的图片内容,比如:颜色、血腥内容' + } }, speechToTextNode: { label: '语音转文本', - text: '将音频通过语音识别模型转换为文本' + text: '将音频通过语音识别模型转换为文本', + stt_model: { + label: '语音识别模型' + }, + audio: { + label: '选择语音文件', + placeholder: '请选择语音文件' + } }, textToSpeechNode: { label: '文本转语音', - text: '将文本通过语音合成模型转换为音频' + text: '将文本通过语音合成模型转换为音频', + tts_model: { + label: '语音识别模型' + }, + content: { + label: '选择文本内容' + } }, functionNode: { label: '自定义函数', @@ -169,5 +269,6 @@ export default { len_gt: '长度大于', len_le: '长度小于等于', len_lt: '长度小于' - } + }, + FileUploadSetting: {} } diff --git a/ui/src/locales/lang/zh_CN/views/application.ts b/ui/src/locales/lang/zh_CN/views/application.ts index b6eeabe70..5bc705b8d 100644 --- a/ui/src/locales/lang/zh_CN/views/application.ts +++ b/ui/src/locales/lang/zh_CN/views/application.ts @@ -1,6 +1,3 @@ -import Password from '@/views/chat/auth/component/password.vue' -import { create } from 'lodash' - export default { title: '应用', createApplication: '创建应用', @@ -59,6 +56,7 @@ export default { references: ' (引用知识库)', placeholder: '请输入提示词', requiredMessage: '请输入提示词', + tooltip:'通过调整提示词内容,可以引导大模型聊天方向,该提示词会被固定在上下文的开头,可以使用变量。', noReferencesTooltip: '通过调整提示词内容,可以引导大模型聊天方向,该提示词会被固定在上下文的开头。可以使用变量:{question} 是用户提出问题的占位符。', referencesTooltip: diff --git a/ui/src/locales/lang/zh_CN/views/function-lib.ts b/ui/src/locales/lang/zh_CN/views/function-lib.ts index 20804ec3c..f9e1e9fe2 100644 --- a/ui/src/locales/lang/zh_CN/views/function-lib.ts +++ b/ui/src/locales/lang/zh_CN/views/function-lib.ts @@ -41,7 +41,7 @@ export default { }, inputParam: { label: '输入参数', - placeholder: '请输入参数值', + placeholder: '请选择参数', requiredMessage: '请输入参数值' }, paramName: { diff --git a/ui/src/locales/lang/zh_CN/views/template.ts b/ui/src/locales/lang/zh_CN/views/template.ts index 80f89d5fa..00464d3ec 100644 --- a/ui/src/locales/lang/zh_CN/views/template.ts +++ b/ui/src/locales/lang/zh_CN/views/template.ts @@ -40,7 +40,8 @@ export default { modelParams: '模型参数', editParam: '编辑参数', addParam: '添加参数', - paramSetting: '模型参数设置' + paramSetting: '模型参数设置', + apiParamPassing: '接口传参' }, form: { templateName: { diff --git a/ui/src/locales/lang/zh_TW/common.ts b/ui/src/locales/lang/zh_TW/common.ts index 529935d8c..8217e65be 100644 --- a/ui/src/locales/lang/zh_TW/common.ts +++ b/ui/src/locales/lang/zh_TW/common.ts @@ -27,7 +27,6 @@ export default { createDate: '創建日期', createTime: '創建時間', operation: '操作', - document: '文檔', character: '字符', export: '匯出', exportSuccess: '匯出成功', @@ -40,9 +39,16 @@ export default { required: '必填', noData: '暂无数据', result: '結果', + fileUpload: { + document: '文檔', + image: '圖片', + audio: '音頻', + video: '視頻' + }, status: { label: '狀態', enableSuccess: '啟用成功', disableSuccess: '停用成功' - } + }, + inputPlaceholder: '請輸入' } diff --git a/ui/src/views/application-overview/index.vue b/ui/src/views/application-overview/index.vue index 999c18b14..409f07e02 100644 --- a/ui/src/views/application-overview/index.vue +++ b/ui/src/views/application-overview/index.vue @@ -103,7 +103,7 @@
- API {{ $t('common.document') }}:API {{ $t('common.fileUpload.document') }}:
{{ data?.document_list.length || 0 }} - {{ $t('common.document') }} + {{ $t('common.fileUpload.document') }} {{ paragraph_count || 0 }} {{ diff --git a/ui/src/views/dataset/index.vue b/ui/src/views/dataset/index.vue index 7417f55ac..86096d51c 100644 --- a/ui/src/views/dataset/index.vue +++ b/ui/src/views/dataset/index.vue @@ -85,7 +85,7 @@