fix(backend): update message object shape

This commit is contained in:
Nicholas Tindle
2025-02-10 15:17:18 -06:00
parent 9aba2f8c63
commit 882cbe9aac

View File

@@ -14,7 +14,7 @@ from redis.lock import Lock as RedisLock
from backend.data.notifications import (
AgentRunData,
NotificationEventModel,
NotificationEventDTO,
NotificationType,
)
@@ -226,20 +226,21 @@ def execute_node(
# Update execution status and spend credits
update_execution(ExecutionStatus.COMPLETED)
notification_service.queue_notification(
NotificationEventModel(
user_id=user_id,
type=NotificationType.AGENT_RUN,
data=AgentRunData(
agent_name=node_block.name,
credits_used=cost,
execution_time=0,
graph_id=graph_id,
node_count=1,
),
)
event = NotificationEventDTO(
user_id=user_id,
type=NotificationType.AGENT_RUN,
data=AgentRunData(
agent_name=node_block.name,
credits_used=cost,
execution_time=0,
graph_id=graph_id,
node_count=1,
).model_dump(),
)
logger.info(f"Sending notification for {event}")
notification_service.queue_notification(event)
except Exception as e:
error_msg = str(e)
db_client.upsert_execution_output(node_exec_id, "error", error_msg)