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 2026-10-23 03:46:52 +02:00 • committed by GitHub
parent 9faca2ac5b
commit 4324573f16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 7 deletions

View file

@ -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')}

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>