fix: first-image ack should pause instead of pushing unified quote
This commit is contained in:
@@ -418,6 +418,14 @@ class CustomerServiceAgent:
|
|||||||
"""
|
"""
|
||||||
收图阶段回复默认走 AI 改写,失败时回退到固定模板。
|
收图阶段回复默认走 AI 改写,失败时回退到固定模板。
|
||||||
"""
|
"""
|
||||||
|
# 首张收图先承接“我看一下”,避免机械地立刻催“发完统一报价”。
|
||||||
|
if scene == "collect_ack" and len(state.pending_image_urls) <= 1:
|
||||||
|
first_ack = [
|
||||||
|
"收到了,我先看一下哈,稍等哈",
|
||||||
|
"这张我收到了,我先看下,等我一下哈",
|
||||||
|
"收到这张了,我先过一眼,稍等哈",
|
||||||
|
]
|
||||||
|
return random.choice(first_ack)
|
||||||
if not self.dynamic_collection_replies:
|
if not self.dynamic_collection_replies:
|
||||||
return fallback
|
return fallback
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -364,6 +364,35 @@ class RegressionPipelineTest(unittest.IsolatedAsyncioTestCase):
|
|||||||
)
|
)
|
||||||
self.assertEqual(reply, "图片收到了,你继续发就行。")
|
self.assertEqual(reply, "图片收到了,你继续发就行。")
|
||||||
|
|
||||||
|
async def test_first_image_ack_avoids_unified_quote_wording(self):
|
||||||
|
os.environ["AI_DYNAMIC_COLLECTION_REPLIES"] = "true"
|
||||||
|
agent = CustomerServiceAgent()
|
||||||
|
st = agent._get_conversation_state(self.customer_id)
|
||||||
|
st.pending_image_urls = ["https://img.alicdn.com/a.jpg"]
|
||||||
|
msg = CustomerMessage(
|
||||||
|
msg_id="m-first-ack",
|
||||||
|
acc_id="test_shop",
|
||||||
|
msg="https://img.alicdn.com/a.jpg",
|
||||||
|
from_id=self.customer_id,
|
||||||
|
from_name="t",
|
||||||
|
cy_id=self.customer_id,
|
||||||
|
acc_type="AliWorkbench",
|
||||||
|
msg_type=0,
|
||||||
|
cy_name="t",
|
||||||
|
goods_name="专业找图",
|
||||||
|
goods_order="",
|
||||||
|
)
|
||||||
|
reply = await agent._render_collection_reply_with_ai(
|
||||||
|
message=msg,
|
||||||
|
state=st,
|
||||||
|
scene="collect_ack",
|
||||||
|
intent_hint="确认收到后先承接",
|
||||||
|
fallback="图片收到了,你继续发就行。",
|
||||||
|
)
|
||||||
|
self.assertIn("稍等", reply)
|
||||||
|
self.assertNotIn("统一报价", reply)
|
||||||
|
self.assertNotIn("发完", reply)
|
||||||
|
|
||||||
async def test_map_inquiry_is_rejected(self):
|
async def test_map_inquiry_is_rejected(self):
|
||||||
agent = CustomerServiceAgent()
|
agent = CustomerServiceAgent()
|
||||||
msg = CustomerMessage(
|
msg = CustomerMessage(
|
||||||
|
|||||||
Reference in New Issue
Block a user