mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 12:25:20 +00:00
fix: <think> tag
This commit is contained in:
parent
1ab66e83c6
commit
c36c63f1e8
1 changed files with 26 additions and 7 deletions
|
|
@ -1233,6 +1233,16 @@ async def process_chat_response(
|
|||
].replace(match.group(0), "")
|
||||
if not content_blocks[-1]["content"]:
|
||||
content_blocks.pop()
|
||||
|
||||
if not content_blocks:
|
||||
# Append the new block
|
||||
content_blocks.append(
|
||||
{
|
||||
"type": "text",
|
||||
"content": "",
|
||||
}
|
||||
)
|
||||
|
||||
# Append the new block
|
||||
content_blocks.append(
|
||||
{
|
||||
|
|
@ -1461,6 +1471,7 @@ async def process_chat_response(
|
|||
log.debug("Error: ", e)
|
||||
continue
|
||||
|
||||
if content_blocks:
|
||||
# Clean up the last text block
|
||||
if content_blocks[-1]["type"] == "text":
|
||||
content_blocks[-1]["content"] = content_blocks[-1][
|
||||
|
|
@ -1470,6 +1481,14 @@ async def process_chat_response(
|
|||
if not content_blocks[-1]["content"]:
|
||||
content_blocks.pop()
|
||||
|
||||
if not content_blocks:
|
||||
content_blocks.append(
|
||||
{
|
||||
"type": "text",
|
||||
"content": "",
|
||||
}
|
||||
)
|
||||
|
||||
if response_tool_calls:
|
||||
tool_calls.append(response_tool_calls)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue