feat: 消息的调整
This commit is contained in:
@@ -10,23 +10,32 @@
|
||||
<!-- AI avatar -->
|
||||
<ChatAvatar v-if="msg.messageRole === MessageRole.AI" :src="aiAvatar" />
|
||||
|
||||
<!-- 消息气泡 -->
|
||||
<div class="max-w-[70%]">
|
||||
<!-- 名字和时间 -->
|
||||
<ChatNameTime :showReverse="msg.messageRole === MessageRole.ME" />
|
||||
<!-- 自己 发的消息 -->
|
||||
<ChatRoleMe v-if="msg.messageRole === MessageRole.ME" :msg="msg" >
|
||||
<template #header>
|
||||
<!-- 名字和时间 -->
|
||||
<ChatNameTime :showReverse="true" />
|
||||
</template>
|
||||
</ChatRoleMe>
|
||||
|
||||
<!-- AI 发的消息 -->
|
||||
<ChatRoleAI v-if="msg.messageRole === MessageRole.AI" :msg="msg" />
|
||||
<!-- AI 发的消息 -->
|
||||
<ChatRoleAI v-if="msg.messageRole === MessageRole.AI" :msg="msg">
|
||||
<template #header>
|
||||
<!-- 名字和时间 -->
|
||||
<ChatNameTime :showReverse="false" />
|
||||
</template>
|
||||
|
||||
<!-- 自己 发的消息 -->
|
||||
<ChatRoleMe v-if="msg.messageRole === MessageRole.ME" :msg="msg" />
|
||||
<template #footer>
|
||||
<!-- 问题标签 -->
|
||||
<ChatAttach v-if="msg.question && msg.question.length > 0" :question="msg.question" @select="onTagSelect" />
|
||||
|
||||
<!-- AI 标识 -->
|
||||
<ChatAIMark v-if="msg.messageRole === MessageRole.AI && msg.finished" />
|
||||
<!-- AI 标识 -->
|
||||
<ChatAIMark v-if="msg.finished" />
|
||||
|
||||
<!-- AI 操作按钮 -->
|
||||
<ChatOperation v-if="msg.messageRole === MessageRole.AI && msg.finished" :msg="msg" />
|
||||
</div>
|
||||
<!-- AI 操作按钮 -->
|
||||
<ChatOperation v-if="msg.finished" :msg="msg" />
|
||||
</template>
|
||||
</ChatRoleAI>
|
||||
|
||||
<!-- User avatar -->
|
||||
<ChatAvatar v-if="msg.messageRole === MessageRole.ME" :src="userAvatar" />
|
||||
@@ -76,13 +85,13 @@ import ChatRoleAI from './components/ChatRoleAI.vue';
|
||||
import ChatRoleMe from './components/ChatRoleMe.vue';
|
||||
import ChatAIMark from './components/ChatAIMark.vue';
|
||||
import ChatNameTime from './components/ChatNameTime.vue';
|
||||
import ChatAttach from './components/ChatAttach.vue';
|
||||
|
||||
import { Session } from '../../utils/storage';
|
||||
|
||||
import userAvatar from '@assets/images/login/user_icon.png';
|
||||
import aiAvatar from '@assets/images/login/blue_logo.png';
|
||||
|
||||
|
||||
// 列表滚动容器引用
|
||||
const listRef = ref<HTMLElement | null>(null);
|
||||
|
||||
@@ -173,7 +182,6 @@ const handleReplyText = (text: string) => {
|
||||
// 是发送指令消息
|
||||
const handleReplyInstruct = async (message: string, type: string) => {
|
||||
// await checkToken();
|
||||
|
||||
commonTypeMessage = type;
|
||||
// 重置消息状态,准备接收新的AI回复
|
||||
resetMessageState();
|
||||
@@ -181,6 +189,11 @@ const handleReplyInstruct = async (message: string, type: string) => {
|
||||
setTimeoutScrollToBottom();
|
||||
};
|
||||
|
||||
/// 选择标签事件
|
||||
const onTagSelect = (text: string) => {
|
||||
handleReplyText(text);
|
||||
};
|
||||
|
||||
/// 添加附件按钮事件
|
||||
const addAttachmentAction = () => {
|
||||
console.log("添加附件");
|
||||
@@ -406,6 +419,7 @@ const handleWebSocketMessage = (data: any) => {
|
||||
|
||||
// 处理question
|
||||
if (data.question && data.question.length > 0) {
|
||||
console.log("收到问题标签:", data.question);
|
||||
chatMsgList.value[aiMsgIndex].question = data.question;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user