This commit is contained in:
Timothy Jaeryang Baek 2024-11-12 16:04:03 -08:00
parent f470f3fce2
commit 3d923a15a2
2 changed files with 16 additions and 8 deletions

View File

@ -13,6 +13,8 @@
export let models = []; export let models = [];
export let chatFiles = []; export let chatFiles = [];
export let params = {}; export let params = {};
let showValves = false;
</script> </script>
<div class=" dark:text-white"> <div class=" dark:text-white">
@ -59,9 +61,9 @@
<hr class="my-2 border-gray-50 dark:border-gray-700/10" /> <hr class="my-2 border-gray-50 dark:border-gray-700/10" />
{/if} {/if}
<Collapsible title={$i18n.t('Valves')} buttonClassName="w-full"> <Collapsible bind:open={showValves} title={$i18n.t('Valves')} buttonClassName="w-full">
<div class="text-sm" slot="content"> <div class="text-sm" slot="content">
<Valves /> <Valves show={showValves} />
</div> </div>
</Collapsible> </Collapsible>

View File

@ -25,6 +25,8 @@
const i18n = getContext('i18n'); const i18n = getContext('i18n');
export let show = false;
let tab = 'tools'; let tab = 'tools';
let selectedId = ''; let selectedId = '';
@ -115,21 +117,25 @@
getUserValves(); getUserValves();
} }
onMount(async () => { $: if (show) {
init();
}
const init = async () => {
loading = true; loading = true;
if ($functions.length === 0) { if ($functions === null) {
functions.set(await getFunctions(localStorage.token)); functions.set(await getFunctions(localStorage.token));
} }
if ($tools.length === 0) { if ($tools === null) {
tools.set(await getTools(localStorage.token)); tools.set(await getTools(localStorage.token));
} }
loading = false; loading = false;
}); };
</script> </script>
{#if !loading} {#if show && !loading}
<form <form
class="flex flex-col h-full justify-between space-y-3 text-sm" class="flex flex-col h-full justify-between space-y-3 text-sm"
on:submit|preventDefault={() => { on:submit|preventDefault={() => {
@ -203,5 +209,5 @@
</div> </div>
</form> </form>
{:else} {:else}
<Spinner className="size-6" /> <Spinner className="size-4" />
{/if} {/if}