victor HF staff commited on
Commit
bddbba8
1 Parent(s): f8d4725

system prompt

Browse files
src/lib/components/Playground/Playground.svelte CHANGED
@@ -18,7 +18,7 @@
18
 
19
  let hfToken: string | null = '';
20
  let currentModel = compatibleModels[0];
21
- let systemMessage: Message = { role: 'system', content: 'only answer in uppercase letters' };
22
  let messages: Message[] = startMessages;
23
  let temperature = 0.5;
24
  let maxTokens = 2048;
@@ -64,8 +64,11 @@
64
 
65
  try {
66
  const hf = new HfInference(hfToken);
 
67
  const requestMessages = [
68
- systemMessage,
 
 
69
  ...messages.map(({ role, content }) => ({ role, content }))
70
  ];
71
 
@@ -129,7 +132,6 @@
129
  <div class="relative flex flex-col overflow-y-auto px-5 pb-24 pt-7">
130
  <div class="pb-2 text-sm font-semibold">SYSTEM</div>
131
  <textarea
132
- disabled
133
  name=""
134
  id=""
135
  placeholder="Enter a custom prompt"
 
18
 
19
  let hfToken: string | null = '';
20
  let currentModel = compatibleModels[0];
21
+ let systemMessage: Message = { role: 'system', content: '' };
22
  let messages: Message[] = startMessages;
23
  let temperature = 0.5;
24
  let maxTokens = 2048;
 
64
 
65
  try {
66
  const hf = new HfInference(hfToken);
67
+
68
  const requestMessages = [
69
+ ...(systemMessage.content.length
70
+ ? [{ role: 'system', content: systemMessage.content }]
71
+ : []),
72
  ...messages.map(({ role, content }) => ({ role, content }))
73
  ];
74
 
 
132
  <div class="relative flex flex-col overflow-y-auto px-5 pb-24 pt-7">
133
  <div class="pb-2 text-sm font-semibold">SYSTEM</div>
134
  <textarea
 
135
  name=""
136
  id=""
137
  placeholder="Enter a custom prompt"