Signed-off-by: chickeyton <ngton2014@gmail.com> Signed-off-by: Yueqian Lin <linyueqian@outlook.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: Yueqian Lin <linyueqian@outlook.com>
This commit is contained in:
49 files changed
+3056
-1715
No files matched your search
@@ -121,7 +121,14 @@ class SessionEmitter:
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def auto_responds(self) -> bool:
|
||||
"""Whether the session answers committed input without a ``response.create``."""
|
||||
"""Whether the session answers committed input without a ``response.create``.
|
||||
|
||||
A model that takes no client commits (``supports_client_commit`` off, a
|
||||
lockstep model) can only auto-respond; for every other model the
|
||||
client opts in through ``extra_body.auto_response``.
|
||||
"""
|
||||
if not self._ctx.session.capabilities.supports_client_commit:
|
||||
return True
|
||||
extra = getattr(self._ctx.session.config, "extra_body", None)
|
||||
if not isinstance(extra, dict):
|
||||
return False
|
||||
|
||||
@@ -29,7 +29,6 @@ from collections.abc import Awaitable, Callable, Mapping
|
||||
from dataclasses import replace
|
||||
from typing import TYPE_CHECKING, Protocol
|
||||
|
||||
import pybase64 as base64
|
||||
from vllm.logger import init_logger
|
||||
|
||||
from vllm_omni.engine.duplex.config import DuplexSessionState
|
||||
@@ -83,7 +82,6 @@ class ModelChannel:
|
||||
"""Appends out to the model, events back from it, for one session."""
|
||||
|
||||
# One MiniCPM model unit (1 s at 16 kHz) is the compatibility default.
|
||||
_SILENCE_UNIT_PAYLOAD_AUDIO = base64.b64encode(bytes(16000 * 4)).decode("ascii")
|
||||
_RESPONSE_MAX_CONTINUATION_UNITS = 8
|
||||
_AUTO_RESPONSE_MAX_CONTINUATION_UNITS = 64
|
||||
|
||||
@@ -1210,13 +1208,8 @@ class ModelChannel:
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def silence_unit_payload(self) -> dict[str, object]:
|
||||
samples = int(self._ctx.plugin.silence_continuation_samples)
|
||||
audio = (
|
||||
self._SILENCE_UNIT_PAYLOAD_AUDIO
|
||||
if samples == 16000
|
||||
else base64.b64encode(bytes(samples * 4)).decode("ascii")
|
||||
)
|
||||
return {"type": "audio", "audio": audio, "format": "pcm_f32le", "sample_rate_hz": 16000}
|
||||
"""One silence unit in the model's own format: the plugin defines it (rate and length)."""
|
||||
return dict(self._ctx.plugin.silence_unit_payload())
|
||||
|
||||
def response_continuations_remaining(self, response_id: str) -> bool:
|
||||
model_state = self._ctx.model_state
|
||||
|
||||
Reference in new issue
Block a user