mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Preserve split-flap animation state when voice transcripts scroll (#43699)
## Why Trimming the live voice transcript to its 1,024-byte window could restart animations for retained words or skip animations for new text that repeats existing text. ## What changed Track discarded prefix bytes and render the retained text to identify which tiles survive. Preserve their arrival times and animation phase so only new tiles begin animating. Start fresh when the speaker changes or the retained text no longer matches. ## Testing Add regression coverage for repeated text, retained-word visibility, Unicode and Markdown rendering, reduced motion, and replaced or changed-speaker windows. GitOrigin-RevId: dd33f76441baa4d7787d0a9a1e72b281476acb4c
This commit is contained in:
1 parent
49a9d78999
commit
6b6fdc3572
3 files changed
+193
-15
No files matched your search
@@ -1233,6 +1233,7 @@ impl ChatWidget {
|
||||
self.realtime_conversation.transcript_role = Some(role);
|
||||
}
|
||||
self.realtime_conversation.transcript.push_str(&delta);
|
||||
let mut discarded_prefix_bytes = 0;
|
||||
if self.realtime_conversation.transcript.len() > MAX_TRANSCRIPT_BYTES {
|
||||
let mut start = self.realtime_conversation.transcript.len() - MAX_TRANSCRIPT_BYTES;
|
||||
while !self
|
||||
@@ -1243,6 +1244,7 @@ impl ChatWidget {
|
||||
start += 1;
|
||||
}
|
||||
self.realtime_conversation.transcript.drain(..start);
|
||||
discarded_prefix_bytes = start;
|
||||
}
|
||||
let role = self
|
||||
.realtime_conversation
|
||||
@@ -1254,13 +1256,12 @@ impl ChatWidget {
|
||||
.live_transcript_cell
|
||||
.as_deref()
|
||||
.and_then(|cell| cell.as_any().downcast_ref::<SplitFlapTranscriptCell>());
|
||||
let cell =
|
||||
self.realtime_transcript_history_cell(role, &self.realtime_conversation.transcript);
|
||||
let live_cell = SplitFlapTranscriptCell::new(
|
||||
cell,
|
||||
|text| self.realtime_transcript_history_cell(role, text),
|
||||
role,
|
||||
&self.realtime_conversation.transcript,
|
||||
previous,
|
||||
discarded_prefix_bytes,
|
||||
MotionMode::from_animations_enabled(self.config.animations),
|
||||
self.frame_requester.clone(),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user