diff --git a/pages/deepMate/deepMate.vue b/pages/deepMate/deepMate.vue index dfdd884..922fc8c 100644 --- a/pages/deepMate/deepMate.vue +++ b/pages/deepMate/deepMate.vue @@ -129,13 +129,24 @@ " > - + > --> + @@ -299,6 +310,8 @@ import { postHistoryDetail, } from "../../api/deepMate/deepMate"; +import { useUserStore } from "../../stores/modules/userInfo"; + const renderer = new marked.Renderer(); renderer.heading = function (text, level) { return `

${text}

`; @@ -335,41 +348,20 @@ const drawerOffsetY = ref(0); const searchHistory = ref([]); const historyList = ref([]); -const hotTopics = ref([ - { - id: 1, - text: "英伟达(NVDA)股票情绪温度?", - icon: "https://d31zlh4on95l9h.cloudfront.net/images/7ed58be0f4b81aeb398d9ba2534a624b.svg", - }, - { - id: 2, - text: "博通(AVGO)明天还能涨吗?", - icon: "https://d31zlh4on95l9h.cloudfront.net/images/7ed58be0f4b81aeb398d9ba2534a624b.svg", - }, - { - id: 3, - text: "为什么Fluence Energy(FLNC)会暴涨?", - icon: "https://d31zlh4on95l9h.cloudfront.net/images/7ed58be0f4b81aeb398d9ba2534a624b.svg", - }, - { - id: 4, - text: "为什么Fluence Energy(FLNC)会暴涨?", - icon: "https://d31zlh4on95l9h.cloudfront.net/images/7ed58be0f4b81aeb398d9ba2534a624b.svg", - }, -]); + // 处理页面加载时的路由参数 onLoad((options) => { - console.log('deepMate页面接收到参数:', options); - + console.log("deepMate页面接收到参数:", options); + // 如果有query参数,自动发送消息 if (options.query) { const decodedQuery = decodeURIComponent(options.query); - console.log('解码后的查询内容:', decodedQuery); - + console.log("解码后的查询内容:", decodedQuery); + // 设置输入框内容并自动发送 inputMessage.value = decodedQuery; - + // 延迟一下再发送,确保页面已经完全加载 setTimeout(() => { sendMessage(); @@ -526,6 +518,12 @@ const formatTimeForHistory = (timeString) => { return timeString; }; +const userStore = useUserStore(); +// 用户头像 +const userAvatar = computed(() => { + return userStore.userInfo.avatar; +}); + // 历史分组(今天/昨天/近一周/按月) const groupedHistory = computed(() => { const sections = []; @@ -656,9 +654,8 @@ const simulateBotResponse = async (userMessage) => { "pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q", }); } catch (error) { - - } finally { isSending.value = false; + } finally { } console.log("res" + res); @@ -768,7 +765,9 @@ const simulateBotResponse = async (userMessage) => { messages.value[messages.value.length - 1].isSecond = true; - messages.value[messages.value.length - 1].isThinking = false; + setTimeout(() => { + messages.value[messages.value.length - 1].isThinking = false; + }, 500); // 滚动到底部 nextTick(() => { @@ -780,7 +779,7 @@ const simulateBotResponse = async (userMessage) => { let index = 0; const botIndex = messages.value.length - 1; - const baseDelay = 165; // 普通字符基础延迟(毫秒) + const baseDelay = 5; // 普通字符基础延迟(毫秒) const slowPunct = /[。!?!?;;]/; // 句号、感叹号、分号等较长停顿 const midPunct = /[,、,::]/; // 逗号、顿号、冒号等中等停顿 @@ -1269,25 +1268,25 @@ async function itemClick(item) { .message-icon { font-size: 24rpx; margin: 0 10rpx; - padding: 10rpx; + /* padding: 10rpx; */ border-radius: 50%; background-color: #ddd; - width: 40rpx; - height: 40rpx; + width: 60rpx; + height: 60rpx; display: flex; align-items: center; justify-content: center; } .user-message .message-icon { - background-color: #007aff; + /* background-color: #007aff; */ border-radius: 50%; color: #fff; /* box-shadow: 0 0 12rpx rgba(0, 122, 255, 0.4); */ } .bot-message .message-icon { - background: url("/static/images/robot (1).svg"); + /* background: url("/static/images/robot (1).svg"); */ color: white; }