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',
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