feat: added a functionality for monitoring page
ref: N25B-400
This commit is contained in:
@@ -75,7 +75,12 @@ class BDIProgramManager(BaseAgent):
|
||||
self._transition_phase(phases["old"], phases["new"])
|
||||
|
||||
def _transition_phase(self, old: str, new: str):
|
||||
assert old == str(self._phase.id)
|
||||
if old != str(self._phase.id):
|
||||
self.logger.warning(
|
||||
f"Phase transition desync detected! ASL requested move from '{old}', "
|
||||
f"but Python is currently in '{self._phase.id}'. Request ignored."
|
||||
)
|
||||
return
|
||||
|
||||
if new == "end":
|
||||
self._phase = None
|
||||
@@ -208,6 +213,7 @@ class BDIProgramManager(BaseAgent):
|
||||
|
||||
self._initialize_internal_state(program)
|
||||
|
||||
await self._send_program_to_user_interrupt(program)
|
||||
await self._send_clear_llm_history()
|
||||
|
||||
await asyncio.gather(
|
||||
@@ -216,6 +222,21 @@ class BDIProgramManager(BaseAgent):
|
||||
self._send_goals_to_semantic_belief_extractor(),
|
||||
)
|
||||
|
||||
async def _send_program_to_user_interrupt(self, program: Program):
|
||||
"""
|
||||
Send the received program to the User Interrupt Agent.
|
||||
|
||||
:param program: The program object received from the API.
|
||||
"""
|
||||
msg = InternalMessage(
|
||||
sender=self.name,
|
||||
to=settings.agent_settings.user_interrupt_name,
|
||||
body=program.model_dump_json(),
|
||||
thread="new_program",
|
||||
)
|
||||
|
||||
await self.send(msg)
|
||||
|
||||
async def setup(self):
|
||||
"""
|
||||
Initialize the agent.
|
||||
|
||||
Reference in New Issue
Block a user