mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-14 09:21:22 +00:00
fix: non-ASCII stop sequences on a model reach the provider corrupted (#33614)
A Stop Sequence saved on a workspace model reached the provider corrupted when it had non-ASCII text in it (終 went out as çµ\x82, café as café), so the model never stopped on it. This happened when an API client used the model through /openai/chat/completions or /ollama/api/chat. Those stops now arrive unchanged, and typing \n in the field still sends a newline. Fixes #33610
This commit is contained in:
parent
1d5373066d
commit
dd6720c528
1 changed files with 2 additions and 2 deletions
|
|
@ -210,7 +210,7 @@ def apply_model_params_to_body_openai(params: dict, form_data: dict) -> dict:
|
|||
'presence_penalty': float,
|
||||
'reasoning_effort': str,
|
||||
'seed': lambda x: x,
|
||||
'stop': lambda x: [bytes(s, 'utf-8').decode('unicode_escape') for s in x],
|
||||
'stop': lambda x: [stop.encode('latin-1', 'backslashreplace').decode('unicode_escape') for stop in x],
|
||||
'logit_bias': lambda x: x,
|
||||
'response_format': dict,
|
||||
}
|
||||
|
|
@ -264,7 +264,7 @@ def apply_model_params_to_body_ollama(params: dict, form_data: dict) -> dict:
|
|||
'repeat_penalty': float,
|
||||
'presence_penalty': float,
|
||||
'frequency_penalty': float,
|
||||
'stop': lambda x: [bytes(s, 'utf-8').decode('unicode_escape') for s in x],
|
||||
'stop': lambda x: [stop.encode('latin-1', 'backslashreplace').decode('unicode_escape') for stop in x],
|
||||
'num_gpu': int,
|
||||
'use_mmap': bool,
|
||||
'use_mlock': bool,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue