87 lines
3.2 KiB
Diff
87 lines
3.2 KiB
Diff
--- C:\kefu\deploy\review-assistant-20260917\visual-before\source\gui_runtime.py
|
|
|
|
+++ C:\kefu\wechat_rpa\gui_runtime.py
|
|
|
|
@@ -90,6 +90,30 @@
|
|
|
|
if normalized in {SEND_MODE_AUTO, SEND_MODE_REVIEW}:
|
|
return normalized
|
|
return SEND_MODE_REVIEW if default == SEND_MODE_REVIEW else SEND_MODE_AUTO
|
|
+
|
|
+
|
|
+def cancel_assistant_review_for_state(state, root):
|
|
+ """Close only the explicitly cancelled episode; never start native I/O."""
|
|
+ if not isinstance(state, dict) or not state.get("assistant_review_id"):
|
|
+ return True
|
|
+ event = state.get("database_event") or {}
|
|
+ account = str(state.get("account") or event.get("account") or "")
|
|
+ if not account:
|
|
+ return False
|
|
+ coordinator = None
|
|
+ try:
|
|
+ from review_assistant import ReviewAssistantCoordinator
|
|
+ coordinator = ReviewAssistantCoordinator(root=root, account=account)
|
|
+ if coordinator.cancel_review(state) is False:
|
|
+ print("[助理审核] 任务已移除,但提醒取消尚未保存,请检查审核提醒状态")
|
|
+ return False
|
|
+ return True
|
|
+ except Exception as exc:
|
|
+ print(f"[助理审核] 任务已移除,但提醒取消失败({type(exc).__name__}),请检查审核提醒状态")
|
|
+ return False
|
|
+ finally:
|
|
+ if coordinator is not None:
|
|
+ coordinator.close()
|
|
|
|
|
|
def delete_pending_reply_file(keys, path="", *, handoff=False, confirm_uncertain=False):
|
|
@@ -179,6 +203,8 @@
|
|
|
|
result["error"] = str(exc)
|
|
return result
|
|
|
|
+ for _key, state in removed:
|
|
+ cancel_assistant_review_for_state(state, directory)
|
|
result["deleted"] = [key for key, _state in removed]
|
|
result["missing"] = sorted(requested.difference(result["deleted"]).difference(result["protected"]))
|
|
try:
|
|
@@ -766,6 +792,11 @@
|
|
|
|
poll_failures = 0
|
|
while not self.stop_event.is_set():
|
|
self._reply_wakeup.clear()
|
|
+ # Read-only assistant reconciliation remains available while the screen is busy.
|
|
+ try:
|
|
+ bot.poll_review_assistant()
|
|
+ except Exception as exc:
|
|
+ self.target_queue.put(("log", f"[助理审核] 核验暂不可用({type(exc).__name__}),保留审核任务"))
|
|
if bot.security_verification_required:
|
|
if not self._visual_verification_complete(bot, bot_module):
|
|
continue
|
|
@@ -824,6 +855,11 @@
|
|
|
|
except Exception:
|
|
pass
|
|
self._engine_b = None
|
|
+ if bot is not None:
|
|
+ try:
|
|
+ bot.close_review_assistant()
|
|
+ except Exception:
|
|
+ pass
|
|
if self._db_source is not None:
|
|
try:
|
|
self._db_source.close()
|
|
@@ -848,6 +884,12 @@
|
|
|
|
except Exception:
|
|
pass
|
|
self._engine_b = None
|
|
+ active_bot = getattr(self, "bot", None)
|
|
+ if active_bot is not None:
|
|
+ try:
|
|
+ active_bot.close_review_assistant()
|
|
+ except Exception:
|
|
+ pass
|
|
if self._db_source is not None:
|
|
try:
|
|
self._db_source.close()
|