auto-git:
[change] main.js
This commit is contained in:
17
main.js
17
main.js
@@ -247,11 +247,22 @@ 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 });
|
||||||
if (onDataChunk) onDataChunk(chunk);
|
for (const line of chunk.split('\n')) {
|
||||||
fullOutput += chunk;
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fullOutput.trim();
|
return fullOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function squashCommitMessages(repoPath, commitMessage, hashes) {
|
async function squashCommitMessages(repoPath, commitMessage, hashes) {
|
||||||
|
|||||||
Reference in New Issue
Block a user