coyotte508 HF staff commited on
Commit
7b1d57f
1 Parent(s): 10721c1

💄 Preserve whitespace in user message (#39)

Browse files
src/lib/components/chat/ChatMessage.svelte CHANGED
@@ -53,9 +53,11 @@
53
  renderer
54
  };
55
 
56
- $: browser && marked(sanitizeMd(message.content), options, handleParsed);
57
 
58
- html = marked(sanitizeMd(message.content), options);
 
 
59
 
60
  afterUpdate(() => {
61
  if (el) {
@@ -97,8 +99,8 @@
97
  {#if message.from === 'user'}
98
  <div class="flex items-start justify-start gap-4">
99
  <div class="mt-5 w-3 h-3 flex-none rounded-full" />
100
- <div class="rounded-2xl px-5 py-3.5 text-gray-500 dark:text-gray-400">
101
- {message.content}
102
  </div>
103
  </div>
104
  {/if}
 
53
  renderer
54
  };
55
 
56
+ $: browser && message.from === 'assistant' && marked(sanitizeMd(message.content), options, handleParsed);
57
 
58
+ if (message.from === 'assistant') {
59
+ html = marked(sanitizeMd(message.content), options);
60
+ }
61
 
62
  afterUpdate(() => {
63
  if (el) {
 
99
  {#if message.from === 'user'}
100
  <div class="flex items-start justify-start gap-4">
101
  <div class="mt-5 w-3 h-3 flex-none rounded-full" />
102
+ <div class="rounded-2xl px-5 py-3.5 text-gray-500 dark:text-gray-400 whitespace-break-spaces">
103
+ {message.content.trim()}
104
  </div>
105
  </div>
106
  {/if}