1
0

auto-git:

[change] main.js
This commit is contained in:
2025-05-24 14:16:52 +02:00
parent 31b0b2b233
commit 0e8aec9713

20
main.js
View File

@@ -229,7 +229,7 @@ async function streamLLMCommitMessages(prompt, onDataChunk) {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ body: JSON.stringify({
model: 'qwen2.5-coder:32b', // ggf. Modell anpassen model: 'qwen2.5-coder:32b',
prompt: prompt, prompt: prompt,
stream: true stream: true
}) })
@@ -246,23 +246,11 @@ async function streamLLMCommitMessages(prompt, onDataChunk) {
done = streamDone; done = streamDone;
if (value) { if (value) {
const chunk = decoder.decode(value, { stream: true }); const chunk = decoder.decode(value, { stream: true });
for (const line of chunk.split('\n')) { if (onDataChunk) onDataChunk(chunk);
if (!line.trim()) continue; fullOutput += chunk;
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
} }
} }
} return fullOutput.trim();
}
return fullOutput;
} }
// 4. JSON Output robust parsen // 4. JSON Output robust parsen