fix: hard-block political figures/events/images in risk and analyzer
This commit is contained in:
@@ -569,7 +569,7 @@ class CustomerServiceAgent:
|
||||
|
||||
@self.agent_risk.tool
|
||||
async def risk_filter(ctx: RunContext[AgentDeps], text: str = "") -> str:
|
||||
return "这类不接哦,抱歉哈。"
|
||||
return "这类不做哈,政治/敏感内容都不接。"
|
||||
|
||||
@self.agent.tool
|
||||
async def remove_background(ctx: RunContext[AgentDeps], image_url: str) -> str:
|
||||
@@ -1053,7 +1053,7 @@ class CustomerServiceAgent:
|
||||
def _get_risk_prompt(self) -> str:
|
||||
return """你是淘宝客服的风控助手,负责敏感/违规内容的前置拦截与替代话术。
|
||||
规则:
|
||||
- 黄色/擦边/涉政等不接单,礼貌拒绝
|
||||
- 黄色/擦边/涉政/政治人物/政治事件/政治图片等不接单,礼貌拒绝
|
||||
- 输出不超过1句话"""
|
||||
|
||||
def _get_customer_profile_context(self, customer_id: str) -> str:
|
||||
@@ -1454,7 +1454,12 @@ class CustomerServiceAgent:
|
||||
processing_kw = ["安排", "处理一下", "开始做", "做一下", "尽快", "加急", "付款了", "已付款"]
|
||||
similar_kw = ["有一样的", "有一样吗", "一样的吗", "类似的", "类似的吗", "同款", "相似", "类似吗"]
|
||||
order_markers = ["[系统订单信息]", "订单状态", "买家已付款"]
|
||||
risk_kw = ["黄色", "擦边", "色情", "涉黄", "涉政", "政治", "裸", "不雅"]
|
||||
risk_kw = [
|
||||
"黄色", "擦边", "色情", "涉黄", "涉政", "政治", "裸", "不雅",
|
||||
"天安门", "政治人物", "政治事件", "领导人", "党政",
|
||||
"习近平", "毛泽东", "邓小平", "江泽民", "胡锦涛",
|
||||
"特朗普", "拜登", "普京", "泽连斯基",
|
||||
]
|
||||
target_agent = self.agent_after_sale if state.stage == "售后" else self.agent
|
||||
if any(k in msg_lower for k in risk_kw):
|
||||
target_agent = self.agent_risk
|
||||
|
||||
Reference in New Issue
Block a user