Skip to content

Commit 635678c

Browse files
committed
fix unit tests
1 parent 033c02d commit 635678c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

backend/src/xml-stream-parser.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,15 @@ export async function* processStreamWithTags(
138138
processor.onTagEnd(toolName, parsedParams)
139139
}
140140

141-
function* extractToolsFromBufferAndProcess(
142-
forceFlush = true,
143-
): Generator<StreamChunk> {
141+
function extractToolsFromBufferAndProcess(forceFlush = false) {
144142
const matches = extractToolCalls()
145143
matches.forEach(processToolCallContents)
146144
if (forceFlush) {
147-
const chunk: StreamChunk = {
145+
onResponseChunk({
148146
type: 'text',
149147
text: buffer,
150-
}
151-
yield chunk
152-
onResponseChunk(chunk)
148+
})
149+
buffer = ''
153150
}
154151
}
155152

@@ -171,7 +168,7 @@ export async function* processStreamWithTags(
171168
}
172169
autocompleted = true
173170
}
174-
yield* extractToolsFromBufferAndProcess(true)
171+
extractToolsFromBufferAndProcess(true)
175172
}
176173

177174
if (chunk) {

0 commit comments

Comments
 (0)