From ac13c6a6f245434d4d0869cec66a63b6b719731c Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Tue, 21 Jan 2025 09:34:32 +0800 Subject: [PATCH] feat: i18n --- ui/src/locales/lang/en-US/views/log.ts | 4 +- ui/src/locales/lang/en-US/views/template.ts | 66 +++++++++++++++++++-- ui/src/locales/lang/zh-TW/views/template.ts | 59 ++++++++++++++++-- ui/src/router/modules/application.ts | 12 ++-- ui/src/router/modules/dataset.ts | 9 +-- ui/src/views/log/index.vue | 8 +-- 6 files changed, 132 insertions(+), 26 deletions(-) diff --git a/ui/src/locales/lang/en-US/views/log.ts b/ui/src/locales/lang/en-US/views/log.ts index 8b6e2080..3608cc81 100644 --- a/ui/src/locales/lang/en-US/views/log.ts +++ b/ui/src/locales/lang/en-US/views/log.ts @@ -22,7 +22,7 @@ export default { recenTimes: 'Recent Conversation Time' }, addToDataset: 'Add to Knowledge Base', - daysText: 'Conversation records from more than X days ago', + daysText: 'Days ago', selectDataset: 'Select Knowledge Base', selectDatasetPlaceholder: 'Please select a knowledge base', saveToDocument: 'Save to Document', @@ -35,6 +35,6 @@ export default { }, title: { placeholder: 'Please set a title for the current content for management and viewing' - }, + } } } diff --git a/ui/src/locales/lang/en-US/views/template.ts b/ui/src/locales/lang/en-US/views/template.ts index bceedc29..fbdd8eea 100644 --- a/ui/src/locales/lang/en-US/views/template.ts +++ b/ui/src/locales/lang/en-US/views/template.ts @@ -6,8 +6,21 @@ export default { searchBar: { placeholder: 'Search by name' }, - delete: {}, - setting: {}, + delete: { + confirmTitle: 'Delete Model', + confirmMessage: 'Are you sure you want to delete the model:' + }, + tip: { + createSuccessMessage: 'Model created successfully', + createErrorMessage: 'There are errors in the basic information', + errorMessage: 'Variable already exists: ', + emptyMessage1: 'Please select the model type and base model in the basic information first', + emptyMessage2: 'The selected model does not support parameter settings', + updateSuccessMessage: 'Model updated successfully', + saveSuccessMessage: 'Model parameters saved successfully', + downloadError: 'Download failed', + noModel: 'Model does not exist in Ollama' + }, model: { allModel: 'All Models', publicModel: 'Public Models', @@ -22,14 +35,55 @@ export default { }, templateForm: { title: { - editParam: 'Edit Parameters', + baseInfo: 'Basic Information', + advancedInfo: 'Advanced Settings', + modelParams: 'Model Parameters', + editParam: 'Edit Parameter', addParam: 'Add Parameter', + paramSetting: 'Model Parameter Settings', + apiParamPassing: 'API Parameter Passing' }, form: { - provider: { - label: 'Provider', - placeholder: 'Select Provider' + templateName: { + label: 'Model Name', + placeholder: 'Set a name for the base model', + tooltip: 'Custom model name in MaxKB', + requiredMessage: 'Model name cannot be empty' + }, + permissionType: { + label: 'Permission', + privateDesc: 'Only the current user can use', + publicDesc: 'All users can use, but cannot be edited', + requiredMessage: 'Permission cannot be empty' + }, + model_type: { + label: 'Model Type', + placeholder: 'Select a model type', + tooltip1: + 'Large Language Model: An inference model for AI conversations in the application.', + tooltip2: + 'Embedding Model: A model for vectorizing document content in the knowledge base.', + tooltip3: 'Speech-to-Text: A model used for speech recognition in the application.', + tooltip4: 'Text-to-Speech: A model used for text-to-speech in the application.', + tooltip5: + 'Reranker Model: A model used to reorder candidate segments when using multi-route recall in advanced orchestration applications.', + tooltip6: + 'Image Understanding: A visual model used for image understanding in advanced orchestration applications.', + tooltip7: + 'Image Generation: A visual model used for image generation in advanced orchestration applications.', + requiredMessage: 'Model type cannot be empty' + }, + base_model: { + label: 'Base Model', + tooltip: + 'For models not listed in the list, enter the model name directly and press Enter to add', + placeholder: 'Enter the base model name and press Enter to add', + requiredMessage: 'Base model cannot be empty' } } + }, + download: { + downloading: 'Downloading...', + cancelDownload: 'Cancel Download' } } diff --git a/ui/src/locales/lang/zh-TW/views/template.ts b/ui/src/locales/lang/zh-TW/views/template.ts index bfa047ce..2197273f 100644 --- a/ui/src/locales/lang/zh-TW/views/template.ts +++ b/ui/src/locales/lang/zh-TW/views/template.ts @@ -6,8 +6,21 @@ export default { searchBar: { placeholder: '按名稱搜尋' }, - delete: {}, - setting: {}, + delete: { + confirmTitle: '刪除模型', + confirmMessage: '是否刪除模型:' + }, + tip: { + createSuccessMessage: '創建模型成功', + createErrorMessage: '基礎資訊有填寫錯誤', + errorMessage: '變數已存在: ', + emptyMessage1: '請先選擇基礎資訊的模型類型和基礎模型', + emptyMessage2: '所選模型不支援參數設定', + updateSuccessMessage: '修改模型成功', + saveSuccessMessage: '模型參數儲存成功', + downloadError: '下載失敗', + noModel: '模型在Ollama不存在' + }, model: { allModel: '全部模型', publicModel: '公有模型', @@ -22,11 +35,49 @@ export default { }, templateForm: { title: { + baseInfo: '基礎資訊', + advancedInfo: '進階設定', + modelParams: '模型參數', editParam: '編輯參數', - addParam: '添加參數', + addParam: '新增參數', + paramSetting: '模型參數設定', + apiParamPassing: '接口傳參' }, form: { - + templateName: { + label: '模型名稱', + placeholder: '請給基礎模型設定一個名稱', + tooltip: 'MaxKB 中自訂的模型名稱', + requiredMessage: '模型名稱不能為空' + }, + permissionType: { + label: '權限', + privateDesc: '僅當前使用者使用', + publicDesc: '所有使用者都可使用,但不能編輯', + requiredMessage: '權限不能為空' + }, + model_type: { + label: '模型類型', + placeholder: '請選擇模型類型', + tooltip1: '大語言模型:在應用中與AI對話的推理模型。', + tooltip2: '向量模型:在知識庫中對文件內容進行向量化化的模型。', + tooltip3: '語音辨識:在應用中開啟語音辨識後用於語音轉文字的模型。', + tooltip4: '語音合成:在應用中開啟語音播放後用於文字轉語音的模型。', + tooltip5: '重排模型:在高階編排應用中使用多路召回時,對候選分段進行重新排序的模型。', + tooltip6: '圖片理解:在高階編排應用中用於圖片理解的視覺模型。', + tooltip7: '圖片生成:在高階編排應用中用於圖片生成的視覺模型。', + requiredMessage: '模型類型不能為空' + }, + base_model: { + label: '基礎模型', + tooltip: '列表中未列出的模型,直接輸入模型名稱,按 Enter 即可新增', + placeholder: '自訂輸入基礎模型後按 Enter 即可', + requiredMessage: '基礎模型不能為空' + } } + }, + download: { + downloading: '正在下載中', + cancelDownload: '取消下載' } } diff --git a/ui/src/router/modules/application.ts b/ui/src/router/modules/application.ts index 2d591410..bb22f56a 100644 --- a/ui/src/router/modules/application.ts +++ b/ui/src/router/modules/application.ts @@ -1,5 +1,7 @@ import Layout from '@/layout/layout-template/DetailLayout.vue' import { ComplexPermission } from '@/utils/permission/type' +import { t } from '@/locales' + const applicationRouter = { path: '/application', name: 'application', @@ -26,7 +28,7 @@ const applicationRouter = { meta: { icon: 'app-all-menu', iconActive: 'app-all-menu-active', - title: '概览', + title: t('views.applicationOverview.title'), active: 'overview', parentPath: '/application/:id/:type', parentName: 'ApplicationDetail' @@ -39,7 +41,7 @@ const applicationRouter = { meta: { icon: 'app-setting', iconActive: 'app-setting-active', - title: '设置', + title: t('common.setting'), active: 'setting', parentPath: '/application/:id/:type', parentName: 'ApplicationDetail' @@ -52,7 +54,7 @@ const applicationRouter = { meta: { icon: 'app-access', iconActive: 'app-access-active', - title: '应用接入', + title: t('views.application.applicationAccess.title'), active: 'access', parentPath: '/application/:id/:type', parentName: 'ApplicationDetail', @@ -65,7 +67,7 @@ const applicationRouter = { name: 'AppHitTest', meta: { icon: 'app-hit-test', - title: '命中测试', + title: t('views.application.hitTest.title'), active: 'hit-test', parentPath: '/application/:id/:type', parentName: 'ApplicationDetail' @@ -78,7 +80,7 @@ const applicationRouter = { meta: { icon: 'app-document', iconActive: 'app-document-active', - title: '对话日志', + title: t('views.log.title'), active: 'log', parentPath: '/application/:id/:type', parentName: 'ApplicationDetail' diff --git a/ui/src/router/modules/dataset.ts b/ui/src/router/modules/dataset.ts index 38eccafe..e72de833 100644 --- a/ui/src/router/modules/dataset.ts +++ b/ui/src/router/modules/dataset.ts @@ -1,4 +1,5 @@ import Layout from '@/layout/layout-template/DetailLayout.vue' +import { t } from '@/locales' const datasetRouter = { path: '/dataset', name: 'dataset', @@ -32,7 +33,7 @@ const datasetRouter = { meta: { icon: 'app-document', iconActive: 'app-document-active', - title: '文档', + title: t('common.fileUpload.document'), active: 'document', parentPath: '/dataset/:id', parentName: 'DatasetDetail' @@ -45,7 +46,7 @@ const datasetRouter = { meta: { icon: 'app-problems', iconActive: 'QuestionFilled', - title: '问题', + title: t('views.problem.title'), active: 'problem', parentPath: '/dataset/:id', parentName: 'DatasetDetail' @@ -57,7 +58,7 @@ const datasetRouter = { name: 'DatasetHitTest', meta: { icon: 'app-hit-test', - title: '命中测试', + title: t('views.application.hitTest.title'), active: 'hit-test', parentPath: '/dataset/:id', parentName: 'DatasetDetail' @@ -70,7 +71,7 @@ const datasetRouter = { meta: { icon: 'app-setting', iconActive: 'app-setting-active', - title: '设置', + title: t('common.setting'), active: 'setting', parentPath: '/dataset/:id', parentName: 'DatasetDetail' diff --git a/ui/src/views/log/index.vue b/ui/src/views/log/index.vue index b86682c1..159c38d9 100644 --- a/ui/src/views/log/index.vue +++ b/ui/src/views/log/index.vue @@ -183,14 +183,12 @@ step-strictly style="width: 110px; margin-left: 8px; margin-right: 8px" > - {{ $t('views.log.form.daysText') }} + {{ $t('views.log.daysText') }}