feat(gateway): expose context usage and warning events
This commit is contained in:
@@ -593,6 +593,15 @@ async function sendMessage(client, overrideText) {
|
||||
scrollToBottom();
|
||||
});
|
||||
|
||||
stream.on('context_warning', (data) => {
|
||||
const note = document.createElement('div');
|
||||
note.className = 'message assistant';
|
||||
const text = data?.message || 'Context usage is getting high.';
|
||||
note.innerHTML = renderSafeMarkdown(`> ${text}`);
|
||||
_elements.messages.insertBefore(note, placeholder);
|
||||
scrollToBottom();
|
||||
});
|
||||
|
||||
const done = await stream.result;
|
||||
// Replace placeholder with actual response
|
||||
placeholder.classList.remove('streaming-cursor');
|
||||
|
||||
Reference in New Issue
Block a user