From d7f90a2e7fe110d8c34f8f791f90d149f981e205 Mon Sep 17 00:00:00 2001 From: seven Date: Sun, 14 Apr 2024 16:48:21 +0800 Subject: [PATCH] Feat/chat UI (#47) #35 --------- Signed-off-by: seven --- components.d.ts | 7 + package-lock.json | 29 ++- package.json | 3 +- src/lang/enUS.ts | 1 + src/lang/zhCN.ts | 1 + src/layout/components/the-aside.vue | 2 +- src/layout/components/tool-bar-right.vue | 225 +++++++++++++++++++++++ src/layout/index.vue | 2 + src/store/chatStore.ts | 32 ++++ src/store/index.ts | 1 + src/views/editor/index.vue | 32 ++-- 11 files changed, 316 insertions(+), 19 deletions(-) create mode 100644 src/layout/components/tool-bar-right.vue create mode 100644 src/store/chatStore.ts diff --git a/components.d.ts b/components.d.ts index 781f0f0..72e0e95 100644 --- a/components.d.ts +++ b/components.d.ts @@ -8,10 +8,14 @@ export {} declare module 'vue' { export interface GlobalComponents { AppProvider: typeof import('./src/components/AppProvider.vue')['default'] + NAvatar: typeof import('naive-ui')['NAvatar'] NButton: typeof import('naive-ui')['NButton'] NButtonGroup: typeof import('naive-ui')['NButtonGroup'] NCard: typeof import('naive-ui')['NCard'] 'NCard:': typeof import('naive-ui')['NCard:'] + NCardBody: typeof import('naive-ui')['NCardBody'] + NCardFooter: typeof import('naive-ui')['NCardFooter'] + NCardHeader: typeof import('naive-ui')['NCardHeader'] NConfigProvider: typeof import('naive-ui')['NConfigProvider'] NDialogProvider: typeof import('naive-ui')['NDialogProvider'] NDropdown: typeof import('naive-ui')['NDropdown'] @@ -35,9 +39,12 @@ declare module 'vue' { NRadioGroup: typeof import('naive-ui')['NRadioGroup'] NScrollbar: typeof import('naive-ui')['NScrollbar'] NSelect: typeof import('naive-ui')['NSelect'] + NSpace: typeof import('naive-ui')['NSpace'] + NSplit: typeof import('naive-ui')['NSplit'] NSwitch: typeof import('naive-ui')['NSwitch'] NTabPane: typeof import('naive-ui')['NTabPane'] NTabs: typeof import('naive-ui')['NTabs'] + NTag: typeof import('naive-ui')['NTag'] NTooltip: typeof import('naive-ui')['NTooltip'] RouterLink: typeof import('vue-router')['RouterLink'] RouterMain: typeof import('./src/components/RouterMain.vue')['default'] diff --git a/package-lock.json b/package-lock.json index 28385ae..84eee7f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "DocKit", - "version": "0.2.6", + "version": "0.2.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "DocKit", - "version": "0.2.6", + "version": "0.2.7", "license": "Apache-2.0", "dependencies": { "buffer": "^6.0.3", @@ -17,6 +17,7 @@ "node-fetch": "^2.7.0", "pinia": "^2.1.7", "pinia-plugin-persistedstate": "^3.2.1", + "ulidx": "^2.3.0", "update-electron-app": "^3.0.0", "vue": "^3.4.19", "vue-i18n": "^9.9.1", @@ -52,7 +53,7 @@ "eslint-plugin-vue": "^9.21.1", "husky": "^9.0.11", "jest": "^29.7.0", - "naive-ui": "^2.37.3", + "naive-ui": "^2.38.1", "prettier": "^3.2.5", "sass": "^1.71.0", "ts-jest": "^29.1.2", @@ -10017,6 +10018,11 @@ "node": ">=6" } }, + "node_modules/layerr": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/layerr/-/layerr-2.0.1.tgz", + "integrity": "sha512-z0730CwG/JO24evdORnyDkwG1Q7b7mF2Tp1qRQ0YvrMMARbt1DFG694SOv439Gm7hYKolyZyaB49YIrYIfZBdg==" + }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -10655,9 +10661,9 @@ } }, "node_modules/naive-ui": { - "version": "2.37.3", - "resolved": "https://registry.npmjs.org/naive-ui/-/naive-ui-2.37.3.tgz", - "integrity": "sha512-aUkHFXVIluSi8Me+npbcsdv1NYhVMj5t9YaruoCESlqmfqspj+R2QHEVXkTtUI1kQwVrABMCtAGq/wountqjZA==", + "version": "2.38.1", + "resolved": "https://registry.npmjs.org/naive-ui/-/naive-ui-2.38.1.tgz", + "integrity": "sha512-AnU1FQ7K/CbhguAX++V4kCFjk7h7RvWt4nvZPRjORMpq+fUIlzD+EcQ5Cv1VqDloNF8+eMv4Akc2Ogacc9S+5A==", "dev": true, "dependencies": { "@css-render/plugin-bem": "^0.15.12", @@ -13532,6 +13538,17 @@ "integrity": "sha512-Hhy+BhRBleFjpJ2vchUNN40qgkh0366FWJGqVLYBHev0vpHTrXSA0ryT+74UiW6KWsldNurQMKGqCm1M2zBciQ==", "dev": true }, + "node_modules/ulidx": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/ulidx/-/ulidx-2.3.0.tgz", + "integrity": "sha512-36piWNqcdp9hKlQewyeehCaALy4lyx3FodsCxHuV6i0YdexSkjDOubwxEVr2yi4kh62L/0MgyrxqG4K+qtovnw==", + "dependencies": { + "layerr": "^2.0.1" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", diff --git a/package.json b/package.json index 772b0a5..d704446 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "node-fetch": "^2.7.0", "pinia": "^2.1.7", "pinia-plugin-persistedstate": "^3.2.1", + "ulidx": "^2.3.0", "update-electron-app": "^3.0.0", "vue": "^3.4.19", "vue-i18n": "^9.9.1", @@ -65,7 +66,7 @@ "eslint-plugin-vue": "^9.21.1", "husky": "^9.0.11", "jest": "^29.7.0", - "naive-ui": "^2.37.3", + "naive-ui": "^2.38.1", "prettier": "^3.2.5", "sass": "^1.71.0", "ts-jest": "^29.1.2", diff --git a/src/lang/enUS.ts b/src/lang/enUS.ts index e1b0a39..2eafcd0 100644 --- a/src/lang/enUS.ts +++ b/src/lang/enUS.ts @@ -6,6 +6,7 @@ export const enUS = { github: 'GitHub', user: 'User', setting: 'Setting', + chatBot: 'AI Assistant', }, setting: { basic: 'Basic', diff --git a/src/lang/zhCN.ts b/src/lang/zhCN.ts index a006e28..57d325f 100644 --- a/src/lang/zhCN.ts +++ b/src/lang/zhCN.ts @@ -6,6 +6,7 @@ export const zhCN = { github: 'GitHub', user: '用户', setting: '设置', + chatBot: 'AI助手', }, setting: { basic: '通用设置', diff --git a/src/layout/components/the-aside.vue b/src/layout/components/the-aside.vue index 8ca8608..b2f46fc 100644 --- a/src/layout/components/the-aside.vue +++ b/src/layout/components/the-aside.vue @@ -46,7 +46,7 @@ import { ref, markRaw } from 'vue'; import { useRouter, useRoute } from 'vue-router'; import { DataBase, Folders, LogoGithub, Settings, UserAvatar, ExpandAll } from '@vicons/carbon'; import { useAppStore } from '../../store'; -import theAsideIcon from './the-aside-icon.vue'; +import TheAsideIcon from './the-aside-icon.vue'; const router = useRouter(); const route = useRoute(); const appStore = useAppStore(); diff --git a/src/layout/components/tool-bar-right.vue b/src/layout/components/tool-bar-right.vue new file mode 100644 index 0000000..0906301 --- /dev/null +++ b/src/layout/components/tool-bar-right.vue @@ -0,0 +1,225 @@ + + + + + diff --git a/src/layout/index.vue b/src/layout/index.vue index 4ce430a..95365e2 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -4,12 +4,14 @@
+