Agent Zero AI framework
context.running to identify chat process
frdel1581d7d12f7d
diff --git a/agent.py b/agent.pyindex df2c8925b..62b98e954 100644--- a/agent.py+++ b/agent.py@@ -187,6 +187,7 @@ class AgentContext:else Localization.get().serialize_datetime(datetime.fromtimestamp(0))),"type": self.type.value,+ "running": self.is_running(),**self.output_data,}@@ -230,6 +231,9 @@ class AgentContext:def get_agent(self):return self.streaming_agent or self.agent0+ def is_running(self):+ return self.task and self.task.is_alive()+def communicate(self, msg: "UserMessage", broadcast_level: int = 1):self.paused = False # unpause if pauseddiff --git a/python/api/poll.py b/python/api/poll.pyindex 4efa0fd43..d01789481 100644--- a/python/api/poll.py+++ b/python/api/poll.py@@ -123,4 +123,5 @@ class Poll(ApiHandler):"notifications_guid": notification_manager.guid,"notifications_version": len(notification_manager.updates),"message_queue": context.output_data.get("message_queue", []) if context else [],+ "running": context.is_running() if context else False,}diff --git a/webui/components/sidebar/chats/chats-list.html b/webui/components/sidebar/chats/chats-list.htmlindex 28d357096..fc0675a76 100644--- a/webui/components/sidebar/chats/chats-list.html+++ b/webui/components/sidebar/chats/chats-list.html@@ -26,7 +26,7 @@<div :class="{'chat-container': true, 'chat-selected': context.id === $store.chats.selected}"@click="$store.chats.selectChat(context.id)"><div class="chat-list-button">- <span class="project-color-ball"+ <span :class="{'project-color-ball': true, 'heartbeat': context.running}":style="context.project?.color ? { backgroundColor: context.project.color } : { border: '1px solid var(--color-border)' }"></span><span class="chat-name"x-text="context.name ? context.name : 'Chat #' + context.no"></span>diff --git a/webui/components/sidebar/tasks/tasks-list.html b/webui/components/sidebar/tasks/tasks-list.htmlindex 744f59d69..a850e282f 100644--- a/webui/components/sidebar/tasks/tasks-list.html+++ b/webui/components/sidebar/tasks/tasks-list.html@@ -28,7 +28,7 @@<div class="chat-list-button" @click="$store.tasks.selectTask(task.id)"><div class="task-container-vertical"><div class="task-title-line">- <span class="project-color-ball" :style="task.project?.color ? { backgroundColor: task.project.color } : { border: '1px solid var(--color-border)' }"></span>+ <span :class="{'project-color-ball': true, 'heartbeat': task.running}" :style="task.project?.color ? { backgroundColor: task.project.color } : { border: '1px solid var(--color-border)' }"></span><span class="task-name"x-text="(task.task_name || `Task #${task.no}`)":data-task-id="task.id"></span>diff --git a/webui/index.css b/webui/index.cssindex e3286b9a3..ae72e0d50 100644--- a/webui/index.css+++ b/webui/index.css@@ -993,6 +993,10 @@ input:checked + .slider:before {color: #e40138;}+.heartbeat {+ animation: heartbeat 1.5s ease-in-out infinite;+}+.font-bold {font-weight: bold;}