From 3d923a15a27965a2e97db519b9fa71b963a5ecfd Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 12 Nov 2024 16:04:03 -0800 Subject: [PATCH] refac --- .../components/chat/Controls/Controls.svelte | 6 ++++-- src/lib/components/chat/Controls/Valves.svelte | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/lib/components/chat/Controls/Controls.svelte b/src/lib/components/chat/Controls/Controls.svelte index e2b166fb3..4ae63f77e 100644 --- a/src/lib/components/chat/Controls/Controls.svelte +++ b/src/lib/components/chat/Controls/Controls.svelte @@ -13,6 +13,8 @@ export let models = []; export let chatFiles = []; export let params = {}; + + let showValves = false;
@@ -59,9 +61,9 @@
{/if} - +
- +
diff --git a/src/lib/components/chat/Controls/Valves.svelte b/src/lib/components/chat/Controls/Valves.svelte index ab2e0895c..45e504081 100644 --- a/src/lib/components/chat/Controls/Valves.svelte +++ b/src/lib/components/chat/Controls/Valves.svelte @@ -25,6 +25,8 @@ const i18n = getContext('i18n'); + export let show = false; + let tab = 'tools'; let selectedId = ''; @@ -115,21 +117,25 @@ getUserValves(); } - onMount(async () => { + $: if (show) { + init(); + } + + const init = async () => { loading = true; - if ($functions.length === 0) { + if ($functions === null) { functions.set(await getFunctions(localStorage.token)); } - if ($tools.length === 0) { + if ($tools === null) { tools.set(await getTools(localStorage.token)); } loading = false; - }); + }; -{#if !loading} +{#if show && !loading}
{ @@ -203,5 +209,5 @@
{:else} - + {/if}