summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-11-30 06:48:35 +0800
committerGitHub <noreply@github.com>2024-11-30 06:48:35 +0800
commit580b40e895f6b5d4b9ee350bfd0066cfe4ae5bcc (patch)
treed88dd7bd89004901ca3186207b78de81beac6b17 /src
parentc06ecffb4c43a83484b77882c9880878be11c71f (diff)
downloadaichat-580b40e895f6b5d4b9ee350bfd0066cfe4ae5bcc.tar.gz
refactor: several improvements (#1020)
- update models.yaml - update copy error message - update combined files style
Diffstat (limited to 'src')
-rw-r--r--src/config/input.rs2
-rw-r--r--src/utils/clipboard.rs4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/config/input.rs b/src/config/input.rs
index c527cfb..d72743a 100644
--- a/src/config/input.rs
+++ b/src/config/input.rs
@@ -90,7 +90,7 @@ impl Input {
texts.push(String::new());
}
for (path, contents) in files {
- texts.push(format!("`{path}`:\n\n{contents}\n"));
+ texts.push(format!("====== PATH: {path} ======\n{contents}\n"));
}
let (role, with_session, with_agent) = resolve_role(&config.read(), role);
Ok(Self {
diff --git a/src/utils/clipboard.rs b/src/utils/clipboard.rs
index c4444e3..23bb4f3 100644
--- a/src/utils/clipboard.rs
+++ b/src/utils/clipboard.rs
@@ -13,12 +13,12 @@ pub fn set_text(text: &str) -> anyhow::Result<()> {
#[cfg(target_os = "linux")]
std::thread::sleep(std::time::Duration::from_millis(50));
}
- None => anyhow::bail!("Failed to copy the text; no available clipboard"),
+ None => return Err(anyhow::anyhow!("No clipboard available").context("Failed to copy")),
}
Ok(())
}
#[cfg(any(target_os = "android", target_os = "emscripten"))]
pub fn set_text(_text: &str) -> anyhow::Result<()> {
- anyhow::bail!("Failed to copy the text; no available clipboard")
+ Err(anyhow::anyhow!("No clipboard available").context("Failed to copy"))
}