mirror of
https://github.com/open-webui/open-webui
synced 2024-11-17 05:53:11 +00:00
refac
This commit is contained in:
parent
f470f3fce2
commit
3d923a15a2
@ -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>
|
||||||
|
|
||||||
|
@ -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}
|
||||||
|
Loading…
Reference in New Issue
Block a user