🎬 火宝短剧 - 基于AI的一站式短剧生成平台 《一句话生成完整短剧,从剧本到成片全自动化》 Huobao Drama - An AI-Powered End-to-End Short Drama Generator "One Sentence to Complete Drama: Fully Automated from Script to Final Video"
TypeScript
fix: handle undefined tool result in agent stream
Connor0e92b2cbd2ce
diff --git a/backend/src/routes/agent.ts b/backend/src/routes/agent.tsindex 9ecfdc5..1a1e91d 100644--- a/backend/src/routes/agent.ts+++ b/backend/src/routes/agent.ts@@ -49,7 +49,9 @@ app.post('/:type/chat', async (c) => {}),})} else if (chunk.type === 'tool-result') {- const resultStr = typeof chunk.result === 'string' ? chunk.result : JSON.stringify(chunk.result)+ const resultStr = chunk.result != null+ ? (typeof chunk.result === 'string' ? chunk.result : JSON.stringify(chunk.result))+ : ''console.log(`[Agent] tool_result: ${chunk.toolName} → ${resultStr.slice(0, 100)}`)await stream.writeSSE({data: JSON.stringify({