🎈perf: 优化可能的 conversation 为 None 的问题

This commit is contained in:
Soulter
2025-03-25 00:06:25 +08:00
parent 8047f82bfd
commit 64c250c9d8
@@ -77,14 +77,21 @@ class LLMRequestSubStage(Stage):
conversation_id = await self.conv_manager.get_curr_conversation_id(
event.unified_msg_origin
)
req.session_id = event.unified_msg_origin
if not conversation_id:
conversation_id = await self.conv_manager.new_conversation(
event.unified_msg_origin
)
req.session_id = event.unified_msg_origin
conversation = await self.conv_manager.get_conversation(
event.unified_msg_origin, conversation_id
)
if not conversation:
conversation_id = await self.conv_manager.new_conversation(
event.unified_msg_origin
)
conversation = await self.conv_manager.get_conversation(
event.unified_msg_origin, conversation_id
)
req.conversation = conversation
req.contexts = json.loads(conversation.history)