mirror of
https://git.mirrors.martin98.com/https://github.com/open-webui/open-webui
synced 2025-08-15 13:45:57 +08:00
refac: filter details
This commit is contained in:
parent
dec9dd1ac0
commit
2aa5e73728
@ -949,15 +949,15 @@ async def process_chat_response(
|
|||||||
if message:
|
if message:
|
||||||
messages = get_message_list(message_map, message.get("id"))
|
messages = get_message_list(message_map, message.get("id"))
|
||||||
|
|
||||||
# Remove reasoning details and files from the messages.
|
# Remove details tags and files from the messages.
|
||||||
# as get_message_list creates a new list, it does not affect
|
# as get_message_list creates a new list, it does not affect
|
||||||
# the original messages outside of this handler
|
# the original messages outside of this handler
|
||||||
for message in messages:
|
for message in messages:
|
||||||
message["content"] = re.sub(
|
message["content"] = re.sub(
|
||||||
r"<details\s+type=\"reasoning\"[^>]*>.*?<\/details>",
|
r"<details\b[^>]*>.*?<\/details>",
|
||||||
"",
|
"",
|
||||||
message["content"],
|
message["content"],
|
||||||
flags=re.S,
|
flags=re.S | re.I,
|
||||||
).strip()
|
).strip()
|
||||||
|
|
||||||
if message.get("files"):
|
if message.get("files"):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user