From 4d414a2994d41dc213250eee451bb4d469a22068 Mon Sep 17 00:00:00 2001 From: Raila23 <3271405327@qq.com> Date: Wed, 9 Apr 2025 22:28:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0dequeue=5Fcontext=5Flength?= =?UTF-8?q?=E7=9A=84=E5=80=BC=E7=9A=84=E5=88=A4=E6=96=AD=EF=BC=8C=E5=8F=AA?= =?UTF-8?q?=E8=83=BD=E5=9C=A81=E5=88=B0max=5Fcontext=5Flength=E4=B9=8B?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/pipeline/process_stage/method/llm_request.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/astrbot/core/pipeline/process_stage/method/llm_request.py b/astrbot/core/pipeline/process_stage/method/llm_request.py index 35e9f5f50..1ce44cee8 100644 --- a/astrbot/core/pipeline/process_stage/method/llm_request.py +++ b/astrbot/core/pipeline/process_stage/method/llm_request.py @@ -38,9 +38,10 @@ class LLMRequestSubStage(Stage): self.max_context_length = ctx.astrbot_config["provider_settings"][ "max_context_length" ] # int - self.dequeue_context_length = ctx.astrbot_config["provider_settings"][ - "dequeue_context_length" - ] # int + self.dequeue_context_length = min( + max(1,ctx.astrbot_config["provider_settings"]["dequeue_context_length"]), + self.max_context_length - 1 + ) # int self.streaming_response = ctx.astrbot_config["provider_settings"][ "streaming_response" ] # bool