From 224b92e05e32e75b2d710ff9c8f17976d00cbf69 Mon Sep 17 00:00:00 2001
From: wangyi <3432649580@qq.com>
Date: Wed, 29 Oct 2025 20:27:31 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AF=B9deepmate=E7=9A=84=E7=AC=AC=E4=B8=80?=
=?UTF-8?q?=E6=AD=A5=E6=84=8F=E5=9B=BE=E8=AF=86=E5=88=AB=E6=B7=BB=E5=8A=A0?=
=?UTF-8?q?trycatch?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/deepMate/deepMate.vue | 71 +++++++++++++++++++++++++++------------------
1 file changed, 42 insertions(+), 29 deletions(-)
diff --git a/pages/deepMate/deepMate.vue b/pages/deepMate/deepMate.vue
index c5e7665..90e0f70 100644
--- a/pages/deepMate/deepMate.vue
+++ b/pages/deepMate/deepMate.vue
@@ -19,7 +19,8 @@
${text}
`; }; // 设置 marked 选项 marked.setOptions({ @@ -628,13 +627,20 @@ const simulateBotResponse = async (userMessage) => { isSending.value = true; // 首先进行意图识别 - const res = await postIntent({ - content: userMessage, - language: "cn", - marketList: "hk,cn,usa,my,sg,vi,in,gb", - token: - "pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q", - }); + let res; + try { + res = await postIntent({ + content: userMessage, + language: "cn", + marketList: "hk,cn,usa,my,sg,vi,in,gb", + token: + "pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q", + }); + } catch (error) { + + } finally { + isSending.value = false; + } console.log("res" + res); @@ -701,31 +707,39 @@ const simulateBotResponse = async (userMessage) => { // 获取股票信息 const StockInfo = await postStock({ - language: 'cn', - token: 'pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q', + language: "cn", + token: + "pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q", recordId: Number(recordId), parentId: Number(parentId), stockId: Number(stockId), }); - console.log('postStock payload', { language: 'cn', token: '790750702588f1ea79f24dc56ccd5d8a', recordId, parentId, stockId }); - console.log('StockInfo', StockInfo); + console.log("postStock payload", { + language: "cn", + token: "790750702588f1ea79f24dc56ccd5d8a", + recordId, + parentId, + stockId, + }); + console.log("StockInfo", StockInfo); const cftl = StockInfo?.cftl || {}; - const date = StockInfo?.date || ''; - + const date = StockInfo?.date || ""; if (StockInfo && StockInfo.code !== 200) { - const errMsg = `postStock失败(${StockInfo.code}): ${StockInfo.message || '未知错误'}` - console.warn(errMsg, StockInfo) - messages.value[messages.value.length - 1].isThinking = false - messages.value[messages.value.length - 1].isTyping = false - messages.value[messages.value.length - 1].content = errMsg - isSending.value = false - return + const errMsg = `postStock失败(${StockInfo.code}): ${ + StockInfo.message || "未知错误" + }`; + console.warn(errMsg, StockInfo); + messages.value[messages.value.length - 1].isThinking = false; + messages.value[messages.value.length - 1].isTyping = false; + messages.value[messages.value.length - 1].content = errMsg; + isSending.value = false; + return; } - const markdown = StockInfo?.data?.markdown || '抱歉,未找到该股票'; - console.log('StockInfo', StockInfo); + const markdown = StockInfo?.data?.markdown || "抱歉,未找到该股票"; + console.log("StockInfo", StockInfo); // 添加请求延迟 // const toDataInfo = await getData(); @@ -934,9 +948,8 @@ async function itemClick(item) { isThinking: false, }; - onDrawerBackClick() + onDrawerBackClick(); messages.value.push(botMsg); - } }