mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-01 19:50:41 +02:00
fix: derive integrations toggle state from the selected ids (#28807)
This commit is contained in:
@@ -34,7 +34,6 @@
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
enabled: boolean;
|
||||
meta?: { description?: string };
|
||||
is_active?: boolean;
|
||||
authenticated?: boolean;
|
||||
@@ -113,8 +112,7 @@
|
||||
a[tool.id] = {
|
||||
...tool,
|
||||
name: tool.name,
|
||||
description: tool.meta?.description,
|
||||
enabled: selectedToolIds.includes(tool.id)
|
||||
description: tool.meta?.description
|
||||
};
|
||||
return a;
|
||||
}, {});
|
||||
@@ -130,8 +128,7 @@
|
||||
items[`direct_server:${serverIdx}`] = {
|
||||
id: `direct_server:${serverIdx}`,
|
||||
name,
|
||||
description: server.info.description ?? '',
|
||||
enabled: selectedToolIds.includes(`direct_server:${serverIdx}`)
|
||||
description: server.info.description ?? ''
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -150,8 +147,7 @@
|
||||
a[skill.id] = {
|
||||
...skill,
|
||||
name: skill.name,
|
||||
description: skill.description,
|
||||
enabled: selectedSkillIds.includes(skill.id)
|
||||
description: skill.description
|
||||
};
|
||||
return a;
|
||||
}, {});
|
||||
@@ -229,9 +225,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
tool.enabled = !tool.enabled;
|
||||
|
||||
const state = tool.enabled;
|
||||
const state = !selectedToolIds.includes(toolId);
|
||||
await tick();
|
||||
|
||||
if (state) {
|
||||
@@ -245,9 +239,7 @@
|
||||
const skill = skills?.[skillId];
|
||||
if (!skill) return;
|
||||
|
||||
skill.enabled = !skill.enabled;
|
||||
|
||||
const state = skill.enabled;
|
||||
const state = !selectedSkillIds.includes(skillId);
|
||||
await tick();
|
||||
|
||||
if (state) {
|
||||
@@ -506,7 +498,7 @@
|
||||
<button
|
||||
class="relative flex w-full justify-between gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer rounded-xl hover:bg-gray-50/40 dark:hover:bg-gray-800/40"
|
||||
aria-pressed={(tools?.[toolId]?.authenticated ?? true)
|
||||
? tools?.[toolId]?.enabled
|
||||
? selectedToolIds.includes(toolId)
|
||||
: undefined}
|
||||
on:click={async (e) => {
|
||||
await toggleTool(toolId, e);
|
||||
@@ -584,7 +576,7 @@
|
||||
{/if}
|
||||
|
||||
<div class=" shrink-0" inert>
|
||||
<Switch state={tools?.[toolId]?.enabled} />
|
||||
<Switch state={selectedToolIds.includes(toolId)} />
|
||||
</div>
|
||||
</button>
|
||||
{/each}
|
||||
@@ -620,7 +612,7 @@
|
||||
{#each skillIds as skillId}
|
||||
<button
|
||||
class="relative flex w-full justify-between gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer rounded-xl hover:bg-gray-50/40 dark:hover:bg-gray-800/40"
|
||||
aria-pressed={skills?.[skillId]?.enabled}
|
||||
aria-pressed={selectedSkillIds.includes(skillId)}
|
||||
on:click={async () => {
|
||||
await toggleSkill(skillId);
|
||||
}}
|
||||
@@ -642,7 +634,7 @@
|
||||
</div>
|
||||
|
||||
<div class=" shrink-0" inert>
|
||||
<Switch state={skills?.[skillId]?.enabled} />
|
||||
<Switch state={selectedSkillIds.includes(skillId)} />
|
||||
</div>
|
||||
</button>
|
||||
{/each}
|
||||
|
||||
Reference in New Issue
Block a user