From 8f267cc82bbea9118ae2748b20d5f9781c619a29 Mon Sep 17 00:00:00 2001
From: Ethereal <3432649580@qq.com>
Date: Tue, 28 Oct 2025 14:46:10 +0800
Subject: [PATCH 1/2] =?UTF-8?q?deepmate=E5=AF=B9=E6=8E=A5=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
api/deepMate/deepMate.js | 2 +-
pages/deepMate/deepMate.vue | 72 +++++++++++++++++++++++++++++++++++-------
pages/home/deepExploration.vue | 3 ++
utils/http.js | 2 +-
4 files changed, 66 insertions(+), 13 deletions(-)
diff --git a/api/deepMate/deepMate.js b/api/deepMate/deepMate.js
index 7eabd99..9416772 100644
--- a/api/deepMate/deepMate.js
+++ b/api/deepMate/deepMate.js
@@ -34,7 +34,7 @@ export const postIntent = (data) => {
export const postStock = (data) => {
return http({
method: 'POST',
- url: '/api/coze/decodingSecond',
+ url: '/api/deepMate/dmSecond',
data
})
}
diff --git a/pages/deepMate/deepMate.vue b/pages/deepMate/deepMate.vue
index 5eb8d58..8f119cf 100644
--- a/pages/deepMate/deepMate.vue
+++ b/pages/deepMate/deepMate.vue
@@ -287,7 +287,7 @@
:key="sIdx"
class="history-section"
>
- {{ section.title }}
+ {{ section.stockName }}
{
};
// 历史抽屉控制
-const openHistoryDrawer = () => {
- const res = postHistory({
+ const openHistoryDrawer = async() => {
+ const res = await postHistory({
model: 5,
});
@@ -604,18 +604,67 @@ const simulateBotResponse = async (userMessage) => {
// 首先进行意图识别
const res = await postIntent({
content: userMessage,
- language: 'cn',
- marketList: 'hk,cn,usa,my,sg,vi,in,gb',
- token: "pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q",
+ language: "cn",
+ marketList: "hk,cn,usa,my,sg,vi,in,gb",
+ token:
+ "pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q",
});
console.log("res" + res);
// 意图识别不通过
if (res.code !== 200) {
+ console.log("未通过意图识别");
+
+ // 更新机器人的消息内容
+ const errorMessage = res.message || "请求失败,请稍后重试";
+ let responseText = `我已经收到您的消息: "${userMessage}"。错误信息: "${errorMessage}"`;
+
+ // 开始打字机效果显示错误信息
+ let index = 0;
+ const botIndex = messages.value.length - 1;
+
+ const typeWriter = () => {
+ if (index < responseText.length) {
+ const ch = responseText.charAt(index);
+ const current = messages.value[botIndex];
+ // 通过数组替换触发渲染,避免部分平台对子项属性变更不响应
+ messages.value.splice(botIndex, 1, {
+ ...current,
+ content: current.content + ch,
+ isTyping: true,
+ });
+ index++;
+ scrollToBottom();
+
+ // 字符间延迟,模拟打字效果
+ const baseDelay = 5; // 普通字符基础延迟(毫秒)
+ const slowPunct = /[。!?!?;;]/; // 句号、感叹号、分号等较长停顿
+ const midPunct = /[,、,::]/; // 逗号、顿号、冒号等中等停顿
+ const delay = slowPunct.test(ch)
+ ? 220
+ : midPunct.test(ch)
+ ? 120
+ : baseDelay;
+ setTimeout(typeWriter, delay);
+ } else {
+ // 打字完成,更新状态
+ const current = messages.value[botIndex];
+ messages.value.splice(botIndex, 1, { ...current, isTyping: false });
+ isSending.value = false;
+ nextTick(() => {
+ scrollToBottom();
+ });
+ }
+ };
+
+ // 启动打字机效果
+ setTimeout(typeWriter, 300);
return;
}
+ console.log("通过意图识别");
+
// 获取意图识别结果
const recordId = res.data.recordId;
const parentId = res.data.parentId;
@@ -623,10 +672,11 @@ const simulateBotResponse = async (userMessage) => {
// 获取股票信息
const StockInfo = await postStock({
- recordId: "42",
- parentId: "0",
- stockId:"42",
- token: memberStore.userInfo?.token || '',
+ recordId: recordId,
+ parentId: parentId,
+ stockId: stockId,
+ token:
+ "pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q",
language: "cn",
});
console.log("StockInfo", StockInfo);
@@ -635,7 +685,7 @@ const simulateBotResponse = async (userMessage) => {
// return ;
// }
- const markdown = StockInfo.markdown;
+ const markdown = StockInfo.data.markdown;
console.log("StockInfo", StockInfo);
// 添加请求延迟
diff --git a/pages/home/deepExploration.vue b/pages/home/deepExploration.vue
index c1c8335..4d580f0 100644
--- a/pages/home/deepExploration.vue
+++ b/pages/home/deepExploration.vue
@@ -20,6 +20,9 @@ function showLoginPrompt() {
userStore.clearUserInfo();
}
+console.log(userStore.userInfo);
+
+
function toDeepMate() {
uni.navigateTo({
url: "/pages/deepMate/deepMate",
diff --git a/utils/http.js b/utils/http.js
index 5e96a94..6e0072a 100644
--- a/utils/http.js
+++ b/utils/http.js
@@ -39,7 +39,7 @@ const httpInterceptor = {
//4 添加token,优先用store,没有则回退到body中的token,保持与Apifox一致
const memberStore = useUserStore()
// const token = memberStore.userInfo?.token || options.data?.token
- const token = '790750702588f1ea79f24dc56ccd5d8a'
+ const token = 'dccec0b65a94f498b8183a17589ab16e'
if (token) {
options.header.token = token
}
From 8151c1d9c0ea0cd22284dfedeb018f9b146d1fde Mon Sep 17 00:00:00 2001
From: Ethereal <3432649580@qq.com>
Date: Tue, 28 Oct 2025 16:18:56 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E5=85=A8=E5=B1=80=E6=B3=A8=E5=86=8C?=
=?UTF-8?q?=E7=99=BB=E5=BD=95=E6=8F=90=E7=A4=BA=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/login-prompt.vue | 2 +
main.js | 45 +++++----
pages/deepMate/deepMate.vue | 214 +++++++++++++++++++++--------------------
pages/home/deepExploration.vue | 14 ++-
utils/http.js | 4 +-
5 files changed, 147 insertions(+), 132 deletions(-)
diff --git a/components/login-prompt.vue b/components/login-prompt.vue
index a499e43..6989276 100644
--- a/components/login-prompt.vue
+++ b/components/login-prompt.vue
@@ -23,6 +23,8 @@ const userStore = useUserStore();
onMounted(() => {
if (!userStore.userInfo) {
show();
+
+
}
});
diff --git a/main.js b/main.js
index 4ef91b6..b7439b9 100644
--- a/main.js
+++ b/main.js
@@ -1,4 +1,4 @@
-
+import LoginPrompt from './components/login-prompt.vue'
import pinia from './stores/index.js'
// #ifndef VUE3
import Vue from 'vue'
@@ -7,17 +7,18 @@ import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
+Vue.component('LoginPrompt', LoginPrompt)
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
- ...App,
+ ...App,
pinia
})
app.use(ElementPlus)
-for (const [key, component] of Object.entries(ElementPlusIconsVue)){
+for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)
}
app.$mount()
@@ -57,7 +58,7 @@ function getCurrentLocale() {
})
console.log(language);
return language
- }else if (language.indexOf('zh') != -1) {
+ } else if (language.indexOf('zh') != -1) {
if (language.indexOf('CN') != -1) {
language = 'zh_CN'
uni.setStorageSync('languageData', {
@@ -99,24 +100,26 @@ function getCurrentLocale() {
}
// 创建 i18n 实例
const i18n = createI18n({
- locale: getCurrentLocale(),
- legacy: false, // 使用 Composition API 模式
- globalInjection: true, // 全局注入 $t 函数
- messages: {
- 'en': en,
- 'ms': ms,
- 'th': th,
- 'vi': vi,
- 'zh_CN': zh_CN,
- 'zh_HK': zh_HK
- }
+ locale: getCurrentLocale(),
+ legacy: false, // 使用 Composition API 模式
+ globalInjection: true, // 全局注入 $t 函数
+ messages: {
+ 'en': en,
+ 'ms': ms,
+ 'th': th,
+ 'vi': vi,
+ 'zh_CN': zh_CN,
+ 'zh_HK': zh_HK
+ }
})
export function createApp() {
- const app = createSSRApp(App)
- app.use(pinia)
- app.use(i18n)
- return {
- app
- }
+ const app = createSSRApp(App)
+ app.component('LoginPrompt', LoginPrompt)
+
+ app.use(pinia)
+ app.use(i18n)
+ return {
+ app
+ }
}
// #endif
\ No newline at end of file
diff --git a/pages/deepMate/deepMate.vue b/pages/deepMate/deepMate.vue
index 8f119cf..33757ae 100644
--- a/pages/deepMate/deepMate.vue
+++ b/pages/deepMate/deepMate.vue
@@ -159,13 +159,13 @@
- ✓
+ ✓
问题分析完成
- ✓
+ ✓
收集相关信息
@@ -222,39 +222,6 @@
-
-
+
暂无历史记录
- {{ section.stockName }}
+ {{ section.title }}
{{ item.stockName }}
({{ item.stockCode }})
- {{ item.createdTime }}
+ {{
+ formatTimeForHistory(item.createdTime)
+ }}
-
+