feat: Support extending the system prompt (#1167)

This commit is contained in:
Bradley Axen
2025-02-11 20:03:32 -08:00
committed by GitHub
parent a5e2419380
commit 6220ef054f
8 changed files with 88 additions and 1 deletions
+16
View File
@@ -0,0 +1,16 @@
/// Returns a system prompt extension that explains CLI-specific functionality
pub fn get_cli_prompt() -> String {
String::from(
"You are being accessed through a command-line interface. The following slash commands are available
- you can let the user know about them if they need help:
- /exit or /quit - Exit the session
- /t - Toggle between Light/Dark/Ansi themes
- /? or /help - Display help message
Additional keyboard shortcuts:
- Ctrl+C - Interrupt the current interaction (resets to before the interrupted request)
- Ctrl+J - Add a newline
- Up/Down arrows - Navigate command history"
)
}
+5
View File
@@ -161,6 +161,11 @@ pub async fn build_session(
let prompt = Box::new(RustylinePrompt::new());
// Add CLI-specific system prompt extension
agent
.extend_system_prompt(crate::cli_prompt::get_cli_prompt())
.await;
display_session_info(resume, &provider_name, &model, &session_file);
Session::new(agent, prompt, session_file)
}
+1
View File
@@ -9,6 +9,7 @@ pub static APP_STRATEGY: Lazy<AppStrategyArgs> = Lazy::new(|| AppStrategyArgs {
app_name: "goose".to_string(),
});
mod cli_prompt;
mod commands;
mod log_usage;
mod logging;