Skip to content

Agent Zero AI framework

welcome screen poll fix

frdel23f53c431816
diff --git a/python/api/poll.py b/python/api/poll.py
index cfaa74b26..a17987f13 100644
--- a/python/api/poll.py
+++ b/python/api/poll.py
@@ -18,10 +18,14 @@ class Poll(ApiHandler):
timezone = input.get("timezone", get_dotenv_value("DEFAULT_USER_TIMEZONE", "UTC"))
Localization.get().set_timezone(timezone)
- # context instance - get or create
- context = self.get_context(ctxid)
+ # context instance - get or create only if ctxid is provided
+ if ctxid:
+ context = self.get_context(ctxid)
+ else:
+ context = None
- logs = context.log.output(start=from_no)
+ # Get logs only if we have a context
+ logs = context.log.output(start=from_no) if context else []
# Get notifications from global notification manager
notification_manager = AgentContext.get_notification_manager()
@@ -102,16 +106,16 @@ class Poll(ApiHandler):
# data from this server
return {
- "context": context.id,
+ "context": context.id if context else "",
"contexts": ctxs,
"tasks": tasks,
"logs": logs,
- "log_guid": context.log.guid,
- "log_version": len(context.log.updates),
- "log_progress": context.log.progress,
- "log_progress_active": context.log.progress_active,
- "paused": context.paused,
+ "log_guid": context.log.guid if context else "",
+ "log_version": len(context.log.updates) if context else 0,
+ "log_progress": context.log.progress if context else 0,
+ "log_progress_active": context.log.progress_active if context else False,
+ "paused": context.paused if context else False,
"notifications": notifications,
"notifications_guid": notification_manager.guid,
"notifications_version": len(notification_manager.updates),
- }
+ }
\ No newline at end of file