Abstract base transport class & local transport class

This commit is contained in:
Moishe Lettvin
2024-01-31 15:33:38 -05:00
parent 70d07b6ea2
commit ee1ce8f288
28 changed files with 745 additions and 344 deletions

View File

@@ -1,6 +1,7 @@
import asyncio
import io
import logging
import time
import wave
from dailyai.queue_frame import (
@@ -12,6 +13,7 @@ from dailyai.queue_frame import (
LLMResponseEndQueueFrame,
QueueFrame,
TextQueueFrame,
TranscriptionQueueFrame,
)
from abc import abstractmethod
@@ -188,7 +190,8 @@ class STTService(AIService):
ww.close()
content.seek(0)
text = await self.run_stt(content)
yield TextQueueFrame(text)
yield TranscriptionQueueFrame(text, '', str(time.time()))
class FrameLogger(AIService):
def __init__(self, prefix="Frame", **kwargs):
@@ -202,10 +205,3 @@ class FrameLogger(AIService):
print(f"{self.prefix}: {frame}")
yield frame
@dataclass
class AIServiceConfig:
tts: TTSService
image: ImageGenService
llm: LLMService
stt: STTService