perf: count chat tool calls without a filtered array (#20328)

Co-authored-by: Orca Worker <orca-worker@localhost>
This commit is contained in:
OrcaWin
2026-09-12 18:10:40 -07:00
committed by GitHub
co-authored by Orca Worker
parent 0d4d059ae1
commit 3d648003ec
+7 -1
View File
@@ -298,7 +298,13 @@ export function summarizeToolRun(blocks: readonly NativeChatBlock[]): string {
}
export function countToolCalls(blocks: readonly NativeChatBlock[]): number {
return blocks.filter(isToolCallBlock).length
let count = 0
blocks.forEach((block) => {
if (isToolCallBlock(block)) {
count += 1
}
})
return count
}
function toRawPreview(input: unknown): string {