mishig HF staff commited on
Commit
78b198f
1 Parent(s): f1b84d3

fix placeholder msg in code snippets

Browse files
src/lib/components/CodeSnippets.svelte CHANGED
@@ -35,7 +35,10 @@
35
 
36
  function getMessages() {
37
  const placeholder = [{ role: 'user', content: 'Tell me a story' }];
38
- const messages = conversation.messages.length ? conversation.messages : placeholder;
 
 
 
39
  return JSON.stringify(messages, null, 2);
40
  }
41
 
 
35
 
36
  function getMessages() {
37
  const placeholder = [{ role: 'user', content: 'Tell me a story' }];
38
+ let messages = conversation.messages;
39
+ if (messages.length === 1 && messages[0].role === 'user' && !messages[0].content) {
40
+ messages = placeholder;
41
+ }
42
  return JSON.stringify(messages, null, 2);
43
  }
44