mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
refac
This commit is contained in:
parent
e000494e48
commit
7d205b1711
1 changed files with 11 additions and 13 deletions
|
|
@ -330,7 +330,7 @@
|
||||||
{#each Object.keys(tools) as toolId}
|
{#each Object.keys(tools) as toolId}
|
||||||
<button
|
<button
|
||||||
class="relative flex w-full justify-between gap-2 items-center px-3 py-1.5 text-sm cursor-pointer rounded-xl hover:bg-gray-50 dark:hover:bg-gray-800/50"
|
class="relative flex w-full justify-between gap-2 items-center px-3 py-1.5 text-sm cursor-pointer rounded-xl hover:bg-gray-50 dark:hover:bg-gray-800/50"
|
||||||
on:click={(e) => {
|
on:click={async (e) => {
|
||||||
if (!(tools[toolId]?.authenticated ?? true)) {
|
if (!(tools[toolId]?.authenticated ?? true)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
|
@ -341,6 +341,15 @@
|
||||||
window.open(authUrl, '_blank', 'noopener');
|
window.open(authUrl, '_blank', 'noopener');
|
||||||
} else {
|
} else {
|
||||||
tools[toolId].enabled = !tools[toolId].enabled;
|
tools[toolId].enabled = !tools[toolId].enabled;
|
||||||
|
|
||||||
|
const state = tools[toolId].enabled;
|
||||||
|
await tick();
|
||||||
|
|
||||||
|
if (state) {
|
||||||
|
selectedToolIds = [...selectedToolIds, toolId];
|
||||||
|
} else {
|
||||||
|
selectedToolIds = selectedToolIds.filter((id) => id !== toolId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
@ -383,18 +392,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class=" shrink-0">
|
<div class=" shrink-0">
|
||||||
<Switch
|
<Switch state={tools[toolId].enabled} />
|
||||||
state={tools[toolId].enabled}
|
|
||||||
on:change={async (e) => {
|
|
||||||
const state = e.detail;
|
|
||||||
await tick();
|
|
||||||
if (state) {
|
|
||||||
selectedToolIds = [...selectedToolIds, toolId];
|
|
||||||
} else {
|
|
||||||
selectedToolIds = selectedToolIds.filter((id) => id !== toolId);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue