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 May 9, 2025

🔍 Overview

This update improves the animation for streaming a diff of changes when AI helper proofread is triggered. It shows the original text with diff changes live instead of after the fact.

📹 Screen Recording

← Before

Screen.Recording.2025-05-09.at.14.06.40.mov

→ After

Diff types:

dimmed.mov

Regular types:

non-diff-after.mov

@keegangeorge keegangeorge marked this pull request as ready for review May 12, 2025 20:18
@keegangeorge keegangeorge changed the title FEATURE: Improved diff streaming for AI composer helper proofread FEATURE: Improved diff streaming for AI composer helper May 12, 2025
@keegangeorge keegangeorge merged commit acd1986 into main May 12, 2025
6 checks passed
@keegangeorge keegangeorge deleted the better-diff-streaming branch May 12, 2025 22:58
keegangeorge added a commit that referenced this pull request May 15, 2025
The diff animation introduced in #1332 and with attempts to improve it in #1338 still has various issues. As we work on a fix, we want to revert the animation to simply stream the diff without animation so users are not left with a janky unusable experience.
SamSaffron added a commit that referenced this pull request May 21, 2025
Previously we attempted to add a diff streaming animation to the AI composer helper: #1332, but it resulted in issues despite attempted fixes (#1338) so we temporarily suppressed the diff animation (#1341).

This update makes a second attempt at implementing the diff streaming animation. Instead of creating a custom diff algorithm, we make use of a third-party library [`jsDiff`](https://github.com/kpdecker/jsdiff) (which we added to core here: discourse/discourse#32833). While streaming, the diff animation often struggles with markdown links and images, so we make use of `markdown-it` parser to detect those cases and prevent breaking the animation.

---------

Co-authored-by: Sam Saffron <[email protected]>
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