mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac
This commit is contained in:
parent
2aa5e73728
commit
528a2cf96a
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user