Spaces:
Sleeping
Sleeping
Added domain filters text input
Browse files
src/lib/components/WebSearchToggle.svelte
CHANGED
@@ -1,31 +1,50 @@
|
|
1 |
<script lang="ts">
|
2 |
-
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
const toggle = () => ($webSearchParameters.useSearch = !$webSearchParameters.useSearch);
|
7 |
</script>
|
8 |
|
9 |
-
<div
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
>
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>
|