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}

`; +renderer.heading = function (text, level) { + return `

${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); - } }