机器人显示名与站点标题可配;多段联运列表投影;协同群监听对账;工单附件落存;模板与工单后台补强

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
linmianxun
2026-10-19 09:41:59 +08:00
co-authored by Cursor
parent 277cdc1c28
commit 2b528758b4
119 changed files with 6760 additions and 3516 deletions
@@ -205,46 +205,6 @@ def handle_air_group(
intent,
wo or "-",
)
# #region agent log
try:
import json
import time
from pathlib import Path
from agent.llm.extract_text import labeled_quote_date
_payload = {
"sessionId": "717349",
"runId": "post-fix",
"hypothesisId": "H1",
"location": "air_group_collab.py:handle_air_group",
"message": "air group inbound classified",
"data": {
"chat_tail": chat_id[-8:],
"sender_tail": (message.sender_id or "")[-8:],
"intent": intent,
"wo": wo or "",
"text_head": (text or "")[:100],
"labeled_qd": labeled_quote_date(text),
"source": str((message.raw or {}).get("source") or ""),
},
"timestamp": int(time.time() * 1000),
}
_line = json.dumps(_payload, ensure_ascii=False) + "\n"
for _p in (
Path(__file__).resolve().parents[3] / "debug-717349.log",
Path(r"C:\Users\ytd_extdev_0903\incoming\debug-717349.log"),
Path(r"E:\wwwroot\agent\current\debug-717349.log"),
):
try:
_p.parent.mkdir(parents=True, exist_ok=True)
with _p.open("a", encoding="utf-8") as _fh:
_fh.write(_line)
except Exception:
pass
except Exception:
pass
# #endregion
if intent in {INTENT_LOCK, INTENT_RELEASE, INTENT_RELEASE_ASK}:
return _handle_cabin(
engine,
@@ -314,17 +274,34 @@ def _handle_file(engine, message: InboundMessage) -> str:
wo = copy.extract_work_order_no(
" ".join([message.content or "", filename])
)
# 多段已激活的附件也跟当前单,不能再要求先发工单号。
followed = _follow_activated_multi(
engine,
chat_id=chat_id,
sender_id=message.sender_id,
text=" ".join(part for part in ((message.content or "").strip(), filename) if part),
injected_quote=None,
named_wo=wo,
)
if followed is not None:
return followed
# 多段附件:落库归段,禁止把文件名当文字报价(会回「没有识别到报价」)。
from agent.policy.multi_group_ops import apply_multi_file, ticket_is_multi
from agent.policy.sea_group_ops import ticket_no as _ticket_no
multi_ticket = None
if wo:
getter = getattr(engine.ledger, "get_ticket", None)
raw = getter(work_order_no=wo) if callable(getter) else None
if raw is not None and ticket_is_multi(raw):
multi_ticket = raw
if multi_ticket is None:
bound = current_ticket(engine, chat_id)
if bound is not None and ticket_is_multi(bound):
multi_ticket = bound
if multi_ticket is not None:
logger.info(
"air_group 多段附件 wo=%s file=%s",
_ticket_no(multi_ticket),
filename[:80],
)
return apply_multi_file(
flow=engine,
ticket=multi_ticket,
chat_id=chat_id,
sender_id=message.sender_id,
filename=filename,
media=media,
)
if wo:
ticket, phase = activate_ticket(
flow=engine, chat_id=chat_id, work_order_no=wo, speak=False
@@ -588,36 +565,6 @@ def _handle_bound(
keep_tms=intent == INTENT_KEEP_TMS,
)
if intent == INTENT_FIELDS:
# #region agent log
try:
import json
import time
from pathlib import Path
_p = Path(__file__).resolve().parents[3] / "debug-866775.log"
with _p.open("a", encoding="utf-8") as _fh:
_fh.write(
json.dumps(
{
"sessionId": "866775",
"hypothesisId": "C",
"location": "air_group_collab.py:_handle_bound",
"message": "INTENT_FIELDS path",
"data": {
"text_head": (message.content or "")[:80],
"has_quote_date_label": (
"报价日期" in (message.content or "")
),
},
"timestamp": int(time.time() * 1000),
},
ensure_ascii=False,
)
+ "\n"
)
except Exception:
pass
# #endregion
return apply_air_fields(
flow=engine,
ticket=ticket,