From 37966f8701ad4ce30f23e82e201649d5aeb1b79c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=B4=E7=A9=BA?= <3103908461@qq.com> Date: Mon, 10 Nov 2025 17:57:35 +0800 Subject: [PATCH 1/2] Add enable_overflow_return_all configuration option --- src/config/official_configs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/config/official_configs.py b/src/config/official_configs.py index ad933148..e21d8f96 100644 --- a/src/config/official_configs.py +++ b/src/config/official_configs.py @@ -626,6 +626,9 @@ class ResponseSplitterConfig(ConfigBase): enable_kaomoji_protection: bool = False """是否启用颜文字保护""" + enable_overflow_return_all: bool = False + """是否在超出句子数量限制时合并后一次性返回""" + @dataclass class TelemetryConfig(ConfigBase): From 79687b270239f9672eafd62b7979a7b33075c332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=B4=E7=A9=BA?= <3103908461@qq.com> Date: Mon, 10 Nov 2025 17:59:27 +0800 Subject: [PATCH 2/2] Handle overflow in response splitting logic --- src/chat/utils/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/chat/utils/utils.py b/src/chat/utils/utils.py index d85f8143..3f723c46 100644 --- a/src/chat/utils/utils.py +++ b/src/chat/utils/utils.py @@ -402,8 +402,12 @@ def process_llm_response(text: str, enable_splitter: bool = True, enable_chinese sentences.append(sentence) if len(sentences) > max_sentence_num: - logger.warning(f"分割后消息数量过多 ({len(sentences)} 条),返回默认回复") - return [_get_random_default_reply()] + if global_config.response_splitter.enable_overflow_return_all: + logger.warning(f"分割后消息数量过多 ({len(sentences)} 条),合并后一次返回") + sentences = ["".join(sentences)] + else: + logger.warning(f"分割后消息数量过多 ({len(sentences)} 条),返回默认回复") + return [_get_random_default_reply()] # if extracted_contents: # for content in extracted_contents: