|
|
@@ -6,14 +6,14 @@
|
|
|
class="icon-expand"
|
|
|
:style="{
|
|
|
backgroundColor: drawerVisible ? '#44449c' : '#7F70C840',
|
|
|
- left: drawerVisible ? '18%' : '0'
|
|
|
+ left: drawerVisible ? '18%' : '0',
|
|
|
}"
|
|
|
@click="toggleDrawer"
|
|
|
>
|
|
|
<span
|
|
|
class="vertical-lines"
|
|
|
:style="{
|
|
|
- color: drawerVisible ? '#8a78d0' : 'white'
|
|
|
+ color: drawerVisible ? '#8a78d0' : 'white',
|
|
|
}"
|
|
|
>||</span
|
|
|
>
|
|
|
@@ -80,10 +80,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, onMounted, computed } from 'vue'
|
|
|
-import { CreateDialogue, sendChatMessageStream } from '@/api/questions.js'
|
|
|
-import { useRouter, useRoute } from 'vue-router'
|
|
|
-import MarkdownView from '@/components/MarkdownView/index.vue'
|
|
|
+import { ref, onMounted, computed,watch } from "vue";
|
|
|
+import { CreateDialogue, sendChatMessageStream } from "@/api/questions.js";
|
|
|
+import { useRouter, useRoute } from "vue-router";
|
|
|
+import { saveRecord } from '@/api/personalized/index.js'
|
|
|
+
|
|
|
+
|
|
|
+import MarkdownView from "@/components/MarkdownView/index.vue";
|
|
|
import {
|
|
|
Document,
|
|
|
Menu as IconMenu,
|
|
|
@@ -96,264 +99,283 @@ import {
|
|
|
Expand,
|
|
|
Picture,
|
|
|
Tickets,
|
|
|
- User
|
|
|
-} from '@element-plus/icons-vue'
|
|
|
+ User,
|
|
|
+} from "@element-plus/icons-vue";
|
|
|
|
|
|
-import DefaultMessage from '@/components/DefaultMessage/index.vue'
|
|
|
+import DefaultMessage from "@/components/DefaultMessage/index.vue";
|
|
|
|
|
|
// 导入图片
|
|
|
// import question from '@/assets/icon/question.png'
|
|
|
// import painting from '@/assets/icon/painting.png'
|
|
|
// import human from '@/assets/icon/human.png'
|
|
|
|
|
|
-import LeftPanel from '@/components/LeftPanel.vue'
|
|
|
-const leftPanelRef = ref(null)
|
|
|
+import LeftPanel from "@/components/LeftPanel.vue";
|
|
|
+const leftPanelRef = ref(null);
|
|
|
+
|
|
|
|
|
|
// 默认消息控制
|
|
|
-const showDefaultMessages = ref(true)
|
|
|
-const handleDefaultMessageSelect = message => {
|
|
|
- prompt.value = message
|
|
|
- handleSendByButton()
|
|
|
- showDefaultMessages.value = false
|
|
|
-}
|
|
|
+const showDefaultMessages = ref(true);
|
|
|
+const handleDefaultMessageSelect = (message) => {
|
|
|
+ prompt.value = message;
|
|
|
+ handleSendByButton();
|
|
|
+ showDefaultMessages.value = false;
|
|
|
+};
|
|
|
|
|
|
// 添加抽屉显示状态
|
|
|
-const drawerVisible = ref(true)
|
|
|
+const drawerVisible = ref(true);
|
|
|
// 添加切换抽屉显示状态的函数
|
|
|
const toggleDrawer = () => {
|
|
|
- drawerVisible.value = !drawerVisible.value
|
|
|
-}
|
|
|
+ drawerVisible.value = !drawerVisible.value;
|
|
|
+};
|
|
|
|
|
|
// 处理菜单展开和关闭
|
|
|
-const handleOpen = () => {}
|
|
|
-const handleClose = () => {}
|
|
|
+const handleOpen = () => {};
|
|
|
+const handleClose = () => {};
|
|
|
|
|
|
// 返回上一页
|
|
|
const goBack = () => {
|
|
|
- router.push('/ai-laboratory')
|
|
|
-}
|
|
|
-const router = useRouter()
|
|
|
-const route = useRoute()
|
|
|
+ router.push("/ai-laboratory");
|
|
|
+};
|
|
|
+const router = useRouter();
|
|
|
+const route = useRoute();
|
|
|
|
|
|
-const personId = ref(route.query.id)
|
|
|
-const personName = ref(route.query.name)
|
|
|
-const personIntroduce = ref(route.query.message)
|
|
|
-const personImage = ref(route.query.image)
|
|
|
+const personId = ref(route.query.id);
|
|
|
+const personName = ref(route.query.name);
|
|
|
+const personIntroduce = ref(route.query.message);
|
|
|
+const personImage = ref(route.query.image);
|
|
|
|
|
|
// 渲染实验室携带的人物形象图片
|
|
|
-const selectedImage = ref('')
|
|
|
+const selectedImage = ref("");
|
|
|
onMounted(() => {
|
|
|
- const image = route.query.image
|
|
|
+ const image = route.query.image;
|
|
|
if (image) {
|
|
|
- selectedImage.value = image
|
|
|
+ selectedImage.value = image;
|
|
|
}
|
|
|
-})
|
|
|
+});
|
|
|
|
|
|
// 聊天对话
|
|
|
-const activeConversationModelPath = ref(null) // 选中的对话编号
|
|
|
-const activeConversationId = ref(null) // 选中的对话编号
|
|
|
-const activeConversation = ref(null) // 选中的 Conversation
|
|
|
-const conversationInProgress = ref(false) // 对话是否正在进行中。目前只有【发送】消息时,会更新为 true,避免切换对话、删除对话等操作,导致 stream 中断
|
|
|
+const activeConversationModelPath = ref(null); // 选中的对话编号
|
|
|
+const activeConversationId = ref(null); // 选中的对话编号
|
|
|
+const activeConversation = ref(null); // 选中的 Conversation
|
|
|
+const conversationInProgress = ref(false); // 对话是否正在进行中。目前只有【发送】消息时,会更新为 true,避免切换对话、删除对话等操作,导致 stream 中断
|
|
|
|
|
|
// 消息列表
|
|
|
-const messageRef = ref()
|
|
|
-const activeMessageList = ref([]) // 选中对话的消息列表
|
|
|
-const activeMessageListLoading = ref(false) // activeMessageList 是否正在加载中
|
|
|
-const activeMessageListLoadingTimer = ref() // activeMessageListLoading Timer 定时器。如果加载速度很快,就不进入加载中
|
|
|
+const messageRef = ref();
|
|
|
+const activeMessageList = ref([]); // 选中对话的消息列表
|
|
|
+const activeMessageListLoading = ref(false); // activeMessageList 是否正在加载中
|
|
|
+const activeMessageListLoadingTimer = ref(); // activeMessageListLoading Timer 定时器。如果加载速度很快,就不进入加载中
|
|
|
// 消息滚动
|
|
|
-const textSpeed = ref(50) // Typing speed in milliseconds
|
|
|
-const textRoleRunning = ref(false) // Typing speed in milliseconds
|
|
|
+const textSpeed = ref(50); // Typing speed in milliseconds
|
|
|
+const textRoleRunning = ref(false); // Typing speed in milliseconds
|
|
|
|
|
|
// 发送消息输入框
|
|
|
-const isComposing = ref(false) // 判断用户是否在输入
|
|
|
-const conversationInAbortController = ref() // 对话进行中 abort 控制器(控制 stream 对话)
|
|
|
-const inputTimeout = ref() // 处理输入中回车的定时器
|
|
|
-const prompt = ref() // prompt
|
|
|
-const enableContext = ref(true) // 是否开启上下文
|
|
|
+const isComposing = ref(false); // 判断用户是否在输入
|
|
|
+const conversationInAbortController = ref(); // 对话进行中 abort 控制器(控制 stream 对话)
|
|
|
+const inputTimeout = ref(); // 处理输入中回车的定时器
|
|
|
+const prompt = ref(); // prompt
|
|
|
+const enableContext = ref(true); // 是否开启上下文
|
|
|
// 接收 Stream 消息
|
|
|
-const receiveMessageFullText = ref('')
|
|
|
-const receiveMessageDisplayedText = ref('')
|
|
|
+const receiveMessageFullText = ref("");
|
|
|
+const receiveMessageDisplayedText = ref("");
|
|
|
|
|
|
// =========== 【聊天对话】相关 ===========
|
|
|
|
|
|
/** 获取对话信息 */
|
|
|
-const getConversation = async id => {
|
|
|
+const getConversation = async (id) => {
|
|
|
if (!id) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- const conversation = ref({})
|
|
|
+ const conversation = ref({});
|
|
|
if (!conversation) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- conversation.systemMessage = personIntroduce.value
|
|
|
- activeConversation.value = conversation
|
|
|
+ conversation.systemMessage = personIntroduce.value;
|
|
|
+ activeConversation.value = conversation;
|
|
|
// activeConversationId.value = personId.value
|
|
|
- activeConversationModelPath.value = personImage.value
|
|
|
-}
|
|
|
+ activeConversationModelPath.value = personImage.value;
|
|
|
+};
|
|
|
|
|
|
// =========== 【发送消息】相关 ===========
|
|
|
|
|
|
/** 处理来自 keydown 的发送消息 */
|
|
|
-const handleSendByKeydown = async event => {
|
|
|
+const handleSendByKeydown = async (event) => {
|
|
|
// 判断用户是否在输入
|
|
|
if (isComposing.value) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
// 进行中不允许发送
|
|
|
if (conversationInProgress.value) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- const content = prompt.value?.trim()
|
|
|
- if (event.key === 'Enter') {
|
|
|
+ const content = prompt.value?.trim();
|
|
|
+ if (event.key === "Enter") {
|
|
|
if (event.shiftKey) {
|
|
|
// 插入换行
|
|
|
- prompt.value += '\r\n'
|
|
|
- event.preventDefault() // 防止默认的换行行为
|
|
|
+ prompt.value += "\r\n";
|
|
|
+ event.preventDefault(); // 防止默认的换行行为
|
|
|
} else {
|
|
|
// 发送消息
|
|
|
- await doSendMessage(content)
|
|
|
- event.preventDefault() // 防止默认的提交行为
|
|
|
+ await doSendMessage(content);
|
|
|
+ event.preventDefault(); // 防止默认的提交行为
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 处理来自【发送】按钮的发送消息 */
|
|
|
const handleSendByButton = () => {
|
|
|
- doSendMessage(prompt.value?.trim())
|
|
|
-}
|
|
|
+ doSendMessage(prompt.value?.trim());
|
|
|
+};
|
|
|
|
|
|
/** 处理 prompt 输入变化 */
|
|
|
-const handlePromptInput = event => {
|
|
|
+const handlePromptInput = (event) => {
|
|
|
// 非输入法 输入设置为 true
|
|
|
if (!isComposing.value) {
|
|
|
// 回车 event data 是 null
|
|
|
if (event.data == null) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- isComposing.value = true
|
|
|
+ isComposing.value = true;
|
|
|
}
|
|
|
// 清理定时器
|
|
|
if (inputTimeout.value) {
|
|
|
- clearTimeout(inputTimeout.value)
|
|
|
+ clearTimeout(inputTimeout.value);
|
|
|
}
|
|
|
// 重置定时器
|
|
|
inputTimeout.value = setTimeout(() => {
|
|
|
- isComposing.value = false
|
|
|
- }, 400)
|
|
|
-}
|
|
|
+ isComposing.value = false;
|
|
|
+ }, 400);
|
|
|
+};
|
|
|
// TODO注:是不是可以通过 @keydown.enter、@keydown.shift.enter 来实现,回车发送、shift+回车换行;主要看看,是不是可以简化 isComposing 相关的逻辑
|
|
|
const onCompositionstart = () => {
|
|
|
- isComposing.value = true
|
|
|
-}
|
|
|
+ isComposing.value = true;
|
|
|
+};
|
|
|
const onCompositionend = () => {
|
|
|
setTimeout(() => {
|
|
|
- isComposing.value = false
|
|
|
- }, 200)
|
|
|
-}
|
|
|
+ isComposing.value = false;
|
|
|
+ }, 200);
|
|
|
+};
|
|
|
+
|
|
|
+// 保存记录
|
|
|
+// 年级ID相关
|
|
|
+const gradeId = ref('')
|
|
|
+
|
|
|
+onMounted(async () => {
|
|
|
+ gradeId.value = localStorage.getItem('selectedGradeId') || ''
|
|
|
+ console.log(gradeId.value);
|
|
|
+ try{
|
|
|
+ const res = await saveRecord({
|
|
|
+ brpNjId: gradeId.value,
|
|
|
+ brpType: "aiCount",
|
|
|
+ brpProgress: 1
|
|
|
+ });
|
|
|
+ console.log(res);
|
|
|
+ }catch(error){
|
|
|
+ console.error('保存记录失败:', error);
|
|
|
+ }
|
|
|
+});
|
|
|
|
|
|
/** 真正执行【发送】消息操作 */
|
|
|
-const doSendMessage = async content => {
|
|
|
+const doSendMessage = async (content) => {
|
|
|
// 校验
|
|
|
if (content.length < 1) {
|
|
|
- console.error('发送失败,原因:内容为空!')
|
|
|
- return
|
|
|
+ console.error("发送失败,原因:内容为空!");
|
|
|
+ return;
|
|
|
}
|
|
|
-
|
|
|
if (activeConversationId.value == null) {
|
|
|
- console.error('还没创建对话,不能发送!')
|
|
|
- return
|
|
|
+ console.error("还没创建对话,不能发送!");
|
|
|
+ return;
|
|
|
}
|
|
|
// 清空输入框
|
|
|
- prompt.value = ''
|
|
|
+ prompt.value = "";
|
|
|
// 执行发送
|
|
|
await doSendMessageStream({
|
|
|
conversationId: activeConversationId.value,
|
|
|
- content: content
|
|
|
- })
|
|
|
-}
|
|
|
+ content: content,
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
/** 真正执行【发送】消息操作 */
|
|
|
-const doSendMessageStream = async userMessage => {
|
|
|
+const doSendMessageStream = async (userMessage) => {
|
|
|
// 创建 AbortController 实例,以便中止请求
|
|
|
- conversationInAbortController.value = new AbortController()
|
|
|
+ conversationInAbortController.value = new AbortController();
|
|
|
// 标记对话进行中
|
|
|
- conversationInProgress.value = true
|
|
|
+ conversationInProgress.value = true;
|
|
|
// 设置为空
|
|
|
- receiveMessageFullText.value = ''
|
|
|
+ receiveMessageFullText.value = "";
|
|
|
|
|
|
try {
|
|
|
// 1.1 先添加两个假数据,等 stream 返回再替换
|
|
|
activeMessageList.value.push({
|
|
|
id: -1,
|
|
|
conversationId: activeConversationId.value,
|
|
|
- type: 'user',
|
|
|
+ type: "user",
|
|
|
content: userMessage.content,
|
|
|
- createTime: new Date()
|
|
|
- })
|
|
|
+ createTime: new Date(),
|
|
|
+ });
|
|
|
activeMessageList.value.push({
|
|
|
id: -2,
|
|
|
conversationId: activeConversationId.value,
|
|
|
- type: 'assistant',
|
|
|
- content: '思考中...',
|
|
|
- createTime: new Date()
|
|
|
- })
|
|
|
+ type: "assistant",
|
|
|
+ content: "思考中...",
|
|
|
+ createTime: new Date(),
|
|
|
+ });
|
|
|
|
|
|
// 1.3 开始滚动
|
|
|
- textRoll()
|
|
|
+ textRoll();
|
|
|
|
|
|
// 2. 发送 event stream
|
|
|
- let isFirstChunk = true // 是否是第一个 chunk 消息段
|
|
|
+ let isFirstChunk = true; // 是否是第一个 chunk 消息段
|
|
|
|
|
|
await sendChatMessageStream(
|
|
|
userMessage.conversationId,
|
|
|
userMessage.content,
|
|
|
conversationInAbortController.value,
|
|
|
enableContext.value,
|
|
|
- async res => {
|
|
|
- const { code, data, msg } = JSON.parse(res.data)
|
|
|
+ async (res) => {
|
|
|
+ const { code, data, msg } = JSON.parse(res.data);
|
|
|
if (code !== 0) {
|
|
|
- console.log(`对话异常! ${msg}`)
|
|
|
- return
|
|
|
+ console.log(`对话异常! ${msg}`);
|
|
|
+ return;
|
|
|
}
|
|
|
// 如果内容为空,就不处理。
|
|
|
// if (data.receive.content === '') {
|
|
|
// return
|
|
|
// }
|
|
|
receiveMessageFullText.value =
|
|
|
- receiveMessageFullText.value + data.receive.content
|
|
|
+ receiveMessageFullText.value + data.receive.content;
|
|
|
// 首次返回需要添加一个 message 到页面,后面的都是更新
|
|
|
if (isFirstChunk) {
|
|
|
- isFirstChunk = false
|
|
|
+ isFirstChunk = false;
|
|
|
// 弹出两个假数据
|
|
|
- activeMessageList.value.pop()
|
|
|
- activeMessageList.value.pop()
|
|
|
+ activeMessageList.value.pop();
|
|
|
+ activeMessageList.value.pop();
|
|
|
// 更新返回的数据
|
|
|
- activeMessageList.value.push(data.send)
|
|
|
- activeMessageList.value.push(data.receive)
|
|
|
+ activeMessageList.value.push(data.send);
|
|
|
+ activeMessageList.value.push(data.receive);
|
|
|
}
|
|
|
},
|
|
|
- error => {
|
|
|
- console.log(`对话异常! ${error}`)
|
|
|
- stopStream()
|
|
|
+ (error) => {
|
|
|
+ console.log(`对话异常! ${error}`);
|
|
|
+ stopStream();
|
|
|
// 需要抛出异常,禁止重试
|
|
|
- throw error
|
|
|
+ throw error;
|
|
|
},
|
|
|
() => {
|
|
|
- stopStream()
|
|
|
+ stopStream();
|
|
|
}
|
|
|
- )
|
|
|
+ );
|
|
|
} catch {}
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 停止 stream 流式调用 */
|
|
|
const stopStream = async () => {
|
|
|
// tip:如果 stream 进行中的 message,就需要调用 controller 结束
|
|
|
if (conversationInAbortController.value) {
|
|
|
- conversationInAbortController.value.abort()
|
|
|
+ conversationInAbortController.value.abort();
|
|
|
}
|
|
|
// 设置为 false
|
|
|
- conversationInProgress.value = false
|
|
|
-}
|
|
|
+ conversationInProgress.value = false;
|
|
|
+};
|
|
|
|
|
|
/**
|
|
|
* 消息列表
|
|
|
@@ -362,112 +384,116 @@ const stopStream = async () => {
|
|
|
*/
|
|
|
const messageList = computed(() => {
|
|
|
if (activeMessageList.value.length > 0) {
|
|
|
- return activeMessageList.value
|
|
|
+ return activeMessageList.value;
|
|
|
}
|
|
|
|
|
|
// 没有消息时,如果有 systemMessage 则展示它
|
|
|
if (activeConversation.value?.systemMessage) {
|
|
|
let systemMessage = {
|
|
|
id: 0,
|
|
|
- type: 'system',
|
|
|
- content: activeConversation.value.systemMessage
|
|
|
- }
|
|
|
- activeMessageList.value.push(systemMessage)
|
|
|
- return [systemMessage]
|
|
|
+ type: "system",
|
|
|
+ content: activeConversation.value.systemMessage,
|
|
|
+ };
|
|
|
+ activeMessageList.value.push(systemMessage);
|
|
|
+ return [systemMessage];
|
|
|
}
|
|
|
- return []
|
|
|
-})
|
|
|
+ return [];
|
|
|
+});
|
|
|
|
|
|
// ============== 【消息滚动】相关 =============
|
|
|
|
|
|
/** 滚动到 message 底部 */
|
|
|
-const scrollToBottom = async isIgnore => {
|
|
|
+const scrollToBottom = async (isIgnore) => {
|
|
|
// if (messageRef.value) {
|
|
|
// messageRef.value.scrollToBottom(isIgnore)
|
|
|
// }
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 自提滚动效果 */
|
|
|
const textRoll = async () => {
|
|
|
- let index = 0
|
|
|
+ let index = 0;
|
|
|
try {
|
|
|
// 只能执行一次
|
|
|
if (textRoleRunning.value) {
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
// 设置状态
|
|
|
- textRoleRunning.value = true
|
|
|
- receiveMessageDisplayedText.value = ''
|
|
|
+ textRoleRunning.value = true;
|
|
|
+ receiveMessageDisplayedText.value = "";
|
|
|
const task = async () => {
|
|
|
// 调整速度
|
|
|
const diff =
|
|
|
(receiveMessageFullText.value.length -
|
|
|
receiveMessageDisplayedText.value.length) /
|
|
|
- 10
|
|
|
+ 10;
|
|
|
if (diff > 5) {
|
|
|
- textSpeed.value = 10
|
|
|
+ textSpeed.value = 10;
|
|
|
} else if (diff > 2) {
|
|
|
- textSpeed.value = 30
|
|
|
+ textSpeed.value = 30;
|
|
|
} else if (diff > 1.5) {
|
|
|
- textSpeed.value = 50
|
|
|
+ textSpeed.value = 50;
|
|
|
} else {
|
|
|
- textSpeed.value = 100
|
|
|
+ textSpeed.value = 100;
|
|
|
}
|
|
|
// 对话结束,就按 30 的速度
|
|
|
if (!conversationInProgress.value) {
|
|
|
- textSpeed.value = 10
|
|
|
+ textSpeed.value = 10;
|
|
|
}
|
|
|
|
|
|
if (index < receiveMessageFullText.value.length) {
|
|
|
- receiveMessageDisplayedText.value += receiveMessageFullText.value[index]
|
|
|
- index++
|
|
|
+ receiveMessageDisplayedText.value +=
|
|
|
+ receiveMessageFullText.value[index];
|
|
|
+ index++;
|
|
|
|
|
|
// 更新 message
|
|
|
const lastMessage =
|
|
|
- activeMessageList.value[activeMessageList.value.length - 1]
|
|
|
- lastMessage.content = receiveMessageDisplayedText.value
|
|
|
+ activeMessageList.value[activeMessageList.value.length - 1];
|
|
|
+ lastMessage.content = receiveMessageDisplayedText.value;
|
|
|
// 滚动到住下面
|
|
|
- await scrollToBottom()
|
|
|
+ await scrollToBottom();
|
|
|
// 重新设置任务
|
|
|
- timer = setTimeout(task, textSpeed.value)
|
|
|
+ timer = setTimeout(task, textSpeed.value);
|
|
|
} else {
|
|
|
// 不是对话中可以结束
|
|
|
if (!conversationInProgress.value) {
|
|
|
- textRoleRunning.value = false
|
|
|
- clearTimeout(timer)
|
|
|
+ textRoleRunning.value = false;
|
|
|
+ clearTimeout(timer);
|
|
|
} else {
|
|
|
// 重新设置任务
|
|
|
- timer = setTimeout(task, textSpeed.value)
|
|
|
+ timer = setTimeout(task, textSpeed.value);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- let timer = setTimeout(task, textSpeed.value)
|
|
|
+ };
|
|
|
+ let timer = setTimeout(task, textSpeed.value);
|
|
|
} catch {}
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/** 初始化 **/
|
|
|
onMounted(async () => {
|
|
|
if (personId.value) {
|
|
|
// 智能问答
|
|
|
CreateDialogue({ roleId: personId.value })
|
|
|
- .then(res => {
|
|
|
- console.log('创建会话:', res)
|
|
|
- activeConversationId.value = res.data
|
|
|
- })
|
|
|
- .catch(error => {
|
|
|
- console.error('请求出错:', error)
|
|
|
+ .then((res) => {
|
|
|
+ console.log("创建会话:", res);
|
|
|
+ activeConversationId.value = res.data;
|
|
|
})
|
|
|
+ .catch((error) => {
|
|
|
+ console.error("请求出错:", error);
|
|
|
+ });
|
|
|
|
|
|
- await getConversation(personId.value)
|
|
|
+ await getConversation(personId.value);
|
|
|
}
|
|
|
|
|
|
// 获取列表数据
|
|
|
// activeMessageListLoading.value = true
|
|
|
-})
|
|
|
+});
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
-@use 'sass:math';
|
|
|
+@use "sass:math";
|
|
|
// 定义rpx转换函数
|
|
|
@function rpx($px) {
|
|
|
@return math.div($px, 750) * 100vw;
|