Spaces:
Build error
Build error
Mishig
commited on
Commit
•
2128ce0
1
Parent(s):
f3c82b6
[Assistants] Fix selected model reactivity (#784)
Browse files
src/routes/assistants/+page.server.ts
CHANGED
@@ -32,6 +32,7 @@ export const load = async ({ url }) => {
|
|
32 |
|
33 |
return {
|
34 |
assistants: JSON.parse(JSON.stringify(assistants)) as Array<Assistant>,
|
|
|
35 |
numTotalItems,
|
36 |
numItemsPerPage: NUM_PER_PAGE,
|
37 |
};
|
|
|
32 |
|
33 |
return {
|
34 |
assistants: JSON.parse(JSON.stringify(assistants)) as Array<Assistant>,
|
35 |
+
selectedModel: modelId ?? "",
|
36 |
numTotalItems,
|
37 |
numItemsPerPage: NUM_PER_PAGE,
|
38 |
};
|
src/routes/assistants/+page.svelte
CHANGED
@@ -14,8 +14,6 @@
|
|
14 |
|
15 |
export let data: PageData;
|
16 |
|
17 |
-
let selectedModel = $page.url.searchParams.get("modelId") ?? "";
|
18 |
-
|
19 |
const onModelChange = (e: Event) => {
|
20 |
const newUrl = new URL($page.url);
|
21 |
newUrl.search = ""; // clear searchParams (such as "p" for pagination)
|
@@ -65,7 +63,7 @@
|
|
65 |
<div class="mt-6 flex justify-between gap-2 max-sm:flex-col sm:items-center">
|
66 |
<select
|
67 |
class="mt-1 h-[34px] rounded-lg border border-gray-300 bg-gray-50 px-2 text-sm text-gray-900 focus:border-blue-700 focus:ring-blue-700 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400"
|
68 |
-
bind:value={selectedModel}
|
69 |
on:change={onModelChange}
|
70 |
>
|
71 |
<option value="">All models</option>
|
|
|
14 |
|
15 |
export let data: PageData;
|
16 |
|
|
|
|
|
17 |
const onModelChange = (e: Event) => {
|
18 |
const newUrl = new URL($page.url);
|
19 |
newUrl.search = ""; // clear searchParams (such as "p" for pagination)
|
|
|
63 |
<div class="mt-6 flex justify-between gap-2 max-sm:flex-col sm:items-center">
|
64 |
<select
|
65 |
class="mt-1 h-[34px] rounded-lg border border-gray-300 bg-gray-50 px-2 text-sm text-gray-900 focus:border-blue-700 focus:ring-blue-700 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400"
|
66 |
+
bind:value={data.selectedModel}
|
67 |
on:change={onModelChange}
|
68 |
>
|
69 |
<option value="">All models</option>
|