fix: parser error for empty json buffer

This commit is contained in:
KernelDeimos
2025-02-04 15:42:03 -05:00
parent d2358d234b
commit 484bb5c201

View File

@@ -46,6 +46,9 @@ class AIChatToolUseStream extends AIChatConstructStream {
this.buffer += partial_json;
}
_end () {
if ( this.buffer.trim() === '' ) {
this.buffer = '{}';
}
const str = JSON.stringify(objectAssignTop({
...this.contentBlock,
input: JSON.parse(this.buffer),