优化连续追问的报价条件与订单指代
This commit is contained in:
@@ -150,6 +150,7 @@ def render_rates(intent, book, destinations, remote_fees):
|
||||
from .quote_language import translate_quote
|
||||
|
||||
lines = []
|
||||
rate_selection=intent.get('selection') or intent.get('mode')
|
||||
if intent.get('mode')=='time':
|
||||
lines.append('美国线路参考时效:')
|
||||
elif intent['weight']:
|
||||
@@ -172,7 +173,7 @@ def render_rates(intent, book, destinations, remote_fees):
|
||||
if part and intent.get('metal_chargeable_weight') is not None:
|
||||
billing.update(metal_chargeable_weight=None,metal_scope='partial')
|
||||
rates = match_rates(billing, book, destination)
|
||||
if intent.get('mode')=='cheapest' and rates:
|
||||
if rate_selection=='cheapest' and rates:
|
||||
eligible=[r for r in rates if quantity(billing,r) is not None]
|
||||
best={}
|
||||
for rate in eligible:
|
||||
@@ -187,11 +188,11 @@ def render_rates(intent, book, destinations, remote_fees):
|
||||
if destination['label'] != '美国':
|
||||
lines.append(destination['label']+':')
|
||||
selections=[('',rates)]
|
||||
if intent.get('mode') in ('fastest','slowest','speed_compare'):
|
||||
if rate_selection in ('fastest','slowest','speed_compare'):
|
||||
selections=[]
|
||||
if intent['mode'] in ('fastest','speed_compare'):
|
||||
if rate_selection in ('fastest','speed_compare'):
|
||||
selections.append(('最快参考方案',select_timed_rates(rates)))
|
||||
if intent['mode'] in ('slowest','speed_compare'):
|
||||
if rate_selection in ('slowest','speed_compare'):
|
||||
selections.append(('最慢参考方案',select_timed_rates(rates,slowest=True)))
|
||||
lines.append('按相同区域、运输方式、计费单位及税费方式比较参考时效。最快按天数下限、最慢按天数上限选择。')
|
||||
grouped = {}
|
||||
@@ -206,10 +207,11 @@ def render_rates(intent, book, destinations, remote_fees):
|
||||
if selection and selection!=last_selection:
|
||||
lines.append(selection)
|
||||
last_selection=selection
|
||||
eta = re.sub(r'\s*无时效赔偿', '', eta_source).strip()
|
||||
if rows[0]['kind']=='parcel' and eta and '提取' not in eta:eta+='提取'
|
||||
elif rows[0]['kind']=='truck' and eta and '船开' not in eta:eta='开船后参考'+eta
|
||||
if intent.get('mode')=='time':
|
||||
eta=eta_source or '当前资料未列明时效'
|
||||
if rows[0]['kind']=='parcel' and '提取' not in eta:eta+='提取'
|
||||
lines.append(f'- {service} · {origin}:{eta}。提取不等于送达或签收。')
|
||||
lines.append(f'- {service} · {origin},{eta or "当前资料未列明时效"}。')
|
||||
continue
|
||||
parts = []
|
||||
for rate in rows:
|
||||
@@ -228,9 +230,6 @@ def render_rates(intent, book, destinations, remote_fees):
|
||||
elif intent.get('cbm') and rate['unit']=='cbm':
|
||||
lines.append('计费体积四舍五入后不足0.01CBM,最低计费体积需人工确认,不能按零费用出价。')
|
||||
parts.append(rate_text)
|
||||
eta = re.sub(r'\s*无时效赔偿', '', eta_source).strip()
|
||||
if rows[0]['kind']=='parcel' and eta and '提取' not in eta:eta+='提取'
|
||||
elif rows[0]['kind']=='truck' and eta and '船开' not in eta:eta='开船后参考'+eta
|
||||
lines.append(f"- {service} · {origin} · {'包税' if tax=='included' else '不包税'}:"+';'.join(parts)
|
||||
+ (f'({eta})' if eta else ''))
|
||||
if fees:
|
||||
@@ -241,7 +240,7 @@ def render_rates(intent, book, destinations, remote_fees):
|
||||
if not any(intent.get(key) for key in ('warehouse','postal')):
|
||||
lines.append('发我目的仓码或邮编,可继续匹配到仓线路。')
|
||||
if intent.get('mode')=='time':
|
||||
pass
|
||||
lines.append('以上时效按开船后到提取计算,送达时间需结合末端派送进度核对。')
|
||||
elif not intent['weight'] and not intent['cbm'] and not intent['dims']:
|
||||
lines.append('货物多少公斤、几箱?')
|
||||
elif not intent['boxes'] or not intent['dims']:
|
||||
|
||||
Reference in New Issue
Block a user