feat: websocket连接成功
This commit is contained in:
@@ -24,12 +24,12 @@
|
||||
</div>
|
||||
|
||||
<!-- AI 标识 -->
|
||||
<div v-if="msg.messageRole === MessageRole.AI" class="mt-2 text-xs text-gray-400 ">
|
||||
<div v-if="msg.messageRole === MessageRole.AI && msg.finished" class="mt-2 text-xs text-gray-400 ">
|
||||
本回答由 AI 生成
|
||||
</div>
|
||||
|
||||
<!-- AI 操作按钮 -->
|
||||
<div v-if="msg.messageRole === MessageRole.AI"
|
||||
<div v-if="msg.messageRole === MessageRole.AI && msg.finished"
|
||||
class="mt-4 text-gray-500 flex items-center justify-between gap-4 ">
|
||||
<RiFileCopyLine size="16px" @click="copyFileClick(msg)" />
|
||||
<div class="flex items-center gap-4">
|
||||
@@ -38,7 +38,6 @@
|
||||
<RiThumbUpLine size="16px" @click="thumbUpClick(msg)" />
|
||||
<RiThumbDownLine size="16px" @click="thumbDownClick(msg)" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -318,6 +317,7 @@ const initWebSocket = async () => {
|
||||
|
||||
// 处理WebSocket消息
|
||||
const handleWebSocketMessage = (data: any) => {
|
||||
console.log("收到WebSocket消息:", data);
|
||||
// 验证关键字段(若服务端传回 conversationId/agentId,则校验是否属于当前会话)
|
||||
if (data.conversationId && data.conversationId !== conversationId.value) {
|
||||
console.warn("收到不属于当前会话的消息,忽略", data.conversationId);
|
||||
@@ -374,6 +374,7 @@ const handleWebSocketMessage = (data: any) => {
|
||||
|
||||
// 处理完成状态
|
||||
if (data.finish) {
|
||||
chatMsgList.value[aiMsgIndex].finished = data.finish;
|
||||
const msg = chatMsgList.value[aiMsgIndex].messageContent;
|
||||
if (!msg || chatMsgList.value[aiMsgIndex].isLoading) {
|
||||
chatMsgList.value[aiMsgIndex].messageContent = "未获取到内容,请重试";
|
||||
|
||||
Reference in New Issue
Block a user