Thomas G. Lopes commited on
Commit
5ac02d2
·
1 Parent(s): 812d95a

more migration

Browse files
src/lib/components/inference-playground/conversation-header.svelte CHANGED
@@ -10,12 +10,16 @@
10
  import ModelSelectorModal from "./model-selector-modal.svelte";
11
  import ProviderSelect from "./provider-select.svelte";
12
 
13
- export let conversation: Conversation;
14
- export let conversationIdx: number;
 
 
 
 
15
 
16
  const dispatch = createEventDispatcher<{ close: string }>();
17
 
18
- let modelSelectorOpen = false;
19
 
20
  function changeModel(newModelId: ModelWithTokenizer["id"]) {
21
  const model = $models.find(m => m.id === newModelId);
@@ -26,7 +30,7 @@
26
  conversation.provider = undefined;
27
  }
28
 
29
- $: nameSpace = conversation.model.id.split("/")[0] ?? "";
30
  </script>
31
 
32
  {#if modelSelectorOpen}
@@ -43,12 +47,12 @@
43
  : 'mx-4'} flex h-11 flex-none items-center gap-2 rounded-lg border border-gray-200/80 bg-white pr-2 pl-3 text-sm leading-none whitespace-nowrap shadow-xs *:flex-none max-sm:mt-4 dark:border-white/5 dark:bg-gray-800/70 dark:hover:bg-gray-800"
44
  >
45
  <Avatar orgName={nameSpace} size="md" />
46
- <button class="flex-1! self-stretch text-left hover:underline" on:click={() => (modelSelectorOpen = true)}
47
  >{conversation.model.id}</button
48
  >
49
  <button
50
  class="borderdark:border-white/5 flex size-6 items-center justify-center rounded-sm bg-gray-50 text-xs hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600"
51
- on:click={() => dispatch("close", conversation.model.id)}
52
  >
53
 
54
  </button>
 
10
  import ModelSelectorModal from "./model-selector-modal.svelte";
11
  import ProviderSelect from "./provider-select.svelte";
12
 
13
+ interface Props {
14
+ conversation: Conversation;
15
+ conversationIdx: number;
16
+ }
17
+
18
+ let { conversation = $bindable(), conversationIdx }: Props = $props();
19
 
20
  const dispatch = createEventDispatcher<{ close: string }>();
21
 
22
+ let modelSelectorOpen = $state(false);
23
 
24
  function changeModel(newModelId: ModelWithTokenizer["id"]) {
25
  const model = $models.find(m => m.id === newModelId);
 
30
  conversation.provider = undefined;
31
  }
32
 
33
+ let nameSpace = $derived(conversation.model.id.split("/")[0] ?? "");
34
  </script>
35
 
36
  {#if modelSelectorOpen}
 
47
  : 'mx-4'} flex h-11 flex-none items-center gap-2 rounded-lg border border-gray-200/80 bg-white pr-2 pl-3 text-sm leading-none whitespace-nowrap shadow-xs *:flex-none max-sm:mt-4 dark:border-white/5 dark:bg-gray-800/70 dark:hover:bg-gray-800"
48
  >
49
  <Avatar orgName={nameSpace} size="md" />
50
+ <button class="flex-1! self-stretch text-left hover:underline" onclick={() => (modelSelectorOpen = true)}
51
  >{conversation.model.id}</button
52
  >
53
  <button
54
  class="borderdark:border-white/5 flex size-6 items-center justify-center rounded-sm bg-gray-50 text-xs hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600"
55
+ onclick={() => dispatch("close", conversation.model.id)}
56
  >
57
 
58
  </button>
src/lib/components/inference-playground/generation-config.svelte CHANGED
@@ -4,11 +4,17 @@
4
  import { GENERATION_CONFIG_KEYS, GENERATION_CONFIG_SETTINGS } from "./generation-config-settings.js";
5
  import { customMaxTokens } from "./utils.js";
6
 
7
- export let conversation: Conversation;
8
- export let classNames = "";
 
 
9
 
10
- $: modelMaxLength = customMaxTokens[conversation.model.id] ?? conversation.model.tokenizerConfig.model_max_length;
11
- $: maxTokens = Math.min(modelMaxLength ?? GENERATION_CONFIG_SETTINGS["max_tokens"].max, 64_000);
 
 
 
 
12
  </script>
13
 
14
  <div class="flex flex-col gap-y-7 {classNames}">
 
4
  import { GENERATION_CONFIG_KEYS, GENERATION_CONFIG_SETTINGS } from "./generation-config-settings.js";
5
  import { customMaxTokens } from "./utils.js";
6
 
7
+ interface Props {
8
+ conversation: Conversation;
9
+ classNames?: string;
10
+ }
11
 
12
+ let { conversation = $bindable(), classNames = "" }: Props = $props();
13
+
14
+ let modelMaxLength = $derived(
15
+ customMaxTokens[conversation.model.id] ?? conversation.model.tokenizerConfig.model_max_length
16
+ );
17
+ let maxTokens = $derived(Math.min(modelMaxLength ?? GENERATION_CONFIG_SETTINGS["max_tokens"].max, 64_000));
18
  </script>
19
 
20
  <div class="flex flex-col gap-y-7 {classNames}">