新增: 后台会话系统通知与托盘运行态

- 完成/失败/需介入三类系统通知,主窗聚焦静默
- 同类通知五秒合并,用户主动停止不通知
- 托盘菜单与悬浮提示实时显运行中会话数
- 关窗遇运行会话提示后台续跑,每进程一次
- 侧栏常驻徽章显后台运行会话数
This commit is contained in:
lxy
2026-10-01 19:35:20 +08:00
parent 66c6553cdf
commit e1dd0bc3a3
13 changed files with 441 additions and 24 deletions
@@ -215,6 +215,15 @@ pub(super) async fn insert_pending_approval(
conversation_id: Some(conv_id.to_string()),
};
emit_ai_chat_event(&app_handle, ev);
// P1 bg 化:审批挂起需用户介入,主窗隐藏到托盘时系统通知补位(条件发送,失败静默)。
// 审批场景前端已有 ApprovalOverlay 与 approval-popup,通知只补用户不在场(托盘化)场景。
crate::commands::ai::notify::notify_session_event(
&app_handle,
crate::commands::ai::notify::NotifyKind::NeedAction,
conv_id,
"等待工具审批",
&format!("工具 {} 已暂停,批准后继续执行", draft.name),
);
audit_tool_call(audit_repo, conv_id, &draft.id, &draft.name, &draft.args, "pending", risk_level, None, None, current_message_id).await;
}