auto-git:
[change] main.js
This commit is contained in:
20
main.js
20
main.js
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user