Handle overflow in response splitting logic

pull/1353/head
晴空 2025-11-10 17:59:27 +08:00 committed by GitHub
parent 37966f8701
commit 79687b2702
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -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: