From 33168361ed757ed37c1a644f2ca2f3e169bdd181 Mon Sep 17 00:00:00 2001 From: zoujing Date: Sun, 10 Aug 2025 15:39:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A4=84=E7=90=86=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E5=8F=91=E9=80=81=E4=B9=8B=E5=90=8E=20=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E4=B8=AD=E6=B2=A1=E5=8E=BB=E6=8E=89=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/chat/ChatMainList.vue | 17 ++++++++++++----- .../module/discovery/DiscoveryCardComponent.vue | 5 +++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/pages/chat/ChatMainList.vue b/pages/chat/ChatMainList.vue index 827db63..cc4ad36 100644 --- a/pages/chat/ChatMainList.vue +++ b/pages/chat/ChatMainList.vue @@ -349,7 +349,6 @@ const initWebSocket = () => { // 消息回调 onMessage: (data) => { - console.log("onMessage:", data); handleWebSocketMessage(data); }, @@ -373,7 +372,7 @@ const handleWebSocketMessage = (data) => { return; } - console.log("处理WebSocket消息:", data); + //console.log("处理WebSocket消息:", data); // 确保消息内容是字符串类型 if (data.content && typeof data.content !== "string") { @@ -405,6 +404,15 @@ const handleWebSocketMessage = (data) => { return; } + const msg = chatMsgList.value[aiMsgIndex].msg; + console.log('全量消息内容:', msg) + if (!msg || msg === '加载中.' || msg.startsWith('加载中')) { + chatMsgList.value[aiMsgIndex].msg = '未获取到内容,请重试'; + if(data.toolCall) { + chatMsgList.value[aiMsgIndex].msg = ''; + } + } + // 处理toolCall if (data.toolCall) { chatMsgList.value[aiMsgIndex].toolCall = data.toolCall; @@ -444,7 +452,7 @@ const initTypewriterManager = () => { // 双重保险,确保滚动生效 setTimeout(() => { scrollTop.value = 99999 + Math.random(); - }, 5); + }, 20); }); }, // 内容更新时的回调 @@ -492,7 +500,7 @@ const addNoticeListener = () => { if (value && value.length > 0) { commonType = "Command.quickBooking"; sendMessage(value, true); - scrollToBottom(); + setTimeoutScrollToBottom(); } }); }; @@ -589,7 +597,6 @@ const sendWebSocketMessage = (messageType, messageContent, options = {}) => { const sendChat = (message, isInstruct = false) => { if (!webSocketManager || !webSocketManager.isConnected()) { console.error("WebSocket未连接"); - return; } diff --git a/pages/module/discovery/DiscoveryCardComponent.vue b/pages/module/discovery/DiscoveryCardComponent.vue index 39f5848..0f82e38 100644 --- a/pages/module/discovery/DiscoveryCardComponent.vue +++ b/pages/module/discovery/DiscoveryCardComponent.vue @@ -21,13 +21,14 @@ themeDTOList.value = res.data.themeDTOList nextTick(() => { - uni.$emit(SCROLL_TO_BOTTOM, true) + setTimeout(() => { + uni.$emit(SCROLL_TO_BOTTOM, true) + }, 300) }); } } onMounted(() => { - console.log('=============') loadDiscoveryCradComponent() })