fix: Valves pickers in Chat Controls show while tools and functions are off (#32959)

With tools or functions turned off for the instance (ENABLE_TOOLS, ENABLE_FUNCTIONS), Chat Controls still offered both under Valves, and the list for the disabled one was always empty. Tools and functions are now only offered there while they are enabled, and the Valves section is hidden when both are off.

Refs #32830
This commit is contained in:
Classic298 authored and GitHub committed 2026-10-23 10:46:52 +09:00
1 parent 9faca2ac5b
commit 4324573f16
2 files changed
+13 -7

No files matched your search

@@ -9,7 +9,7 @@
import FileItem from '$lib/components/common/FileItem.svelte';
import Collapsible from '$lib/components/common/Collapsible.svelte';
import { user, settings } from '$lib/stores';
import { config, user, settings } from '$lib/stores';
export let models = [];
export let chatFiles = [];
export let params: Record<string, any> = {};
@@ -92,7 +92,7 @@
</Collapsible>
{/if}
{#if $user?.role === 'admin' || ($user?.permissions.chat?.valves ?? true)}
{#if ($config?.features?.enable_tools || $config?.features?.enable_functions) && ($user?.role === 'admin' || ($user?.permissions.chat?.valves ?? true))}
<Collapsible
bind:open={showValves}
onChange={setOpen('valves')}
+11 -5
View File
@@ -28,7 +28,7 @@
export let show = false;
let tab = 'tools';
let tab = $config?.features?.enable_tools ? 'tools' : 'functions';
let selectedId = '';
let loading = false;
@@ -167,10 +167,16 @@
bind:value={tab}
placeholder={$i18n.t('Select')}
>
<option value="tools" class="bg-gray-100 dark:bg-gray-800">{$i18n.t('Tools')}</option>
<option value="functions" class="bg-gray-100 dark:bg-gray-800"
>{$i18n.t('Functions')}</option
>
{#if $config?.features?.enable_tools}
<option value="tools" class="bg-gray-100 dark:bg-gray-800"
>{$i18n.t('Tools')}</option
>
{/if}
{#if $config?.features?.enable_functions}
<option value="functions" class="bg-gray-100 dark:bg-gray-800"
>{$i18n.t('Functions')}</option
>
{/if}
</select>
</div>