mishig HF staff commited on
Commit
58190c6
1 Parent(s): d47c403

make search working

Browse files
src/lib/components/InferencePlayground/InferencePlaygroundModelSelectorModal.svelte CHANGED
@@ -10,6 +10,7 @@
10
  export let models: ModelEntryWithTokenizer[];
11
 
12
  let backdropEl: HTMLDivElement;
 
13
 
14
  const dispatch = createEventDispatcher<{ modelSelected: string; close: void }>();
15
 
@@ -30,8 +31,16 @@
30
  }
31
  }
32
 
33
- $: featuredModels = models.filter(m => FEATUED_MODELS_IDS.includes(m.id));
34
- $: otherModels = models.filter(m => !FEATUED_MODELS_IDS.includes(m.id));
 
 
 
 
 
 
 
 
35
  </script>
36
 
37
  <svelte:window on:keydown={handleKeydown} />
@@ -49,7 +58,7 @@
49
  autofocus
50
  class="flex h-10 w-full rounded-md bg-transparent py-3 text-sm placeholder-gray-400 outline-none"
51
  placeholder="Search models ..."
52
- value=""
53
  />
54
  </div>
55
  <div class="max-h-[300px] overflow-y-auto overflow-x-hidden">
 
10
  export let models: ModelEntryWithTokenizer[];
11
 
12
  let backdropEl: HTMLDivElement;
13
+ let query = "";
14
 
15
  const dispatch = createEventDispatcher<{ modelSelected: string; close: void }>();
16
 
 
31
  }
32
  }
33
 
34
+ $: featuredModels = models.filter(m =>
35
+ query
36
+ ? FEATUED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim())
37
+ : FEATUED_MODELS_IDS.includes(m.id)
38
+ );
39
+ $: otherModels = models.filter(m =>
40
+ query
41
+ ? !FEATUED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim())
42
+ : !FEATUED_MODELS_IDS.includes(m.id)
43
+ );
44
  </script>
45
 
46
  <svelte:window on:keydown={handleKeydown} />
 
58
  autofocus
59
  class="flex h-10 w-full rounded-md bg-transparent py-3 text-sm placeholder-gray-400 outline-none"
60
  placeholder="Search models ..."
61
+ bind:value={query}
62
  />
63
  </div>
64
  <div class="max-h-[300px] overflow-y-auto overflow-x-hidden">