Browse Source

feat:取消AI助手背景遮罩,请求时增加loading

Jerry Liang 3 months ago
parent
commit
5115dba901

+ 3 - 0
src/layout/header/Actions/AiChat/index.vue

@@ -27,6 +27,9 @@ const drawerWidth = ref(480)
     :max-width="800"
     resizable
     placement="right"
+    :show-mask="false"
+    :mask-closable="false"
+    display-directive="show"
   >
     <NDrawerContent closable content-class="!p-0 h-full">
       <ChatPanel />

+ 6 - 1
src/layout/header/Actions/AiChat/useAiChat.ts

@@ -48,6 +48,7 @@ export function useAiChat() {
 
   // 获取当前会话信息
   async function fetchSession() {
+    isLoadingSession.value = true
     try {
       const resp = await fetch(`${getBaseUrl()}/ai/sessions`, {
         headers: { Authorization: `Bearer ${userStore.token}` },
@@ -63,9 +64,13 @@ export function useAiChat() {
           await loadLocalMessages(json.data.sessionId)
         }
       }
-    } catch {
+    }
+    catch {
       // 忽略
     }
+    finally {
+      isLoadingSession.value = false
+    }
     // 同时获取会话列表
     await fetchSessionList()
   }