Closed laholstege closed 2 months ago
A new useStreamableText
function has been added to the useStreamableText.ts
file to enhance the handling of streaming text content in React components. This function uses the internally defined useStreamingText
to manage streaming behavior and return content if it is already a string. This update includes an additional options
parameter to configure the streaming behavior.
File | Change Summary |
---|---|
src/lib/hooks/useStreamableText.ts |
Added useStreamableText function for handling streaming text with an options parameter. Introduced useStreamingText function. |
sequenceDiagram
participant ReactComponent
participant useStreamableText
participant useStreamingText
ReactComponent->>useStreamableText: Call with content and options
useStreamableText->>useStreamingText: Call with content and options
useStreamingText-->>useStreamableText: Return streamed or static content
useStreamableText-->>ReactComponent: Return final content
In rabbit burrows, code delights,
Streaming text through day and night.
With hooks that stream and options bright,
React components now take flight.
🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
there's some weird interplay between the states for the text stream, UI stream, react state, and the react lifecycle (esp with using an async IIFE inside
useEffect
), so sometimes thefinalContent
with formatted citations would be appended instead of replacing the content. i found that if we dotextStream.done()
instead oftextStream.done(finalContent)
sometimes it doesn't update with the formatted citations, but this seems to workSummary by CodeRabbit
useStreamableText
for handling streamed text content in React components. This function allows for advanced text streaming options, improving the user experience with dynamic content updates.