fix(ai_auto_response): keep complete social short replies

This commit is contained in:
liuwei
2026-04-10 16:54:12 +08:00
parent 762b6d5252
commit f3354d39a8

View File

@@ -12,7 +12,7 @@ def finalize_reply(response: str, reply_mode: str) -> List[str]:
text = text.replace("\n", " ").strip()
if reply_mode == "social_short":
return split_reply_chunks(text, sentence_limit=2, char_limit=24, chunk_limit=2, allow_clip_split=False)
return split_reply_chunks(text, sentence_limit=2, char_limit=42, chunk_limit=2, allow_clip_split=False)
if reply_mode == "qa_fast":
return split_reply_chunks(text, sentence_limit=2, char_limit=32, chunk_limit=2, allow_clip_split=False)
if reply_mode == "qa_with_context":
@@ -29,7 +29,7 @@ def preview_text(text: str, limit: int = 80) -> str:
def build_length_rule(reply_mode: str) -> str:
if reply_mode == "social_short":
return "默认回1句短话通常控制在6到18个字;如果这样会把语气砍没可以放宽到2句短消息别写成长段。"
return "默认回1句短话通常控制在6到24个字;如果为了保留语气和完整意思,可以放宽到一整句短句,别硬砍半句,也别写成长段。"
if reply_mode == "qa_fast":
return "优先1句话如果确实需要可以拆成2条短消息发出每条优先控制在32字内先给结论不要主动补第二层解释。"
if reply_mode == "qa_with_context":