summaryrefslogtreecommitdiffstats
path: root/src/config/mod.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2023-05-04 22:42:50 +0800
committerGitHub <noreply@github.com>2023-05-04 22:42:50 +0800
commit00ce1575715329a21726a506b13c0c2aef7f3f82 (patch)
tree766da2bf873b8f37936e1f5a385fc19d191bc193 /src/config/mod.rs
parentcf03952c7bd44a3ad94a675b846cdfafb2af1c75 (diff)
downloadaichat-00ce1575715329a21726a506b13c0c2aef7f3f82.tar.gz
feat: add `.copy` command (#119)
Diffstat (limited to 'src/config/mod.rs')
-rw-r--r--src/config/mod.rs17
1 files changed, 1 insertions, 16 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 021d2c1..900f129 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -10,7 +10,6 @@ use crate::config::message::num_tokens_from_messages;
use crate::utils::{mask_text, now};
use anyhow::{anyhow, bail, Context, Result};
-use copypasta::{ClipboardContext, ClipboardProvider};
use inquire::{Confirm, Text};
use parking_lot::RwLock;
use serde::Deserialize;
@@ -71,7 +70,7 @@ pub struct Config {
pub light_theme: bool,
/// Set a timeout in seconds for connect to gpt
pub connect_timeout: usize,
- /// Automatically copy the last message output to the clipboard
+ /// Automatically copy the last output to the clipboard
pub auto_copy: bool,
/// Predefined roles
#[serde(skip)]
@@ -173,20 +172,6 @@ impl Config {
Ok(path)
}
- pub fn copy_message(&self, output: &str) -> Result<()> {
- if self.auto_copy {
- match ClipboardContext::new() {
- Ok(mut ctx) => {
- ctx.set_contents(output.to_string()).map_err(|err| {
- anyhow!("Error: Unable to the last message output to clipboard, {err}")
- })?;
- }
- Err(_) => bail!("Error: Unable to access clipboard context."),
- }
- }
- Ok(())
- }
-
pub fn save_message(&self, input: &str, output: &str) -> Result<()> {
if !self.save {
return Ok(());