fix: reply with standalone ping for meaningless short customer texts

This commit is contained in:
2026-03-01 14:09:34 +08:00
parent abe5886b5d
commit dc2565b8f3
2 changed files with 50 additions and 15 deletions

View File

@@ -412,7 +412,25 @@ class RegressionPipelineTest(unittest.IsolatedAsyncioTestCase):
self.assertTrue(resp.should_reply)
self.assertIn("地图", resp.reply)
self.assertIn("不做", resp.reply)
self.assertTrue(resp.reply.endswith(("", "", "好的", "嗯咯", "嗯啦")))
async def test_meaningless_short_text_gets_ping_reply(self):
agent = CustomerServiceAgent()
msg = CustomerMessage(
msg_id="m-meaningless",
acc_id="test_shop",
msg="好的",
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="",
)
resp = await agent.process_message(msg)
self.assertTrue(resp.should_reply)
self.assertIn(resp.reply, ("嗯咯", "嗯啦", "", ""))
def tearDown(self):
db.clear_pending_quote_state(self.customer_id)