added a log of the full raw AI response after streaming

This commit is contained in:
Mic 2026-03-05 23:52:00 +01:00
parent c275625111
commit 50d8e8e41f
5 changed files with 11 additions and 0 deletions

View file

@ -80,6 +80,7 @@ self.onmessage = async function(event) {
if (stopStreaming) {
stopStreaming = false;
reader.cancel();
taLog.log("AI full response [STOPPED]: " + assistantResponseAccumulator);
conversationHistory.push({ role: 'assistant', content: assistantResponseAccumulator });
assistantResponseAccumulator = '';
postMessage({ type: 'tokensDone' });
@ -87,6 +88,7 @@ self.onmessage = async function(event) {
}
const { done, value } = await reader.read();
if (done) {
taLog.log("AI full response: " + assistantResponseAccumulator);
conversationHistory.push({ role: 'assistant', content: assistantResponseAccumulator });
assistantResponseAccumulator = '';
postMessage({ type: 'tokensDone' });
@ -138,6 +140,7 @@ self.onmessage = async function(event) {
break;
case 'message_stop':
taLog.log("AI full response: " + assistantResponseAccumulator);
conversationHistory.push({ role: 'assistant', content: assistantResponseAccumulator });
assistantResponseAccumulator = '';
postMessage({ type: 'tokensDone' });

View file

@ -79,6 +79,7 @@ self.onmessage = async function(event) {
if (stopStreaming) {
stopStreaming = false;
reader.cancel();
taLog.log("AI full response [STOPPED]: " + assistantResponseAccumulator);
conversationHistory.push({ role: 'model', parts: [{"text": assistantResponseAccumulator}] });
assistantResponseAccumulator = '';
postMessage({ type: 'tokensDone' });
@ -86,6 +87,7 @@ self.onmessage = async function(event) {
}
const { done, value } = await reader.read();
if (done) {
taLog.log("AI full response: " + assistantResponseAccumulator);
conversationHistory.push({ role: 'model', parts: [{"text": assistantResponseAccumulator}] });
assistantResponseAccumulator = '';
postMessage({ type: 'tokensDone' });

View file

@ -81,6 +81,7 @@ self.onmessage = async function(event) {
if (stopStreaming) {
stopStreaming = false;
reader.cancel();
taLog.log("AI full response [STOPPED]: " + assistantResponseAccumulator);
conversationHistory.push({ role: 'assistant', content: assistantResponseAccumulator });
assistantResponseAccumulator = '';
postMessage({ type: 'tokensDone' });
@ -89,6 +90,7 @@ self.onmessage = async function(event) {
}
const { done, value } = await reader.read();
if (done) {
taLog.log("AI full response: " + assistantResponseAccumulator);
conversationHistory.push({ role: 'assistant', content: assistantResponseAccumulator });
assistantResponseAccumulator = '';
postMessage({ type: 'tokensDone' });

View file

@ -79,6 +79,7 @@ self.onmessage = async function(event) {
if (stopStreaming) {
stopStreaming = false;
reader.cancel();
taLog.log("AI full response [STOPPED]: " + assistantResponseAccumulator);
conversationHistory.push({ role: 'assistant', content: assistantResponseAccumulator });
assistantResponseAccumulator = '';
postMessage({ type: 'tokensDone' });
@ -86,6 +87,7 @@ self.onmessage = async function(event) {
}
const { done, value } = await reader.read();
if (done) {
taLog.log("AI full response: " + assistantResponseAccumulator);
conversationHistory.push({ role: 'assistant', content: assistantResponseAccumulator });
assistantResponseAccumulator = '';
postMessage({ type: 'tokensDone' });

View file

@ -90,6 +90,7 @@ self.onmessage = async function(event) {
if (stopStreaming) {
stopStreaming = false;
reader.cancel();
taLog.log("AI full response [STOPPED]: " + assistantResponseAccumulator);
conversationHistory.push({ role: 'assistant', content: assistantResponseAccumulator });
assistantResponseAccumulator = '';
postMessage({ type: 'tokensDone' });
@ -97,6 +98,7 @@ self.onmessage = async function(event) {
}
const { done, value } = await reader.read();
if (done) {
taLog.log("AI full response: " + assistantResponseAccumulator);
conversationHistory.push({ role: 'assistant', content: assistantResponseAccumulator });
assistantResponseAccumulator = '';
postMessage({ type: 'tokensDone' });