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

Commit f041962

Browse files
committed
wip
1 parent 2755cac commit f041962

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

assets/javascripts/discourse/components/modal/diff-modal.gjs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ export default class ModalDiffModal extends Component {
3333
// () => this.suggestion,
3434
// (newValue) => (this.suggestion = newValue)
3535
// );
36+
@tracked finalDiff = "";
3637
@tracked words = [];
3738
originalWords = [];
38-
diffedSuggestion = "";
3939
typingTimer = null;
4040
currentWordIndex = 0;
4141

@@ -102,23 +102,20 @@ export default class ModalDiffModal extends Component {
102102
}
103103
}
104104

105-
this.lastResultText = newText;
106-
107105
if (result.done) {
108-
this.isStreaming = false;
109-
} else {
110-
this.isStreaming = true;
106+
this.finalDiff = result.diff;
111107
}
112-
}
113108

114-
startStreamingWords() {
115-
if (this.suggestion === "") {
116-
this.suggestion = "";
117-
}
118-
this.streamNextWord();
109+
this.lastResultText = newText;
110+
111+
this.isStreaming = !result.done;
119112
}
120113

121114
streamNextWord() {
115+
if (this.currentWordIndex === this.words.length) {
116+
this.diff = this.finalDiff;
117+
}
118+
122119
if (this.currentWordIndex < this.words.length) {
123120
this.suggestion += this.words[this.currentWordIndex] + " ";
124121
this.diff = this.compareText(

0 commit comments

Comments
 (0)