Fix metrics calculations
This commit is contained in:
@@ -156,7 +156,6 @@ class FishAudioTTSService(TTSService):
|
|||||||
if isinstance(msg, dict):
|
if isinstance(msg, dict):
|
||||||
event = msg.get("event")
|
event = msg.get("event")
|
||||||
if event == "audio":
|
if event == "audio":
|
||||||
await self.stop_ttfb_metrics()
|
|
||||||
audio_data = msg.get("audio")
|
audio_data = msg.get("audio")
|
||||||
# Only process larger chunks to remove msgpack overhead
|
# Only process larger chunks to remove msgpack overhead
|
||||||
if audio_data and len(audio_data) > 1024:
|
if audio_data and len(audio_data) > 1024:
|
||||||
@@ -164,6 +163,7 @@ class FishAudioTTSService(TTSService):
|
|||||||
audio_data, self._settings["sample_rate"], 1
|
audio_data, self._settings["sample_rate"], 1
|
||||||
)
|
)
|
||||||
await self.push_frame(frame)
|
await self.push_frame(frame)
|
||||||
|
await self.stop_ttfb_metrics()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -216,6 +216,7 @@ class FishAudioTTSService(TTSService):
|
|||||||
|
|
||||||
if not self._request_id:
|
if not self._request_id:
|
||||||
await self.start_ttfb_metrics()
|
await self.start_ttfb_metrics()
|
||||||
|
await self.start_tts_usage_metrics(text)
|
||||||
yield TTSStartedFrame()
|
yield TTSStartedFrame()
|
||||||
self._request_id = str(uuid.uuid4())
|
self._request_id = str(uuid.uuid4())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user