机器人显示名与站点标题可配;多段联运列表投影;协同群监听对账;工单附件落存;模板与工单后台补强
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7,8 +7,11 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import time
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
from agent.config import Settings, get_settings
|
||||
@@ -90,10 +93,9 @@ def poll_event_exceptions(
|
||||
test_prefix = False
|
||||
lookup = timeout_lookup or getattr(book, "get_timeout_by_code", None)
|
||||
ready = notify_app_flag(notify_ready)
|
||||
rows = [r for r in (lister() or []) if isinstance(r, dict)]
|
||||
sent = 0
|
||||
for row in lister() or []:
|
||||
if not isinstance(row, dict):
|
||||
continue
|
||||
for row in rows:
|
||||
try:
|
||||
if _handle_one(
|
||||
row,
|
||||
@@ -194,7 +196,8 @@ def _handle_one(
|
||||
if skip_reason:
|
||||
logger.info("事件异常跳过 wo=%s kind=%s reason=%s", no, kind, skip_reason)
|
||||
return False
|
||||
if workday_elapsed_hours(started, now) < hours:
|
||||
elapsed = workday_elapsed_hours(started, now)
|
||||
if elapsed < hours:
|
||||
return False
|
||||
watchers = [dict(x) for x in (row.get("watchers") or []) if isinstance(x, dict)]
|
||||
sales = _ticket_sales(row, watchers)
|
||||
@@ -206,6 +209,7 @@ def _handle_one(
|
||||
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)
|
||||
app_targets = pick_app_targets(people)
|
||||
# 群里用 @。销售超时即使发到私聊,也写成 @销售姓名,不写「您」或「相关人员」。
|
||||
mention = where == "group" or kind in _SALES_WAIT_KINDS
|
||||
text = copy.event_exception_session_text(
|
||||
@@ -248,6 +252,8 @@ def _handle_one(
|
||||
test_prefix=test_prefix,
|
||||
enqueue=enqueue or _default_enqueue,
|
||||
)
|
||||
else:
|
||||
pass
|
||||
recorder = getattr(book, "record_event_exception", None)
|
||||
if callable(recorder):
|
||||
recorder(work_order_no=no, event_exception=exception_type(kind))
|
||||
|
||||
Reference in New Issue
Block a user