From 6ffe15ef9fe57627a167760bbe595e455457ebee Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Sat, 4 Jan 2025 10:50:01 -0500 Subject: [PATCH] ? --- src/assets/js/main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/assets/js/main.js b/src/assets/js/main.js index 0f8ade0..038f87d 100644 --- a/src/assets/js/main.js +++ b/src/assets/js/main.js @@ -27,10 +27,16 @@ async function readResponse(response) { try { function read() { + let finishedResponse = ''; // Recursive function to read the stream reader.read().then(( chunk ) => { console.log(`Done: ${JSON.stringify(chunk.done)}`); console.log(`Value: ${new TextDecoder().decode(chunk.value)}`); + if (chunk.value) { + const text = decoder.decode(chunk.value, { stream: true }); + finishedResponse += text; + outputArea.innerHTML = finishedResponse; + } if (chunk.done) { return; }