feat: 房间号的文案改
This commit is contained in:
@@ -19,8 +19,8 @@
|
||||
<view
|
||||
class="bg-F5F7FA border-box flex flex-items-center p-12 rounded-10 font-size-14 color-171717 mb-12"
|
||||
>
|
||||
<text class="font-500 line-height-22 mr-20">房间号</text>
|
||||
<input placeholder="请填写房间号" v-model="roomId" />
|
||||
<text class="font-500 line-height-22 mr-20">所在位置</text>
|
||||
<input placeholder="请填写所在位置" v-model="roomId" />
|
||||
</view>
|
||||
|
||||
<view
|
||||
@@ -90,7 +90,7 @@
|
||||
<view v-else class="border-box card-content flex flex-items-center p-12">
|
||||
<view class="border-box left flex-full pr-20">
|
||||
<view class="font-size-12 color-525866 line-height-20 mb-4"
|
||||
>房间号:{{ roomId }}</view
|
||||
>所在位置:{{ roomId }}</view
|
||||
>
|
||||
<view class="font-size-12 color-525866 line-height-20 mb-4"
|
||||
>联系方式: {{ contactPhone }}</view
|
||||
@@ -210,7 +210,7 @@ const handleCall = async () => {
|
||||
}
|
||||
|
||||
if (!roomId.value.trim()) {
|
||||
uni.showToast({ title: "请填写房间号", icon: "none" });
|
||||
uni.showToast({ title: "请填写所在位置", icon: "none" });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
:scroll-with-animation="true" @scroll="handleScroll" @scrolltolower="handleScrollToLower">
|
||||
<!-- welcome栏 -->
|
||||
<ChatTopWelcome ref="welcomeRef" :mainPageDataModel="mainPageDataModel" />
|
||||
<NoticeMessage></NoticeMessage>
|
||||
<NoticeMessage v-if="notitceConent"></NoticeMessage>
|
||||
|
||||
<view class="area-msg-list-content" v-for="item in chatMsgList" :key="item.msgId" :id="item.msgId">
|
||||
<template v-if="item.msgType === MessageRole.AI">
|
||||
@@ -32,7 +32,7 @@
|
||||
item.toolCall && item.toolCall.componentName === CompName.mapCard
|
||||
" />
|
||||
<GeneratorPhotoComponent v-else-if="
|
||||
item.toolCall && item.toolCall.componentName === CompName.generateMessageId
|
||||
item.toolCall && item.toolCall.componentName === CompName.aigcPhotoGeneratorCard
|
||||
" />
|
||||
<Feedback v-else-if="
|
||||
item.toolCall && item.toolCall.componentName === CompName.feedbackCard
|
||||
@@ -95,7 +95,7 @@ import {
|
||||
NOTICE_EVENT_LOGOUT,
|
||||
NOTICE_EVENT_LOGIN_SUCCESS,
|
||||
} from "@/constant/constant";
|
||||
import { MessageRole, CompName } from "@/model/ChatModel";
|
||||
import { MessageRole, MessageType, CompName, Command } from "@/model/ChatModel";
|
||||
import ChatTopWelcome from "../ChatTopWelcome/index.vue";
|
||||
import NoticeMessage from "../NoticeMessage/index.vue";
|
||||
import ChatTopNavBar from "../ChatTopNavBar/index.vue";
|
||||
@@ -135,6 +135,7 @@ const statusBarHeight = ref(20);
|
||||
const inputAreaRef = ref(null);
|
||||
const topNavBarRef = ref();
|
||||
const welcomeRef = ref();
|
||||
const notitceConent = ref("");
|
||||
|
||||
const holdKeyboardTimer = ref(null);
|
||||
/// focus时,点击页面的时候不收起键盘
|
||||
@@ -419,6 +420,16 @@ const initWebSocket = async () => {
|
||||
console.log("WebSocket连接成功");
|
||||
// 重置会话状态
|
||||
isSessionActive.value = false; // 连接成功时重置会话状态,避免影响新消息发送
|
||||
|
||||
// 连接成功后发送 welcome 消息 (messageType=4)
|
||||
try {
|
||||
// fire-and-forget, sendWebSocketMessage 会处理重连与队列
|
||||
sendWebSocketMessage(MessageType.notice, Command.welcome, { tryReconnect: true, messageId:IdUtils.generateMessageId() }).catch((e) => {
|
||||
console.warn('发送 Command.welcome 消息失败:', e);
|
||||
});
|
||||
} catch (e) {
|
||||
console.warn('发送 Command.welcome 消息时异常:', e);
|
||||
}
|
||||
},
|
||||
|
||||
// 连接断开回调
|
||||
@@ -475,6 +486,15 @@ const handleWebSocketMessage = (data) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// Welcome 消息 (messageType=4):用于更新顶部欢迎栏内容
|
||||
if (data.messageType && data.messageType === 'broadcast') {
|
||||
console.log("收到 welcome 类型消息:", data);
|
||||
if (data.content) {
|
||||
notitceConent.value = data.content;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let aiMsgIndex = -1;
|
||||
// Prefer matching by replyMessageId if provided
|
||||
if (data.replyMessageId) {
|
||||
@@ -732,7 +752,7 @@ const sendWebSocketMessage = async (messageType, messageContent, options = {}) =
|
||||
const args = {
|
||||
conversationId: conversationId.value,
|
||||
agentId: agentId.value,
|
||||
messageType: String(messageType), // 消息类型 0-对话 1-指令 2-中断停止 3-心跳检测
|
||||
messageType: String(messageType), // 消息类型 0-对话 1-指令 2-中断停止 3-心跳检测 4-消息
|
||||
messageContent: messageContent,
|
||||
messageId: options.messageId || currentSessionMessageId,
|
||||
};
|
||||
@@ -839,7 +859,7 @@ const sendChat = async (message, isInstruct = false) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const messageType = isInstruct ? 1 : 0;
|
||||
const messageType = isInstruct ? MessageType.command : MessageType.dialog;
|
||||
const messageContent = isInstruct ? messageCommonType : message;
|
||||
// 生成 messageId 并保存到当前会话变量(stopRequest 可能使用)
|
||||
currentSessionMessageId = IdUtils.generateMessageId();
|
||||
@@ -902,7 +922,7 @@ const stopRequest = async () => {
|
||||
|
||||
// 发送中断消息给服务器 (messageType=2),带上当前 messageId
|
||||
try {
|
||||
await sendWebSocketMessage(2, "stop_request", { messageId: currentSessionMessageId, silent: true });
|
||||
await sendWebSocketMessage(MessageType.stop, "stop_request", { messageId: currentSessionMessageId, silent: true });
|
||||
} catch (e) {
|
||||
console.warn("stopRequest send failed:", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user