use std::path::PathBuf;
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct ServerConfig {
pub data_dir: PathBuf,
pub embedding_dim: usize,
pub llm_provider: String,
pub llm_api_key: Option<String>,
pub llm_model: Option<String>,
pub full_tools: bool,
}
impl ServerConfig {
pub fn new(
data_dir: PathBuf,
embedding_dim: usize,
llm_provider: String,
llm_api_key: Option<String>,
llm_model: Option<String>,
full_tools: bool,
) -> Self {
Self {
data_dir,
embedding_dim,
llm_provider,
llm_api_key,
llm_model,
full_tools,
}
}
pub fn resolve_data_dir(raw: &str) -> PathBuf {
if raw.starts_with('~')
&& let Some(home) = dirs_home()
{
return home.join(raw.trim_start_matches("~/"));
}
PathBuf::from(raw)
}
}
fn dirs_home() -> Option<PathBuf> {
std::env::var("HOME").ok().map(PathBuf::from)
}