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

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
+41
View File
@@ -9,6 +9,7 @@ from __future__ import annotations
import logging
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Optional
from agent.jobs.libreoffice import LibreOfficeConverter, LibreOfficeResult
@@ -20,6 +21,8 @@ from agent.redis_coord.stream_queue import StreamQueue
logger = logging.getLogger(__name__)
@dataclass
class PdfEnqueueResult:
accepted: bool
@@ -160,6 +163,8 @@ def _deliver_quote_file(data: dict[str, Any], result: LibreOfficeResult) -> None
or {},
},
)
# PDF 出站同时登记主账附件,后台列表/详情才能看到。
_register_pdf_attachment(wo, filename, result.pdf_path, touser=touser)
if wo:
try:
from agent.policy.air_text_flow import get_air_text_flow
@@ -176,3 +181,39 @@ def _deliver_quote_file(data: dict[str, Any], result: LibreOfficeResult) -> None
logger.exception("PDF 出文件后未能切到成交跟进 inquiry=%s", wo)
except Exception:
logger.exception("PDF 出站入队失败 inquiry=%s", wo)
def _register_pdf_attachment(
work_order_no: str,
filename: str,
pdf_path: str,
*,
touser: str = "",
) -> None:
"""
PDF 转换成功后把文件字节登记到主账附件表。
失败只打日志,不挡企微发文件。LibreOffice 槽内调用,短 HTTP。
"""
wo = (work_order_no or "").strip()
path = Path(str(pdf_path or ""))
if not wo or not path.is_file():
return
try:
from agent.ledger.http_ledger import HttpLedger
raw = path.read_bytes()
if not raw:
return
name = (filename or "").strip() or f"{wo}_quote.pdf"
if not name.lower().endswith(".pdf"):
name = f"{name}.pdf"
out = HttpLedger().attach_file_bytes(
work_order_no=wo,
file_name=name,
file_bytes=raw,
content_type="application/pdf",
sender_id=touser or "",
)
except Exception:
logger.exception("PDF 附件登记失败 inquiry=%s", wo)