Merge branch 'order-729'

合并order-729分支代码
This commit is contained in:
duanshuwen
2025-08-10 19:55:49 +08:00
24 changed files with 1668 additions and 94 deletions

View File

@@ -57,6 +57,12 @@
item.toolCall.componentName === CompName.createWorkOrderCard
"
/>
<DetailCardCompontent
v-else-if="
item.toolCall.componentName === ''
"
:toolCall="item.toolCall"
/>
</template>
<template #footer>
@@ -140,6 +146,7 @@ import ActivityListComponent from "../module/banner/ActivityListComponent.vue";
import RecommendPostsComponent from "../module/recommend/RecommendPostsComponent.vue";
import AttachListComponent from "../module/attach/AttachListComponent.vue";
import CreateServiceOrder from "@/components/CreateServiceOrder/index.vue";
import DetailCardCompontent from "../module/detail/DetailCardCompontent.vue";
import { mainPageData } from "@/request/api/MainPageDataApi";
import {
conversationMsgList,
@@ -344,12 +351,12 @@ const initWebSocket = () => {
// 错误回调
onError: (error) => {
isSessionActive.value = false;
console.error("WebSocket错误:", error);
},
// 消息回调
onMessage: (data) => {
console.log("onMessage:", data);
handleWebSocketMessage(data);
},
@@ -368,12 +375,16 @@ const initWebSocket = () => {
// 处理WebSocket消息
const handleWebSocketMessage = (data) => {
if(loadingTimer) {
clearInterval(loadingTimer);
loadingTimer = null;
}
const aiMsgIndex = chatMsgList.value.length - 1;
if (!chatMsgList.value[aiMsgIndex] || aiMsgIndex < 0) {
return;
}
console.log("处理WebSocket消息:", data);
//console.log("处理WebSocket消息:", data);
// 确保消息内容是字符串类型
if (data.content && typeof data.content !== "string") {
@@ -405,6 +416,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 +464,7 @@ const initTypewriterManager = () => {
// 双重保险,确保滚动生效
setTimeout(() => {
scrollTop.value = 99999 + Math.random();
}, 5);
}, 20);
});
},
// 内容更新时的回调
@@ -492,7 +512,7 @@ const addNoticeListener = () => {
if (value && value.length > 0) {
commonType = "Command.quickBooking";
sendMessage(value, true);
scrollToBottom();
setTimeoutScrollToBottom();
}
});
};
@@ -564,8 +584,6 @@ const sendMessage = (message, isInstruct = false) => {
// 通用WebSocket消息发送函数
const sendWebSocketMessage = (messageType, messageContent, options = {}) => {
console.error("WebSocket未连接");
const args = {
conversationId: conversationId.value,
agentId: agentId.value,
@@ -589,7 +607,6 @@ const sendWebSocketMessage = (messageType, messageContent, options = {}) => {
const sendChat = (message, isInstruct = false) => {
if (!webSocketManager || !webSocketManager.isConnected()) {
console.error("WebSocket未连接");
return;
}