Fix : tts issues

This commit is contained in:
martin legrand
2025-03-04 15:13:00 +01:00
parent c3fce55667
commit 9690147000
8 changed files with 73 additions and 30 deletions
+8 -1
View File
@@ -22,7 +22,14 @@ class AgentRouter:
return "cpu"
def classify_text(self, text, threshold=0.5):
result = self.pipeline(text, self.labels, threshold=threshold)
first_sentence = None
for line in text.split("\n"):
if line.strip() != "":
first_sentence = line.strip()
break
if first_sentence is None:
first_sentence = text
result = self.pipeline(first_sentence, self.labels, threshold=threshold)
return result
def select_agent(self, text: str) -> Agent: