mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2026-02-05 02:16:46 +00:00
server/rtc: fix topic output
This commit is contained in:
@@ -21,9 +21,10 @@ class TranscriptTopicDetectorProcessor(Processor):
|
||||
{input_text}
|
||||
|
||||
### Assistant:
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, min_transcript_length=25, **kwargs):
|
||||
def __init__(self, min_transcript_length=100, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.transcript = None
|
||||
self.min_transcript_length = min_transcript_length
|
||||
@@ -43,6 +44,12 @@ class TranscriptTopicDetectorProcessor(Processor):
|
||||
return
|
||||
prompt = self.PROMPT.format(input_text=self.transcript.text)
|
||||
result = await self.llm.generate(prompt=prompt)
|
||||
summary = TitleSummary(title=result["title"], summary=result["summary"])
|
||||
summary = TitleSummary(
|
||||
title=result["title"],
|
||||
summary=result["summary"],
|
||||
timestamp=self.transcript.timestamp,
|
||||
duration=self.transcript.duration,
|
||||
transcript=self.transcript,
|
||||
)
|
||||
self.transcript = None
|
||||
await self.emit(summary)
|
||||
|
||||
@@ -21,12 +21,6 @@ class Word:
|
||||
end: float
|
||||
|
||||
|
||||
@dataclass
|
||||
class TitleSummary:
|
||||
title: str
|
||||
summary: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class Transcript:
|
||||
text: str = ""
|
||||
@@ -63,3 +57,12 @@ class Transcript:
|
||||
Word(text=word.text, start=word.start, end=word.end) for word in self.words
|
||||
]
|
||||
return Transcript(text=self.text, words=words)
|
||||
|
||||
|
||||
@dataclass
|
||||
class TitleSummary:
|
||||
title: str
|
||||
summary: str
|
||||
timestamp: float
|
||||
duration: float
|
||||
transcript: Transcript
|
||||
|
||||
Reference in New Issue
Block a user