私聊建单前拦住枪支弹药爆炸物和毒品,避免真家伙进入报价。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -113,6 +113,16 @@ class SeaTextInquiryFlow(AirTextInquiryFlow):
|
||||
if sess and sess.phase == "wait_confirm" and looks_like_confirm(text):
|
||||
# 确定查价不再抽字段,避免「确定」被模型改成空 facts。
|
||||
logger.info("sea.confirm sender=%s", sender_id)
|
||||
refused = self._refuse_sensitive(
|
||||
sender_id=sender_id,
|
||||
text=text,
|
||||
facts=dict(sess.facts),
|
||||
reply=reply,
|
||||
sess=sess,
|
||||
business_line=sess.business_line,
|
||||
)
|
||||
if refused:
|
||||
return refused
|
||||
return self._confirm_or_hold(
|
||||
sender_id=sender_id,
|
||||
facts=dict(sess.facts),
|
||||
@@ -145,7 +155,7 @@ class SeaTextInquiryFlow(AirTextInquiryFlow):
|
||||
return llm_phase
|
||||
mode = (snap.get("business_line") or "").upper()
|
||||
facts = dict(snap.get("facts") or {})
|
||||
if sess and sess.phase in {"clarify", "need_mode", "wait_confirm"}:
|
||||
if sess and sess.phase in {"clarify", "need_mode", "wait_confirm", "sensitive_block"}:
|
||||
from agent.llm.extract_text import detect_transport_mode
|
||||
from agent.schema.field_validate import harvest_oral_measures
|
||||
|
||||
@@ -156,6 +166,18 @@ class SeaTextInquiryFlow(AirTextInquiryFlow):
|
||||
if not mode:
|
||||
mode = detect_transport_mode(f"{sess.immutable_text or ''}\n{text}")
|
||||
|
||||
if not mode or mode == "SEA":
|
||||
refused = self._refuse_sensitive(
|
||||
sender_id=sender_id,
|
||||
text=text,
|
||||
facts=facts,
|
||||
reply=reply,
|
||||
sess=sess,
|
||||
business_line=mode or (sess.business_line if sess else ""),
|
||||
)
|
||||
if refused:
|
||||
return refused
|
||||
|
||||
if not mode:
|
||||
reply(copy.ask_transport())
|
||||
self._save(
|
||||
@@ -374,6 +396,16 @@ class SeaTextInquiryFlow(AirTextInquiryFlow):
|
||||
from agent.policy.handoff_human import void_virtual_no
|
||||
|
||||
old = self.session_of(sender_id)
|
||||
refused = self._refuse_sensitive(
|
||||
sender_id=sender_id,
|
||||
text="",
|
||||
facts=facts,
|
||||
reply=reply,
|
||||
sess=old,
|
||||
business_line="SEA",
|
||||
)
|
||||
if refused:
|
||||
return refused
|
||||
if old:
|
||||
void_virtual_no(old)
|
||||
pending = tuple(getattr(old, "pending_files", ()) or ()) if old else ()
|
||||
|
||||
Reference in New Issue
Block a user