Deprecate set_model, set_voice, and set_language in favor of *UpdateSettingsFrame.
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import io
|
import io
|
||||||
import time
|
import time
|
||||||
|
import warnings
|
||||||
import wave
|
import wave
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
from typing import Any, AsyncGenerator, Dict, Mapping, Optional
|
from typing import Any, AsyncGenerator, Dict, Mapping, Optional
|
||||||
@@ -168,13 +169,19 @@ class STTService(AIService):
|
|||||||
async def set_model(self, model: str):
|
async def set_model(self, model: str):
|
||||||
"""Set the speech recognition model.
|
"""Set the speech recognition model.
|
||||||
|
|
||||||
When the service has been migrated to typed settings this routes
|
.. deprecated:: 0.0.103
|
||||||
through :meth:`_update_settings_from_typed` so that concrete
|
Use ``STTUpdateSettingsFrame(model=...)`` instead.
|
||||||
services can react (e.g. reconnect) in a single place.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
model: The name of the model to use for speech recognition.
|
model: The name of the model to use for speech recognition.
|
||||||
"""
|
"""
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("always")
|
||||||
|
warnings.warn(
|
||||||
|
"'set_model' is deprecated, use 'STTUpdateSettingsFrame(model=...)' instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
logger.info(f"Switching STT model to: [{model}]")
|
logger.info(f"Switching STT model to: [{model}]")
|
||||||
if isinstance(self._settings, ServiceSettings):
|
if isinstance(self._settings, ServiceSettings):
|
||||||
settings_cls = type(self._settings)
|
settings_cls = type(self._settings)
|
||||||
@@ -185,13 +192,19 @@ class STTService(AIService):
|
|||||||
async def set_language(self, language: Language):
|
async def set_language(self, language: Language):
|
||||||
"""Set the language for speech recognition.
|
"""Set the language for speech recognition.
|
||||||
|
|
||||||
When the service has been migrated to typed settings this routes
|
.. deprecated:: 0.0.103
|
||||||
through :meth:`_update_settings_from_typed` so that concrete
|
Use ``STTUpdateSettingsFrame(language=...)`` instead.
|
||||||
services can react (e.g. reconnect) in a single place.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
language: The language to use for speech recognition.
|
language: The language to use for speech recognition.
|
||||||
"""
|
"""
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("always")
|
||||||
|
warnings.warn(
|
||||||
|
"'set_language' is deprecated, use 'STTUpdateSettingsFrame(language=...)' instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
logger.info(f"Switching STT language to: [{language}]")
|
logger.info(f"Switching STT language to: [{language}]")
|
||||||
if isinstance(self._settings, ServiceSettings):
|
if isinstance(self._settings, ServiceSettings):
|
||||||
settings_cls = type(self._settings)
|
settings_cls = type(self._settings)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import uuid
|
import uuid
|
||||||
|
import warnings
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import (
|
from typing import (
|
||||||
@@ -265,13 +266,19 @@ class TTSService(AIService):
|
|||||||
async def set_model(self, model: str):
|
async def set_model(self, model: str):
|
||||||
"""Set the TTS model to use.
|
"""Set the TTS model to use.
|
||||||
|
|
||||||
When the service has been migrated to typed settings this routes
|
.. deprecated:: 0.0.103
|
||||||
through :meth:`_update_settings_from_typed` so that concrete
|
Use ``TTSUpdateSettingsFrame(model=...)`` instead.
|
||||||
services can react (e.g. reconnect) in a single place.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
model: The name of the TTS model.
|
model: The name of the TTS model.
|
||||||
"""
|
"""
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("always")
|
||||||
|
warnings.warn(
|
||||||
|
"'set_model' is deprecated, use 'TTSUpdateSettingsFrame(model=...)' instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
logger.info(f"Switching TTS model to: [{model}]")
|
logger.info(f"Switching TTS model to: [{model}]")
|
||||||
if isinstance(self._settings, ServiceSettings):
|
if isinstance(self._settings, ServiceSettings):
|
||||||
settings_cls = type(self._settings)
|
settings_cls = type(self._settings)
|
||||||
@@ -282,17 +289,19 @@ class TTSService(AIService):
|
|||||||
async def set_voice(self, voice: str):
|
async def set_voice(self, voice: str):
|
||||||
"""Set the voice for speech synthesis.
|
"""Set the voice for speech synthesis.
|
||||||
|
|
||||||
When the service has been migrated to typed settings this routes
|
.. deprecated:: 0.0.103
|
||||||
through :meth:`_update_settings_from_typed` so that concrete
|
Use ``TTSUpdateSettingsFrame(voice=...)`` instead.
|
||||||
services can react (e.g. reconnect) in a single place.
|
|
||||||
|
|
||||||
.. versionchanged:: 0.0.103
|
|
||||||
Now ``async``. In ``__init__`` methods, set
|
|
||||||
``self._voice_id`` directly instead of calling this method.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
voice: The voice identifier or name.
|
voice: The voice identifier or name.
|
||||||
"""
|
"""
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("always")
|
||||||
|
warnings.warn(
|
||||||
|
"'set_voice' is deprecated, use 'TTSUpdateSettingsFrame(voice=...)' instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
logger.info(f"Switching TTS voice to: [{voice}]")
|
logger.info(f"Switching TTS voice to: [{voice}]")
|
||||||
if isinstance(self._settings, ServiceSettings):
|
if isinstance(self._settings, ServiceSettings):
|
||||||
settings_cls = type(self._settings)
|
settings_cls = type(self._settings)
|
||||||
|
|||||||
Reference in New Issue
Block a user