Skip to content

Add a word-by-word typewriter reveal for finished AI answers - #36

Merged
maun200 merged 1 commit into
mainfrom
feature/typewriter-reveal
Nov 12, 2026
Merged

maun200 merged 1 commit into
mainfrom
feature/typewriter-reveal

Conversation

@maun200

@maun200 maun200 commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Finished AI answers in the desktop app's chat now reveal word by word (short typing animation) instead of popping in all at once.
  • Respects prefers-reduced-motion (renders instantly if set).
  • Presentation-only: the worker still generates and returns the whole answer in one piece. This is not real token streaming — the reveal starts only once the full answer has already arrived, so it doesn't reduce perceived latency the way true streaming would, just makes the arrival feel more natural.

Test plan

  • pytest -q (247 passed, 3 skipped — no backend touched)
  • ruff check --select E9,F63,F7,F82 .
  • node --check on the extracted script block
  • Standalone simulation of the chunk/delay math across empty, short, normal-sentence and long answers — total reveal time stays bounded (~0.9-1s) regardless of length
  • Manual click-through in a real browser not done in this session (no GUI here)

🤖 Generated with Claude Code

A completed answer appeared all at once, which felt abrupt. Reveal it
client-side word by word once it has fully arrived (bounded total reveal
time so long answers don't drag), honoring prefers-reduced-motion. This is
a presentation-only change: the worker still generates and returns the
whole answer in one piece, there is no token streaming from the backend.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T22:37:26.736709Z 10fed59 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@maun200
maun200 merged commit a1bcb8c into main Nov 12, 2026
14 checks passed
@maun200
maun200 deleted the feature/typewriter-reveal branch November 12, 2026 22:37

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 10fed59d91

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

let reduced=false;try{reduced=matchMedia("(prefers-reduced-motion: reduce)").matches}catch(e){}
if(reduced){container.replaceChildren(md(fullText));return}
const chunks=fullText.split(/(\s+)/).filter(Boolean);const delay=Math.max(8,Math.min(40,900/Math.max(chunks.length,1)));
let shown="";for(const c of chunks){shown+=c;container.replaceChildren(md(shown));scrollLog();await sleep(delay)}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Prevent a background reveal from scrolling the selected channel

If an answer finishes and the user switches to another channel while this reveal is running, each remaining iteration calls scrollLog() on the global log, repeatedly jumping the newly selected channel to the bottom and preventing the user from scrolling it until the reveal ends. Long answers can take several seconds at the minimum 8 ms per word/space chunk; stop or guard the reveal when its view is no longer active.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant