text_thread: Improve roles after assistant::Split (shift-enter) (#33215)

Default to `You` when triggering `assistant::Split` at the end of a thread

Release Notes:

- agent_thread: Improved roles when triggering `assistant::Split`
(`shift-enter`)
This commit is contained in:
Peter Tripp 2025-06-25 13:26:24 -04:00 committed by GitHub
parent cc62125244
commit 2a5a1814cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2523,6 +2523,12 @@ impl AssistantContext {
}
let message = start_message;
let at_end = range.end >= message.offset_range.end.saturating_sub(1);
let role_after = if range.start == range.end || at_end {
Role::User
} else {
message.role
};
let role = message.role;
let mut edited_buffer = false;
@ -2557,7 +2563,7 @@ impl AssistantContext {
};
let suffix_metadata = MessageMetadata {
role,
role: role_after,
status: MessageStatus::Done,
timestamp: suffix.id.0,
cache: None,