Skip to content

Commit e3b13ec

Browse files
akshaydeoPratham-Mishra04
authored andcommitted
Update logs.ts
1 parent 6679c24 commit e3b13ec

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

framework/streaming/responses.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,24 @@ func (a *Accumulator) buildCompleteMessageFromResponsesStreamChunks(chunks []*Re
3939
Content: &schemas.ResponsesMessageContent{},
4040
}
4141
}
42-
// Add content part to the message
42+
// Add content part to the message at the correct index
4343
if messageMap[*streamResp.OutputIndex].Content == nil {
4444
messageMap[*streamResp.OutputIndex].Content = &schemas.ResponsesMessageContent{}
4545
}
4646
if messageMap[*streamResp.OutputIndex].Content.ContentBlocks == nil {
47-
messageMap[*streamResp.OutputIndex].Content.ContentBlocks = make([]schemas.ResponsesMessageContentBlock, 0)
47+
messageMap[*streamResp.OutputIndex].Content.ContentBlocks = make([]schemas.ResponsesMessageContentBlock, *streamResp.ContentIndex+1)
4848
}
49-
messageMap[*streamResp.OutputIndex].Content.ContentBlocks = append(
50-
messageMap[*streamResp.OutputIndex].Content.ContentBlocks,
51-
*streamResp.Part,
52-
)
49+
50+
// Ensure we have enough content blocks to accommodate the index
51+
for len(messageMap[*streamResp.OutputIndex].Content.ContentBlocks) <= *streamResp.ContentIndex {
52+
messageMap[*streamResp.OutputIndex].Content.ContentBlocks = append(
53+
messageMap[*streamResp.OutputIndex].Content.ContentBlocks,
54+
schemas.ResponsesMessageContentBlock{},
55+
)
56+
}
57+
58+
// Assign the part at the correct index instead of appending
59+
messageMap[*streamResp.OutputIndex].Content.ContentBlocks[*streamResp.ContentIndex] = *streamResp.Part
5360
}
5461

5562
case schemas.ResponsesStreamResponseTypeOutputTextDelta:

ui/lib/types/logs.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,10 @@ export interface ResponsesTool {
494494
// Reasoning parameters
495495
export interface ResponsesParametersReasoning {
496496
effort?: "minimal" | "low" | "medium" | "high";
497-
generate_summary?: string; // Deprecated
497+
/**
498+
* @deprecated Use `summary` instead
499+
*/
500+
generate_summary?: string;
498501
summary?: "auto" | "concise" | "detailed";
499502
}
500503

0 commit comments

Comments
 (0)