feat: 处理命令发送之后 加载中没去掉的问题
This commit is contained in:
@@ -349,7 +349,6 @@ const initWebSocket = () => {
|
|||||||
|
|
||||||
// 消息回调
|
// 消息回调
|
||||||
onMessage: (data) => {
|
onMessage: (data) => {
|
||||||
console.log("onMessage:", data);
|
|
||||||
handleWebSocketMessage(data);
|
handleWebSocketMessage(data);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -373,7 +372,7 @@ const handleWebSocketMessage = (data) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("处理WebSocket消息:", data);
|
//console.log("处理WebSocket消息:", data);
|
||||||
|
|
||||||
// 确保消息内容是字符串类型
|
// 确保消息内容是字符串类型
|
||||||
if (data.content && typeof data.content !== "string") {
|
if (data.content && typeof data.content !== "string") {
|
||||||
@@ -405,6 +404,15 @@ const handleWebSocketMessage = (data) => {
|
|||||||
return;
|
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
|
// 处理toolCall
|
||||||
if (data.toolCall) {
|
if (data.toolCall) {
|
||||||
chatMsgList.value[aiMsgIndex].toolCall = data.toolCall;
|
chatMsgList.value[aiMsgIndex].toolCall = data.toolCall;
|
||||||
@@ -444,7 +452,7 @@ const initTypewriterManager = () => {
|
|||||||
// 双重保险,确保滚动生效
|
// 双重保险,确保滚动生效
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
scrollTop.value = 99999 + Math.random();
|
scrollTop.value = 99999 + Math.random();
|
||||||
}, 5);
|
}, 20);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 内容更新时的回调
|
// 内容更新时的回调
|
||||||
@@ -492,7 +500,7 @@ const addNoticeListener = () => {
|
|||||||
if (value && value.length > 0) {
|
if (value && value.length > 0) {
|
||||||
commonType = "Command.quickBooking";
|
commonType = "Command.quickBooking";
|
||||||
sendMessage(value, true);
|
sendMessage(value, true);
|
||||||
scrollToBottom();
|
setTimeoutScrollToBottom();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -589,7 +597,6 @@ const sendWebSocketMessage = (messageType, messageContent, options = {}) => {
|
|||||||
const sendChat = (message, isInstruct = false) => {
|
const sendChat = (message, isInstruct = false) => {
|
||||||
if (!webSocketManager || !webSocketManager.isConnected()) {
|
if (!webSocketManager || !webSocketManager.isConnected()) {
|
||||||
console.error("WebSocket未连接");
|
console.error("WebSocket未连接");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,13 +21,14 @@
|
|||||||
themeDTOList.value = res.data.themeDTOList
|
themeDTOList.value = res.data.themeDTOList
|
||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
uni.$emit(SCROLL_TO_BOTTOM, true)
|
setTimeout(() => {
|
||||||
|
uni.$emit(SCROLL_TO_BOTTOM, true)
|
||||||
|
}, 300)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log('=============')
|
|
||||||
loadDiscoveryCradComponent()
|
loadDiscoveryCradComponent()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user