|
|
@ -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) { |
|
|
|
// 第二个工作流接口成功,完成思考过程 |
|
|
|