diff options
| author | sigoden <sigoden@gmail.com> | 2024-04-28 19:18:56 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-28 19:18:56 +0800 |
| commit | d9b8eabf23ae96fb395a8059c1e08840609499f4 (patch) | |
| tree | 73c69f56c5ecd718daacd9450bb25ec8db0649b1 /src | |
| parent | 4b205c4bac414f625001faa39fe36f9e118dfaa3 (diff) | |
| download | aichat-d9b8eabf23ae96fb395a8059c1e08840609499f4.tar.gz | |
feat: add `--prompt` option (#454)
Diffstat (limited to 'src')
| -rw-r--r-- | src/cli.rs | 3 | ||||
| -rw-r--r-- | src/main.rs | 4 | ||||
| -rw-r--r-- | src/repl/mod.rs | 2 |
3 files changed, 7 insertions, 2 deletions
@@ -6,6 +6,9 @@ pub struct Cli { /// Select a LLM model #[clap(short, long)] pub model: Option<String>, + /// Use the system prompt + #[clap(long)] + pub prompt: Option<String>, /// Select a role #[clap(short, long)] pub role: Option<String>, diff --git a/src/main.rs b/src/main.rs index f3d3846..f691b6f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -80,7 +80,9 @@ async fn main() -> Result<()> { if cli.dry_run { config.write().dry_run = true; } - if let Some(name) = &cli.role { + if let Some(prompt) = &cli.prompt { + config.write().set_prompt(prompt)?; + } else if let Some(name) = &cli.role { config.write().set_role(name)?; } else if cli.execute { config.write().set_role(SHELL_ROLE)?; diff --git a/src/repl/mod.rs b/src/repl/mod.rs index dd1c735..6306f0b 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -32,7 +32,7 @@ lazy_static! { ReplCommand::new(".model", "Change the current LLM", State::all()), ReplCommand::new( ".prompt", - "Make a temporary role using a prompt", + "Create a temporary role using a custom prompt", State::able_change_role() ), ReplCommand::new( |
