From 64c250c9d8d22b42656442c2865eea547deaa322 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Tue, 25 Mar 2025 00:06:25 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=88perf:=20=E4=BC=98=E5=8C=96=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E7=9A=84=20conversation=20=E4=B8=BA=20None=20?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/pipeline/process_stage/method/llm_request.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/astrbot/core/pipeline/process_stage/method/llm_request.py b/astrbot/core/pipeline/process_stage/method/llm_request.py index d13a101ef..b49cd6581 100644 --- a/astrbot/core/pipeline/process_stage/method/llm_request.py +++ b/astrbot/core/pipeline/process_stage/method/llm_request.py @@ -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)