feat: AppState gains speaker pause fields and AWAITING_SPEAKERS status
This commit is contained in:
+6
-1
@@ -8,15 +8,20 @@ class Status(str, Enum):
|
|||||||
IDLE = "idle"
|
IDLE = "idle"
|
||||||
RECORDING = "recording"
|
RECORDING = "recording"
|
||||||
PROCESSING = "processing"
|
PROCESSING = "processing"
|
||||||
|
AWAITING_SPEAKERS = "awaiting_speakers"
|
||||||
ERROR = "error"
|
ERROR = "error"
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class AppState:
|
class AppState:
|
||||||
status: Status = Status.IDLE
|
status: Status = Status.IDLE
|
||||||
recording_user: str | None = None # which user triggered the current recording
|
recording_user: str | None = None
|
||||||
last_error: str | None = None
|
last_error: str | None = None
|
||||||
_listeners: list[Callable] = field(default_factory=list, repr=False)
|
_listeners: list[Callable] = field(default_factory=list, repr=False)
|
||||||
|
# Diarization pipeline pause
|
||||||
|
_speakers_event: asyncio.Event | None = None
|
||||||
|
_pending_aligned_segments: list[tuple[str, str]] | None = None
|
||||||
|
_speaker_names: dict[str, str] | None = None
|
||||||
|
|
||||||
def subscribe(self, callback: Callable):
|
def subscribe(self, callback: Callable):
|
||||||
self._listeners.append(callback)
|
self._listeners.append(callback)
|
||||||
|
|||||||
@@ -160,6 +160,17 @@ def test_status_includes_is_admin():
|
|||||||
app.dependency_overrides.pop(current_user, None)
|
app.dependency_overrides.pop(current_user, None)
|
||||||
|
|
||||||
|
|
||||||
|
def test_state_has_speaker_fields():
|
||||||
|
from api.state import AppState
|
||||||
|
s = AppState()
|
||||||
|
assert hasattr(s, "_speakers_event")
|
||||||
|
assert hasattr(s, "_pending_aligned_segments")
|
||||||
|
assert hasattr(s, "_speaker_names")
|
||||||
|
assert s._speakers_event is None
|
||||||
|
assert s._pending_aligned_segments is None
|
||||||
|
assert s._speaker_names is None
|
||||||
|
|
||||||
|
|
||||||
def test_put_config_deep_merges(tmp_path, monkeypatch):
|
def test_put_config_deep_merges(tmp_path, monkeypatch):
|
||||||
import config as cfg_mod
|
import config as cfg_mod
|
||||||
monkeypatch.setattr(cfg_mod, "CONFIG_PATH", str(tmp_path / "config.toml"))
|
monkeypatch.setattr(cfg_mod, "CONFIG_PATH", str(tmp_path / "config.toml"))
|
||||||
|
|||||||
Reference in New Issue
Block a user