Change apply_update / _update_settings return type from set[str] to dict[str, Any]. The dict maps each changed field name to its pre-update value, enabling services to do granular diffing of complex settings objects. Existing call-site patterns ("field" in changed, if changed, iteration) work unchanged; set-difference sites use changed.keys() - {...}.

This commit is contained in:
Paul Kompfner
2026-02-17 11:49:15 -05:00
parent 02c2778b8d
commit 3b1ba57452
38 changed files with 129 additions and 116 deletions

View File

@@ -17,7 +17,7 @@ Provides two STT services:
import base64
import json
from dataclasses import dataclass, field
from typing import AsyncGenerator, Literal, Optional, Union
from typing import Any, AsyncGenerator, Literal, Optional, Union
from loguru import logger
@@ -268,7 +268,7 @@ class OpenAIRealtimeSTTService(WebsocketSTTService):
"""
return True
async def _update_settings(self, update: STTSettings) -> set[str]:
async def _update_settings(self, update: STTSettings) -> dict[str, Any]:
"""Apply a settings update and send session update if needed.
Keeps ``_language_code`` and ``_prompt`` in sync with settings
@@ -278,7 +278,7 @@ class OpenAIRealtimeSTTService(WebsocketSTTService):
update: A :class:`STTSettings` (or ``OpenAIRealtimeSTTSettings``) delta.
Returns:
Set of field names whose values actually changed.
Dict mapping changed field names to their previous values.
"""
changed = await super()._update_settings(update)