add debug logging in chat

This commit is contained in:
Ramnique Singh 2025-07-18 17:08:33 +05:30
parent 23681d8b4d
commit 58199aab35

View file

@ -213,9 +213,11 @@ export function Chat({
return; return;
} }
console.log(`chat.tsx: got streamid: ${streamId}`);
eventSource = new EventSource(`/api/stream-response/${streamId}`); eventSource = new EventSource(`/api/stream-response/${streamId}`);
eventSource.addEventListener("message", (event) => { eventSource.addEventListener("message", (event) => {
console.log(`chat.tsx: got message: ${event.data}`);
if (ignore) { if (ignore) {
return; return;
} }
@ -233,6 +235,7 @@ export function Chat({
}); });
eventSource.addEventListener('done', (event) => { eventSource.addEventListener('done', (event) => {
console.log(`chat.tsx: got done event: ${event.data}`);
if (eventSource) { if (eventSource) {
eventSource.close(); eventSource.close();
} }
@ -250,6 +253,7 @@ export function Chat({
}); });
eventSource.addEventListener('stream_error', (event) => { eventSource.addEventListener('stream_error', (event) => {
console.log(`chat.tsx: got stream_error event: ${event.data}`);
if (eventSource) { if (eventSource) {
eventSource.close(); eventSource.close();
} }