|
|
@ -129,13 +129,24 @@ |
|
|
" |
|
|
" |
|
|
> |
|
|
> |
|
|
<!-- 会话图标 --> |
|
|
<!-- 会话图标 --> |
|
|
<text |
|
|
|
|
|
|
|
|
<!-- <text |
|
|
:class=" |
|
|
:class=" |
|
|
message.isUser |
|
|
message.isUser |
|
|
? 'fa-solid fa-user message-icon' |
|
|
? 'fa-solid fa-user message-icon' |
|
|
: 'fa-solid fa-robot message-icon' |
|
|
: 'fa-solid fa-robot message-icon' |
|
|
" |
|
|
" |
|
|
></text> |
|
|
|
|
|
|
|
|
></text> --> |
|
|
|
|
|
<image |
|
|
|
|
|
v-if="message.isUser" |
|
|
|
|
|
class="message-icon" |
|
|
|
|
|
:src="userAvatar" |
|
|
|
|
|
mode="scaleToFill" |
|
|
|
|
|
/><image |
|
|
|
|
|
v-else |
|
|
|
|
|
class="message-icon" |
|
|
|
|
|
src="/static/icons/robot.svg" |
|
|
|
|
|
mode="scaleToFill" |
|
|
|
|
|
/> |
|
|
<!-- 会话内容 --> |
|
|
<!-- 会话内容 --> |
|
|
<view class="message-content"> |
|
|
<view class="message-content"> |
|
|
<!-- <text class="message-text">{{ message.content }}</text> --> |
|
|
<!-- <text class="message-text">{{ message.content }}</text> --> |
|
|
@ -299,6 +310,8 @@ import { |
|
|
postHistoryDetail, |
|
|
postHistoryDetail, |
|
|
} from "../../api/deepMate/deepMate"; |
|
|
} from "../../api/deepMate/deepMate"; |
|
|
|
|
|
|
|
|
|
|
|
import { useUserStore } from "../../stores/modules/userInfo"; |
|
|
|
|
|
|
|
|
const renderer = new marked.Renderer(); |
|
|
const renderer = new marked.Renderer(); |
|
|
renderer.heading = function (text, level) { |
|
|
renderer.heading = function (text, level) { |
|
|
return `<p>${text}</p>`; |
|
|
return `<p>${text}</p>`; |
|
|
@ -335,41 +348,20 @@ const drawerOffsetY = ref(0); |
|
|
const searchHistory = ref([]); |
|
|
const searchHistory = ref([]); |
|
|
const historyList = 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) => { |
|
|
onLoad((options) => { |
|
|
console.log('deepMate页面接收到参数:', options); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log("deepMate页面接收到参数:", options); |
|
|
|
|
|
|
|
|
// 如果有query参数,自动发送消息 |
|
|
// 如果有query参数,自动发送消息 |
|
|
if (options.query) { |
|
|
if (options.query) { |
|
|
const decodedQuery = decodeURIComponent(options.query); |
|
|
const decodedQuery = decodeURIComponent(options.query); |
|
|
console.log('解码后的查询内容:', decodedQuery); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log("解码后的查询内容:", decodedQuery); |
|
|
|
|
|
|
|
|
// 设置输入框内容并自动发送 |
|
|
// 设置输入框内容并自动发送 |
|
|
inputMessage.value = decodedQuery; |
|
|
inputMessage.value = decodedQuery; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 延迟一下再发送,确保页面已经完全加载 |
|
|
// 延迟一下再发送,确保页面已经完全加载 |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
sendMessage(); |
|
|
sendMessage(); |
|
|
@ -526,6 +518,12 @@ const formatTimeForHistory = (timeString) => { |
|
|
return timeString; |
|
|
return timeString; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const userStore = useUserStore(); |
|
|
|
|
|
// 用户头像 |
|
|
|
|
|
const userAvatar = computed(() => { |
|
|
|
|
|
return userStore.userInfo.avatar; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
// 历史分组(今天/昨天/近一周/按月) |
|
|
// 历史分组(今天/昨天/近一周/按月) |
|
|
const groupedHistory = computed(() => { |
|
|
const groupedHistory = computed(() => { |
|
|
const sections = []; |
|
|
const sections = []; |
|
|
@ -656,9 +654,8 @@ const simulateBotResponse = async (userMessage) => { |
|
|
"pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q", |
|
|
"pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q", |
|
|
}); |
|
|
}); |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
isSending.value = false; |
|
|
isSending.value = false; |
|
|
|
|
|
} finally { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
console.log("res" + res); |
|
|
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].isSecond = true; |
|
|
|
|
|
|
|
|
messages.value[messages.value.length - 1].isThinking = false; |
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
messages.value[messages.value.length - 1].isThinking = false; |
|
|
|
|
|
}, 500); |
|
|
|
|
|
|
|
|
// 滚动到底部 |
|
|
// 滚动到底部 |
|
|
nextTick(() => { |
|
|
nextTick(() => { |
|
|
@ -780,7 +779,7 @@ const simulateBotResponse = async (userMessage) => { |
|
|
let index = 0; |
|
|
let index = 0; |
|
|
|
|
|
|
|
|
const botIndex = messages.value.length - 1; |
|
|
const botIndex = messages.value.length - 1; |
|
|
const baseDelay = 165; // 普通字符基础延迟(毫秒) |
|
|
|
|
|
|
|
|
const baseDelay = 5; // 普通字符基础延迟(毫秒) |
|
|
const slowPunct = /[。!?!?;;]/; // 句号、感叹号、分号等较长停顿 |
|
|
const slowPunct = /[。!?!?;;]/; // 句号、感叹号、分号等较长停顿 |
|
|
const midPunct = /[,、,::]/; // 逗号、顿号、冒号等中等停顿 |
|
|
const midPunct = /[,、,::]/; // 逗号、顿号、冒号等中等停顿 |
|
|
|
|
|
|
|
|
@ -1269,25 +1268,25 @@ async function itemClick(item) { |
|
|
.message-icon { |
|
|
.message-icon { |
|
|
font-size: 24rpx; |
|
|
font-size: 24rpx; |
|
|
margin: 0 10rpx; |
|
|
margin: 0 10rpx; |
|
|
padding: 10rpx; |
|
|
|
|
|
|
|
|
/* padding: 10rpx; */ |
|
|
border-radius: 50%; |
|
|
border-radius: 50%; |
|
|
background-color: #ddd; |
|
|
background-color: #ddd; |
|
|
width: 40rpx; |
|
|
|
|
|
height: 40rpx; |
|
|
|
|
|
|
|
|
width: 60rpx; |
|
|
|
|
|
height: 60rpx; |
|
|
display: flex; |
|
|
display: flex; |
|
|
align-items: center; |
|
|
align-items: center; |
|
|
justify-content: center; |
|
|
justify-content: center; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.user-message .message-icon { |
|
|
.user-message .message-icon { |
|
|
background-color: #007aff; |
|
|
|
|
|
|
|
|
/* background-color: #007aff; */ |
|
|
border-radius: 50%; |
|
|
border-radius: 50%; |
|
|
color: #fff; |
|
|
color: #fff; |
|
|
/* box-shadow: 0 0 12rpx rgba(0, 122, 255, 0.4); */ |
|
|
/* box-shadow: 0 0 12rpx rgba(0, 122, 255, 0.4); */ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.bot-message .message-icon { |
|
|
.bot-message .message-icon { |
|
|
background: url("/static/images/robot (1).svg"); |
|
|
|
|
|
|
|
|
/* background: url("/static/images/robot (1).svg"); */ |
|
|
|
|
|
|
|
|
color: white; |
|
|
color: white; |
|
|
} |
|
|
} |
|
|
|