summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-07-11 20:59:27 +0800
committerGitHub <noreply@github.com>2024-07-11 20:59:27 +0800
commit6c73643750bc85a3a19f61100852c668648b88e6 (patch)
treed3327e9137fdaafc8ecca03bbce7afba0344848b /src
parent8e5c17b5543e0e79b1b74d9723f808861f70c162 (diff)
downloadaichat-6c73643750bc85a3a19f61100852c668648b88e6.tar.gz
refactor: template of including files (#704)
Diffstat (limited to 'src')
-rw-r--r--src/config/input.rs13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/config/input.rs b/src/config/input.rs
index 1fce6d0..c6d0c62 100644
--- a/src/config/input.rs
+++ b/src/config/input.rs
@@ -72,13 +72,8 @@ impl Input {
if files_len > 0 {
texts.push(String::new());
}
- let is_multi_files = files_len > 1;
for (path, contents) in files {
- if is_multi_files {
- texts.push(format!("`{path}`:\n\n{contents}\n\n"));
- } else {
- texts.push(contents);
- }
+ texts.push(format!("`{path}`:\n\n{contents}\n\n"));
}
let (role, with_session, with_agent) = resolve_role(&config.read(), role);
Ok(Self {
@@ -409,11 +404,11 @@ fn resolve_local_path(path: &str) -> Option<String> {
return None;
}
let new_path = if let (Some(file), Some(home)) = (path.strip_prefix("~/"), dirs::home_dir()) {
- home.join(file)
+ home.join(file).display().to_string()
} else {
- std::env::current_dir().ok()?.join(path)
+ path.to_string()
};
- Some(new_path.display().to_string())
+ Some(new_path)
}
fn is_image(path: &str) -> bool {