mirror of
https://github.com/open-webui/open-webui
synced 2024-11-21 23:57:51 +00:00
refac
This commit is contained in:
parent
d5435cb8b9
commit
94a0bf90ce
@ -31,7 +31,12 @@
|
||||
init();
|
||||
}
|
||||
|
||||
$: if (tools) {
|
||||
selectedToolIds = Object.keys(tools).filter((toolId) => tools[toolId]?.enabled ?? false);
|
||||
}
|
||||
|
||||
const init = async () => {
|
||||
console.log('init');
|
||||
if ($_tools === null) {
|
||||
await _tools.set(await getTools(localStorage.token));
|
||||
}
|
||||
@ -76,9 +81,7 @@
|
||||
<button
|
||||
class="flex w-full justify-between gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer rounded-xl"
|
||||
on:click={() => {
|
||||
selectedToolIds = tools[toolId].enabled
|
||||
? selectedToolIds.filter((id) => id !== toolId)
|
||||
: [...selectedToolIds, toolId];
|
||||
tools[toolId].enabled = !tools[toolId].enabled;
|
||||
}}
|
||||
>
|
||||
<div class="flex-1 truncate">
|
||||
@ -93,7 +96,7 @@
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
<div class=" shrink-0 flex-shrink-0">
|
||||
<div class=" flex-shrink-0">
|
||||
<Switch state={tools[toolId].enabled} />
|
||||
</div>
|
||||
</button>
|
||||
|
Loading…
Reference in New Issue
Block a user