feat(voice): implement local S2S retained history and provider selection
Add pinned CPU engine dependencies, retained interrupted-response history, provider admission, offline evaluation and isolated browser tooling. Record Phase 2 acceptance and Phase 3/4 preparation, bounded paid-test accounting and interruption incident findings. Human interruption acceptance, paired OpenAI evaluation and rollback remain pending.
This commit is contained in:
@@ -9,9 +9,19 @@ UPSTREAM_REVISION = '619e3fe4f71d1c6f35c15870d588a3638de34722'
|
||||
CONTRACT_REVISION = 'rag-local-s2s-phase2-v1'
|
||||
PATCH_REVISION = 'rag-local-s2s-phase2-v3'
|
||||
|
||||
RETENTION_POLICY = 'retain_unheard_draft_v1'
|
||||
DRAFT_MARKER = '[LOCAL_S2S_UNHEARD_DRAFT_V1]'
|
||||
RETENTION_INSTRUCTIONS = (DRAFT_MARKER + ' Interrupted assistant output is a saved draft, not proof the user heard it. '
|
||||
'For the same question you may answer from the draft again. Before using document facts, '
|
||||
'call reuse_last_evidence to revalidate evidence, then report_used_sources with current labels. '
|
||||
'Never treat a saved draft as fresh evidence or as a completed spoken answer. '
|
||||
'Do not speak draft markers or internal status labels.')
|
||||
|
||||
|
||||
|
||||
class LocalS2SSettings(BaseModel):
|
||||
local_s2s_enabled: bool = False
|
||||
local_s2s_retain_interrupted_answers: bool = False
|
||||
local_s2s_endpoint: str = 'ws://local-s2s-engine:8765/v1/realtime'
|
||||
local_s2s_token: SecretStr = SecretStr('')
|
||||
local_s2s_engine_revision: Literal[UPSTREAM_REVISION] = UPSTREAM_REVISION
|
||||
@@ -63,12 +73,15 @@ def setup_session(config):
|
||||
session['audio']['input']['transcription'] = dict(model=config.local_s2s_stt_model, language='fa')
|
||||
session['audio']['output']['voice'] = config.local_s2s_tts_voice
|
||||
session['audio']['output']['speed'] = 1.0
|
||||
if config.local_s2s_retain_interrupted_answers:
|
||||
session['instructions'] += '\n' + RETENTION_INSTRUCTIONS
|
||||
return session
|
||||
|
||||
|
||||
def effective_identity(components, session):
|
||||
return dict(engine_revision=UPSTREAM_REVISION, patch_revision=PATCH_REVISION,
|
||||
contract_revision=CONTRACT_REVISION, components=components,
|
||||
retention = session.get('instructions', '').endswith(RETENTION_INSTRUCTIONS)
|
||||
return dict(engine_revision=UPSTREAM_REVISION, patch_revision='rag-local-s2s-phase3-retain-v1' if retention else PATCH_REVISION,
|
||||
contract_revision='rag-local-s2s-phase3-retain-v1' if retention else CONTRACT_REVISION, components=components,
|
||||
effective_config_sha256=sha256(canonical_json(dict(components=components, session=session)).encode()).hexdigest())
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user