mishig HF Staff commited on
Commit
8c267b8
·
unverified ·
2 Parent(s): 89bc5df 14c38af

Fix buttons (#42)

Browse files
src/lib/components/Icons/IconShare.svelte DELETED
@@ -1,12 +0,0 @@
1
- <script lang="ts">
2
- export let classNames = "";
3
- </script>
4
-
5
- <svg class={classNames} width="1em" height="1em" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
6
- <path
7
- fill-rule="evenodd"
8
- clip-rule="evenodd"
9
- d="M5.41 9.41L4 8L12 0L20 8L18.59 9.41L13 3.83L13 17.5H11L11 3.83L5.41 9.41ZM22 17.5V23H2V17.5H0V23C0 23.5304 0.210714 24.0391 0.585786 24.4142C0.960859 24.7893 1.46957 25 2 25H22C22.5304 25 23.0391 24.7893 23.4142 24.4142C23.7893 24.0391 24 23.5304 24 23V17.5H22Z"
10
- fill="currentColor"
11
- />
12
- </svg>
 
 
 
 
 
 
 
 
 
 
 
 
 
src/lib/components/InferencePlayground/InferencePlayground.svelte CHANGED
@@ -15,18 +15,17 @@
15
  import HFTokenModal from "./InferencePlaygroundHFTokenModal.svelte";
16
  import ModelSelector from "./InferencePlaygroundModelSelector.svelte";
17
  import Conversation from "./InferencePlaygroundConversation.svelte";
18
- import IconShare from "../Icons/IconShare.svelte";
19
  import IconDelete from "../Icons/IconDelete.svelte";
20
  import IconCode from "../Icons/IconCode.svelte";
21
 
22
  export let models: ModelEntryWithTokenizer[];
23
 
24
- const startMessages: ChatCompletionInputMessage[] = [{ role: "user", content: "" }];
25
 
26
  let conversation: Conversation = {
27
  model: models[0],
28
  config: defaultGenerationConfig,
29
- messages: startMessages,
30
  streaming: true,
31
  };
32
 
@@ -58,7 +57,7 @@
58
 
59
  function reset() {
60
  systemMessage.content = "";
61
- conversation.messages = [...startMessages];
62
  }
63
 
64
  function abort() {
@@ -126,7 +125,7 @@
126
  }
127
 
128
  function onKeydown(event: KeyboardEvent) {
129
- if (!event.shiftKey && event.key === "Enter") {
130
  submit();
131
  }
132
  }
@@ -184,17 +183,6 @@
184
  <div
185
  class="fixed inset-x-0 bottom-0 flex h-20 items-center gap-2 overflow-hidden whitespace-nowrap px-3 md:absolute"
186
  >
187
- <button
188
- type="button"
189
- class="flex h-[39px] flex-none gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2.5 text-sm font-medium text-gray-900 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:outline-none focus:ring-4 focus:ring-gray-100 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:ring-gray-700"
190
- >
191
- <div class="flex size-5 items-center justify-center rounded border border-black/5 bg-black/5 text-xs">
192
- <IconShare />
193
- </div>
194
-
195
- Share</button
196
- >
197
-
198
  <button
199
  type="button"
200
  on:click={reset}
@@ -241,7 +229,7 @@
241
  </div>
242
  {:else}
243
  Run <span class="inline-flex gap-0.5 rounded border border-white/20 bg-white/10 px-0.5 text-xs text-white/70"
244
- >↵</span
245
  >
246
  {/if}
247
  </button>
 
15
  import HFTokenModal from "./InferencePlaygroundHFTokenModal.svelte";
16
  import ModelSelector from "./InferencePlaygroundModelSelector.svelte";
17
  import Conversation from "./InferencePlaygroundConversation.svelte";
 
18
  import IconDelete from "../Icons/IconDelete.svelte";
19
  import IconCode from "../Icons/IconCode.svelte";
20
 
21
  export let models: ModelEntryWithTokenizer[];
22
 
23
+ const startMessage: ChatCompletionInputMessage = { role: "user", content: "" };
24
 
25
  let conversation: Conversation = {
26
  model: models[0],
27
  config: defaultGenerationConfig,
28
+ messages: [{ ...startMessage }],
29
  streaming: true,
30
  };
31
 
 
57
 
58
  function reset() {
59
  systemMessage.content = "";
60
+ conversation.messages = [{ ...startMessage }];
61
  }
62
 
63
  function abort() {
 
125
  }
126
 
127
  function onKeydown(event: KeyboardEvent) {
128
+ if ((event.ctrlKey || event.metaKey) && event.key === "Enter") {
129
  submit();
130
  }
131
  }
 
183
  <div
184
  class="fixed inset-x-0 bottom-0 flex h-20 items-center gap-2 overflow-hidden whitespace-nowrap px-3 md:absolute"
185
  >
 
 
 
 
 
 
 
 
 
 
 
186
  <button
187
  type="button"
188
  on:click={reset}
 
229
  </div>
230
  {:else}
231
  Run <span class="inline-flex gap-0.5 rounded border border-white/20 bg-white/10 px-0.5 text-xs text-white/70"
232
+ >⌘<span class="translate-y-px">↵</span></span
233
  >
234
  {/if}
235
  </button>