From 3f8999f674bf92e0e5ca2c2d2d2344d7de2d478c Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Tue, 11 Mar 2025 16:10:26 -0700 Subject: [PATCH] fix: wrap agent response in 'response' for consistency across all blocks --- components/ui/tag-dropdown.tsx | 4 ++-- executor/handlers.ts | 24 +++++++++++++----------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/components/ui/tag-dropdown.tsx b/components/ui/tag-dropdown.tsx index 9ae4f66c0b..05f63b32c3 100644 --- a/components/ui/tag-dropdown.tsx +++ b/components/ui/tag-dropdown.tsx @@ -146,7 +146,7 @@ export const TagDropdown: React.FC = ({ const fields = extractFieldsFromSchema(responseFormat) if (fields.length > 0) { return { - tags: fields.map((field: Field) => `${normalizedBlockName}.${field.name}`), + tags: fields.map((field: Field) => `${normalizedBlockName}.response.${field.name}`), } } } @@ -185,7 +185,7 @@ export const TagDropdown: React.FC = ({ if (responseFormat) { const fields = extractFieldsFromSchema(responseFormat) if (fields.length > 0) { - return fields.map((field: Field) => `${normalizedBlockName}.${field.name}`) + return fields.map((field: Field) => `${normalizedBlockName}.response.${field.name}`) } } } diff --git a/executor/handlers.ts b/executor/handlers.ts index 0507c3cc8d..6696d0f042 100644 --- a/executor/handlers.ts +++ b/executor/handlers.ts @@ -322,18 +322,20 @@ export class AgentBlockHandler implements BlockHandler { console.log(`[AgentBlockHandler Debug] Successfully parsed content:`, parsedContent) const result = { - ...parsedContent, - tokens: response.tokens || { - prompt: 0, - completion: 0, - total: 0, + response: { + ...parsedContent, + tokens: response.tokens || { + prompt: 0, + completion: 0, + total: 0, + }, + toolCalls: response.toolCalls + ? { + list: response.toolCalls, + count: response.toolCalls.length, + } + : undefined, }, - toolCalls: response.toolCalls - ? { - list: response.toolCalls, - count: response.toolCalls.length, - } - : undefined, } console.log(`[AgentBlockHandler Debug] Result:`, result)