voice: strip markdown emphasis in CJK text - #2175
Open
rosetta-livekit-bot[bot] wants to merge 3 commits into
Open
voice: strip markdown emphasis in CJK text#2175rosetta-livekit-bot[bot] wants to merge 3 commits into
rosetta-livekit-bot[bot] wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: 82a851f The changes in this PR will be included in the next version bump. This PR includes changesets to release 39 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
unbalanced() built two RegExp objects per call on the streaming path and pushed escaping onto callers, which passed a pre-escaped '\\*'. The delimiters are literals, so splitting on them counts the same and keeps the call sites plain.
Mirrors the source PR's shape (livekit/agents#6560), which collapsed the two per-delimiter blocks into one condition.
This was referenced Jul 30, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Ports livekit/agents#6560 to the Node.js voice text transform.
Source diff coverage
Source diff coverage
livekit-agents/livekit/agents/voice/transcription/filters.py->agents/src/voice/transcription/text_transforms.ts. Ported all emphasis, horizontal-rule, incomplete-pattern, streaming, and fast-path behavior. Python's Unicode-aware\wboundaries are represented with JavaScript Unicode property escapes because JavaScript\wis ASCII-only.tests/test_transcription_filter.py->agents/src/voice/transcription/text_transforms.test.ts. Ported every emphasis, preservation, horizontal-rule, and chunk-independence case added or modified by the source PR into the target's Vitest table style; retained unrelated target-only transform tests.Validation
pnpm test agents(1,836 passed, 5 skipped)pnpm build(40 packages)pnpm lint(passes with pre-existing warnings)pnpm format:checkcue-clivoice dispatch: raw assistant text这是**很重要**的文本。; TTS usage reported 9 characters, matching transformed这是很重要的文本。Source: livekit/agents#6560
Ported from livekit/agents#6560
Original PR description
这是**很重要**的文本,テスト**強調**ですand한국어**강조**입니다all previously reached TTS with the asterisks spoken aloud. Underscores keep the full word boundary, sosnake_caseand__dunder__stay intact.***bold italic***, collapsing the three delimiter widths into one pattern.---/***/___), which carry no spoken content. Following CommonMark, the markers may be spaced apart (* * *) and a fourth column of indent makes the line code rather than a rule. Rules are stripped before the line patterns, which would otherwise read a spaced rule's first marker as a list item.a _ b _ cis left alone.