[Cleanup][Full Duplex] Remove generic server VAD

Signed-off-by: Sy03 <1370724210@qq.com>
This commit is contained in:
Sy03 committed 2026-08-25 03:14:31 +08:00
1 parent 2a7407fe85
commit d3780fdcb7
13 files changed
+17 -854

No files matched your search

@@ -58,7 +58,6 @@ class NativeRealtimeSessionProtocol(
while True:
if not self._pending_outbound.empty():
return json.dumps(await self._pending_outbound.get())
await self.wait_for_realtime_turn_detection_update()
raw = await websocket.receive_text()
try:
event = json.loads(raw)
@@ -98,22 +97,11 @@ class NativeRealtimeSessionProtocol(
return json.dumps(translated)
def encode_outbound_event(self, data: dict[str, Any]) -> list[dict[str, object]]:
self._resolve_realtime_turn_detection_update(data)
payloads = self._from_duplex_event(data)
for payload in payloads:
self._attach_event_id(payload)
return payloads
def _resolve_realtime_turn_detection_update(self, data: dict[str, Any]) -> None:
"""Publish or discard a staged VAD with the Realtime session ACK."""
if not self._turn_detection_update_pending:
return
event_type = data.get("type")
if event_type in {"session.created", "session.updated"}:
self.commit_realtime_turn_detection_update()
elif event_type == "error":
self.reject_realtime_turn_detection_update()
@staticmethod
def _attach_event_id(payload: dict[str, object]) -> None:
payload.setdefault("event_id", f"event_{uuid4().hex}")