This commit is contained in:
Timothy Jaeryang Baek 2025-05-16 18:19:28 +04:00
parent 2aa5e73728
commit 528a2cf96a

View File

@ -953,15 +953,25 @@ async def process_chat_response(
# 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( content = message.get("content", "")
if isinstance(content, list):
for item in content:
if item.get("type") == "text":
content = item["text"]
break
if isinstance(content, str):
content = re.sub(
r"<details\b[^>]*>.*?<\/details>", r"<details\b[^>]*>.*?<\/details>",
"", "",
message["content"], content,
flags=re.S | re.I, flags=re.S | re.I,
).strip() ).strip()
if message.get("files"): message = {
message["files"] = [] "role": message["role"],
"content": content,
}
if tasks and messages: if tasks and messages:
if TASKS.TITLE_GENERATION in tasks: if TASKS.TITLE_GENERATION in tasks: