mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-26 15:20:59 -05:00
fix: router model titles and tags in a voice call come from a model unrelated to the chat (#34908)
A realtime voice call in a router model chat asks for the title and tags at its first spoken words, before any model has answered. With no task model set, those requests went to the router, and its rules and Decisions API judged the built-in task instructions, so a model unrelated to the chat wrote the title and tags. Prompt Autocompletion, Display Emoji in Call and Merge Responses had the same problem, and the emoji instructions by themselves match a rule that looks for code blocks. Each of these requests is now routed like a message holding the text it is about (the chat, the text being typed for autocompletion, the spoken sentence for the emoji, the question and answers for a merge). A task model set in the admin settings still writes them as before. Refs #34887
This commit is contained in:
1 parent
9c71742e35
commit
5e61d4ef03
1 file changed
+10
-1
@@ -160,7 +160,16 @@ async def dispatch_chat_completion(
|
||||
# Fallback for paths that skip process_chat_payload (title, tags, follow-ups),
|
||||
# so background tasks for sensitive chats are routed too.
|
||||
if not selected_model_id and model.get('owned_by') == 'router':
|
||||
selected_model_id, strategy = await resolve_router_model(model['id'], form_data, user)
|
||||
# Tasks route on the text they are about, not on their own instructions.
|
||||
task_body = metadata.get('task_body')
|
||||
routing_form_data = form_data
|
||||
if task_body:
|
||||
messages = list(task_body.get('messages') or [])
|
||||
if task_body.get('prompt'):
|
||||
messages.append({'role': 'user', 'content': task_body['prompt']})
|
||||
messages += [{'role': 'assistant', 'content': content} for content in task_body.get('responses') or []]
|
||||
routing_form_data = {**form_data, 'messages': messages}
|
||||
selected_model_id, strategy = await resolve_router_model(model['id'], routing_form_data, user)
|
||||
form_data['model'] = selected_model_id
|
||||
|
||||
# bypass_filter recursion below skips the access check; gate the resolved model here.
|
||||
|
||||
Reference in new issue
Block a user