diff --git a/frontend/src/components/Assistant.vue b/frontend/src/components/Assistant.vue index 0e0cdb0..967297b 100644 --- a/frontend/src/components/Assistant.vue +++ b/frontend/src/components/Assistant.vue @@ -94,7 +94,7 @@ import type { DepartmentUpsertModel } from "@/types/department"; import DOMPurify from "dompurify"; import { Modal, type ModalInterface, initFlowbite } from "flowbite"; import { marked } from "marked"; -import { onMounted, onUnmounted, ref, watch } from "vue"; +import { nextTick, onMounted, onUnmounted, ref, watch } from "vue"; import { z } from "zod"; import Button from "../components/Button.vue"; import DepartmentUpsertModal from "../components/DepartmentUpsertModal.vue"; @@ -256,6 +256,9 @@ const chatByMode = async ( isUser: true, username: user.username!, }); + await nextTick(() => { + scrollToBottom(); + }); if (mode === "search") { await searchAction(message); } else if (mode === "execute") { @@ -269,7 +272,6 @@ const handleSendClick = async ( message: string, mode: "chat" | "search" | "execute", ) => { - scrollToBottom(); if (isLoading.value) { abortChat(); return; @@ -289,10 +291,7 @@ onMounted(async () => { initFlowbite(); const $upsertModalElement: HTMLElement | null = document.querySelector("#user-upsert-modal"); - userUpsertModal.value = new Modal( - $upsertModalElement, - {}, - ); + userUpsertModal.value = new Modal($upsertModalElement, {}); const $userDeleteModalElement: HTMLElement | null = document.querySelector("#user-delete-modal"); userDeleteModal.value = new Modal( @@ -304,16 +303,10 @@ onMounted(async () => { ); const $departmentDeleteModalElement: HTMLElement | null = document.querySelector("#department-delete-modal"); - departmentDeleteModal.value = new Modal( - $departmentDeleteModalElement, - {}, - ); + departmentDeleteModal.value = new Modal($departmentDeleteModalElement, {}); const $departmentUpsertModalElement: HTMLElement | null = document.querySelector("#department-upsert-modal"); - departmentUpsertModal.value = new Modal( - $departmentUpsertModalElement, - {}, - ); + departmentUpsertModal.value = new Modal($departmentUpsertModalElement, {}); }); diff --git a/frontend/src/components/Headbar.vue b/frontend/src/components/Headbar.vue index ed8ea53..4d77163 100644 --- a/frontend/src/components/Headbar.vue +++ b/frontend/src/components/Headbar.vue @@ -101,12 +101,12 @@ import { RouteName, RoutePath } from "../router/constants"; import AiChatIcon from "./icons/AiChatIcon.vue"; const props = defineProps<{ - changeAssistantVisible: () => void; - onSidebarToggle: () => void; + changeAssistantVisible: () => void; + onSidebarToggle: () => void; }>(); const handleSidebarToggle = () => { - props.onSidebarToggle(); + props.onSidebarToggle(); }; const userDropDownMenu = ref(); @@ -115,19 +115,19 @@ const { user } = useUserStore(); const { signOut } = useUserAuth(); const router = useRouter(); const handleLogoutClick = () => { - signOut(); - router.push(RoutePath.LOGIN); + signOut(); + router.push(RoutePath.LOGIN); }; onMounted(() => { - initFlowbite(); - const $dropdownUser = document.getElementById("dropdown-user"); - const $dropdownButton = document.getElementById("dropdown-button"); - userDropDownMenu.value = new Dropdown( - $dropdownUser, - $dropdownButton, - {}, - { id: "dropdownMenu", override: true }, - ); + initFlowbite(); + const $dropdownUser = document.getElementById("dropdown-user"); + const $dropdownButton = document.getElementById("dropdown-button"); + userDropDownMenu.value = new Dropdown( + $dropdownUser, + $dropdownButton, + {}, + { id: "dropdownMenu", override: true }, + ); }); diff --git a/frontend/src/components/Sidebar.vue b/frontend/src/components/Sidebar.vue index 26d17e2..b7133d5 100644 --- a/frontend/src/components/Sidebar.vue +++ b/frontend/src/components/Sidebar.vue @@ -43,11 +43,11 @@ import SettingsIcon from "./icons/SettingsIcon.vue"; import UsersIcon from "./icons/UsersIcon.vue"; const isDrawerVisible = ref(false); -const emit = defineEmits(['menu-click']); +const emit = defineEmits(["menu-click"]); // 菜单点击处理 const handleMenuClick = () => { - emit('menu-click'); + emit("menu-click"); }; const toggleSidebar = () => { @@ -66,7 +66,7 @@ defineExpose({ toggleSidebar, openSidebar, closeSidebar, - isDrawerVisible + isDrawerVisible, }); // 菜单配置 diff --git a/frontend/src/composables/ai/useAiChat.ts b/frontend/src/composables/ai/useAiChat.ts index 5ac2bd1..61adbed 100644 --- a/frontend/src/composables/ai/useAiChat.ts +++ b/frontend/src/composables/ai/useAiChat.ts @@ -45,6 +45,7 @@ export const useAiChat = () => { console.log("onclose"); }, onerror(err) { + console.error(err); throw err; }, });