Skip to content

Commit

Permalink
processors(rtvi): send initial empty metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
aconchillo committed Jul 23, 2024
1 parent f41c2b3 commit 05d4fba
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pipecat/processors/frameworks/rtvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
LLMMessagesAppendFrame,
LLMMessagesUpdateFrame,
LLMModelUpdateFrame,
MetricsFrame,
StartFrame,
SystemFrame,
TTSSpeakFrame,
Expand Down Expand Up @@ -456,6 +457,13 @@ async def _handle_setup(self, setup: RTVISetup | None):
start_frame = dataclasses.replace(self._start_frame)
await self.push_frame(start_frame)

# Send new initial metrics with the new processors
processors = parent.processors_with_metrics()
processors.extend(self._pipeline.processors_with_metrics())
ttfb = [{"name": p.name, "time": 0.0} for p in processors]
processing = [{"name": p.name, "time": 0.0} for p in processors]
await self.push_frame(MetricsFrame(ttfb=ttfb, processing=processing))

message = RTVIBotReady()
frame = TransportMessageFrame(message=message.model_dump(exclude_none=True))
await self.push_frame(frame)
Expand Down

0 comments on commit 05d4fba

Please sign in to comment.