feat: let everyone who can use a model pick its model controls (#32860)

Picking a model control option, such as a Thinking level, needed both the Allow Chat Controls and Allow Chat Params permissions, so admins had to hand out the Advanced Parameters panel just to let people pick a preset. Model control picks now work for anyone with access to the model and are saved per model to their account. Allow Chat Controls still hides the Chat Controls panel and Allow Chat Params still hides the Advanced Parameters panel, in the chat and in personal Settings. Parameters a person saves to their account are no longer filtered by these two permissions, since any chat message could already set any parameter without them.

Fixes #32626
This commit is contained in:
Classic298 2026-10-21 21:44:53 +02:00 • committed by GitHub
parent dc45e3960d
commit db5b874944
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 2 additions and 21 deletions

View file

@ -1217,12 +1217,6 @@ async def chat_completion(
if not isinstance(model_controls, dict):
raise HTTPException(400, 'Model control options must be keyed by model.')
model_controls = {} if form_data.get('automation_id') else model_controls
if any(model_controls.values()) and user.role != 'admin':
permissions = await Config.get('user.permissions')
for permission in ('chat.controls', 'chat.params'):
if not await has_permission(user.id, permission, permissions):
model_controls = {}
break
if missing_base_model and model_controls.get(model_id):
raise HTTPException(400, 'Model control options cannot be applied to the fallback model.')
if model_info_params or request_params:

View file

@ -514,16 +514,6 @@ async def update_user_settings_by_session_user(
):
ui_settings.pop('system', None)
if (
user.role != 'admin'
and 'params' in ui_settings
and (
not await has_permission(user.id, 'chat.controls', await Config.get('user.permissions'), db=db)
or not await has_permission(user.id, 'chat.params', await Config.get('user.permissions'), db=db)
)
):
ui_settings.pop('params', None)
if (
user.role != 'admin'
and ui_settings is not None

View file

@ -1,6 +1,6 @@
<script lang="ts">
import { getContext, tick } from 'svelte';
import { models, user, mobile, settings, type Model } from '$lib/stores';
import { models, mobile, settings, type Model } from '$lib/stores';
import Dropdown from '$lib/components/common/Dropdown.svelte';
import DropdownMenu from '$lib/components/common/DropdownMenu.svelte';
import DropdownSub from '$lib/components/common/DropdownSub.svelte';
@ -40,9 +40,6 @@
!('pipe' in model && model.pipe) &&
Object.keys(model.info?.params?.model_controls ?? {}).length > 0
);
$: permitted =
$user?.role === 'admin' ||
(($user?.permissions?.chat?.controls ?? true) && ($user?.permissions?.chat?.params ?? true));
$: rowClass = `focus-ring flex h-[1.6875rem] w-full cursor-pointer select-none items-center gap-2 rounded-xl px-2 text-left text-[0.8125rem] font-normal text-gray-700 outline-hidden transition-colors duration-75 dark:text-gray-100 ${$settings?.highContrastMode ? 'hover:bg-gray-200! dark:hover:bg-gray-800!' : 'hover:bg-gray-50/40! dark:hover:bg-gray-800/40!'}`;
$: selectedClass = $settings?.highContrastMode
? 'bg-gray-200 dark:bg-gray-800'
@ -117,7 +114,7 @@
{/each}
{/snippet}
{#if permitted && available.length}
{#if available.length}
<Dropdown align="end" visualViewportAware onOpenChange={() => (active = null)}>
<Tooltip content={$i18n.t('Model controls')} placement="top">
<button