[Bugfix] Reject instructions changes on locked native duplex sessions (#6318)
Signed-off-by: ANURAG KANADE <anuragkanade6@gmail.com>
This commit is contained in:
1 parent
926e7fbfa2
commit
91dd7fcaec
8 files changed
+309
-7
No files matched your search
@@ -15,6 +15,7 @@ from vllm_omni.experimental.fullduplex.openai.protocol import (
|
||||
)
|
||||
from vllm_omni.experimental.fullduplex.openai.runtime_adapter import (
|
||||
ServingRuntimeConfigError,
|
||||
reject_changed_runtime_value,
|
||||
)
|
||||
from vllm_omni.experimental.fullduplex.personaplex.config import DEFAULT_PERSONA
|
||||
from vllm_omni.experimental.fullduplex.personaplex.data_plane import (
|
||||
@@ -31,6 +32,7 @@ _PRIVATE_RUNTIME_CONFIG_KEYS = frozenset(
|
||||
{
|
||||
"personaplex_prefill_slots",
|
||||
"personaplex_model_path",
|
||||
"minicpmo45_native_duplex",
|
||||
}
|
||||
)
|
||||
|
||||
@@ -40,6 +42,7 @@ class PersonaPlexServingSessionState:
|
||||
audio_buffer: PersonaPlexPcmAppendBuffer = field(default_factory=PersonaPlexPcmAppendBuffer)
|
||||
input_since_commit: bool = False
|
||||
speech_since_commit: bool = False
|
||||
native_context_locked: bool = False
|
||||
committed_audio_payload: dict[str, object] | None = None
|
||||
committed_audio_operation_id: str | None = None
|
||||
committed_audio_reserved_bytes: int = 0
|
||||
@@ -190,9 +193,23 @@ class PersonaPlexServingRuntimeAdapter:
|
||||
current: Mapping[str, object],
|
||||
) -> dict[str, object]:
|
||||
cls.validate_client_extra_body(getattr(config, "extra_body", None))
|
||||
new_persona = str(getattr(config, "instructions", None) or DEFAULT_PERSONA)
|
||||
reject_changed_runtime_value(
|
||||
new_persona,
|
||||
current.get("personaplex_persona"),
|
||||
message="PersonaPlex persona (instructions) cannot be changed after the session is created",
|
||||
code="persona_update_unsupported",
|
||||
)
|
||||
new_voice = cls._voice_name(getattr(config, "voice", None))
|
||||
reject_changed_runtime_value(
|
||||
new_voice,
|
||||
current.get("personaplex_voice_prompt"),
|
||||
message="PersonaPlex voice cannot be changed after the session is created",
|
||||
code="voice_update_unsupported",
|
||||
)
|
||||
runtime_config = deepcopy(dict(current))
|
||||
runtime_config["personaplex_voice_prompt"] = cls._voice_name(getattr(config, "voice", None))
|
||||
runtime_config["personaplex_persona"] = str(getattr(config, "instructions", None) or DEFAULT_PERSONA)
|
||||
runtime_config["personaplex_voice_prompt"] = new_voice
|
||||
runtime_config["personaplex_persona"] = new_persona
|
||||
return runtime_config
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in new issue
Block a user