From f687a322bb30eb472ba6e4de89958d77f16e7a1e Mon Sep 17 00:00:00 2001 From: kdrmlhcn Date: Fri, 7 Nov 2025 03:00:52 +0300 Subject: [PATCH] feat: Add i18n support for supplier names and model types - Add supplier name translations (Chinese, English, Korean) - Add model type translations - Update supplier.ts to include i18nKey for each supplier - Update Vue components to use i18n translations --- frontend/src/entity/CommonEntity.ts | 5 +++-- frontend/src/entity/supplier.ts | 12 ++++++++++++ frontend/src/i18n/en.json | 16 ++++++++++++++++ frontend/src/i18n/ko-KR.json | 16 ++++++++++++++++ frontend/src/i18n/zh-CN.json | 16 ++++++++++++++++ frontend/src/views/system/model/Card.vue | 2 +- frontend/src/views/system/model/Model.vue | 5 ++++- frontend/src/views/system/model/ModelForm.vue | 2 +- frontend/src/views/system/model/ModelList.vue | 14 ++++++++++++-- .../src/views/system/model/ModelListSide.vue | 11 +++++++++-- 10 files changed, 90 insertions(+), 9 deletions(-) diff --git a/frontend/src/entity/CommonEntity.ts b/frontend/src/entity/CommonEntity.ts index a515e943..5a5419b8 100644 --- a/frontend/src/entity/CommonEntity.ts +++ b/frontend/src/entity/CommonEntity.ts @@ -1,10 +1,11 @@ export interface SelectOption { label: string value: string | number + i18nKey?: string } export const modelTypeOptions: SelectOption[] = [ - { label: '大语言模型', value: 0 }, + { label: '大语言模型', value: 0, i18nKey: 'modelType.llm' }, /* { label: 'Anthropic', value: 1 }, { label: 'Baidu', value: 2 }, { label: 'iFLYTEK', value: 3 }, @@ -17,5 +18,5 @@ export const modelTypeOptions: SelectOption[] = [ export const getModelTypeName = (value: any) => { const tv = parseInt(value) const item = modelTypeOptions.find((item) => item.value === tv) - return item?.label || '' + return item?.i18nKey || item?.label || '' } diff --git a/frontend/src/entity/supplier.ts b/frontend/src/entity/supplier.ts index b9debf4f..733cde9f 100644 --- a/frontend/src/entity/supplier.ts +++ b/frontend/src/entity/supplier.ts @@ -26,6 +26,7 @@ type ModelConfig = Record< export const supplierList: Array<{ id: number name: string + i18nKey: string icon: any type?: string is_private?: boolean @@ -34,6 +35,7 @@ export const supplierList: Array<{ { id: 1, name: '阿里云百炼', + i18nKey: 'supplier.alibaba_cloud_bailian', icon: icon_alybl_colorful, model_config: { 0: { @@ -60,6 +62,7 @@ export const supplierList: Array<{ { id: 2, name: '千帆大模型', + i18nKey: 'supplier.qianfan_model', icon: icon_bdyzn_colorful, model_config: { 0: { @@ -71,6 +74,7 @@ export const supplierList: Array<{ { id: 3, name: 'DeepSeek', + i18nKey: 'supplier.deepseek', icon: icon_deepseek_colorful, model_config: { 0: { @@ -85,6 +89,7 @@ export const supplierList: Array<{ { id: 4, name: '腾讯混元', + i18nKey: 'supplier.tencent_hunyuan', icon: icon_txhy_colorful, model_config: { 0: { @@ -104,6 +109,7 @@ export const supplierList: Array<{ { id: 5, name: '讯飞星火', + i18nKey: 'supplier.iflytek_spark', icon: icon_xfhx_colorful, model_config: { 0: { @@ -156,6 +162,7 @@ export const supplierList: Array<{ { id: 6, name: 'Gemini', + i18nKey: 'supplier.gemini', icon: icon_gemini_colorful, model_config: { 0: { @@ -174,6 +181,7 @@ export const supplierList: Array<{ { id: 7, name: 'OpenAI', + i18nKey: 'supplier.openai', icon: icon_openai_colorful, model_config: { 0: { @@ -202,6 +210,7 @@ export const supplierList: Array<{ { id: 8, name: 'Kimi', + i18nKey: 'supplier.kimi', icon: icon_kimi_colorful, model_config: { 0: { @@ -232,6 +241,7 @@ export const supplierList: Array<{ { id: 9, name: '腾讯云', + i18nKey: 'supplier.tencent_cloud', icon: icon_txy_colorful, model_config: { 0: { @@ -249,6 +259,7 @@ export const supplierList: Array<{ { id: 10, name: '火山引擎', + i18nKey: 'supplier.volcano_engine', icon: icon_hsyq_colorful, model_config: { 0: { @@ -311,6 +322,7 @@ export const supplierList: Array<{ { id: 15, name: '通用OpenAI', + i18nKey: 'supplier.generic_openai', icon: icon_common_openai, is_private: true, model_config: { diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index e4f4254c..e3848755 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -716,5 +716,21 @@ "platform_disable": "{0} settings are not enabled!", "input_account": "Please enter account", "redirect_2_auth": "Redirecting to {0} authentication, {1} seconds..." + }, + "supplier": { + "alibaba_cloud_bailian": "Alibaba Cloud Bailian", + "qianfan_model": "Qianfan Model", + "deepseek": "DeepSeek", + "tencent_hunyuan": "Tencent Hunyuan", + "iflytek_spark": "iFlytek Spark", + "gemini": "Gemini", + "openai": "OpenAI", + "kimi": "Kimi", + "tencent_cloud": "Tencent Cloud", + "volcano_engine": "Volcano Engine", + "generic_openai": "Generic OpenAI" + }, + "modelType": { + "llm": "Large Language Model" } } diff --git a/frontend/src/i18n/ko-KR.json b/frontend/src/i18n/ko-KR.json index f53aa4b5..f3860840 100644 --- a/frontend/src/i18n/ko-KR.json +++ b/frontend/src/i18n/ko-KR.json @@ -716,5 +716,21 @@ "platform_disable": "{0} 설정이 활성화되지 않았습니다!", "input_account": "계정을 입력해 주세요", "redirect_2_auth": "{0} 인증으로 리디렉션 중입니다, {1}초..." + }, + "supplier": { + "alibaba_cloud_bailian": "알리바바 클라우드 바이리엔", + "qianfan_model": "치엔판 모델", + "deepseek": "DeepSeek", + "tencent_hunyuan": "텐센트 훈위안", + "iflytek_spark": "아이플라이텍 스파크", + "gemini": "Gemini", + "openai": "OpenAI", + "kimi": "Kimi", + "tencent_cloud": "텐센트 클라우드", + "volcano_engine": "볼케이노 엔진", + "generic_openai": "범용 OpenAI" + }, + "modelType": { + "llm": "대형 언어 모델" } } \ No newline at end of file diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json index 3a762296..9417002c 100644 --- a/frontend/src/i18n/zh-CN.json +++ b/frontend/src/i18n/zh-CN.json @@ -716,5 +716,21 @@ "platform_disable": "{0}设置未开启!", "input_account": "请输入账号", "redirect_2_auth": "正在跳转至 {0} 认证,{1} 秒..." + }, + "supplier": { + "alibaba_cloud_bailian": "阿里云百炼", + "qianfan_model": "千帆大模型", + "deepseek": "DeepSeek", + "tencent_hunyuan": "腾讯混元", + "iflytek_spark": "讯飞星火", + "gemini": "Gemini", + "openai": "OpenAI", + "kimi": "Kimi", + "tencent_cloud": "腾讯云", + "volcano_engine": "火山引擎", + "generic_openai": "通用OpenAI" + }, + "modelType": { + "llm": "大语言模型" } } \ No newline at end of file diff --git a/frontend/src/views/system/model/Card.vue b/frontend/src/views/system/model/Card.vue index dfbb38a2..d6854bd2 100644 --- a/frontend/src/views/system/model/Card.vue +++ b/frontend/src/views/system/model/Card.vue @@ -69,7 +69,7 @@ defineExpose({ showErrorMask })
{{ $t('model.model_type') }} - {{ modelType }} + {{ modelType.startsWith('modelType.') ? $t(modelType) : modelType }}
{{ $t('model.basic_model') }} diff --git a/frontend/src/views/system/model/Model.vue b/frontend/src/views/system/model/Model.vue index 308c2b0e..4aff07bc 100644 --- a/frontend/src/views/system/model/Model.vue +++ b/frontend/src/views/system/model/Model.vue @@ -33,6 +33,7 @@ const searchLoading = ref(false) const editModel = ref(false) const activeStep = ref(0) const activeName = ref('') +const activeNameI18nKey = ref('') const activeType = ref('') const modelFormRef = ref() const cardRefs = ref([]) @@ -185,6 +186,7 @@ const handleEditModel = (row: any) => { editModel.value = true activeType.value = row.supplier activeName.value = row.supplier_item.name + activeNameI18nKey.value = row.supplier_item.i18nKey modelApi.query(row.id).then((res: any) => { modelConfigvVisible.value = true nextTick(() => { @@ -256,6 +258,7 @@ const clickModel = (ele: any) => { const supplierChang = (ele: any) => { activeName.value = ele.name + activeNameI18nKey.value = ele.i18nKey nextTick(() => { modelFormRef.value.supplierChang({ ...ele }) }) @@ -425,7 +428,7 @@ const submit = (item: any) => { >