fix(streaming-response): add in handling for the response block when streaming (#1568)

This commit is contained in:
Waleed
2025-10-07 16:21:10 -07:00
committed by GitHub
parent 2d7ba91c0e
commit c6f6c9e2a5

View File

@@ -96,7 +96,12 @@ export async function createStreamingResponse(
for (const outputId of matchingOutputs) {
const path = extractPathFromOutputId(outputId, blockId)
const outputValue = traverseObjectPath(output, path)
// Response blocks have their data nested under 'response'
let outputValue = traverseObjectPath(output, path)
if (outputValue === undefined && output.response) {
outputValue = traverseObjectPath(output.response, path)
}
if (outputValue !== undefined) {
const formattedOutput =
@@ -150,7 +155,11 @@ export async function createStreamingResponse(
if (result.logs) {
const blockLog = result.logs.find((log: any) => log.blockId === blockId)
if (blockLog?.output) {
const value = traverseObjectPath(blockLog.output, path)
// Response blocks have their data nested under 'response'
let value = traverseObjectPath(blockLog.output, path)
if (value === undefined && blockLog.output.response) {
value = traverseObjectPath(blockLog.output.response, path)
}
if (value !== undefined) {
// Store it in a structured way
if (!minimalResult.output[blockId]) {