This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user