Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions llmfit-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sysinfo = "0.38"
ureq = { version = "3.2", features = ["json"] }
which = "8.0.2"
17 changes: 3 additions & 14 deletions llmfit-core/src/providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use std::collections::HashSet;
use std::path::PathBuf;
use which::which;

// ---------------------------------------------------------------------------
// Provider trait
Expand Down Expand Up @@ -916,21 +917,9 @@ fn llamacpp_models_dir() -> PathBuf {

/// Find a binary in PATH using `which`.
fn find_binary(name: &str) -> Option<String> {
std::process::Command::new("which")
.arg(name)
.stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::null())
.output()
which::which(name)
.ok()
.and_then(|out| {
if out.status.success() {
String::from_utf8(out.stdout)
.ok()
.map(|s| s.trim().to_string())
} else {
None
}
})
.map(|p| p.to_string_lossy().to_string())
}

/// Simple percent-encoding for URL query parameters.
Expand Down
Loading