Skip to content

feat(tencent):add tencent cloud asr and tts#6316

Open
LiJunbo66 wants to merge 1 commit into
livekit:mainfrom
LiJunbo66:main
Open

feat(tencent):add tencent cloud asr and tts#6316
LiJunbo66 wants to merge 1 commit into
livekit:mainfrom
LiJunbo66:main

Conversation

@LiJunbo66

Copy link
Copy Markdown

add tencent cloud asr and tts

@LiJunbo66 LiJunbo66 requested a review from a team as a code owner July 4, 2026 11:15
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


JunboLi seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

Comment on lines +303 to +331
def push_text(self, token: str) -> None:
if not token or self._input_ch.closed:
return

self._pushed_text += token

if self._metrics_task is None:
self._metrics_task = asyncio.create_task(
self._metrics_monitor_task(self._monitor_aiter), name="TTS._metrics_task"
)

if not self._mtc_text:
self._num_segments += 1

self._mtc_text += token
self._input_ch.send_nowait(token)
self._input_buffer.append(token)

def flush(self) -> None:
if self._input_ch.closed:
return

if self._mtc_text:
self._mtc_pending_texts.append(self._mtc_text)
self._mtc_text = ""

sentinel = self._FlushSentinel()
self._input_ch.send_nowait(sentinel)
self._input_buffer.append(sentinel)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 TTS SynthesizeStream overrides push_text/flush to support multi-segment usage

The Tencent SynthesizeStream overrides both push_text (tts.py:303-319) and flush (tts.py:321-331) from the base class at livekit-agents/livekit/agents/tts/tts.py:635-673. The key difference is that the base class's push_text has a guard at livekit-agents/livekit/agents/tts/tts.py:648-654 that logs a deprecation warning and drops tokens when _num_segments >= 1 (i.e., a second segment is starting). The Tencent override removes this guard, unconditionally incrementing _num_segments for each new segment. This is intentional because the Tencent _run method (tts.py:333-370) explicitly handles multiple segments by creating a new WebSocket connection per flush via _synthesize_once, and the base class's _main_task validates that _num_segments == output_emitter.num_segments at livekit-agents/livekit/agents/tts/tts.py:500. The counts will match because each _flush_segment calls start_segment/end_segment. However, this pattern of overriding public API methods to bypass deprecation guards is unusual among the existing plugins β€” most other plugins don't override push_text/flush at all.

Open in Devin Review

Was this helpful? React with πŸ‘ or πŸ‘Ž to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants