From e896e5bb27cde997b7890dcb66ced26361ccba18 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Tue, 21 May 2024 11:46:30 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=A7=A3=E5=86=B3todo=E3=80=91AI=20ch?= =?UTF-8?q?at=20=E5=A4=B4=E9=83=A8=E4=BF=AE=E6=94=B9=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E6=9B=B4=E6=96=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/chat/index.vue | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/views/ai/chat/index.vue b/src/views/ai/chat/index.vue index a13be005..844be9ab 100644 --- a/src/views/ai/chat/index.vue +++ b/src/views/ai/chat/index.vue @@ -94,7 +94,6 @@ import {ChatMessageApi, ChatMessageVO} from '@/api/ai/chat/message' import {ChatConversationApi, ChatConversationVO} from '@/api/ai/chat/conversation' import {useClipboard} from '@vueuse/core' import ChatConversationUpdateForm from "@/views/ai/chat/components/ChatConversationUpdateForm.vue"; -import {send} from "vite"; const route = useRoute() // 路由 const message = useMessage() // 消息弹窗 @@ -381,6 +380,7 @@ const openChatConversationUpdateForm = async () => { */ const handlerTitleSuccess = async () => { // TODO 需要刷新 对话列表 + await getConversation(activeConversationId.value) } /** @@ -418,9 +418,13 @@ const handlerConversationDelete = async (delConversation: ChatConversationVO) => /** * 对话 - 获取 */ -const getConversation = async (id: string) => { +const getConversation = async (id: string | null) => { + if (!id) { + return + } const conversation: ChatConversationVO = await ChatConversationApi.getChatConversationMy(id) - return conversation + activeConversation.value = conversation + activeConversationId.value = conversation.id } // ============ message =========== @@ -435,8 +439,7 @@ onMounted(async () => { // 设置当前对话 TODO 角色仓库过来的,自带 conversationId 需要选中 if (route.query.conversationId) { const id = route.query.conversationId as string - activeConversationId.value = id - activeConversation.value = await getConversation(id) as ChatConversationVO + await getConversation(id) } // 获取列表数据 await getMessageList()