[Bugfix][Full Duplex] Preserve shared runtime compatibility
Signed-off-by: Sy03 <1370724210@qq.com>
This commit is contained in:
1 parent
6e720e49e7
commit
b103e65efc
6 files changed
+58
-18
No files matched your search
@@ -370,21 +370,6 @@ class OmniChunkTransferAdapter(OmniTransferAdapterBase):
|
||||
stage_id = self.connector.stage_id
|
||||
next_stage_id = stage_id + 1
|
||||
external_req_id = request.external_req_id
|
||||
task_generation = task.get("segment_generation")
|
||||
expected_generation = self._segment_generation.get(external_req_id, task_generation)
|
||||
if (
|
||||
isinstance(task_generation, int)
|
||||
and isinstance(expected_generation, int)
|
||||
and task_generation < expected_generation
|
||||
and not is_segment_finished
|
||||
):
|
||||
logger.warning(
|
||||
"Skip queued late chunk for request %s, segment_generation=%s, expected=%s",
|
||||
external_req_id,
|
||||
task_generation,
|
||||
expected_generation,
|
||||
)
|
||||
return
|
||||
chunk_id = self.put_req_chunk[external_req_id]
|
||||
connector_put_key = f"{external_req_id}_{stage_id}_{chunk_id}"
|
||||
# Process payload in save_loop thread
|
||||
|
||||
@@ -9,6 +9,7 @@ from uuid import uuid4
|
||||
|
||||
|
||||
class DuplexOverlapPolicy(str, Enum):
|
||||
AUTO = "auto"
|
||||
LISTEN_ONLY = "listen_only"
|
||||
BARGE_IN_ON_SPEECH = "barge_in_on_speech"
|
||||
|
||||
|
||||
@@ -961,6 +961,23 @@ class OmniDuplexSessionHandler(
|
||||
max_sessions=self._duplex_session_config.max_sessions,
|
||||
)
|
||||
)
|
||||
if (
|
||||
config.overlap_policy == DuplexOverlapPolicy.BARGE_IN_ON_SPEECH.value
|
||||
and not session.capabilities.supports_barge_in
|
||||
):
|
||||
if realtime_protocol is not None:
|
||||
realtime_protocol.reject_realtime_turn_detection_update()
|
||||
await send_json(
|
||||
{
|
||||
"type": "error",
|
||||
"error": (
|
||||
"server_vad with interrupt_response=true requires a runtime "
|
||||
"that supports barge-in"
|
||||
),
|
||||
"code": "unsupported_turn_detection",
|
||||
}
|
||||
)
|
||||
return None
|
||||
session.replace_runtime_config(runtime_config)
|
||||
return _DuplexSessionHandshake(session=session)
|
||||
|
||||
|
||||
Reference in new issue
Block a user