From 0e8aec9713b5bd4b229c8066bcdc8f7c8ae18904 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sat, 24 May 2025 14:16:52 +0200 Subject: [PATCH] auto-git: [change] main.js --- main.js | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/main.js b/main.js index 0ebd2d6..61dc865 100644 --- a/main.js +++ b/main.js @@ -229,7 +229,7 @@ async function streamLLMCommitMessages(prompt, onDataChunk) { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ - model: 'qwen2.5-coder:32b', // ggf. Modell anpassen + model: 'qwen2.5-coder:32b', prompt: prompt, stream: true }) @@ -246,23 +246,11 @@ async function streamLLMCommitMessages(prompt, onDataChunk) { done = streamDone; if (value) { const chunk = decoder.decode(value, { stream: true }); - for (const line of chunk.split('\n')) { - if (!line.trim()) continue; - try { - const obj = JSON.parse(line); - if (obj.response) { - fullOutput += obj.response; - if (onDataChunk) onDataChunk(obj.response); - } - if (obj.done) break; - } catch (e) { - // ignore malformed chunk - } - } + if (onDataChunk) onDataChunk(chunk); + fullOutput += chunk; } } - - return fullOutput; + return fullOutput.trim(); } // 4. JSON Output robust parsen