fix: transfer on delivery handoff requests
This commit is contained in:
@@ -113,6 +113,19 @@ _FILE_HANDOFF_TRANSFER_KEYWORDS = (
|
||||
"文件发你了",
|
||||
)
|
||||
|
||||
_DELIVERY_HANDOFF_HINT_KEYWORDS = (
|
||||
"发给我吧原图",
|
||||
"原图发给我",
|
||||
"把原图发给我",
|
||||
"发我吧原图",
|
||||
"把文件发给我",
|
||||
"把成品发给我",
|
||||
"做好了发给我",
|
||||
"做好了直接发我",
|
||||
"做完了发给我",
|
||||
"发过来吧",
|
||||
)
|
||||
|
||||
_DESIGNER_SCHEDULE_QUESTION_KEYWORDS = (
|
||||
"几点上班",
|
||||
"什么时候上班",
|
||||
@@ -287,17 +300,43 @@ def _requests_payment_link(current_text: str, history: Optional[List[dict]] = No
|
||||
return ("付款" in text or "支付" in text or "拍单" in text or "下单" in text) and "链接" in text
|
||||
|
||||
|
||||
def _history_has_transfer_or_order(history: Optional[List[dict]] = None) -> bool:
|
||||
for item in history or []:
|
||||
content = str(item.get("content") or "")
|
||||
if not content:
|
||||
continue
|
||||
if "[转移会话]" in content or "设计师上线了" in content:
|
||||
return True
|
||||
if "[系统订单信息]" in content or "订单状态:" in content or "订单号:" in content:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _requests_file_handoff_transfer(current_text: str, history: Optional[List[dict]] = None) -> bool:
|
||||
text = _normalize_text(current_text)
|
||||
if not text:
|
||||
return False
|
||||
if any(keyword in text for keyword in _FILE_HANDOFF_TRANSFER_KEYWORDS):
|
||||
return True
|
||||
if any(keyword in text for keyword in _DELIVERY_HANDOFF_HINT_KEYWORDS):
|
||||
return True
|
||||
|
||||
has_file_signal = "文件" in text or "源文件" in text
|
||||
has_delivery_signal = any(token in text for token in ("发了", "发送了", "发过去", "发你", "给你发"))
|
||||
has_receipt_signal = any(token in text for token in ("看到了吗", "收到了吗", "收到没", "看见了吗", "收到吗"))
|
||||
return has_file_signal and (has_delivery_signal or has_receipt_signal)
|
||||
if has_file_signal and (has_delivery_signal or has_receipt_signal):
|
||||
return True
|
||||
|
||||
if _history_has_transfer_or_order(history):
|
||||
has_asset_signal = any(token in text for token in ("原图", "源文件", "文件", "成品", "图", "图片"))
|
||||
has_send_request = any(
|
||||
token in text
|
||||
for token in ("发给我", "发我", "发过来", "给我吧", "给我发", "直接发", "传给我", "传过来")
|
||||
)
|
||||
if has_asset_signal and has_send_request:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def _asks_designer_schedule(current_text: str, history: Optional[List[dict]] = None) -> bool:
|
||||
@@ -372,7 +411,7 @@ class CustomerServiceBrain:
|
||||
" 客户只发了图但没说需求 → 先问'亲亲这张是找原图还是修复哈?'\n"
|
||||
" 客户说了'有吗'、'能找吗'、'找图'、'找原图'、'有大图吗' → 直接按【找原图】意图处理,不要重复追问。\n"
|
||||
" 客户说了'修复'、'高清'、'清晰点'、'放大清晰' → 直接按【高清修复】意图处理,不要重复追问。\n"
|
||||
" 客户说'文件发过去了'、'发送文件了看到了吗'、'源文件发你了'这类文件交接话术 → 视为设计师成品/文件交接场景,必须立即调用转人工工具,不要再问客户发图或问需求。\n"
|
||||
" 客户说'文件发过去了'、'发送文件了看到了吗'、'源文件发你了'、'发给我吧原图'、'做好了直接发我'这类交付话术 → 视为设计师成品/文件交接场景,必须立即调用转人工工具,不要再问客户发图或问需求。\n"
|
||||
"9. **下线安抚**:只有工具返回ERROR时才能提设计师不在。根据错误码区分:\n"
|
||||
" - ERROR_DESIGNER_NOT_STARTED → 说'还没上班,记下了上班马上处理'(严禁说下班)\n"
|
||||
" - ERROR_DESIGNER_OFFLINE → 说'下班了,需求记下明天回'\n"
|
||||
@@ -426,9 +465,9 @@ class CustomerServiceBrain:
|
||||
elif _requests_file_handoff_transfer(user_content, history):
|
||||
logger.info(f"[Brain] 已识别为文件交接转接意图: user={msg.user_id}")
|
||||
user_content = (
|
||||
"【系统通知:客户现在是在说文件已经发过去了、让你确认有没有看到。"
|
||||
"这通常代表设计师已经做完或正在交接成品文件。"
|
||||
"不要让客户重发图,不要继续问需求,必须立即调用转人工工具转接设计师跟进文件交接。】\n"
|
||||
"【系统通知:客户现在是在说文件/原图/成品的交接,或者让你把做好的内容直接发过去。"
|
||||
"这通常代表设计师已经做完,客户现在是在催交付或确认文件收发。"
|
||||
"不要让客户重发图,不要继续问需求,必须立即调用转人工工具转接设计师跟进交付。】\n"
|
||||
f"{user_content}"
|
||||
)
|
||||
elif _asks_designer_schedule(user_content, history):
|
||||
|
||||
Reference in New Issue
Block a user