瀏覽代碼

Fix: FollowUpRequest Command an Satellite senden

Der IntentDispatcher emittierte nur ein internes followup_expected
Event, sendete aber keinen FollowUpRequest Command an den Satellite.
Der Client wartete auf FollowUpRequest um in den Hoer-Modus zu
wechseln — ohne diesen Command blieb er stumm.

Jetzt wird nach followup_expected auch ein FollowUpRequest via
Command-Socket an den Satellite gesendet. Der Client wechselt
in FOLLOW_UP State und nimmt Audio auf ohne neues Wakeword.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
patrick 2 月之前
父節點
當前提交
790fd755a0
共有 1 個文件被更改,包括 29 次插入0 次删除
  1. 29 0
      trixy_core/nlp/intent_dispatcher.py

+ 29 - 0
trixy_core/nlp/intent_dispatcher.py

@@ -436,6 +436,12 @@ class IntentDispatcherService(IService):
 
             pinfo(f"Follow-up erwartet für Satellite: {followup_info['satellite_id']}")
             await self._application.events.trigger("followup_expected", followup_event)
+
+            # FollowUpRequest an Satellite senden (Server→Client Modus)
+            await self._send_follow_up_request(
+                followup_info["satellite_id"],
+                followup_info["session_id"],
+            )
         else:
             # Kein Follow-up → ConversationEnd senden
             if satellite_id:
@@ -462,6 +468,29 @@ class IntentDispatcherService(IService):
         except Exception as e:
             perror(f"Fehler beim Senden von ConversationEnd: {e}")
 
+    async def _send_follow_up_request(self, satellite_id: str, session_id: str = "") -> None:
+        """Sendet FollowUpRequest an den Satellite → Client wechselt in Hoer-Modus."""
+        satellites = getattr(self._application, "satellites", None)
+        if satellites is None:
+            return
+
+        satellite = satellites.get(satellite_id)
+        if satellite is None or not satellite.is_connected:
+            pdebug(f"Satellite {satellite_id} nicht verfuegbar fuer FollowUpRequest")
+            return
+
+        try:
+            from trixy_core.network.cmd.wakeword import FollowUpRequest
+            cmd = FollowUpRequest(
+                session_id=session_id,
+                question="",  # Keine explizite Rueckfrage — Konversation geht einfach weiter
+                timeout_seconds=60.0,
+            )
+            await satellite.send_command(cmd)
+            pdebug(f"FollowUpRequest gesendet an {satellite_id}")
+        except Exception as e:
+            perror(f"Fehler beim Senden von FollowUpRequest: {e}")
+
     async def _send_tts_to_satellite(self, satellite_id: str, audio_data_hex: str) -> None:
         """Sendet TTS-Audio an den Satellite."""
         try: