fix: use single-image wording for 1-image quote flow
This commit is contained in:
@@ -2019,6 +2019,8 @@ class CustomerServiceAgent:
|
||||
return any(k in text for k in finish_keywords)
|
||||
|
||||
def _build_collect_ack(self, count: int) -> str:
|
||||
if count <= 1:
|
||||
return "收到这张图了,你还有图就继续发;发完我再一起给你报价。"
|
||||
templates = [
|
||||
"收到,这边先记下了(已收{n}张)。你继续发,等你发完我再一起给你打包报价。",
|
||||
"好的,当前这批先收到了(第{n}张)。还有图就继续发,发齐我一次性给你总价。",
|
||||
@@ -2027,6 +2029,8 @@ class CustomerServiceAgent:
|
||||
return random.choice(templates).format(n=count)
|
||||
|
||||
def _build_collect_remind(self, count: int) -> str:
|
||||
if count <= 1:
|
||||
return "需求我记下了。你如果还有图继续发,发完回我“发完了”,我给你报价。"
|
||||
templates = [
|
||||
"需求我记下了(当前共{n}张图)。你继续发齐,发完回我“发完了”,我一次性给你总价。",
|
||||
"好的,这条需求也加上了(现在{n}张)。等你说发完,我立刻统一报价。",
|
||||
@@ -2103,6 +2107,15 @@ class CustomerServiceAgent:
|
||||
single_total = round((total_suggest + extra) / 5) * 5
|
||||
req_hit = "、".join(req_fee.get("hits", [])) if req_fee.get("hits") else ""
|
||||
|
||||
# 单图时不要使用“分图/这批/A-B方案”措辞,避免客户误解为多图。
|
||||
if len(results) == 1:
|
||||
line = detail_lines[0].replace("图1:", "这张:")
|
||||
lines = [f"给你报下这张:{line.split(':', 1)[1]}"]
|
||||
if req_hit:
|
||||
lines.append(f"按你的需求另加{extra}元({req_hit})。")
|
||||
lines.append(f"这张做下来共{single_total}元,可以的话我马上安排。")
|
||||
return "\n".join(lines)
|
||||
|
||||
lines = ["先给你分图报下:"]
|
||||
lines.extend(detail_lines)
|
||||
if req_hit:
|
||||
|
||||
@@ -61,6 +61,29 @@ class BatchQuoteReplyFormatTest(unittest.IsolatedAsyncioTestCase):
|
||||
self.assertIn("打包", reply)
|
||||
self.assertIn("共", reply)
|
||||
|
||||
async def test_single_image_reply_avoids_batch_wording(self):
|
||||
agent = CustomerServiceAgent()
|
||||
results = [
|
||||
(
|
||||
"https://img.alicdn.com/a.jpg",
|
||||
{
|
||||
"complexity": "normal",
|
||||
"reason": "常规处理",
|
||||
"price_suggest": 20,
|
||||
},
|
||||
)
|
||||
]
|
||||
reply = agent._build_batch_quote_reply(
|
||||
results=results,
|
||||
total_suggest=20,
|
||||
bundle_price=20,
|
||||
req_fee={"extra": 0, "hits": []},
|
||||
)
|
||||
self.assertIn("这张", reply)
|
||||
self.assertNotIn("这批", reply)
|
||||
self.assertNotIn("先给你分图报下", reply)
|
||||
self.assertNotIn("可选:A", reply)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
|
||||
Reference in New Issue
Block a user