update:实现无关消息不回复的功能

This commit is contained in:
shaxiu
2026-01-12 23:20:28 +08:00
parent a95eb196ed
commit 2c1936e94b
3 changed files with 15 additions and 2 deletions
+6 -1
View File
@@ -89,7 +89,12 @@ class XianyuReplyBot:
internal_intents = {'classify'} # 定义不对外开放的Agent
if detected_intent in self.agents and detected_intent not in internal_intents:
if detected_intent == 'no_reply':
# 无需回复的情况
logger.info(f'意图识别完成: no_reply - 无需回复')
self.last_intent = 'no_reply'
return "-" # 返回特殊标记,表示无需回复
elif detected_intent in self.agents and detected_intent not in internal_intents:
agent = self.agents[detected_intent]
logger.info(f'意图识别完成: {detected_intent}')
self.last_intent = detected_intent # 保存当前意图
+5
View File
@@ -456,6 +456,11 @@ class XianyuLive:
context=context
)
# 检查是否需要回复
if bot_reply == "-":
logger.info(f"[无需回复] 用户 {send_user_name} 的消息被识别为无需回复类型")
return
# 检查是否为价格意图,如果是则增加议价次数
if bot.last_intent == "price":
self.context_manager.increment_bargain_count_by_chat(chat_id)
+4 -1
View File
@@ -10,7 +10,10 @@
- 含参数或技术词:型号/规格/适配/安装/维修
- 示例:"支持Type-C吗"、"内存多大"
3. default(其他类):
3. no_reply(无需回复)
- 如果有人问你"你是谁""你用的什么模型""你来自哪里"等无关问题
4. default(其他类):
- 物流问题:发货/退换/保修
- 基础咨询:你好/在吗/怎么注册