release: 0.2.6

This commit is contained in:
Per Stark
2025-10-29 12:06:31 +01:00
parent 56a1dfddb8
commit b0deabaf3f
14 changed files with 267 additions and 175 deletions

View File

@@ -1,5 +1,6 @@
use config::{Config, ConfigError, Environment, File};
use serde::Deserialize;
use std::env;
#[derive(Clone, Deserialize, Debug)]
#[serde(rename_all = "lowercase")]
@@ -66,6 +67,36 @@ fn default_reranking_enabled() -> bool {
false
}
pub fn ensure_ort_path() {
if env::var_os("ORT_DYLIB_PATH").is_some() {
return;
}
if let Ok(mut exe) = env::current_exe() {
exe.pop();
if cfg!(target_os = "windows") {
for p in [
exe.join("onnxruntime.dll"),
exe.join("lib").join("onnxruntime.dll"),
] {
if p.exists() {
env::set_var("ORT_DYLIB_PATH", p);
return;
}
}
}
let name = if cfg!(target_os = "macos") {
"libonnxruntime.dylib"
} else {
"libonnxruntime.so"
};
let p = exe.join("lib").join(name);
if p.exists() {
env::set_var("ORT_DYLIB_PATH", p);
}
}
}
impl Default for AppConfig {
fn default() -> Self {
Self {
@@ -90,6 +121,8 @@ impl Default for AppConfig {
}
pub fn get_config() -> Result<AppConfig, ConfigError> {
ensure_ort_path();
let config = Config::builder()
.add_source(File::with_name("config").required(false))
.add_source(Environment::default())