diff options
| author | sigoden <sigoden@gmail.com> | 2023-03-05 06:17:43 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-05 06:17:43 +0800 |
| commit | 822f0eed9429f71524e739352da3f76d604071d5 (patch) | |
| tree | 30787848b82dba796b0a7fc54069f72012c268d9 /src/main.rs | |
| parent | 7a60a3636780974dd4dfc7e73e4df0d5ab2f7f93 (diff) | |
| download | aichat-822f0eed9429f71524e739352da3f76d604071d5.tar.gz | |
refactor: message record format (#12)
```
i am excited
--------
😃💥🎉
--------
```
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 6 |
1 files changed, 4 insertions, 2 deletions
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(()) } |
