@@ -23,21 +23,23 @@ export default class ModalDiffModal extends Component {
2323
2424 @tracked loading = false ;
2525 @tracked finalResult = " " ;
26- @tracked showcasedDiff = " " ;
2726 @tracked diffStreamer = new DiffStreamer (this .args .model .selectedText );
2827 @tracked suggestion = " " ;
2928 @tracked
3029 smoothStreamer = new SmoothStreamer (
3130 () => this .suggestion ,
3231 (newValue ) => (this .suggestion = newValue)
3332 );
34- @tracked isStreaming = false ;
3533
3634 constructor () {
3735 super (... arguments );
3836 this .suggestChanges ();
3937 }
4038
39+ get isStreaming () {
40+ return this .diffStreamer .isStreaming || this .smoothStreamer .isStreaming ;
41+ }
42+
4143 get primaryBtnLabel () {
4244 return this .loading
4345 ? i18n (" discourse_ai.ai_helper.context_menu.loading" )
@@ -62,23 +64,14 @@ export default class ModalDiffModal extends Component {
6264
6365 @action
6466 async updateResult (result ) {
65- // TODO(@keegan)
66- // Temporarily we are removing the animation using the diff streamer
67- // and simply showing the diff streamed without a proper animation
68- // while we figure things out
69- // so that things are not too janky in the meantime.
7067 this .loading = false ;
71- this .isStreaming = true ;
7268
7369 if (result .done ) {
7470 this .finalResult = result .result ;
7571 }
7672
77- this .showcasedDiff = result .diff ;
78-
7973 if (result .done ) {
8074 this .loading = false ;
81- this .isStreaming = false ;
8275 }
8376
8477 if (this .args .model .showResultAsDiff ) {
@@ -143,7 +136,7 @@ export default class ModalDiffModal extends Component {
143136 <div {{didInsert this . subscribe}} {{willDestroy this . unsubscribe}} >
144137 {{#if this . loading }}
145138 <div class =" composer-ai-helper-modal__loading" >
146- < CookText @ rawText = {{ @ model.selectedText}} />
139+ {{~ @ model.selectedText~}}
147140 </div >
148141 {{else }}
149142 <div
@@ -154,8 +147,10 @@ export default class ModalDiffModal extends Component {
154147 ( if @ model.showResultAsDiff " inline-diff" )
155148 }}
156149 >
157- {{#if @ model.showResultAsDiff }}
158- {{htmlSafe this . showcasedDiff}}
150+ {{~#if @ model.showResultAsDiff ~}}
151+ <span class =" diff-inner" >{{htmlSafe
152+ this . diffStreamer.diff
153+ }} </span >
159154 {{else }}
160155 {{#if this . smoothStreamer.isStreaming }}
161156 <CookText
0 commit comments