确定运输方式前的多句询价带到所选方式并按该方式抽字段;成交已定后放舱不再推跟进,未成交原因不再被当成新询价。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -17,7 +17,13 @@ from typing import Any, Optional
|
||||
from agent.ledger.memory_ledger import MemoryLedger
|
||||
from agent.llm.extract_text import extract_inquiry_snapshot
|
||||
from agent.policy import inquiry_copy as copy
|
||||
from agent.policy.air_text_flow import FlowSession, ReplyFn
|
||||
from agent.policy.air_text_flow import (
|
||||
FlowSession,
|
||||
ReplyFn,
|
||||
is_waiting_mode_session,
|
||||
stack_user_text,
|
||||
waiting_mode_source,
|
||||
)
|
||||
from agent.policy.sea_text_flow import SeaTextInquiryFlow
|
||||
from agent.schema.field_validate import harvest_oral_measures, validate_required_fields
|
||||
from agent.schema.land_options import (
|
||||
@@ -149,9 +155,11 @@ class LandTextInquiryFlow(SeaTextInquiryFlow):
|
||||
cargo = {k: v for k, v in facts.items() if k not in option_keys}
|
||||
merged = dict(base)
|
||||
merged.update(cargo)
|
||||
facts = harvest_oral_measures(text, merged)
|
||||
# 还在问运输方式时,重量体积和陆运选项要对照前面几句,不只看「1」。
|
||||
source = waiting_mode_source(sess, text)
|
||||
facts = harvest_oral_measures(source, merged)
|
||||
# 选项只从原话+能对上枚举的模型值收;禁止模型「陆运」盖掉已选的国内运输拼车。
|
||||
facts = harvest_land_options(text, facts)
|
||||
facts = harvest_land_options(source, facts)
|
||||
b_opt = " ".join(
|
||||
str(x).strip()
|
||||
for x in (
|
||||
@@ -174,7 +182,10 @@ class LandTextInquiryFlow(SeaTextInquiryFlow):
|
||||
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"
|
||||
@@ -211,6 +222,11 @@ class LandTextInquiryFlow(SeaTextInquiryFlow):
|
||||
inbound_raw=inbound_raw,
|
||||
)
|
||||
|
||||
if is_waiting_mode_session(sess):
|
||||
from agent.schema.field_validate import shape_facts_for_chosen_mode
|
||||
|
||||
# 刚选定陆运:不留空运件数、海运箱型和贸易条款。重量体积仍按陆运货物字段留。
|
||||
facts = shape_facts_for_chosen_mode(facts, "LAND")
|
||||
return self._advance_front(
|
||||
sender_id=sender_id,
|
||||
facts=facts,
|
||||
|
||||
Reference in New Issue
Block a user