feat: add streaming display optimization option#1422
Conversation
7f95ef4 to
babc132
Compare
babc132 to
c98f707
Compare
|
There seem to be too many effect hooks for a performance update. Although we can expect better performance when this option is enabled when the update rate is high, the PR adds a lot of hooks that run when the variable is updated even when the option is disabled, which can worsen performance when the option is disabled, or even if the update rate is not high enough with option enabled |
Thanks, I think this concern is valid. I’ll refactor this so the optimization state is computed once at the parent/current-chat level, and only the active streaming assistant message receives the optimized rendering props. When the mode is |
32217c5 to
d461339
Compare
PR Checklist
Summary
Adds an experimental, opt-in Streaming Display Optimization setting for streamed assistant responses. The default
offmode keeps the normal rendering path close to the existing behavior, whilebalancedandstrongreduce UI churn during long streamed responses.Changes
streamingDisplayOptimizationModesetting withoff,balanced, andstrongoptions in Advanced Settings.balancedandstrongmodes with a timer plusrequestAnimationFrame, while flushing pending output on completion or abort.ChatBodyfor repeated rendering of long messages.Additional Notes
pnpm checkreports 0 errors(in this changes).Footnotes
Modifies the behavior of prompting, requesting, or handling responses from AI models. ↩
Over 80% of the code is AI generated. ↩