MariaK commited on
Commit
0010d1f
1 Parent(s): ac04347

Added domain filters text input

Browse files
src/lib/components/WebSearchToggle.svelte CHANGED
@@ -1,31 +1,50 @@
1
  <script lang="ts">
2
- import { webSearchParameters } from "$lib/stores/webSearchParameters";
3
- import CarbonInformation from "~icons/carbon/information";
4
- import Switch from "./Switch.svelte";
 
 
 
 
 
 
 
 
5
 
6
- const toggle = () => ($webSearchParameters.useSearch = !$webSearchParameters.useSearch);
7
  </script>
8
 
9
- <div
10
- class="flex h-9 cursor-pointer select-none items-center gap-2 rounded-xl border bg-white p-1.5 shadow-sm hover:shadow-none dark:border-gray-800 dark:bg-gray-900"
11
- on:click={toggle}
12
- on:keypress={toggle}
13
- aria-checked={$webSearchParameters.useSearch}
14
- aria-label="web search toggle"
15
- role="switch"
16
- tabindex="0"
17
- >
18
- <Switch name="useSearch" bind:checked={$webSearchParameters.useSearch} on:click on:keypress />
19
- <div class="whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">Search web</div>
20
- <div class="group relative w-max">
21
- <CarbonInformation class="text-xs text-gray-500" />
22
- <div
23
- class="pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"
24
- >
25
- <p class="max-w-sm text-sm text-gray-800 dark:text-gray-200">
26
- When enabled, the model will try to complement its answer with information queried from the
27
- web.
28
- </p>
29
- </div>
30
- </div>
31
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <script lang="ts">
2
+ import { webSearchParameters } from "$lib/stores/webSearchParameters";
3
+ import CarbonInformation from "~icons/carbon/information";
4
+ import Switch from "./Switch.svelte";
5
+
6
+ const toggle = () => {$webSearchParameters.useSearch = !$webSearchParameters.useSearch;};
7
+
8
+ let domainFilters = $webSearchParameters.domainFilters;
9
+
10
+ const updateDomainFilters = () => {
11
+ $webSearchParameters.domainFilters = domainFilters;
12
+ };
13
 
 
14
  </script>
15
 
16
+ <div class="flex flex-col gap-4">
17
+ <div
18
+ class="flex h-9 cursor-pointer select-none items-center gap-2 rounded-xl border bg-white p-1.5 shadow-sm hover:shadow-none dark:border-gray-800 dark:bg-gray-900"
19
+ on:click={toggle}
20
+ on:keypress={toggle}
21
+ >
22
+ <Switch name="useSearch" bind:checked={$webSearchParameters.useSearch} on:click on:keypress />
23
+ <div class="whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">Search web</div>
24
+ <div class="group relative w-max">
25
+ <CarbonInformation class="text-xs text-gray-500" />
26
+ <div
27
+ class="pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"
28
+ >
29
+ <p class="max-w-sm text-sm text-gray-800 dark:text-gray-200">
30
+ When enabled, the model will try to complement its answer with information queried from the
31
+ web.
32
+ </p>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ {#if $webSearchParameters.useSearch}
37
+ <div class="flex items-center gap-2">
38
+ <label for="domainFilters" class="text-sm text-gray-800 dark:text-gray-200">(Optional) limit search to :</label>
39
+ <input
40
+ type="text"
41
+ id="domainFilters"
42
+ name="domainFilters"
43
+ bind:value={domainFilters}
44
+ class="border rounded-md p-2"
45
+ placeholder="e.g. hf.co, github.com"
46
+ on:input={updateDomainFilters}
47
+ />
48
+ </div>
49
+ {/if}
50
+ </div>