Merge pull request #629 from SuanmoSuanyangTechnology/fix/conversation-msgmetadata
fix(conversation): handle None meta_data in msg to prevent exceptions
This commit is contained in:
@@ -124,7 +124,7 @@ class AppChatService:
|
|||||||
limit=10
|
limit=10
|
||||||
)
|
)
|
||||||
history = [
|
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
|
for msg in messages
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -317,7 +317,7 @@ class AppChatService:
|
|||||||
limit=memory_config.get("max_history", 10)
|
limit=memory_config.get("max_history", 10)
|
||||||
)
|
)
|
||||||
history = [
|
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
|
for msg in messages
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ class ConversationService:
|
|||||||
history = [
|
history = [
|
||||||
{
|
{
|
||||||
"role": msg.role,
|
"role": msg.role,
|
||||||
"content": [{"type": "text", "text": msg.content}] + msg.meta_data.get("files", [])
|
"content": [{"type": "text", "text": msg.content}] + (msg.meta_data.get("files", []) if msg.meta_data else [])
|
||||||
}
|
}
|
||||||
for msg in messages
|
for msg in messages
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ class SharedChatService:
|
|||||||
limit=memory_config.get("max_history", 10)
|
limit=memory_config.get("max_history", 10)
|
||||||
)
|
)
|
||||||
history = [
|
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
|
for msg in messages
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -472,7 +472,7 @@ class SharedChatService:
|
|||||||
limit=memory_config.get("max_history", 10)
|
limit=memory_config.get("max_history", 10)
|
||||||
)
|
)
|
||||||
history = [
|
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
|
for msg in messages
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user