确定运输方式前的多句询价带到所选方式并按该方式抽字段;成交已定后放舱不再推跟进,未成交原因不再被当成新询价。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -23,6 +23,9 @@ from agent.policy.air_text_flow import (
|
||||
FlowSession,
|
||||
ReplyFn,
|
||||
build_ledger,
|
||||
is_waiting_mode_session,
|
||||
stack_user_text,
|
||||
waiting_mode_source,
|
||||
)
|
||||
from agent.schema.field_validate import validate_required_fields
|
||||
from agent.schema.tms_sea_query import assemble_sea_query
|
||||
@@ -135,7 +138,7 @@ class SeaTextInquiryFlow(AirTextInquiryFlow):
|
||||
|
||||
merged = dict(sess.facts)
|
||||
merged.update(facts)
|
||||
facts = harvest_oral_measures(text, merged)
|
||||
facts = harvest_oral_measures(waiting_mode_source(sess, text), merged)
|
||||
mode = mode or (sess.business_line or "").upper()
|
||||
if not mode:
|
||||
mode = detect_transport_mode(f"{sess.immutable_text or ''}\n{text}")
|
||||
@@ -149,7 +152,10 @@ class SeaTextInquiryFlow(AirTextInquiryFlow):
|
||||
phase="need_mode",
|
||||
business_line="",
|
||||
facts=facts,
|
||||
immutable_text=sess.immutable_text if sess and sess.immutable_text else text,
|
||||
immutable_text=stack_user_text(
|
||||
sess.immutable_text if sess else "",
|
||||
text,
|
||||
),
|
||||
)
|
||||
)
|
||||
return "need_mode"
|
||||
@@ -187,13 +193,28 @@ class SeaTextInquiryFlow(AirTextInquiryFlow):
|
||||
inbound_raw=inbound_raw,
|
||||
)
|
||||
|
||||
from agent.schema.sea_options import drop_invented_door_trade_terms, harvest_sea_class
|
||||
from agent.schema.field_validate import harvest_spoken_trade_term, shape_facts_for_chosen_mode
|
||||
from agent.schema.sea_options import (
|
||||
apply_spoken_sea_trade_reply,
|
||||
harvest_sea_class,
|
||||
short_sea_trade_reply,
|
||||
)
|
||||
|
||||
facts = harvest_sea_class(text, facts)
|
||||
# 贸易条款标签行原样优先(Port to Port 等);再丢掉无标签的冒充「门到门」
|
||||
facts = drop_invented_door_trade_terms(text, facts)
|
||||
# 刚选定海运时,贸易条款、运输分类要对照定方式前的全部原话,不只看「海运」两个字。
|
||||
source = waiting_mode_source(sess, text)
|
||||
# 整句只回「港到港」是贸易条款举例,不要改写成运输分类。
|
||||
class_source = "" if short_sea_trade_reply(source) == "港到港" else source
|
||||
facts = harvest_sea_class(class_source, facts)
|
||||
# 贸易条款标签行原样优先;整句回复门到门/港到港要收下;没写这两个词时模型冒充的门到门丢掉。
|
||||
facts = apply_spoken_sea_trade_reply(source, facts)
|
||||
spoken = harvest_spoken_trade_term(source)
|
||||
if spoken.get("贸易条款") and not str(facts.get("贸易条款") or "").strip():
|
||||
facts["贸易条款"] = spoken["贸易条款"]
|
||||
check = validate_required_fields(facts=facts, business_line="SEA")
|
||||
facts = dict(check["facts"])
|
||||
if is_waiting_mode_session(sess):
|
||||
# 件数里的数量已进货物数量;空运的件数、毛重、体积、包装不再留在海运单上。
|
||||
facts = shape_facts_for_chosen_mode(facts, "SEA")
|
||||
tms_ready = assemble_sea_query(facts)
|
||||
facts = dict(tms_ready["facts"])
|
||||
if not check["ok"] or not tms_ready["ok"]:
|
||||
|
||||
Reference in New Issue
Block a user