pull/1356/head
SengokuCola 2025-11-10 22:20:18 +08:00
commit 85864c7013
3 changed files with 12 additions and 4 deletions

View File

@ -405,8 +405,12 @@ def process_llm_response(text: str, enable_splitter: bool = True, enable_chinese
sentences.append(sentence) sentences.append(sentence)
if len(sentences) > max_sentence_num: if len(sentences) > max_sentence_num:
logger.warning(f"分割后消息数量过多 ({len(sentences)} 条),返回默认回复") if global_config.response_splitter.enable_overflow_return_all:
return [_get_random_default_reply()] logger.warning(f"分割后消息数量过多 ({len(sentences)} 条),合并后一次返回")
sentences = ["".join(sentences)]
else:
logger.warning(f"分割后消息数量过多 ({len(sentences)} 条),返回默认回复")
return [_get_random_default_reply()]
# if extracted_contents: # if extracted_contents:
# for content in extracted_contents: # for content in extracted_contents:

View File

@ -626,6 +626,9 @@ class ResponseSplitterConfig(ConfigBase):
enable_kaomoji_protection: bool = False enable_kaomoji_protection: bool = False
"""是否启用颜文字保护""" """是否启用颜文字保护"""
enable_overflow_return_all: bool = False
"""是否在超出句子数量限制时合并后一次性返回"""
@dataclass @dataclass
class TelemetryConfig(ConfigBase): class TelemetryConfig(ConfigBase):

View File

@ -1,5 +1,5 @@
[inner] [inner]
version = "6.20.2" version = "6.20.3"
#----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- #----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读----
#如果你想要修改配置文件请递增version的值 #如果你想要修改配置文件请递增version的值
@ -206,6 +206,7 @@ enable = true # 是否启用回复分割器
max_length = 512 # 回复允许的最大长度 max_length = 512 # 回复允许的最大长度
max_sentence_num = 8 # 回复允许的最大句子数 max_sentence_num = 8 # 回复允许的最大句子数
enable_kaomoji_protection = false # 是否启用颜文字保护 enable_kaomoji_protection = false # 是否启用颜文字保护
enable_overflow_return_all = false # 是否在句子数量超出回复允许的最大句子数时一次性返回全部内容
[log] [log]
date_style = "m-d H:i:s" # 日期格式 date_style = "m-d H:i:s" # 日期格式