enclose text between brackets when logging

This commit is contained in:
Aleix Conchillo Flaqué
2024-05-22 19:04:18 -07:00
parent acd2d55b84
commit 76709a9a39
3 changed files with 5 additions and 5 deletions

View File

@@ -119,7 +119,7 @@ class TextFrame(DataFrame):
text: str text: str
def __str__(self): def __str__(self):
return f"{self.name}(text: {self.text})" return f"{self.name}(text: [{self.text}])"
@dataclass @dataclass
@@ -132,7 +132,7 @@ class TranscriptionFrame(TextFrame):
timestamp: str timestamp: str
def __str__(self): def __str__(self):
return f"{self.name}(user_id: {self.user_id}, text: {self.text}, timestamp: {self.timestamp})" return f"{self.name}(user_id: {self.user_id}, text: [{self.text}], timestamp: {self.timestamp})"
@dataclass @dataclass
@@ -143,7 +143,7 @@ class InterimTranscriptionFrame(TextFrame):
timestamp: str timestamp: str
def __str__(self): def __str__(self):
return f"{self.name}(user: {self.user_id}, text: {self.text}, timestamp: {self.timestamp})" return f"{self.name}(user: {self.user_id}, text: [{self.text}], timestamp: {self.timestamp})"
@dataclass @dataclass

View File

@@ -66,7 +66,7 @@ class TTSService(AIService):
else: else:
self._current_sentence += frame.text self._current_sentence += frame.text
if self._current_sentence.strip().endswith((".", "?", "!")): if self._current_sentence.strip().endswith((".", "?", "!")):
text = self._current_sentence text = self._current_sentence.strip()
self._current_sentence = "" self._current_sentence = ""
if text: if text:

View File

@@ -32,7 +32,7 @@ class ElevenLabsTTSService(TTSService):
self._model = model self._model = model
async def run_tts(self, text: str) -> AsyncGenerator[Frame, None]: async def run_tts(self, text: str) -> AsyncGenerator[Frame, None]:
logger.debug(f"Transcribing text: {text}") logger.debug(f"Transcribing text: [{text}]")
url = f"https://api.elevenlabs.io/v1/text-to-speech/{self._voice_id}/stream" url = f"https://api.elevenlabs.io/v1/text-to-speech/{self._voice_id}/stream"