Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Conversation

@keegangeorge
Copy link
Member

@keegangeorge keegangeorge commented Mar 26, 2025

🔍 Overview

This takes the logic used in summarization/discoveries for streaming and consolidates it into a single helper lib for smooth streaming. It introduces a new lib: SmoothStreamer that can be used by components for smooth streaming text from message bus updates. Additionally, the PR makes use of that new lib in the AI post menu helper.

With this PR the SmoothStreamer will now be used in all component based implementations of streaming to the client:

  • AI helper
  • Summarization
  • Discobot discoveries

➕ Usage

To make use of the new SmoothStreamer class, add it to your component like so:

import SmoothStreamer from "../lib/smooth-streamer";

@tracked
smoothStreamer = new SmoothStreamer(
  () => this.result,
  (newValue) => (this.result = newValue)
);

The constructor for the streamer expects a getter/setter for the tracked property you use in your component for showcasing the result. You can then call the smooth streamer in your MessageBus update function like so:

  @bind
  subscribe() {
    const channel = `/foo`;
    this.messageBus.subscribe(channel, this._updateResult);
  }

  @bind
  async _updateResult(result) {
    await this.smoothStreamer.updateResult(result, "result");
    // your additional custom logic
  }

📹 Screen captures

Screen.Recording.2025-03-26.at.16.31.07.mov

@keegangeorge keegangeorge marked this pull request as ready for review March 27, 2025 01:14
@keegangeorge keegangeorge merged commit 6827d63 into main Mar 27, 2025
6 checks passed
@keegangeorge keegangeorge deleted the streaming-animation branch March 27, 2025 15:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants