summaryrefslogtreecommitdiffstats
path: root/src/repl/mod.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-03-02 22:02:29 +0800
committerGitHub <noreply@github.com>2024-03-02 22:02:29 +0800
commitb2f86f2899b79b291eb56435f99402509105b7ec (patch)
treeeaba5d76d05289c25f2f7e027c05c2fa3aec9928 /src/repl/mod.rs
parent3c16aff59145134885f32056fa3be9bd6bed2cce (diff)
downloadaichat-b2f86f2899b79b291eb56435f99402509105b7ec.tar.gz
refactor: auto_copy works when executing command (#328)
Diffstat (limited to 'src/repl/mod.rs')
-rw-r--r--src/repl/mod.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/repl/mod.rs b/src/repl/mod.rs
index 3edf5f6..118ff0c 100644
--- a/src/repl/mod.rs
+++ b/src/repl/mod.rs
@@ -273,9 +273,7 @@ impl Repl {
ensure_model_capabilities(client.as_mut(), input.required_capabilities())?;
let output = render_stream(&input, client.as_ref(), &self.config, self.abort.clone())?;
self.config.write().save_message(input, &output)?;
- if self.config.read().auto_copy {
- let _ = self.copy(&output);
- }
+ self.config.read().maybe_copy(&output);
Ok(())
}
@@ -352,7 +350,7 @@ Type ".help" for more information.
fn copy(&self, text: &str) -> Result<()> {
if text.is_empty() {
- bail!("No text")
+ bail!("Empty text")
}
set_text(text)?;
Ok(())