This commit is contained in:
Daniel Edrisian
2025-08-26 08:11:55 -07:00
parent ba05216461
commit 4d7bb516c6
4 changed files with 5 additions and 14 deletions

View File

@@ -44,7 +44,7 @@ pub fn discover_prompts_in_excluding(dir: &Path, exclude: &HashSet<String>) -> V
}
/// Discover prompt files in the default prompts directory, excluding any with names in `exclude`.
pub fn discover_prompts_excluding(exclude: &HashSet<String>) -> Vec<CustomPrompt> {
pub(crate) fn discover_prompts_excluding(exclude: &HashSet<String>) -> Vec<CustomPrompt> {
let dir = default_prompts_dir();
discover_prompts_in_excluding(&dir, exclude)
}

View File

@@ -1115,8 +1115,7 @@ impl ChatComposer {
}
}
pub(crate) fn set_custom_prompts(&mut self, mut prompts: Vec<CustomPrompt>) {
prompts.sort_by(|a, b| a.name.cmp(&b.name));
pub(crate) fn set_custom_prompts(&mut self, prompts: Vec<CustomPrompt>) {
self.custom_prompts = prompts.clone();
if let ActivePopup::Command(popup) = &mut self.active_popup {
popup.set_prompts(prompts);

View File

@@ -31,7 +31,6 @@ use codex_core::protocol::TokenUsage;
use codex_core::protocol::TurnAbortReason;
use codex_core::protocol::TurnDiffEvent;
use codex_core::protocol::WebSearchBeginEvent;
use codex_protocol::custom_prompts::CustomPrompt;
use codex_protocol::parse_command::ParsedCommand;
use crossterm::event::KeyCode;
use crossterm::event::KeyEvent;
@@ -116,8 +115,6 @@ pub(crate) struct ChatWidget {
last_history_was_exec: bool,
// User messages queued while a turn is in progress
queued_user_messages: VecDeque<UserMessage>,
// Cached custom prompts discovered via protocol event
custom_prompts: Vec<CustomPrompt>,
}
struct UserMessage {
@@ -606,7 +603,6 @@ impl ChatWidget {
last_history_was_exec: false,
queued_user_messages: VecDeque::new(),
show_welcome_banner: true,
custom_prompts: Vec::new(),
}
}
@@ -652,7 +648,6 @@ impl ChatWidget {
last_history_was_exec: false,
queued_user_messages: VecDeque::new(),
show_welcome_banner: false,
custom_prompts: Vec::new(),
}
}
@@ -1166,12 +1161,10 @@ impl ChatWidget {
}
fn on_list_custom_prompts(&mut self, ev: ListCustomPromptsResponseEvent) {
// Cache prompts locally; UI surfaces them from this store.
self.custom_prompts = ev.custom_prompts;
debug!("received {} custom prompts", self.custom_prompts.len());
let len = ev.custom_prompts.len();
debug!("received {} custom prompts", len);
// Forward to bottom pane so the slash popup can show them now.
self.bottom_pane
.set_custom_prompts(self.custom_prompts.clone());
self.bottom_pane.set_custom_prompts(ev.custom_prompts);
}
/// Programmatically submit a user text message as if typed in the

View File

@@ -185,7 +185,6 @@ fn make_chatwidget_manual() -> (
show_welcome_banner: true,
last_history_was_exec: false,
queued_user_messages: std::collections::VecDeque::new(),
custom_prompts: Vec::new(),
};
(widget, rx, op_rx)
}