From 822f0eed9429f71524e739352da3f76d604071d5 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sun, 5 Mar 2023 06:17:43 +0800 Subject: refactor: message record format (#12) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` i am excited -------- 😃💥🎉 -------- ``` --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 9cb360d..55c09a6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -56,7 +56,9 @@ fn start_directive( input: &str, ) -> Result<()> { let mut file = config.open_message_file()?; - let output = client.acquire(input, role.map(|v| v.prompt))?; + let prompt = role.as_ref().map(|v| v.prompt.to_string()); + let role_name = role.as_ref().map(|v| v.name.to_string()); + let output = client.acquire(input, prompt)?; let output = output.trim(); if !config.no_highlight && stdout().is_terminal() { let markdown_render = MarkdownRender::init()?; @@ -65,7 +67,7 @@ fn start_directive( println!("{output}"); } - Config::save_message(file.as_mut(), input, output); + Config::save_message(file.as_mut(), input, output, &role_name); Ok(()) } -- cgit v1.2.3