优化连续追问的报价条件与订单指代
This commit is contained in:
@@ -119,3 +119,119 @@ class QuoteTimingTests(unittest.TestCase):
|
||||
self.assertIn('最快参考方案暂时无法确定',text)
|
||||
self.assertIn('最慢参考方案暂时无法确定',text)
|
||||
self.assertNotIn('1000KG =',text)
|
||||
|
||||
def test_selected_route_survives_total_calculation_time_and_tax_questions(self):
|
||||
cid=self.client.post('/api/new_chat').json['id']
|
||||
self.ask('美国1000KG义乌美东海运,便宜的报价',cid)
|
||||
for question in ('那一共多少钱','怎么算出来的'):
|
||||
text=self.ask(question,cid)
|
||||
self.assertIn('普船海派',text)
|
||||
self.assertIn('1000KG = 6000元',text)
|
||||
self.assertNotIn('美森正班海派',text)
|
||||
text=self.ask('多快能到',cid)
|
||||
self.assertIn('普船海派',text)
|
||||
self.assertIn('船开后25-30天左右提取',text)
|
||||
self.assertNotIn('美森正班海派',text)
|
||||
self.assertIn('标注包税',self.ask('含税吗',cid))
|
||||
text=self.ask('具体多少',cid)
|
||||
self.assertIn('1000KG = 6000元',text)
|
||||
self.assertNotIn('美森正班海派',text)
|
||||
text=self.ask('全部渠道报价',cid)
|
||||
self.assertIn('美森正班海派',text)
|
||||
self.assertIn('普船海派',text)
|
||||
|
||||
def test_polite_acknowledgements_keep_quote_conditions_and_selection(self):
|
||||
cid=self.client.post('/api/new_chat').json['id']
|
||||
self.ask('美国30KG义乌美西最快海派报价',cid)
|
||||
for question in ('谢谢','好的,谢谢您','OK'):
|
||||
self.ask(question,cid)
|
||||
text=self.ask('改成50KG呢',cid)
|
||||
self.assertIn('美森正班海派 · 义乌',text)
|
||||
self.assertIn('50KG = 400元',text)
|
||||
self.assertNotIn('普船海派',text)
|
||||
text=self.ask('所有箱都是普通货',cid)
|
||||
self.assertIn('最快参考方案',text)
|
||||
self.assertNotIn('普船海派',text)
|
||||
|
||||
def test_missing_weight_unit_stays_pending_until_an_explicit_unit_is_supplied(self):
|
||||
cid=self.client.post('/api/new_chat').json['id']
|
||||
self.ask('美国1000KG义乌美西海运最快报价',cid)
|
||||
for question in ('重量改成800,其他不变','换成华南','谢谢','美东呢'):
|
||||
text=self.ask(question,cid)
|
||||
if question!='谢谢':
|
||||
self.assertIn('单位',text)
|
||||
self.assertNotIn('1000KG =',text)
|
||||
text=self.ask('单位是KG',cid)
|
||||
self.assertIn('美森正班海派 · 华南',text)
|
||||
self.assertIn('800KG = 8000元',text)
|
||||
self.assertNotIn('1000KG',text)
|
||||
self.assertIn('800KG = 8000元',self.ask('具体多少',cid))
|
||||
|
||||
def test_quote_resume_is_explicit_and_survives_later_field_edits(self):
|
||||
cid=self.client.post('/api/new_chat').json['id']
|
||||
self.ask('美国30KG义乌美西最快报价',cid)
|
||||
self.ask('我有多少个订单',cid)
|
||||
text=self.ask('50KG呢',cid)
|
||||
self.assertNotIn('美森正班海派',text)
|
||||
text=self.ask('回到刚才的报价',cid)
|
||||
self.assertIn('30KG = 240元',text)
|
||||
self.assertNotIn('50KG',text)
|
||||
text=self.ask('换成华南',cid)
|
||||
self.assertIn('美森正班海派 · 华南',text)
|
||||
self.assertIn('30KG = 240元',text)
|
||||
|
||||
def test_resume_does_not_recover_us_conditions_across_a_new_country_quote(self):
|
||||
cid=self.client.post('/api/new_chat').json['id']
|
||||
self.ask('美国30KG义乌海运报价',cid)
|
||||
with self.app.app_context():
|
||||
db.save_message(cid,'user','新的一票100KG发德国海运报价')
|
||||
db.save_message(cid,'assistant','请核对对应目的地的报价。')
|
||||
self.ask('我有多少个订单',cid)
|
||||
text=self.ask('回到刚才的报价',cid)
|
||||
self.assertIn('目的国家',text)
|
||||
self.assertNotIn('美国 30KG',text)
|
||||
self.assertNotIn('元/KG',text)
|
||||
|
||||
def test_new_quote_with_a_topic_switch_becomes_the_next_followup_root(self):
|
||||
cid=self.client.post('/api/new_chat').json['id']
|
||||
self.ask('美国30KG义乌美西最快报价',cid)
|
||||
self.ask('换个话题,美国50KG华南美东海运报价',cid)
|
||||
text=self.ask('最慢的呢',cid)
|
||||
self.assertIn('普船海派 · 华南',text)
|
||||
self.assertIn('50KG = 300元',text)
|
||||
self.assertNotIn('30KG',text)
|
||||
self.ask('另外问美国海运报价',cid)
|
||||
text=self.ask('20KG呢',cid)
|
||||
self.assertIn('美国 20KG',text)
|
||||
self.assertIn('义乌',text)
|
||||
self.assertNotIn('50KG',text)
|
||||
|
||||
def test_explicit_selection_and_business_question_are_retained_independently(self):
|
||||
cid=self.client.post('/api/new_chat').json['id']
|
||||
self.ask('美国1000KG义乌美东海运报价',cid)
|
||||
self.assertIn('标注包税',self.ask('最快的含税吗',cid))
|
||||
text=self.ask('那一共多少钱',cid)
|
||||
self.assertIn('1000KG = 10000元',text)
|
||||
self.assertNotIn('普船海派',text)
|
||||
text=self.ask('最快多久能提取',cid)
|
||||
self.assertIn('15天左右提取',text)
|
||||
self.assertNotIn('普船海派',text)
|
||||
|
||||
def test_missing_weight_units_before_a_destination_do_not_reuse_the_old_weight(self):
|
||||
cid=self.client.post('/api/new_chat').json['id']
|
||||
self.ask('美国1000KG义乌美西最快海运报价',cid)
|
||||
self.assertIn('单位',self.ask('重量改成800美东,其他不变',cid))
|
||||
text=self.ask('KG',cid)
|
||||
self.assertIn('800KG = 8000元',text)
|
||||
self.assertNotIn('1000KG',text)
|
||||
|
||||
def test_all_channels_clears_the_named_service_and_keeps_origin_destination_weight(self):
|
||||
cid=self.client.post('/api/new_chat').json['id']
|
||||
self.ask('美国1000KG义乌美东普船海派最便宜报价',cid)
|
||||
text=self.ask('全部渠道报价',cid)
|
||||
self.assertIn('美森正班海派',text)
|
||||
self.assertIn('合德海派',text)
|
||||
self.assertIn('普船海派',text)
|
||||
self.assertIn('1000KG = 10000元',text)
|
||||
self.assertNotIn('华南',text)
|
||||
self.assertNotIn('美西 ',text)
|
||||
|
||||
Reference in New Issue
Block a user