feat: integrate quality-gated draw flow with online dispatch transfer
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 14:10:00 +08:00
parent 5e9590030d
commit 484f1f6be4
4 changed files with 223 additions and 2 deletions

View File

@@ -25,6 +25,7 @@ from .orchestrator import Orchestrator
from .rules import extract_image_urls, prefilter_message
from .runtime_switch import is_listen_only
from .store import ConversationStore
from .transfer_flow import transfer_to_human_flow
class QingjianClient:
@@ -383,8 +384,11 @@ class QingjianClient:
text = (decision.transfer_msg or "").strip()
if self._is_invalid_ai_reply(text):
text = self._fallback_reply("transfer")
await self.send_reply(data, text, trace_id=trace_id, turn_version=turn_version)
self.last_reply_key[key] = text
ok_transfer, reason = await transfer_to_human_flow(self, data, transfer_msg=text, trace_id=trace_id)
if not ok_transfer:
self.logger.error("[转人工] 指令失败: %s", reason)
await self.send_reply(data, text, trace_id=trace_id, turn_version=turn_version)
self.last_reply_key[key] = text
await post_tianwang_callback("message_processed", data, extra={"trace_id": trace_id, "route": route, "action": "transfer", "reply": text})
return
@@ -433,6 +437,19 @@ class QingjianClient:
customer_id=context["customer_id"],
error=str(draw_res.get("error", "unknown")),
)
if bool(draw_res.get("need_transfer")):
tmsg = "这个我转人工给你看下"
ok_transfer, reason = await transfer_to_human_flow(self, data, transfer_msg=tmsg, trace_id=trace_id)
if not ok_transfer:
self.logger.error("[转人工] 指令失败: %s", reason)
await self.send_reply(data, tmsg, trace_id=trace_id, turn_version=turn_version)
self.last_reply_key[key] = tmsg
await post_tianwang_callback(
"message_processed",
data,
extra={"trace_id": trace_id, "route": route, "action": "transfer", "reply": tmsg},
)
return
self.logger.error("[作图] 失败 customer=%s error=%s", context["customer_id"], draw_res.get("error", "unknown"))
elif AUTO_DRAW_ENABLED and (not draw_allowed):
self.logger.info("[作图] 已跳过: 识图结果不可做 can_do=%s customer=%s", can_do, context["customer_id"])