feat: low-latency debounce, context logs, and stable draw/upload config
Some checks failed
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_en (ubuntu-latest, 3.10) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_zh (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.12) (push) Has been cancelled

This commit is contained in:
2026-03-03 13:38:18 +08:00
parent 1f28dc4630
commit 01c32be6ea
5 changed files with 145 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ from .config import (
AUTO_DRAW_ENABLED,
AUTO_QUOTE_WAIT_SECONDS,
DECISION_TIMEOUT_SECONDS,
IMAGE_MESSAGE_DEBOUNCE_SECONDS,
MAX_CONCURRENT_TURNS,
MESSAGE_DEBOUNCE_SECONDS,
QINGJIAN_WS_URI,
@@ -133,7 +134,7 @@ class QingjianClient:
def _debounce_seconds(self, msg: str) -> float:
if extract_image_urls(msg):
return 2.5
return float(IMAGE_MESSAGE_DEBOUNCE_SECONDS)
return float(MESSAGE_DEBOUNCE_SECONDS)
async def send_message(self, message: dict) -> None:
@@ -271,7 +272,7 @@ class QingjianClient:
def _fallback_reply(self, action: str) -> str:
if action == "transfer":
return "我先给你转人工处理。"
return "收到,我先处理一下。"
return "我先看看"
def _is_outbound_echo(self, data: dict, msg: str) -> bool:
"""
@@ -338,6 +339,20 @@ class QingjianClient:
"last_reply": self.last_reply_key.get(key, ""),
"recent_dialogue": recent_dialogue[-12:],
}
try:
rd = context.get("recent_dialogue", []) or []
rd_preview = " | ".join(
[f"{str(x.get('role',''))}:{str(x.get('text',''))[:32]}" for x in rd[-8:] if isinstance(x, dict)]
)
self.logger.info(
"[AI上下文] customer=%s msg=%s pending_images=%s recent=%s",
context["customer_id"],
str(merged_msg or "")[:120],
context["pending_images"],
rd_preview,
)
except Exception:
pass
activity_event(self.logger, "agent_process_start", trace_id=trace_id, customer_id=context["customer_id"], acc_id=context["acc_id"], intent=context["intent"])
route, decision, state = await self.orchestrator.decide(context)