feat: enforce fixed pricing negotiation and trust-case replies
This commit is contained in:
@@ -1590,6 +1590,11 @@ class CustomerServiceAgent:
|
|||||||
# 更新历史,最多保留最近 30 条消息防止 token 超限
|
# 更新历史,最多保留最近 30 条消息防止 token 超限
|
||||||
self.message_histories[message.from_id] = result.all_messages()[-30:]
|
self.message_histories[message.from_id] = result.all_messages()[-30:]
|
||||||
reply_text = self._normalize_reply_text(result.output)
|
reply_text = self._normalize_reply_text(result.output)
|
||||||
|
|
||||||
|
# 价格谈判与信任建立固定策略(避免只回“最低了/先拍下”)
|
||||||
|
strategy_reply = self._negotiation_strategy_reply(message.msg, state)
|
||||||
|
if strategy_reply:
|
||||||
|
reply_text = strategy_reply
|
||||||
# 拦截超低杀价:客户报价低于底线时,统一礼貌拒绝
|
# 拦截超低杀价:客户报价低于底线时,统一礼貌拒绝
|
||||||
try:
|
try:
|
||||||
from config.config import MIN_PRICE_FLOOR
|
from config.config import MIN_PRICE_FLOOR
|
||||||
@@ -1930,6 +1935,34 @@ class CustomerServiceAgent:
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def _negotiation_strategy_reply(self, customer_text: str, state: ConversationState) -> str:
|
||||||
|
"""
|
||||||
|
价格谈判固定策略(优先级高于通用 AI 自由回复):
|
||||||
|
- 有点贵:给两张打包建议价
|
||||||
|
- 优惠点:引导3张以上打包价
|
||||||
|
- 先发效果图:给固定案例链接并说明不满意包退
|
||||||
|
"""
|
||||||
|
text = (customer_text or "").strip()
|
||||||
|
if not text:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
if any(k in text for k in ["先发效果图", "先看效果", "不放心", "没法确认"]):
|
||||||
|
return (
|
||||||
|
f"小妹整理了一些案例图,亲点这个链接就能看到啦({CASE_LIBRARY_LINK})。"
|
||||||
|
"有什么想要的效果随时可以告诉我哈,我这边都可以按您的要求来做哦~/:065 效果不好不满意,我们这边包退的哦。"
|
||||||
|
)
|
||||||
|
|
||||||
|
if "有点贵" in text or "就是贵" in text:
|
||||||
|
# 约定示例:两张优惠价,默认45;若已有单张价格则动态估算两张打包价
|
||||||
|
base = state.last_price if isinstance(state.last_price, int) and state.last_price > 0 else 25
|
||||||
|
two_pack = max(10, round(((base * 2) - 5) / 5) * 5)
|
||||||
|
return f"理解你的顾虑,这样吧,两张一起的话给你算 {two_pack} 元?"
|
||||||
|
|
||||||
|
if any(k in text for k in ["优惠点", "便宜点", "少点", "打折"]):
|
||||||
|
return "看你要做的数量,3张以上可以给你打包价~"
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
||||||
def _parse_order_info(self, msg: str) -> dict:
|
def _parse_order_info(self, msg: str) -> dict:
|
||||||
"""从系统订单消息中提取所有字段"""
|
"""从系统订单消息中提取所有字段"""
|
||||||
import re
|
import re
|
||||||
|
|||||||
Reference in New Issue
Block a user