From 580b40e895f6b5d4b9ee350bfd0066cfe4ae5bcc Mon Sep 17 00:00:00 2001 From: sigoden Date: Sat, 30 Nov 2024 06:48:35 +0800 Subject: refactor: several improvements (#1020) - update models.yaml - update copy error message - update combined files style --- src/config/input.rs | 2 +- src/utils/clipboard.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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")) } -- cgit v1.2.3