From 062919359bed8f48b8a0413a79a45b78c9ab9e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=9D=B0?= Date: Mon, 18 Aug 2025 20:58:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E4=B8=AA=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=90=8E=E7=AB=AF=E8=BF=94=E5=9B=9E=E7=9A=84?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/AiEmotion.vue | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/views/AiEmotion.vue b/src/views/AiEmotion.vue index 6b10664..cfa7f3b 100644 --- a/src/views/AiEmotion.vue +++ b/src/views/AiEmotion.vue @@ -2184,6 +2184,52 @@ async function handleSendMessage(input, onComplete) { // 处理结论接口返回的数据 const conclusionResponse = conclusionResult; + + // 检查getConclusionAPI是否成功 + if (conclusionResponse && conclusionResponse.code !== 200) { + // getConclusionAPI失败,清理第三步思考过程消息 + if (thinkingMessage3Ref) { + const index = messages.value.indexOf(thinkingMessage3Ref); + if (index > -1) { + messages.value.splice(index, 1); + } + } + + // 使用getConclusionAPI返回的msg在对话界面中输出 + const errorMsg = conclusionResponse.msg || "第二个接口请求失败"; + const aiMessage = reactive({ + sender: "ai", + text: errorMsg, + }); + messages.value.push(aiMessage); + + // 停止图片旋转,恢复历史数据 + isRotating.value = false; + messages.value = [...previousMessages, ...messages.value]; + + // 如果有之前的股票数据且页面已加载,重新渲染图表 + // if ( + // isPageLoaded.value && + // emotionStore.activeStock && + // emotionStore.activeStock.apiData + // ) { + // nextTick(() => { + // renderCharts(emotionStore.activeStock.apiData); + // console.log( + // "第二个接口失败,恢复显示之前股票的图表:", + // emotionStore.activeStock.stockInfo.name + // ); + // }); + // } + + // 调用完成回调,重新启用输入框 + if (onComplete && typeof onComplete === "function") { + onComplete(); + currentOnCompleteCallback.value = null; + } + return; + } + // 检查所有数据是否都加载成功 if (conclusionResponse && conclusionResponse.data && fetchDataResult) { // 第二个工作流接口成功,完成思考过程