From bc44026ff8828f532e9eba138e2ba35f7c247271 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sat, 28 Oct 2023 21:39:17 +0800 Subject: feat: enhance session/conversation (#162) * feat: enhance session/conversation * updates * updates * cut version v0.9.0-rc2 * add .session name completion --- src/repl/mod.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/repl/mod.rs') diff --git a/src/repl/mod.rs b/src/repl/mod.rs index f498ab4..797519b 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -26,10 +26,10 @@ pub const REPL_COMMANDS: [(&str, &str); 15] = [ (".prompt", "Add a GPT prompt"), (".role", "Select a role"), (".clear role", "Clear the currently selected role"), - (".conversation", "Start a conversation."), - (".clear conversation", "End current conversation."), + (".session", "Start a session"), + (".clear session", "End current session"), (".copy", "Copy the last output to the clipboard"), - (".read", "Read the contents of a file into the prompt"), + (".read", "Read the contents of a file and submit"), (".edit", "Multi-line editing (CTRL+S to finish)"), (".history", "Print the history"), (".clear history", "Clear the history"), @@ -89,6 +89,7 @@ impl Repl { _ => {} } } + handler.handle(ReplCmd::EndSession)?; Ok(()) } @@ -111,7 +112,7 @@ impl Repl { print_now!("\n"); } Some("role") => handler.handle(ReplCmd::ClearRole)?, - Some("conversation") => handler.handle(ReplCmd::EndConversatoin)?, + Some("session") => handler.handle(ReplCmd::EndSession)?, _ => dump_unknown_command(), }, ".history" => { @@ -141,8 +142,8 @@ impl Repl { handler.handle(ReplCmd::Prompt(text))?; } } - ".conversation" => { - handler.handle(ReplCmd::StartConversation)?; + ".session" => { + handler.handle(ReplCmd::StartSession(args.map(|v| v.to_string())))?; } ".copy" => { handler.handle(ReplCmd::Copy)?; -- cgit v1.2.3