From 50d8e8e41f239d06352ad5d122ae1ee32b3c32e0 Mon Sep 17 00:00:00 2001 From: Mic Date: Thu, 5 Mar 2026 23:52:00 +0100 Subject: [PATCH] added a log of the full raw AI response after streaming --- js/workers/model-worker-anthropic.js | 3 +++ js/workers/model-worker-google_gemini.js | 2 ++ js/workers/model-worker-ollama.js | 2 ++ js/workers/model-worker-openai_comp.js | 2 ++ js/workers/model-worker-openai_responses.js | 2 ++ 5 files changed, 11 insertions(+) diff --git a/js/workers/model-worker-anthropic.js b/js/workers/model-worker-anthropic.js index 21452ca4..cc1e8fdb 100644 --- a/js/workers/model-worker-anthropic.js +++ b/js/workers/model-worker-anthropic.js @@ -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' }); diff --git a/js/workers/model-worker-google_gemini.js b/js/workers/model-worker-google_gemini.js index efd1b9c7..04a63ce2 100644 --- a/js/workers/model-worker-google_gemini.js +++ b/js/workers/model-worker-google_gemini.js @@ -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' }); diff --git a/js/workers/model-worker-ollama.js b/js/workers/model-worker-ollama.js index 6a8d1310..e7a7d611 100644 --- a/js/workers/model-worker-ollama.js +++ b/js/workers/model-worker-ollama.js @@ -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' }); diff --git a/js/workers/model-worker-openai_comp.js b/js/workers/model-worker-openai_comp.js index d2685500..daaa0883 100644 --- a/js/workers/model-worker-openai_comp.js +++ b/js/workers/model-worker-openai_comp.js @@ -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' }); diff --git a/js/workers/model-worker-openai_responses.js b/js/workers/model-worker-openai_responses.js index 8f3189ee..8ff9805b 100644 --- a/js/workers/model-worker-openai_responses.js +++ b/js/workers/model-worker-openai_responses.js @@ -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' });