mishig HF staff commited on
Commit
251818f
1 Parent(s): 61bd855
src/lib/components/InferencePlayground/InferencePlayground.svelte CHANGED
@@ -55,11 +55,6 @@
55
  ];
56
  }
57
 
58
- function updateMessage(value: string, messageIdx: number) {
59
- conversation.messages[messageIdx].content = value;
60
- conversation = conversation;
61
- }
62
-
63
  function deleteAndGetItem<T>(array: T[], index: number) {
64
  if (index >= 0 && index < array.length) {
65
  return array.splice(index, 1)[0];
@@ -206,10 +201,6 @@
206
  index={0}
207
  {viewCode}
208
  on:addMessage={addMessage}
209
- on:messageValueChanged={(e) => {
210
- const { conversationIdx, messageIdx, value } = e.detail;
211
- updateMessage(value, conversationIdx, messageIdx);
212
- }}
213
  on:deleteMessage={(e) => deleteMessage(e.detail)}
214
  />
215
  </div>
@@ -288,7 +279,7 @@
288
  >
289
  <PlaygroundModelSelector
290
  {models}
291
- {conversation}
292
  on:click={() => (showModelPickerModal = open)}
293
  />
294
 
 
55
  ];
56
  }
57
 
 
 
 
 
 
58
  function deleteAndGetItem<T>(array: T[], index: number) {
59
  if (index >= 0 && index < array.length) {
60
  return array.splice(index, 1)[0];
 
201
  index={0}
202
  {viewCode}
203
  on:addMessage={addMessage}
 
 
 
 
204
  on:deleteMessage={(e) => deleteMessage(e.detail)}
205
  />
206
  </div>
 
279
  >
280
  <PlaygroundModelSelector
281
  {models}
282
+ bind:conversation
283
  on:click={() => (showModelPickerModal = open)}
284
  />
285
 
src/lib/components/InferencePlayground/InferencePlaygroundConversation.svelte CHANGED
@@ -40,8 +40,6 @@
40
  <Message
41
  class="border-b"
42
  {message}
43
- {messageIdx}
44
- on:messageValueChanged
45
  on:delete={() => dispatch('deleteMessage', messageIdx)}
46
  autofocus={!loading && messageIdx === conversation.messages.length - 1}
47
  />
 
40
  <Message
41
  class="border-b"
42
  {message}
 
 
43
  on:delete={() => dispatch('deleteMessage', messageIdx)}
44
  autofocus={!loading && messageIdx === conversation.messages.length - 1}
45
  />
src/lib/components/InferencePlayground/InferencePlaygroundMessage.svelte CHANGED
@@ -3,7 +3,6 @@
3
  import { type ChatCompletionInputMessage } from '@huggingface/tasks';
4
 
5
  export let message: ChatCompletionInputMessage;
6
- export let messageIdx: number;
7
  export let autofocus: boolean = false;
8
 
9
  const dispatch = createEventDispatcher<{
@@ -20,8 +19,7 @@
20
  </div>
21
  <textarea
22
  {autofocus}
23
- value={message.content}
24
- on:input={(e) => dispatch('messageValueChanged', { messageIdx, value: e.target.value })}
25
  placeholder="Enter {message.role} message"
26
  class="resize-none rounded bg-transparent px-2 py-2.5 ring-gray-100 [field-sizing:content] hover:resize-y hover:bg-white focus:resize-y focus:bg-white focus:ring group-hover/message:ring @2xl:px-3 dark:ring-gray-600 dark:hover:bg-gray-900 dark:focus:bg-gray-900"
27
  rows="1"
 
3
  import { type ChatCompletionInputMessage } from '@huggingface/tasks';
4
 
5
  export let message: ChatCompletionInputMessage;
 
6
  export let autofocus: boolean = false;
7
 
8
  const dispatch = createEventDispatcher<{
 
19
  </div>
20
  <textarea
21
  {autofocus}
22
+ bind:value={message.content}
 
23
  placeholder="Enter {message.role} message"
24
  class="resize-none rounded bg-transparent px-2 py-2.5 ring-gray-100 [field-sizing:content] hover:resize-y hover:bg-white focus:resize-y focus:bg-white focus:ring group-hover/message:ring @2xl:px-3 dark:ring-gray-600 dark:hover:bg-gray-900 dark:focus:bg-gray-900"
25
  rows="1"