File tree Expand file tree Collapse file tree 1 file changed +10
-16
lines changed
ui/user/src/lib/components/messages Expand file tree Collapse file tree 1 file changed +10
-16
lines changed Original file line number Diff line number Diff line change 10
10
import { popover } from ' $lib/actions' ;
11
11
import { fly } from ' svelte/transition' ;
12
12
import { waitingOnModelMessage } from ' $lib/services/chat/messages' ;
13
+ import Loading from ' $lib/icons/Loading.svelte' ;
13
14
14
15
interface Props {
15
16
msg: Message ;
77
78
78
79
$effect (() => {
79
80
// this is a hack to ensure the effect is run each time animatedText updates
80
- void markdownText ;
81
+ void animatedText ;
81
82
82
83
const blocks = document .querySelectorAll (' .message-content pre > code' );
83
84
blocks .forEach ((block ) => {
145
146
return true ;
146
147
});
147
148
}
148
-
149
- let markdownText = $derived .by (() => {
150
- let text = animatedText ;
151
-
152
- // Count the number of code tags in the text
153
- const codeOpenTagCount = (text .match (/ ```/ g ) || []).length ;
154
- // If there's an odd number of code tags, add a closing code tag
155
- if (codeOpenTagCount % 2 !== 0 ) {
156
- text += ' \n ```\n ' ;
157
- }
158
-
159
- return text + ' \n <span data-end-indicator></span>' ;
160
- });
161
149
</script >
162
150
163
151
{#snippet time ()}
315
303
{/each }
316
304
{@render explain ()}
317
305
{:else }
318
- <div class:loading-container ={! msg .done || animating }>
319
- {@html toHTMLFromMarkdown (markdownText )}
306
+ <div >
307
+ {@html toHTMLFromMarkdown (animatedText )}
308
+
309
+ {#if ! msg .done || animating }
310
+ <p class =" flex items-center gap-2 text-sm text-gray-500" >
311
+ <Loading /> Loading...
312
+ </p >
313
+ {/if }
320
314
</div >
321
315
{/if }
322
316
{/ snippet }
You can’t perform that action at this time.
0 commit comments