a basic duplex agent is built

This commit is contained in:
Xin Wang
2026-01-29 16:36:46 +08:00
parent ac0c76e6e8
commit d6d0ade33e
6 changed files with 432 additions and 15 deletions

View File

@@ -269,6 +269,15 @@ class MicrophoneClient:
print("← User speech detected")
elif event_type == "silence":
print("← User silence detected")
elif event_type == "transcript":
# Display user speech transcription
text = event.get("text", "")
is_final = event.get("isFinal", False)
if is_final:
print(f"← You said: {text}")
else:
# Interim result - show with indicator
print(f"← [listening] {text}", end="\r")
elif event_type == "trackStart":
print("← Bot started speaking")
# Clear any old audio in buffer