From 915f8ff59a921dee4b3747ec53e9bf76cfd4cd64 Mon Sep 17 00:00:00 2001 From: ivamp Date: Thu, 12 Sep 2024 21:50:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/swagger.yaml | 1 - package.json | 3 +- src/App.vue | 1 - src/api/api.ts | 2 +- src/components/Container.vue | 33 ---- src/components/LeftSettings.vue | 149 +++++++++++++- src/components/chat/MessageList.vue | 21 +- src/components/chat/chat.vue | 290 ++++++++++++++++++++++++---- src/layouts/DefaultLayout.vue | 39 +++- src/layouts/Header.vue | 38 ++-- src/main.ts | 1 + src/style.css | 14 ++ 12 files changed, 481 insertions(+), 111 deletions(-) delete mode 100644 src/components/Container.vue diff --git a/api/swagger.yaml b/api/swagger.yaml index a97288f..0e17016 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -335,7 +335,6 @@ definitions: maxLength: 30 type: string required: - - assistant_id - name type: object schema.ChatMessageAddRequest: diff --git a/package.json b/package.json index 73aaced..2489f79 100644 --- a/package.json +++ b/package.json @@ -11,15 +11,14 @@ "gen": "openapi-generator-cli generate -i ./api/swagger.yaml -g typescript-axios -o ./src/api" }, "dependencies": { - "@f3ve/vue-markdown-it": "^0.2.2", "@kangc/v-md-editor": "^2.3.18", "@traptitech/markdown-it-katex": "^3.6.0", + "animate.css": "^4.1.1", "axios": "^1.7.7", "highlight.js": "^11.10.0", "js-base64": "^3.7.7", "katex": "^0.16.11", "lottie-web": "^5.12.2", - "markdown-it-latex2img": "^0.0.6", "pinia": "^2.2.2", "pinia-plugin-persistedstate": "^4.0.0", "vooks": "^0.2.12", diff --git a/src/App.vue b/src/App.vue index e76126d..6d8f917 100644 --- a/src/App.vue +++ b/src/App.vue @@ -14,7 +14,6 @@ :locale="zhCN" :theme="theme" :theme-overrides="themeOverrides" - preflight-style-disabled > diff --git a/src/api/api.ts b/src/api/api.ts index 3e6f9a2..66833db 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -1399,7 +1399,7 @@ export interface SchemaChatCreateRequest { * @type {number} * @memberof SchemaChatCreateRequest */ - 'assistant_id': number; + 'assistant_id'?: number; /** * * @type {SchemaCustomTime} diff --git a/src/components/Container.vue b/src/components/Container.vue deleted file mode 100644 index bd4b32c..0000000 --- a/src/components/Container.vue +++ /dev/null @@ -1,33 +0,0 @@ - - - - - diff --git a/src/components/LeftSettings.vue b/src/components/LeftSettings.vue index db7483c..2d9d180 100644 --- a/src/components/LeftSettings.vue +++ b/src/components/LeftSettings.vue @@ -1,18 +1,28 @@ diff --git a/src/components/chat/MessageList.vue b/src/components/chat/MessageList.vue index 78b2243..1701d6d 100644 --- a/src/components/chat/MessageList.vue +++ b/src/components/chat/MessageList.vue @@ -1,6 +1,6 @@ diff --git a/src/layouts/Header.vue b/src/layouts/Header.vue index 86d8abf..8fbdf87 100644 --- a/src/layouts/Header.vue +++ b/src/layouts/Header.vue @@ -23,8 +23,9 @@ resizable :default-width="width" placement="left" + class="select-none" > - + @@ -44,9 +45,15 @@ - - - + + + 新对话 + + @@ -89,17 +96,24 @@ import UserMenu from "../components/UserMenu.vue"; import AssistantMenu from "../components/AssistantMenu.vue"; import { useAppStore } from "../stores/app"; import { useUserStore } from "../stores/user"; -import { useIsMobile, useIsTablet } from "../utils/composables"; -import { MenuOutline, PersonOutline, AddOutline } from "@vicons/ionicons5"; +import { useIsMobile } from "../utils/composables"; +import { + MenuOutline, + PersonOutline, + AddOutline, + TrashOutline, +} from "@vicons/ionicons5"; import router from "@/router"; - +import { useChatStore } from "@/stores/chat"; +import getApi from "@/plugins/api"; const userStore = useUserStore(); const isMobile = useIsMobile(); -const isTablet = useIsTablet(); +// const isTablet = useIsTablet(); const appStore = useAppStore(); const showDrawer = ref(false); const width = ref(200); +const chatStore = useChatStore(); // 如果是手机,则 width 为全屏 if (isMobile.value) { @@ -115,9 +129,11 @@ if (isMobile.value) { userPlacement.value = "bottom"; } +const clearChatHistory = async () => { + await getApi().ChatMessage.apiV1ChatsIdClearPost(chatStore.currentChatId); +}; + const backToHome = () => { router.push("/"); }; - - diff --git a/src/main.ts b/src/main.ts index 11baee3..e0a3b8f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,6 +3,7 @@ meta.name = "naive-ui-style"; document.head.appendChild(meta); import "./style.css"; +import "animate.css"; import { registerPlugins } from "./plugins"; import router from "./router"; diff --git a/src/style.css b/src/style.css index cba4625..a9bc2bc 100644 --- a/src/style.css +++ b/src/style.css @@ -6,6 +6,20 @@ --header-height: 48px; } +body { + overflow: hidden; +} + .header-height { min-height: var(--header-height); } + +.fade-enter-active, +.fade-leave-active { + transition: opacity 0.15s ease-in-out; +} + +.fade-enter-from, +.fade-leave-to { + opacity: 0; +}