mirror of
https://github.com/openai/codex.git
synced 2026-11-26 07:26:11 +00:00
Suggest conversation-based thread titles in /rename (#40495)
## What changed - Generate a title suggestion from the latest substantive user and assistant messages when the TUI `/rename` prompt opens. - Prefill the prompt with the result while keeping it editable and preserving any text the user enters before generation finishes. - Bound and escape the conversation context, omit commentary and IDE context, and correlate responses with the active thread and prompt so stale suggestions are ignored. ## Testing - Cover conversation selection and prompt construction, generated-title delivery through the embedded app server, loading and prefilled prompt states, stale responses, and preservation of manual edits. GitOrigin-RevId: 1e7f1d5d4f6503ff9da0548388f610c446c130ca
This commit is contained in:
1 parent
0c992c305d
commit
5a51caf04d
13 files changed
+877
-2
No files matched your search
@@ -417,7 +417,10 @@ impl ChatWidget {
|
||||
} else {
|
||||
"Name thread"
|
||||
};
|
||||
let view = CustomPromptView::new(
|
||||
let suggestion_request = self
|
||||
.thread_id
|
||||
.map(|thread_id| (thread_id, uuid::Uuid::new_v4()));
|
||||
let mut view = CustomPromptView::new(
|
||||
title.to_string(),
|
||||
"Type a name and press Enter".to_string(),
|
||||
/*initial_text*/ existing_name.unwrap_or_default().to_string(),
|
||||
@@ -432,7 +435,32 @@ impl ChatWidget {
|
||||
tx.set_thread_name(name);
|
||||
}),
|
||||
);
|
||||
if let Some((_, request_id)) = suggestion_request {
|
||||
view = view.with_text_suggestion(
|
||||
request_id,
|
||||
"Generating a title suggestion…".to_string(),
|
||||
"Suggested from this conversation".to_string(),
|
||||
);
|
||||
}
|
||||
self.bottom_pane.show_text_prompt(view);
|
||||
if let Some((thread_id, request_id)) = suggestion_request {
|
||||
self.app_event_tx.send(AppEvent::SuggestThreadName {
|
||||
thread_id,
|
||||
request_id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn apply_thread_name_suggestion(
|
||||
&mut self,
|
||||
thread_id: ThreadId,
|
||||
request_id: uuid::Uuid,
|
||||
suggestion: Option<&str>,
|
||||
) {
|
||||
if self.thread_id == Some(thread_id) {
|
||||
self.bottom_pane
|
||||
.apply_text_suggestion(request_id, suggestion);
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn ensure_thread_rename_allowed(&mut self) -> bool {
|
||||
|
||||
Reference in new issue
Block a user