feat: added goal start sending functionality
ref: N25B-400
This commit is contained in:
@@ -212,7 +212,6 @@ class BDIProgramManager(BaseAgent):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
self._initialize_internal_state(program)
|
self._initialize_internal_state(program)
|
||||||
|
|
||||||
await self._send_program_to_user_interrupt(program)
|
await self._send_program_to_user_interrupt(program)
|
||||||
await self._send_clear_llm_history()
|
await self._send_clear_llm_history()
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import asyncio
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import zmq
|
import zmq
|
||||||
@@ -151,6 +150,15 @@ class UserInterruptAgent(BaseAgent):
|
|||||||
payload = {"type": "phase_update", "phase_id": new_phase_id}
|
payload = {"type": "phase_update", "phase_id": new_phase_id}
|
||||||
|
|
||||||
await self._send_experiment_update(payload)
|
await self._send_experiment_update(payload)
|
||||||
|
case "goal_start":
|
||||||
|
goal_name = msg.body
|
||||||
|
ui_id = self._goal_reverse_map.get(goal_name)
|
||||||
|
if ui_id:
|
||||||
|
payload = {"type": "goal_update", "id": ui_id, "active": True}
|
||||||
|
await self._send_experiment_update(payload)
|
||||||
|
self.logger.info(f"UI Update: Goal {goal_name} started (ID: {ui_id})")
|
||||||
|
else:
|
||||||
|
self.logger.warning(f"Goal start received for unknown goal : {goal_name}")
|
||||||
case "active_norms_update":
|
case "active_norms_update":
|
||||||
asl_slugs = [s.strip() for s in msg.body.split(";")]
|
asl_slugs = [s.strip() for s in msg.body.split(";")]
|
||||||
|
|
||||||
@@ -159,23 +167,6 @@ class UserInterruptAgent(BaseAgent):
|
|||||||
case _:
|
case _:
|
||||||
self.logger.debug(f"Received internal message on unhandled thread: {msg.thread}")
|
self.logger.debug(f"Received internal message on unhandled thread: {msg.thread}")
|
||||||
|
|
||||||
# moet weg!!!!!
|
|
||||||
async def test_sending_behaviour(self):
|
|
||||||
self.logger.info("Starting simple test sending behaviour...")
|
|
||||||
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
test_data = {"type": "heartbeat", "status": "ok"}
|
|
||||||
|
|
||||||
await self._send_experiment_update(test_data)
|
|
||||||
|
|
||||||
except zmq.ZMQError as ze:
|
|
||||||
self.logger.error(f"ZMQ error: {ze}")
|
|
||||||
except Exception as e:
|
|
||||||
self.logger.error(f"Error: {e}")
|
|
||||||
|
|
||||||
await asyncio.sleep(2)
|
|
||||||
|
|
||||||
async def _broadcast_cond_norms(self, active_slugs: list[str]):
|
async def _broadcast_cond_norms(self, active_slugs: list[str]):
|
||||||
"""
|
"""
|
||||||
Sends the current state of all conditional norms to the UI.
|
Sends the current state of all conditional norms to the UI.
|
||||||
@@ -209,6 +200,10 @@ class UserInterruptAgent(BaseAgent):
|
|||||||
|
|
||||||
for goal in phase.goals:
|
for goal in phase.goals:
|
||||||
self._goal_map[str(goal.id)] = AgentSpeakGenerator.slugify(goal)
|
self._goal_map[str(goal.id)] = AgentSpeakGenerator.slugify(goal)
|
||||||
|
self._goal_reverse_map[AgentSpeakGenerator.slugify(goal)] = str(goal.id)
|
||||||
|
|
||||||
|
for goal, id in self._goal_reverse_map.items():
|
||||||
|
self.logger.debug(f"Goal mapping: UI ID {goal} -> {id}")
|
||||||
|
|
||||||
for norm in phase.norms:
|
for norm in phase.norms:
|
||||||
if not isinstance(norm, BasicNorm):
|
if not isinstance(norm, BasicNorm):
|
||||||
|
|||||||
Reference in New Issue
Block a user