feat: 处理命令发送之后 加载中没去掉的问题

This commit is contained in:
2025-08-10 15:39:34 +08:00
parent b38d08ecd8
commit 33168361ed
2 changed files with 15 additions and 7 deletions

View File

@@ -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;
}

View File

@@ -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()
})