Add notification model (#31)
All checks were successful
CI / ci (push) Successful in 21s

Co-authored-by: Anibal Angulo <a8065384@banorte.com>
Reviewed-on: #31
This commit was merged in pull request #31.
This commit is contained in:
2026-03-10 23:50:41 +00:00
parent a264276a5d
commit ac27d12ed3
3 changed files with 92 additions and 49 deletions

View File

@@ -84,23 +84,16 @@ async def provide_dynamic_instruction(
return ""
# Build dynamic instruction with notification details
notification_ids = [
nid
for n in recent_notifications
if (nid := n.get("id_notificacion")) is not None
]
notification_ids = [n.id_notificacion for n in recent_notifications]
count = len(recent_notifications)
# Format notification details for the agent (most recent first)
now = time.time()
notification_details = []
for i, notif in enumerate(recent_notifications, 1):
evento = notif.get("nombre_evento_dialogflow", "notificacion")
texto = notif.get("texto", "Sin texto")
ts = notif.get("timestamp_creacion", notif.get("timestampCreacion", 0))
ago = _format_time_ago(now, ts)
ago = _format_time_ago(now, notif.timestamp_creacion)
notification_details.append(
f" {i}. [{ago}] Evento: {evento} | Texto: {texto}"
f" {i}. [{ago}] Evento: {notif.nombre_evento} | Texto: {notif.texto}"
)
details_text = "\n".join(notification_details)
@@ -123,6 +116,7 @@ async def provide_dynamic_instruction(
count,
phone_number,
)
logger.debug("Dynamic instruction content:\n%s", instruction)
except Exception:
logger.exception(