MCPcopy Create free account
hub / github.com/CopilotKit/aimock / parseAllSSEChunks

Function parseAllSSEChunks

src/__tests__/stream-usage.test.ts:14–19  ·  view source on GitHub ↗
(body: string)

Source from the content-addressed store, hash-verified

12}
13
14function parseAllSSEChunks(body: string): SSEChunkWithUsage[] {
15 return body
16 .split("\n\n")
17 .filter((line) => line.startsWith("data: ") && !line.includes("[DONE]"))
18 .map((line) => JSON.parse(line.slice(6)));
19}
20
21function hasUsageChunk(chunks: SSEChunkWithUsage[]): boolean {
22 return chunks.some((c) => c.usage !== undefined && c.choices.length === 0);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…