Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit b690532

Browse files
committed
rush last update
1 parent 595bb66 commit b690532

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

assets/javascripts/discourse/lib/diff-streamer.gjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,24 @@ export default class DiffStreamer {
3737
const newText = result[newTextKey];
3838
this.isDone = !!result?.done;
3939

40+
if (this.isDone) {
41+
this.isStreaming = false;
42+
this.suggestion = newText;
43+
this.words = [];
44+
45+
if (this.typingTimer) {
46+
clearTimeout(this.typingTimer);
47+
this.typingTimer = null;
48+
}
49+
50+
const originalDiff = this.jsDiff.diffWordsWithSpace(
51+
this.selectedText,
52+
this.suggestion
53+
);
54+
this.diff = this.#formatDiffWithTags(originalDiff, false);
55+
return;
56+
}
57+
4058
if (newText.length < this.lastResultText.length) {
4159
this.isThinking = false;
4260
// reset if text got shorter (e.g., reset or new input)

0 commit comments

Comments
 (0)