Skip to content

Commit 94f9a53

Browse files
perf: Model language
1 parent 14799a3 commit 94f9a53

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

frontend/src/components/layout/LayoutDsl.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@ import LOGO_fold from '@/assets/LOGO-fold.svg'
88
import icon_moments_categories_outlined from '@/assets/svg/icon_moments-categories_outlined.svg'
99
import icon_side_fold_outlined from '@/assets/svg/icon_side-fold_outlined.svg'
1010
import icon_side_expand_outlined from '@/assets/svg/icon_side-expand_outlined.svg'
11+
import { useRouter } from 'vue-router'
12+
const router = useRouter()
1113
const collapse = ref(false)
1214
1315
const handleFoldExpand = () => {
1416
collapse.value = !collapse.value
1517
}
18+
const toWorkspace = () => {
19+
router.push('/')
20+
}
1621
</script>
1722

1823
<template>
@@ -23,7 +28,7 @@ const handleFoldExpand = () => {
2328
<Workspace :collapse="collapse"></Workspace>
2429
<Menu :collapse="collapse"></Menu>
2530
<div class="bottom">
26-
<div class="back-to_workspace">
31+
<div class="back-to_workspace" @click="toWorkspace">
2732
<el-icon size="16">
2833
<icon_moments_categories_outlined></icon_moments_categories_outlined>
2934
</el-icon>
@@ -85,7 +90,12 @@ const handleFoldExpand = () => {
8590
border-radius: 6px;
8691
height: 40px;
8792
cursor: pointer;
88-
93+
&:hover {
94+
background-color: #1f23291a;
95+
}
96+
&:active {
97+
background-color: #1f232926;
98+
}
8999
.ed-icon {
90100
margin-right: 4.95px;
91101
}

frontend/src/i18n/zh-CN.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@
193193
"text": "文本",
194194
"number": "数值",
195195
"parameter_type": "参数类型",
196-
"verification_successful": "校验成功"
196+
"verification_successful": "校验成功",
197+
"del_default_tip": "无法删除模型: {msg}",
198+
"del_default_warn": "该模型为系统默认模型,请先设置其他模型为系统默认模型,再删除此模型。",
199+
"del_warn_tip": "是否删除模型: {msg}?"
197200
},
198201
"chat": {
199202
"chart_type": {
@@ -231,4 +234,4 @@
231234
"back_community": "还原至社区版",
232235
"confirm_tips": "确定还原至社区版?"
233236
}
234-
}
237+
}

frontend/src/views/system/model/Model.vue

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,17 @@ const handleDefaultModelChange = (item: any) => {
7373
if (current_default_node?.id === item.id) {
7474
return
7575
}
76-
ElMessageBox.confirm(`是否设置 ${item.name} 为系统默认模型?`, {
76+
ElMessageBox.confirm(t('model.system_default_model', { msg: item.name }), {
7777
confirmButtonType: 'primary',
78-
tip: '系统默认模型被替换后,智能问数的结果将会受到影响,请谨慎操作。',
78+
tip: t('model.operate_with_caution'),
7979
confirmButtonText: t('datasource.confirm'),
8080
cancelButtonText: t('common.cancel'),
8181
customClass: 'confirm-no_icon',
8282
autofocus: false,
8383
callback: (val: string) => {
8484
if (val === 'confirm') {
8585
modelApi.setDefault(item.id).then(() => {
86-
ElMessage.success('设置成功')
86+
ElMessage.success(t('model.set_successfully'))
8787
search()
8888
})
8989
}
@@ -114,12 +114,12 @@ const handleEditModel = (id: any) => {
114114
115115
const deleteHandler = (item: any) => {
116116
if (item.default_model) {
117-
ElMessageBox.confirm(`无法删除模型:${item.name}?`, {
117+
ElMessageBox.confirm(t('model.del_default_tip', { msg: item.name }), {
118118
confirmButtonType: 'primary',
119-
tip: '该模型为系统默认模型,请先设置其他模型为系统默认模型,再删除此模型。',
119+
tip: t('model.del_default_warn'),
120120
showConfirmButton: false,
121-
confirmButtonText: '确定',
122-
cancelButtonText: '知道了',
121+
confirmButtonText: t('datasource.confirm'),
122+
cancelButtonText: t('datasource.got_it'),
123123
customClass: 'confirm-no_icon',
124124
autofocus: false,
125125
callback: (val: string) => {
@@ -128,18 +128,18 @@ const deleteHandler = (item: any) => {
128128
})
129129
return
130130
}
131-
ElMessageBox.confirm(`是否删除模型:${item.name}?`, {
131+
ElMessageBox.confirm(t('model.del_warn_tip', { msg: item.name }), {
132132
confirmButtonType: 'danger',
133-
confirmButtonText: '删除',
134-
cancelButtonText: '取消',
133+
confirmButtonText: t('dashboard.delete'),
134+
cancelButtonText: t('common.cancel'),
135135
customClass: 'confirm-no_icon',
136136
autofocus: false,
137137
callback: (value: string) => {
138138
if (value === 'confirm') {
139139
modelApi.delete(item.id).then(() => {
140140
ElMessage({
141141
type: 'success',
142-
message: '删除成功',
142+
message: t('dashboard.delete_success'),
143143
})
144144
search()
145145
})

0 commit comments

Comments
 (0)