dev: add additional debugging for stream AI errors

This commit is contained in:
KernelDeimos
2025-05-19 17:24:47 -04:00
parent 8a0619af26
commit 76b973cd41
2 changed files with 4 additions and 0 deletions
@@ -598,6 +598,9 @@ class AIChatService extends BaseService {
try {
await ret.result.value.init_chat_stream({ chatStream });
} catch (e) {
this.errors.report('error during stream response', {
source: e,
})
stream.write(JSON.stringify({
type: 'error',
message: e.message,
@@ -49,6 +49,7 @@ class AIChatToolUseStream extends AIChatConstructStream {
if ( this.buffer.trim() === '' ) {
this.buffer = '{}';
}
if ( process.env.DEBUG ) console.log('BUFFER BEING PARSED', this.buffer);
const str = JSON.stringify(objectAssignTop({
...this.contentBlock,
input: JSON.parse(this.buffer),