Skip to content

Commit 484bb5c

Browse files
committed
fix: parser error for empty json buffer
1 parent d2358d2 commit 484bb5c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/backend/src/modules/puterai/lib/Streaming.js

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ class AIChatToolUseStream extends AIChatConstructStream {
4646
this.buffer += partial_json;
4747
}
4848
_end () {
49+
if ( this.buffer.trim() === '' ) {
50+
this.buffer = '{}';
51+
}
4952
const str = JSON.stringify(objectAssignTop({
5053
...this.contentBlock,
5154
input: JSON.parse(this.buffer),

0 commit comments

Comments
 (0)