feat: 增加问卷调查组件
This commit is contained in:
@@ -33,6 +33,9 @@
|
||||
<AddCarCrad v-else-if="
|
||||
item.toolCall.componentName === CompName.enterLicensePlateCard
|
||||
" :toolCall="item.toolCall" />
|
||||
<SurveyQuestionnaire v-else-if="
|
||||
item.toolCall.componentName === CompName.callSurveyQuestionnaire
|
||||
" :toolCall="item.toolCall" />
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
@@ -99,6 +102,7 @@ import DetailCardCompontent from "../../module/DetailCardCompontent/index.vue";
|
||||
import CreateServiceOrder from "@/components/CreateServiceOrder/index.vue";
|
||||
import Feedback from "@/components/Feedback/index.vue";
|
||||
import AddCarCrad from "@/components/AddCarCrad/index.vue";
|
||||
import SurveyQuestionnaire from "@/components/SurveyQuestionnaire/index.vue";
|
||||
import { mainPageData } from "@/request/api/MainPageDataApi";
|
||||
import {
|
||||
conversationMsgList,
|
||||
@@ -658,31 +662,31 @@ const sendWebSocketMessage = async (messageType, messageContent, options = {}) =
|
||||
try {
|
||||
const raw = webSocketManager.sendMessage(args);
|
||||
// 兼容可能返回同步布尔或 Promise 的实现
|
||||
const result = await Promise.resolve(raw);
|
||||
if (result) {
|
||||
console.log(`WebSocket消息已发送 [类型:${messageType}]:`, args);
|
||||
return true;
|
||||
}
|
||||
const result = await Promise.resolve(raw);
|
||||
if (result) {
|
||||
console.log(`WebSocket消息已发送 [类型:${messageType}]:`, args);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 若返回 false,消息可能已经被 manager 入队并触发连接流程。
|
||||
// 在这种情况下避免立即当作失败处理,而是等待短暂时间以观察连接是否建立并由 manager 发送队列。
|
||||
console.warn('webSocketManager.sendMessage 返回 false,等待连接或队列发送...', { attempt, args });
|
||||
const waitForConnectMs = typeof options.waitForConnectMs === 'number' ? options.waitForConnectMs : 5000;
|
||||
if (webSocketManager && typeof webSocketManager.isConnected === 'function' && !webSocketManager.isConnected()) {
|
||||
const startTs = Date.now();
|
||||
while (Date.now() - startTs < waitForConnectMs) {
|
||||
await sleep(200);
|
||||
if (webSocketManager.isConnected()) {
|
||||
// 给 manager 一点时间处理队列并发送
|
||||
await sleep(150);
|
||||
console.log('检测到 manager 已连接,假定队列消息已发送', args);
|
||||
return true;
|
||||
}
|
||||
// 若返回 false,消息可能已经被 manager 入队并触发连接流程。
|
||||
// 在这种情况下避免立即当作失败处理,而是等待短暂时间以观察连接是否建立并由 manager 发送队列。
|
||||
console.warn('webSocketManager.sendMessage 返回 false,等待连接或队列发送...', { attempt, args });
|
||||
const waitForConnectMs = typeof options.waitForConnectMs === 'number' ? options.waitForConnectMs : 5000;
|
||||
if (webSocketManager && typeof webSocketManager.isConnected === 'function' && !webSocketManager.isConnected()) {
|
||||
const startTs = Date.now();
|
||||
while (Date.now() - startTs < waitForConnectMs) {
|
||||
await sleep(200);
|
||||
if (webSocketManager.isConnected()) {
|
||||
// 给 manager 一点时间处理队列并发送
|
||||
await sleep(150);
|
||||
console.log('检测到 manager 已连接,假定队列消息已发送', args);
|
||||
return true;
|
||||
}
|
||||
console.warn('等待 manager 建连超时,进入重试逻辑', { waitForConnectMs, args });
|
||||
} else {
|
||||
console.warn('sendMessage 返回 false 但 manager 看起来已连接或不可用,继续重试', { args });
|
||||
}
|
||||
console.warn('等待 manager 建连超时,进入重试逻辑', { waitForConnectMs, args });
|
||||
} else {
|
||||
console.warn('sendMessage 返回 false 但 manager 看起来已连接或不可用,继续重试', { args });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('发送WebSocket消息异常:', error, args);
|
||||
}
|
||||
@@ -802,11 +806,11 @@ const stopRequest = async () => {
|
||||
}
|
||||
|
||||
if (chatMsgList.value[aiMsgIndex] &&
|
||||
chatMsgList.value[aiMsgIndex].msgType === MessageRole.AI) {
|
||||
chatMsgList.value[aiMsgIndex].msgType === MessageRole.AI) {
|
||||
chatMsgList.value[aiMsgIndex].isLoading = false;
|
||||
if (chatMsgList.value[aiMsgIndex].msg &&
|
||||
chatMsgList.value[aiMsgIndex].msg.trim() &&
|
||||
!chatMsgList.value[aiMsgIndex].msg.startsWith("加载中")) {
|
||||
chatMsgList.value[aiMsgIndex].msg.trim() &&
|
||||
!chatMsgList.value[aiMsgIndex].msg.startsWith("加载中")) {
|
||||
// 保留已显示内容
|
||||
} else {
|
||||
chatMsgList.value[aiMsgIndex].msg = "请求已停止";
|
||||
|
||||
Reference in New Issue
Block a user