processors(rtvi): send initial empty metrics
This commit is contained in:
@@ -19,6 +19,7 @@ from pipecat.frames.frames import (
|
|||||||
LLMMessagesAppendFrame,
|
LLMMessagesAppendFrame,
|
||||||
LLMMessagesUpdateFrame,
|
LLMMessagesUpdateFrame,
|
||||||
LLMModelUpdateFrame,
|
LLMModelUpdateFrame,
|
||||||
|
MetricsFrame,
|
||||||
StartFrame,
|
StartFrame,
|
||||||
SystemFrame,
|
SystemFrame,
|
||||||
TTSSpeakFrame,
|
TTSSpeakFrame,
|
||||||
@@ -456,6 +457,13 @@ class RTVIProcessor(FrameProcessor):
|
|||||||
start_frame = dataclasses.replace(self._start_frame)
|
start_frame = dataclasses.replace(self._start_frame)
|
||||||
await self.push_frame(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()
|
message = RTVIBotReady()
|
||||||
frame = TransportMessageFrame(message=message.model_dump(exclude_none=True))
|
frame = TransportMessageFrame(message=message.model_dump(exclude_none=True))
|
||||||
await self.push_frame(frame)
|
await self.push_frame(frame)
|
||||||
|
|||||||
Reference in New Issue
Block a user