mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-02 02:12:25 +00:00
fix: missing space in reasoning model answers right after the thinking block (#31438)
With reasoning models, when the first part of the answer arrived together with the end of the thinking block and ended with a space, that space went missing, so "The answer is 4." was shown and saved as "The answeris 4.". That space is now kept. Fixes #31435
This commit is contained in:
parent
9d6b17ffbc
commit
8081ac299f
1 changed files with 2 additions and 2 deletions
|
|
@ -4682,14 +4682,14 @@ async def streaming_chat_response_handler(response, ctx):
|
|||
|
||||
# Strip start and end tags from content
|
||||
start_tag_pattern = _start_tag_pattern(start_tag)
|
||||
block_content = re.sub(start_tag_pattern, '', block_content).strip()
|
||||
block_content = re.sub(start_tag_pattern, '', block_content)
|
||||
|
||||
end_tag_pattern = rf'{re.escape(end_tag)}'
|
||||
end_tag_regex = re.compile(end_tag_pattern, re.DOTALL)
|
||||
split_content = end_tag_regex.split(block_content, maxsplit=1)
|
||||
|
||||
block_content = split_content[0].strip() if split_content else ''
|
||||
leftover_content = split_content[1].strip() if len(split_content) > 1 else ''
|
||||
leftover_content = split_content[1].lstrip() if len(split_content) > 1 else ''
|
||||
|
||||
if block_content:
|
||||
# Update the item with final content
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue