mishig HF staff commited on
Commit
7d5d2bc
1 Parent(s): 0ced8a6
src/lib/components/InferencePlayground/InferencePlayground.svelte CHANGED
@@ -32,6 +32,8 @@
32
  }
33
  ];
34
 
 
 
35
  let systemMessage: ChatCompletionInputMessage = { role: 'system', content: '' };
36
  let hfToken: string | null = import.meta.env.VITE_HF_TOKEN;
37
  let viewCode = false;
@@ -42,7 +44,7 @@
42
  let abortControllers: AbortController[] = [];
43
  let waitForNonStreaming = true;
44
 
45
- $: systemPromptSupported = isSystemPromptSupported(conversations[0].model);
46
 
47
  onDestroy(() => {
48
  for (const abortController of abortControllers) {
@@ -64,7 +66,7 @@
64
  }
65
 
66
  function updateMessage(value: string, conversationIdx: number, messageIdx: number) {
67
- const lastMsgIdx = conversations[0].messages.length - 1;
68
  const msg = conversations[conversationIdx].messages[messageIdx];
69
  msg.content = value;
70
  const { role } = msg;
@@ -185,7 +187,7 @@
185
  if (!model) {
186
  return;
187
  }
188
- conversations[0].model = model;
189
  }
190
  </script>
191
 
@@ -246,7 +248,7 @@
246
  >
247
  <Conversation
248
  {loading}
249
- conversation={conversations[0]}
250
  index={0}
251
  {viewCode}
252
  on:addMessage={addMessage}
@@ -333,11 +335,11 @@
333
  >
334
  <PlaygroundModelSelector
335
  {models}
336
- conversation={conversations[0]}
337
  on:click={() => (showModelPickerModal = open)}
338
  />
339
 
340
- <PlaygroundOptions bind:conversation={conversations[0]} />
341
  <div class="mt-auto">
342
  <div class="mb-3 flex items-center justify-between gap-2">
343
  <label
 
32
  }
33
  ];
34
 
35
+ $: conversation = conversations[0];
36
+
37
  let systemMessage: ChatCompletionInputMessage = { role: 'system', content: '' };
38
  let hfToken: string | null = import.meta.env.VITE_HF_TOKEN;
39
  let viewCode = false;
 
44
  let abortControllers: AbortController[] = [];
45
  let waitForNonStreaming = true;
46
 
47
+ $: systemPromptSupported = isSystemPromptSupported(conversation.model);
48
 
49
  onDestroy(() => {
50
  for (const abortController of abortControllers) {
 
66
  }
67
 
68
  function updateMessage(value: string, conversationIdx: number, messageIdx: number) {
69
+ const lastMsgIdx = conversation.messages.length - 1;
70
  const msg = conversations[conversationIdx].messages[messageIdx];
71
  msg.content = value;
72
  const { role } = msg;
 
187
  if (!model) {
188
  return;
189
  }
190
+ conversation.model = model;
191
  }
192
  </script>
193
 
 
248
  >
249
  <Conversation
250
  {loading}
251
+ {conversation}
252
  index={0}
253
  {viewCode}
254
  on:addMessage={addMessage}
 
335
  >
336
  <PlaygroundModelSelector
337
  {models}
338
+ {conversation}
339
  on:click={() => (showModelPickerModal = open)}
340
  />
341
 
342
+ <PlaygroundOptions bind:conversation />
343
  <div class="mt-auto">
344
  <div class="mb-3 flex items-center justify-between gap-2">
345
  <label