feat: end to end connected for demo

Includes the Transcription agent. Involved updating the RI agent to receive messages from other agents, sending speech commands to the RI agent, and some performance optimizations.

ref: N25B-216
This commit is contained in:
Twirre Meulenbelt
2025-10-30 10:42:25 +01:00
parent 657c300bc7
commit 86938f79c0
7 changed files with 132 additions and 49 deletions

View File

@@ -1,15 +1,18 @@
import logging
from spade.behaviour import CyclicBehaviour
from spade.message import Message
from control_backend.core.config import settings
from control_backend.schemas.ri_message import SpeechCommand
class ReceiveLLMResponseBehaviour(CyclicBehaviour):
"""
Adds behavior to receive responses from the LLM Agent.
"""
logger = logging.getLogger("BDI/LLM Reciever")
logger = logging.getLogger("BDI/LLM Receiver")
async def run(self):
msg = await self.receive(timeout=2)
if not msg:
@@ -20,7 +23,17 @@ class ReceiveLLMResponseBehaviour(CyclicBehaviour):
case settings.agent_settings.llm_agent_name:
content = msg.body
self.logger.info("Received LLM response: %s", content)
#Here the BDI can pass the message back as a response
speech_command = SpeechCommand(data=content)
message = Message(to=settings.agent_settings.ri_command_agent_name
+ '@' + settings.agent_settings.host,
sender=self.agent.jid,
body=speech_command.model_dump_json())
self.logger.debug("Sending message: %s", message)
await self.send(message)
case _:
self.logger.debug("Not from the llm, discarding message")
pass