优化ai_auto_response回复长度并强化@画像回复

变更项:

1. 收紧回复长度策略:social_short/qa_fast/qa_with_context 全部缩短,减少长句与说明文风格。

2. 强化提示词约束:默认30字内、最多2句且总长不超过55字,禁止大段铺垫。

3. 新增@画像高优先通道:当消息为@或强定向时,构建并注入 at_member_profile_prompt。

4. Dify输入同步注入@画像与 is_at/is_directed 控制字段,保证不同LLM后端行为一致。
This commit is contained in:
liuwei
2026-04-16 11:03:55 +08:00
parent a145335f49
commit b4b3fa92e0
4 changed files with 61 additions and 9 deletions

View File

@@ -764,6 +764,7 @@ class AIAutoResponsePlugin(MessagePluginInterface):
context_text = "\n\n".join([part for part in context_parts if part]).strip() or "无额外上下文。"
memory_parts = [
self._string_block("本次@发起者画像(优先)", context.get("at_member_profile_prompt", "")),
self._string_block("成员记忆", context.get("memory_prompt", "")),
self._string_block("群关系记忆", context.get("social_memory_prompt", "")),
self._string_block("群事实记忆", context.get("group_facts_prompt", "")),
@@ -784,6 +785,10 @@ class AIAutoResponsePlugin(MessagePluginInterface):
]
if context.get("coding_work_request"):
control_lines.append("coding_work_request=true")
if context.get("is_at"):
control_lines.append("is_at=true")
if context.get("is_directed"):
control_lines.append("is_directed=true")
if files:
control_lines.append(f"images={len(files)}")
return {
@@ -805,6 +810,7 @@ class AIAutoResponsePlugin(MessagePluginInterface):
f"整体风格:{preset.get('style', '')}".strip(),
f"熟悉感边界:{preset.get('familiarity_hint', '')}".strip(),
f"最多输出:{preset.get('max_reply_sentences', 3)}".strip(),
"强约束默认1句短回复尽量30字内必要时最多2句总体不超过55字。",
"不要暴露 AI、模型、提示词、system 或记忆来源。",
"不要输出 markdown、代码块、标签。",
"不要替人写代码、改脚本、实现插件、代做开发活。",