diff --git a/frontend/package.json b/frontend/package.json index 83f11fff..edc1cd8e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,11 +13,12 @@ "@npkg/tinymce-plugins": "^0.0.7", "@tinymce/tinymce-vue": "^5.1.0", "dayjs": "^1.11.13", - "element-plus": "^2.9.11", + "element-plus": "^2.10.1", "lodash": "^4.17.21", "snowflake-id": "^1.1.0", "tinymce": "^5.8.2", "vue": "^3.5.13", + "vue-i18n": "^9.14.4", "vue-router": "^4.5.0", "web-storage-cache": "^1.1.1" }, diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 93424263..40534573 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,8 +1,16 @@ \ No newline at end of file diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json new file mode 100644 index 00000000..fb51d1e9 --- /dev/null +++ b/frontend/src/i18n/en.json @@ -0,0 +1,14 @@ +{ + "menu": { + "dashboard": "Dashboard", + "chat": "Chat", + "datasource": "Data Source", + "system": "System" + }, + "common": { + "back": "Back", + "confirm": "Confirm", + "cancel": "Cancel", + "system_manage": "System Management" + } +} \ No newline at end of file diff --git a/frontend/src/i18n/index.ts b/frontend/src/i18n/index.ts new file mode 100644 index 00000000..9fb39600 --- /dev/null +++ b/frontend/src/i18n/index.ts @@ -0,0 +1,34 @@ +import { createI18n } from 'vue-i18n' +import en from './en.json' +import zhCN from './zh-CN.json' +import elementEnLocale from 'element-plus/es/locale/lang/en' +import elementZhLocale from 'element-plus/es/locale/lang/zh-cn' + +const getDefaultLocale = () => { + /* const savedLang = localStorage.getItem('lang') + return savedLang || 'zh-CN' */ + return 'zh-CN' +} + +const messages = { + en: { + ...en, + el: elementEnLocale + }, + 'zh-CN': { + ...zhCN, + el: elementZhLocale + } +} + +export const i18n = createI18n({ + legacy: false, + locale: getDefaultLocale(), + fallbackLocale: 'en', + globalInjection: true, + messages +}) + +export const getElementLocale = () => { + return i18n.global.locale.value === 'en' ? elementEnLocale : elementZhLocale +} \ No newline at end of file diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json new file mode 100644 index 00000000..7369b96a --- /dev/null +++ b/frontend/src/i18n/zh-CN.json @@ -0,0 +1,14 @@ +{ + "menu": { + "dashboard": "仪表盘", + "chat": "聊天", + "datasource": "数据源", + "system": "系统" + }, + "common": { + "back": "返回", + "confirm": "确认", + "cancel": "取消", + "system_manage": "系统管理" + } +} \ No newline at end of file diff --git a/frontend/src/main.ts b/frontend/src/main.ts index 6e558f05..530607b4 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -3,10 +3,12 @@ import { createPinia } from 'pinia' import './style.less' import App from './App.vue' import router from './router' +import { i18n } from './i18n' // import 'element-plus/dist/index.css' const app = createApp(App) const pinia = createPinia() app.use(pinia) app.use(router) +app.use(i18n) app.mount('#app') diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index b6ed972d..c0fd1513 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -7,7 +7,8 @@ import chat from "@/views/chat/index.vue"; import ds from "@/views/ds/index.vue"; import DashboardEditor from "@/views/dashboard/editor/index.vue"; import Dashboard from "@/views/dashboard/index.vue"; -// import setting from "@/views/setting/index.vue"; +import Model from "@/views/system/model/index.vue"; +import User from "@/views/system/user/index.vue"; import { watchRouter } from "./watch"; const router = createRouter({ history: createWebHashHistory(), @@ -95,17 +96,17 @@ const router = createRouter({ { path: "user", name: "user", - component: () => import("@/views/system/user/index.vue"), + component: User, meta: { title: "User Management", icon: "icon_user" }, }, { path: "model", name: "model", - component: () => import("@/views/system/model/index.vue"), + component: Model, meta: { title: "AI Model Configuration", icon: "icon_ai" }, }, ], - }, + } ], }); watchRouter(router); diff --git a/frontend/src/views/system/model/index.vue b/frontend/src/views/system/model/index.vue index fe57f259..9afa061f 100644 --- a/frontend/src/views/system/model/index.vue +++ b/frontend/src/views/system/model/index.vue @@ -80,6 +80,7 @@ v-model:page-size="state.pageInfo.pageSize" :page-sizes="[10, 20, 30]" :background="true" + :pager-count="5" layout="total, sizes, prev, pager, next, jumper" :total="state.pageInfo.total" @size-change="handleSizeChange"