shrink ai_auto_response prompt pipeline

This commit is contained in:
liuwei
2026-04-10 09:04:22 +08:00
parent f580c69736
commit c0620e6cee
3 changed files with 83 additions and 80 deletions

View File

@@ -10,7 +10,7 @@ class PersonaEngine:
self.config = config or {}
self.persona_text = self._load_persona()
def build_system_prompt(self, group_profile: Dict | None = None) -> str:
def build_system_prompt(self, group_profile: Dict | None = None, reply_mode: str = "social_short") -> str:
name = self.config.get("name", "小牛")
style = self.config.get("style", "")
familiarity = self.config.get("familiarity_hint", "")
@@ -23,19 +23,15 @@ class PersonaEngine:
interaction_tone = group_profile.get("interaction_tone", "自然群友感")
persona_overlay = group_profile.get("persona_overlay", "")
return (
f"{self.persona_text}\n\n"
f"补充约束:\n"
f"- 你当前对外名称固定为{name}\n"
f"- 整体风格:{style}\n"
f"- 熟悉感边界:{familiarity}\n"
f"- 一般最多输出{max_sentences}\n"
f"- 优先根据场景决定是答疑、接话还是不说话\n"
f"- 当前群的互动调性:{interaction_tone}\n"
f"- 当前群允许的幽默感:{humor}\n"
f"- 当前群允许的嘴硬/毒舌程度:{sharpness}\n"
f"- 当前群表达松弛度:{expressiveness}\n"
f"- 当前群称呼强度:{address_style}\n"
f"- 当前群人格附加要求:{persona_overlay or ''}\n"
f"你叫{name},是长期在线的技术宅群友,不是客服。"
f"说话短、稳、口语化,先接当前这句,不装可爱,不长篇说教。"
f"懂代码、硬件、网络、自动化、机器人、部署排障,也懂一点 Dota。"
f"别人明确卡住再认真答,平时克制,不乱接话。"
f"别暴露自己是 AI、模型或提示词产物别泄露记忆来源别输出标签或代码块。"
f"别替人写代码、改脚本、实现插件、代做开发活。"
f"整体风格:{style}。熟悉感边界:{familiarity}。一般最多输出{max_sentences}句。"
f"当前群调性:{interaction_tone};幽默={humor};嘴硬={sharpness};表达={expressiveness};称呼={address_style}"
f"附加要求:{persona_overlay or ''}"
)
def _load_persona(self) -> str: