|
|
@@ -861,6 +861,31 @@ class ClientApplication(IApplication):
|
|
|
|
|
|
pdebug(f"Follow-Up-Request empfangen: {request.question[:50]}...")
|
|
|
|
|
|
+ # Warten bis TTS-Audio fertig abgespielt ist.
|
|
|
+ # Der FollowUpRequest kommt oft gleichzeitig mit dem Audio —
|
|
|
+ # wir duerfen nicht aufnehmen waehrend Trixy noch spricht,
|
|
|
+ # sonst nimmt das Mikrofon die eigene TTS-Ausgabe auf.
|
|
|
+ audio_player = getattr(self, "_audio_player", None)
|
|
|
+ if audio_player and hasattr(audio_player, "is_playing"):
|
|
|
+ import asyncio
|
|
|
+ wait_count = 0
|
|
|
+ while audio_player.is_playing and wait_count < 60:
|
|
|
+ await asyncio.sleep(0.5)
|
|
|
+ wait_count += 1
|
|
|
+ if wait_count > 0:
|
|
|
+ # Kurze Pause nach TTS damit Echo abklingt
|
|
|
+ await asyncio.sleep(0.3)
|
|
|
+
|
|
|
+ # WakewordService in Follow-Up Modus versetzen
|
|
|
+ # (startet neue Aufnahme ohne Wakeword)
|
|
|
+ wakeword = self.services.get_service("WakewordService")
|
|
|
+ if wakeword and hasattr(wakeword, "_handle_follow_up"):
|
|
|
+ await wakeword._handle_follow_up({
|
|
|
+ "session_id": request.session_id,
|
|
|
+ "question": request.question,
|
|
|
+ "follow_up": True,
|
|
|
+ })
|
|
|
+
|
|
|
# Keyboard-Input für Antwort öffnen (falls aktiv)
|
|
|
if self._keyboard_service:
|
|
|
self._keyboard_service.handle_follow_up_request(request)
|