diff --git a/src/control_backend/agents/ri_command_agent.py b/src/control_backend/agents/ri_command_agent.py index 7ca1bf9..9e3ee5b 100644 --- a/src/control_backend/agents/ri_command_agent.py +++ b/src/control_backend/agents/ri_command_agent.py @@ -32,11 +32,11 @@ class RICommandAgent(Agent): # Try to get body try: + body = json.loads(body) message = SpeechCommand.model_validate(body) - # Send to the robot. - await self.agent.pubsocket.send_json(message) + await self.agent.pubsocket.send_json(message.model_dump()) except Exception as e: logger.error("Error processing message: %s", e) diff --git a/src/control_backend/api/v1/endpoints/command.py b/src/control_backend/api/v1/endpoints/command.py index 60cdf46..14e6fae 100644 --- a/src/control_backend/api/v1/endpoints/command.py +++ b/src/control_backend/api/v1/endpoints/command.py @@ -15,6 +15,6 @@ async def receive_command(command: SpeechCommand, request: Request): SpeechCommand.model_validate(command) topic = b"command" pub_socket: Socket = request.app.state.internal_comm_socket - pub_socket.send_multipart([topic, command]) + pub_socket.send_multipart([topic, command.model_dump_json().encode()]) return {"status": "Command received"}