You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good overall structure — the change follows the established pattern from cosy_tts_python and the three version bumps are correct.
Bug: rime_tts counts empty/whitespace text in character metrics
In rime_tts/extension.py, the new call is placed without an empty-text guard:
self.sent_tts=True# Track character metrics <- added hereself.metrics_add_output_characters(len(t.text))
awaitself.client.send_text(t)
Unlike the other two extensions, rime_tts.request_tts does not filter empty text before this point. The t.text.strip() == "" check later in the method is a downstream edge-case for a different code path and does not protect the metrics call.
Compare with:
google_tts_python: call is inside if t.text.strip() != "": (correct)
qwen3_tts_python: call is after if not t.text or not t.text.strip(): ... return (correct)
qwen3_tts_python and rime_tts both pass self.current_request_id directly. In qwen3_tts this is safe due to the early if self.current_request_id is None: return guard in _complete_request, but in _handle_tts_audio_end (rime_tts) the guard is only if self.request_start_ts is not None:, which does not formally guarantee current_request_id is non-None. If the base-class send_usage_metrics does not accept None, this could surface as a runtime error on unusual teardown paths.
Suggestion: use self.current_request_id or "" in both places for consistency with google_tts_python.
Missing test coverage for the new metrics
The existing test_metrics.py files in both google_tts_python and rime_tts only exercise TTFB. The new functionality — metrics_add_output_characters and send_usage_metrics (usage metrics emission at end-of-request) — is untested. qwen3_tts_python has no test directory at all.
Consider adding:
An assertion that output_characters accumulates correctly across multiple text chunks per request.
An assertion that a usage metric is emitted exactly once per completed request (and not for empty-text skips).
A basic test suite for qwen3_tts_python mirroring the cosy/rime pattern.
Everything else looks good
Placement of metrics_add_recv_audio_chunks (immediately after accumulating bytes, before sending audio data) is consistent with the reference cosy_tts_python pattern in all three extensions.
send_usage_metrics is correctly placed beforefinish_request in all three completion paths.
Character metrics are correctly scoped to the non-empty text path in google_tts_python and qwen3_tts_python.
All three manifest.json version bumps are appropriate for the behaviour change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.