fix: messages to a model fail after the admin removes a model control the user had set (#32197)

When an admin removed a model control (such as Thinking) after a user had chosen one of its options in the chat input, every message that user sent to that model failed with "the selected option is no longer available" and never reached the model. The control is gone from the chat input, so the user had no way to undo the choice. A choice for a control that no longer exists is now ignored and the message goes through. When only one option of a control is removed, the error stays, because the control is still in the chat input and the user can pick another option there.

Fixes #31996
This commit is contained in:
Classic298 2026-10-10 18:11:47 +02:00 • committed by GitHub
parent 170ec28a1a
commit aaea99005d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,7 +22,8 @@ def apply_model_controls(params: dict, controls: dict, model_options: dict) -> d
if not isinstance(model_options, dict):
raise HTTPException(400, 'Model control options must be an object.')
for key, choice in model_options.items():
if key not in controls or not isinstance(choice, str) or choice not in controls[key]['options']:
# Picks for removed controls are skipped: the user has no menu left to clear them.
if key in controls and (not isinstance(choice, str) or choice not in controls[key]['options']):
raise HTTPException(400, f'Model control {key}: the selected option is no longer available.')
for key, control in controls.items():
choice = model_options.get(key, control.get('default'))