diff --git a/pages/deepMate/deepMate.vue b/pages/deepMate/deepMate.vue index 33757ae..d4e335e 100644 --- a/pages/deepMate/deepMate.vue +++ b/pages/deepMate/deepMate.vue @@ -640,7 +640,7 @@ const simulateBotResponse = async (userMessage) => { scrollToBottom(); // 字符间延迟,模拟打字效果 - const baseDelay = 5; // 普通字符基础延迟(毫秒) + const baseDelay = 165; // 普通字符基础延迟(毫秒) const slowPunct = /[。!?!?;;]/; // 句号、感叹号、分号等较长停顿 const midPunct = /[,、,::]/; // 逗号、顿号、冒号等中等停顿 const delay = slowPunct.test(ch) @@ -675,21 +675,31 @@ const simulateBotResponse = async (userMessage) => { // 获取股票信息 const StockInfo = await postStock({ - recordId: recordId, - parentId: parentId, - stockId: stockId, - token: - "pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q", - language: "cn", + language: 'cn', + token: 'pCtw6AYK0EHAaIexoFHsbZjtsfEAIhcmwkCFm6uKko8VPfMvyDiODL9v9c0veic9fIpQbvT8zN4sH/Si6Q', + recordId: Number(recordId), + parentId: Number(parentId), + stockId: Number(stockId), }); - console.log("StockInfo", StockInfo); - - // if (StockInfo.code !== 200) { - // return ; - // } + console.log('postStock payload', { language: 'cn', token: '790750702588f1ea79f24dc56ccd5d8a', recordId, parentId, stockId }); + console.log('StockInfo', StockInfo); + + const cftl = StockInfo?.cftl || {}; + 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 markdown = StockInfo.data.markdown; - console.log("StockInfo", StockInfo); + const markdown = StockInfo?.data?.markdown || '抱歉,未找到该股票'; + console.log('StockInfo', StockInfo); // 添加请求延迟 // const toDataInfo = await getData(); diff --git a/utils/http.js b/utils/http.js index 24f85c8..7016a37 100644 --- a/utils/http.js +++ b/utils/http.js @@ -32,7 +32,7 @@ const httpInterceptor = { 'source-client': 'miniapp', // 标准头与文档头同时设置,确保兼容 'content-type': 'application/json', - // 'contentType': 'application/json', + 'contentType': 'application/json', 'version': '1', 'client': client }