1
0

Remove cat stream logic from main.js

This commit is contained in:
2025-06-01 10:50:12 +02:00
parent ff9ec031bf
commit b7d1b96598

28
main.js
View File

@@ -812,34 +812,6 @@ async function streamLLMCommitMessages(prompt, onDataChunk, win) {
let fullOutput = '';
let done = false;
// ⭐️ Starte den Stream für die Katze!
win.webContents.send('cat-begin');
while (!done) {
const { value, done: streamDone } = await reader.read();
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;
// Sende Chunk an Renderer/Katze:
win.webContents.send('cat-chunk', obj.response);
if (onDataChunk) onDataChunk(obj.response);
}
if (obj.done) break;
} catch (e) {
// ignore malformed chunk
}
}
}
}
// ⭐️ Stream ist zu Ende
win.webContents.send('cat-end');
return fullOutput;
}