From b7ca014fd08454ebfe93e19cfee34e2aeb0ccd37 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Tue, 10 Jun 2025 15:45:06 +0800 Subject: [PATCH] feat: enhance routing to support chatbox and improve path handling in ChatPage --- dashboard/src/views/ChatPage.vue | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/dashboard/src/views/ChatPage.vue b/dashboard/src/views/ChatPage.vue index 053b15810..aeefb9530 100644 --- a/dashboard/src/views/ChatPage.vue +++ b/dashboard/src/views/ChatPage.vue @@ -324,9 +324,11 @@ export default { '$route': { immediate: true, handler(to) { + console.log('Route changed:', to.path); // Check if the route matches /chat/ pattern - if (to.path.startsWith('/chat/')) { + if (to.path.startsWith('/chat/') || to.path.startsWith('/chatbox/')) { const pathCid = to.path.split('/')[2]; + console.log('Path CID:', pathCid); if (pathCid && pathCid !== this.currCid) { // If conversations are already loaded if (this.conversations.length > 0) { @@ -748,7 +750,11 @@ export default { const cid = response.data.data.conversation_id; this.currCid = cid; // Update the URL to reflect the new conversation - router.push(`/chat/${cid}`); + if (this.$route.path.startsWith('/chatbox')) { + router.push(`/chatbox/${cid}`); + } else { + router.push(`/chat/${cid}`); + } this.getConversations(); return cid; }).catch(err => { @@ -760,7 +766,11 @@ export default { newC() { this.currCid = ''; this.messages = []; - router.push('/chat'); + if (this.$route.path.startsWith('/chatbox')) { + router.push('/chatbox'); + } else { + router.push('/chat'); + } }, formatDate(timestamp) {