debug: add logging to diagnose streaming issue in AI SDK v6
This commit is contained in:
parent
268112f96e
commit
56e0c0da79
1 changed files with 6 additions and 0 deletions
|
|
@ -221,15 +221,21 @@ export async function executeToolWithAgent(
|
|||
tools: toolsConfig,
|
||||
onFinish: () => {
|
||||
agentSteps++;
|
||||
console.log('[executeToolWithAgent] Stream finished, steps:', agentSteps);
|
||||
},
|
||||
});
|
||||
|
||||
console.log('[executeToolWithAgent] Starting text stream consumption');
|
||||
|
||||
// Stream and collect text
|
||||
for await (const chunk of result.textStream) {
|
||||
console.log('[executeToolWithAgent] Received chunk:', chunk);
|
||||
fullOutput += chunk;
|
||||
onChunk?.(chunk);
|
||||
}
|
||||
|
||||
console.log('[executeToolWithAgent] Text stream complete, fullOutput length:', fullOutput.length);
|
||||
|
||||
// Calculate final token breakdown
|
||||
const parameters = Array.isArray(tool.parameters)
|
||||
? (tool.parameters as unknown as TPMJSParameter[])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue