fix(conversation): handle None meta_data in msg to prevent exceptions

This commit is contained in:
Eternity
2026-03-19 19:21:39 +08:00
parent 37a22fbfa9
commit c3f8dbd4bc
3 changed files with 5 additions and 5 deletions

View File

@@ -124,7 +124,7 @@ class AppChatService:
limit=10
)
history = [
{"role": msg.role, "content": [{"type": "text", "text": msg.content}] + msg.meta_data.get("files", [])}
{"role": msg.role, "content": [{"type": "text", "text": msg.content}] + (msg.meta_data.get("files", []) if msg.meta_data else [])}
for msg in messages
]
@@ -317,7 +317,7 @@ class AppChatService:
limit=memory_config.get("max_history", 10)
)
history = [
{"role": msg.role, "content": [{"type": "text", "text": msg.content}] + msg.meta_data.get("files", [])}
{"role": msg.role, "content": [{"type": "text", "text": msg.content}] + (msg.meta_data.get("files", []) if msg.meta_data else [])}
for msg in messages
]