员工岗位可重新启用;调价认空运航线;会话存档跳号补拉;陆运报价按车型列回填

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
linmianxun
2026-10-28 19:48:47 +08:00
co-authored by Cursor
parent 2b528758b4
commit 56ba8e93b5
62 changed files with 2960 additions and 793 deletions
@@ -202,10 +202,12 @@ def _handle_one(
watchers = [dict(x) for x in (row.get("watchers") or []) if isinstance(x, dict)]
sales = _ticket_sales(row, watchers)
people = pick_mentions(wait_kind=kind, sales=sales, members=watchers, business_line=line)
# 空运群往往只绑了群号,成员列表是空的,群里就找不到航线岗,话术会落成「相关人员」。
# 只补航线超时。销售超时不能改去 @ 航线,只 @ 本单销售。
if kind == WAIT_AIR_QUOTE and not people:
people = _airline_staff_mentions(book)
# 空运群往往只绑了群号;且航线超时必须按本单「负责线路」点名,禁止整岗广播。
# 与激活摘要 resolve_air_mentions 同口径。销售超时不能改去 @ 航线。
if kind == WAIT_AIR_QUOTE:
route_people = _airline_staff_mentions(book, facts=facts)
if route_people:
people = route_people
names = [str(p.get("name") or "").strip() for p in people if str(p.get("name") or "").strip()]
chat_id = str(row.get("collab_chat_id") or row.get("collabChatId") or "").strip()
where = conversation_of(wait_kind=kind, collab_chat_id=chat_id)
@@ -295,22 +297,42 @@ def _ticket_sales(row: dict[str, Any], watchers: list[dict[str, Any]]) -> dict[s
return matched
def _airline_staff_mentions(book: Any) -> list[dict[str, Any]]:
def _airline_staff_mentions(
book: Any,
*,
facts: dict[str, Any] | None = None,
) -> list[dict[str, Any]]:
"""
主账按岗位列出启用的航线同事。
主账列出启用航线·空运,再按本单负责线路过滤。
只在群成员里没有航线岗时调用。主账失败或没有这个接口时返回空,话术仍用「相关人员」。
不写工单。可与巡检线程并发,每次只读这一单的员工名单。
与空运群激活摘要同口径:对上起运/目的(或空运全线);对不上则只留全线。
主账失败或没有接口时返回空,话术仍用「相关人员」。不写工单。
"""
from agent.policy.deal_followup import air_staff_route_matches
lister = getattr(book, "list_staff_by_role", None)
if not callable(lister):
return []
try:
rows = list(lister(role_code="air") or [])
rows = [dict(x) for x in (lister(role_code="air") or []) if isinstance(x, dict)]
except Exception:
logger.exception("事件异常列航线岗失败")
return []
return mentions_for_role(rows, role_code="air")
matched = [
r
for r in rows
if air_staff_route_matches(routes=str(r.get("routes") or ""), facts=facts)
]
if not matched:
matched = [
r
for r in rows
if any(
t.strip() in {"空运全线", "全线"}
for t in str(r.get("routes") or "").replace(",", ",").replace("、", ",").split(",")
)
]
return mentions_for_role(matched, role_code="air")
def _send_app_cards(