|
@@ -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(
|
|
|
|
- r"<details\b[^>]*>.*?<\/details>",
|
|
|
|
- "",
|
|
|
|
- message["content"],
|
|
|
|
- flags=re.S | re.I,
|
|
|
|
- ).strip()
|
|
|
|
-
|
|
|
|
- if message.get("files"):
|
|
|
|
- message["files"] = []
|
|
|
|
|
|
+ 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>",
|
|
|
|
+ "",
|
|
|
|
+ content,
|
|
|
|
+ flags=re.S | re.I,
|
|
|
|
+ ).strip()
|
|
|
|
+
|
|
|
|
+ message = {
|
|
|
|
+ "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:
|