Repository navigation
fix(ai-components): replace SpokenMessageText with a standalone useHeardText hook - #3344
Conversation
β¦useHeardText hook ai-components must work without the core SDK, and SpokenMessageText rendered through the core Message components. Remove SpokenMessageText, SpokenTextProvider, SpokenTextContext and useSpokenTextContext, and keep only useHeardText, which now depends on React alone: it takes the text, a heard(now) progress function (Unicode code points) and an optional subscribe, generating and live, and returns the heard text, whether it is paced, and skip(). A drop-in for the StreamedMessageText slot is a recipe in the docs.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the βοΈ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Size Change: -4.39 kB (-0.37%) Total Size: 1.18 MB π¦ View Changed
βΉοΈ View Unchanged
|
Codecov Reportβ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release-v14 #3344 +/- ##
===============================================
- Coverage 86.84% 86.47% -0.38%
===============================================
Files 526 541 +15
Lines 16699 17590 +891
Branches 5251 5421 +170
===============================================
+ Hits 14503 15211 +708
- Misses 2196 2379 +183 β View full report in Codecov by Harness. π New features to boost your workflow:
|
## [14.14.1](v14.14.0...v14.14.1) (2026-10-22) ### Bug Fixes * **ai-components:** replace SpokenMessageText with a standalone useHeardText hook ([#3344](#3344)) ([ad16506](ad16506)), closes [#3343](#3343) [GetStream/getstream.io#761](https://github.com/GetStream/getstream.io/issues/761) [#3343](#3343) [#3339](#3339)
|
π This PR is included in version 14.14.1 π The release is available on: Your semantic-release bot π¦π |
π― Goal
stream-chat-react/ai-componentsmust work standalone, without the core SDK.SpokenMessageText(added in #3343) rendered through the coreMessagecomponents (MessageText, theStreamedMessageTextfallback, and the message and channel contexts), so it doesn't belong in the plugin. This keeps only the utility hook. The drop-in component becomes a recipe in the docs (GetStream/getstream.io#761).This is the last commit of #3343 (
57e84ca2e), which was pushed just before the PR was merged and didn't make it in.π Implementation details
SpokenMessageText,SpokenTextProvider,SpokenTextContext,useSpokenTextContext, their types and their tests.useHeardTextnow lives insrc/plugins/AIComponents/hooks/useHeardText.ts. Its only import isreact; I checked this in the source, the built ESM and the CJS bundle.useHeardText({ text, heard, subscribe?, generating?, live? }) => { heardText, isPaced, skip }.heard(now)returns{ chars, done } | undefined, wherecharscounts Unicode code points.heardandsubscribeare read through refs, so new function identities on each render don't restart pacing.HeardTextProgress,HeardTextFunction,HeardTextSubscribe,UseHeardTextParams,UseHeardTextResult.floor(chars)code points and never goes backwards; surrogate pairs are never split.requestAnimationFrameonly while paced and not done.done && !generating, whenliveis false, or afterskip().renderHooktests. Full suite 3175/3175 passes, as doyarn types,yarn lint,yarn buildandvalidate-cjs/validate-esm/validate-entry-isolation. In the built output,ai-componentsexportsuseHeardTextand nothingSpoken*, and the main entry exports neither.SpokenMessageTextrecipe on this hook: each voice reply is revealed as its audio plays.π¨ UI Changes
None.