Add local S2S responsiveness candidate pinning ASR options and sentence-at-a-time generation. Route speech synthesis directly to OpenAI API for fluent Persian phonetics with gpt-4o-mini-tts-2025-12-15. Add responsiveness, budget carry, and browser watch unit tests along with acceptance benchmarks and evaluation evidence.
39 lines
2.1 KiB
Python
39 lines
2.1 KiB
Python
"""Real DB local profiles retain replay/owner/revocation authority."""
|
|
from uuid import UUID, uuid4
|
|
from sqlalchemy import text
|
|
import pytest
|
|
from tests.integration.test_phase2_postgres import seeded_env
|
|
from tests.unit.test_local_s2s_phase2 import local_config
|
|
|
|
|
|
@pytest.mark.parametrize('responsive',[False, True])
|
|
def test_local_profile_replay_never_rewrites_frozen_components(seeded_env,responsive):
|
|
e = seeded_env
|
|
cid = UUID(e.lifecycle.create_conversation(e.user, uuid4())['id'])
|
|
request = uuid4()
|
|
config = local_config(local_s2s_responsive=responsive)
|
|
first = e.lifecycle.create_live_session(e.user, cid, request, provider='local_s2s',
|
|
model=config.selected_model, execution_profile=config.profile())
|
|
sid = UUID(first['session_id'])
|
|
changed = local_config(local_s2s_tts_voice='different', local_s2s_retain_interrupted_answers=True)
|
|
replay = e.lifecycle.create_live_session(e.user, cid, request, provider='local_s2s',
|
|
model=changed.selected_model, execution_profile=changed.profile())
|
|
assert replay['session_id'] == first['session_id'] and replay['replayed']
|
|
info = e.lifecycle.validate_stream(e.user, sid, initial=True)
|
|
assert info['provider'] == 'local_s2s' and info['execution_profile'] == config.profile()
|
|
assert info['execution_profile'] != changed.profile()
|
|
with e.engine.begin() as conn:
|
|
row = conn.execute(text('SELECT execution_profile FROM live_sessions WHERE id=:id'), {'id': sid}).scalar_one()
|
|
assert row == config.profile()
|
|
|
|
|
|
def test_local_profile_revocation_still_blocks_stream(seeded_env):
|
|
e = seeded_env
|
|
cid = UUID(e.lifecycle.create_conversation(e.user, uuid4())['id'])
|
|
c = local_config()
|
|
reservation = e.lifecycle.create_live_session(e.user, cid, uuid4(), provider='local_s2s', model=c.selected_model, execution_profile=c.profile())
|
|
with e.engine.begin() as conn:
|
|
conn.execute(text('UPDATE organization_settings SET access_epoch=access_epoch+1 WHERE organization_id=:org'), {'org': e.org})
|
|
with pytest.raises(ValueError):
|
|
e.lifecycle.validate_stream(e.user, UUID(reservation['session_id']), initial=True)
|