notification links
All checks were successful
/ upload (release) Successful in 35s

This commit is contained in:
pavel 2026-02-12 21:26:41 +01:00
commit 42a78c529d
5 changed files with 74 additions and 5 deletions

View file

@ -1,5 +1,6 @@
use crate::error::AppResult;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use web_push::*;
pub struct PushSender {
@ -56,6 +57,8 @@ impl PushSender {
subscription: &PushSubscription,
title: &str,
body: &str,
task_id: Option<Uuid>,
run_id: Option<Uuid>,
) -> AppResult<()> {
let subscription_info = SubscriptionInfo::new(
subscription.endpoint.clone(),
@ -81,6 +84,8 @@ impl PushSender {
let payload = serde_json::to_vec(&serde_json::json!({
"title": title,
"body": body,
"task_id": task_id,
"run_id": run_id,
}))
.map_err(|e| crate::error::AppError::Internal(e.to_string()))?;

View file

@ -171,7 +171,13 @@ pub async fn execute_agent_run(
tokio::spawn(async move {
if let Err(e) = sender
.send_notification(&sub_data, &format!("Task Completed: {}", status), &goal)
.send_notification(
&sub_data,
&format!("Task Completed: {}", status),
&goal,
Some(task_id),
Some(run_id),
)
.await
{
tracing::error!("Failed to send notification in background task: {}", e);

View file

@ -201,6 +201,8 @@ impl Scheduler {
&sub_data,
&format!("Scheduled Task Completed: {}", status),
&goal,
Some(task_id),
Some(run_id),
)
.await;
});