mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-07-25 12:01:04 +02:00
chore: move from HTTP Service to Websocket Service
This commit is contained in:
parent
a78bd58ea2
commit
dd1a1696ea
3 changed files with 56 additions and 29 deletions
|
|
@ -1,23 +0,0 @@
|
|||
"""Inworld TTS wrapper that closes its aiohttp session in cleanup().
|
||||
|
||||
Pipecat's InworldHttpTTSService leaves session disposal to the caller. Our
|
||||
factory creates a fresh session per service instance, so we own its close here
|
||||
to avoid leaking sockets/FDs on shutdown.
|
||||
"""
|
||||
|
||||
import aiohttp
|
||||
|
||||
from pipecat.services.inworld.tts import InworldHttpTTSService
|
||||
|
||||
|
||||
class InworldOwnedSessionTTSService(InworldHttpTTSService):
|
||||
"""InworldHttpTTSService variant that owns its aiohttp session lifecycle."""
|
||||
|
||||
def __init__(self, *args, aiohttp_session: aiohttp.ClientSession, **kwargs):
|
||||
super().__init__(*args, aiohttp_session=aiohttp_session, **kwargs)
|
||||
self._owned_session = aiohttp_session
|
||||
|
||||
async def cleanup(self):
|
||||
await super().cleanup()
|
||||
if not self._owned_session.closed:
|
||||
await self._owned_session.close()
|
||||
|
|
@ -8,7 +8,6 @@ from loguru import logger
|
|||
from api.constants import MPS_API_URL
|
||||
from api.services.configuration.options import DEEPGRAM_FLUX_MODELS
|
||||
from api.services.configuration.registry import ServiceProviders
|
||||
from api.services.pipecat.inworld_tts import InworldOwnedSessionTTSService
|
||||
from api.services.pipecat.minimax_tts import MiniMaxOwnedSessionTTSService
|
||||
from api.utils.url_security import validate_user_configured_service_url
|
||||
from pipecat.services.assemblyai.stt import AssemblyAISTTService, AssemblyAISTTSettings
|
||||
|
|
@ -49,7 +48,7 @@ from pipecat.services.huggingface.stt import (
|
|||
HuggingFaceSTTService,
|
||||
HuggingFaceSTTSettings,
|
||||
)
|
||||
from pipecat.services.inworld.tts import InworldTTSSettings
|
||||
from pipecat.services.inworld.tts import InworldTTSService, InworldTTSSettings
|
||||
from pipecat.services.minimax.llm import MiniMaxLLMService
|
||||
from pipecat.services.minimax.tts import MiniMaxTTSSettings
|
||||
from pipecat.services.openai._constants import OPENAI_SAMPLE_RATE
|
||||
|
|
@ -477,11 +476,8 @@ def create_tts_service(
|
|||
speed = getattr(user_config.tts, "speed", None)
|
||||
language = getattr(user_config.tts, "language", None) or "en-US"
|
||||
delivery_mode = getattr(user_config.tts, "delivery_mode", None) or "BALANCED"
|
||||
session = aiohttp.ClientSession()
|
||||
return InworldOwnedSessionTTSService(
|
||||
return InworldTTSService(
|
||||
api_key=user_config.tts.api_key,
|
||||
aiohttp_session=session,
|
||||
streaming=True,
|
||||
settings=InworldTTSSettings(
|
||||
voice=voice,
|
||||
model=model,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue