更新bug
This commit is contained in:
@@ -422,6 +422,7 @@ def process_registration_reply(
|
||||
reply_text: str,
|
||||
store: Optional[RegistrationStore] = None,
|
||||
agent_name: str = "",
|
||||
persist: bool = True,
|
||||
) -> tuple[str, Optional[dict]]:
|
||||
"""
|
||||
归一化医院名;仅当客户明确要挂号时才写预约话术并登记。
|
||||
@@ -446,14 +447,21 @@ def process_registration_reply(
|
||||
|
||||
contact = extract_contact_name(user_text, agent_name=agent_name)
|
||||
status = "booked" if symptom else "pending_symptom"
|
||||
lead_spec = {
|
||||
"session_id": session_id or "unknown",
|
||||
"contact": contact,
|
||||
"symptom": symptom,
|
||||
"status": status,
|
||||
"last_user": (user_text or "")[:500],
|
||||
"last_reply": reply[:500],
|
||||
"note": "客户明确要求挂号/预约",
|
||||
}
|
||||
if not persist:
|
||||
# 自动回复链路必须等到消息已在会话中可见后再落盘。这里仅准备登记
|
||||
# 内容,交给待回复事务一起持久化,避免发送被取消却留下错误登记。
|
||||
return reply, lead_spec
|
||||
st = store or RegistrationStore()
|
||||
lead = st.add_or_update(
|
||||
session_id=session_id or "unknown",
|
||||
contact=contact,
|
||||
symptom=symptom,
|
||||
status=status,
|
||||
last_user=(user_text or "")[:500],
|
||||
last_reply=reply[:500],
|
||||
note="客户明确要求挂号/预约",
|
||||
**lead_spec,
|
||||
)
|
||||
return reply, lead
|
||||
|
||||
Reference in New Issue
Block a user