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:
@@ -13,7 +13,7 @@ WebSocket API for streaming audio transcription.
|
||||
import base64
|
||||
import json
|
||||
from dataclasses import dataclass, field
|
||||
from typing import AsyncGenerator, Optional
|
||||
from typing import Any, AsyncGenerator, Optional
|
||||
|
||||
from loguru import logger
|
||||
from pydantic import BaseModel
|
||||
@@ -171,14 +171,14 @@ class GradiumSTTService(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, sync params, and reconnect.
|
||||
|
||||
Args:
|
||||
update: A :class:`STTSettings` (or ``GradiumSTTSettings``) 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)
|
||||
if not changed:
|
||||
|
||||
Reference in New Issue
Block a user