Skip to main content

offline_intelligence/
resources.rs

1// Server/src/resources.rs
2
3pub const HAS_EMBEDDED_RESOURCES: bool = false;
4
5use std::fs;
6use std::path::Path;
7use anyhow::Context;
8
9pub struct ResourceManager;
10
11impl ResourceManager {
12    pub fn extract_all(target_dir: &Path) -> anyhow::Result<()> {
13        println!("ℹ️ Using external resources (not embedded)");
14        // Just create the directory structure
15        fs::create_dir_all(target_dir)?;
16        Ok(())
17    }
18
19    pub fn ensure_llama_binary(&self) -> anyhow::Result<String> {
20        // Use LLAMA_BIN directly from environment variable
21        let llama_bin = std::env::var("LLAMA_BIN")
22            .context("LLAMA_BIN environment variable not set. Please set it in your .env file")?;
23        
24        // Verify the binary exists
25        if std::path::Path::new(&llama_bin).exists() {
26            Ok(llama_bin)
27        } else {
28            Err(anyhow::anyhow!(
29                "Llama binary not found at: {}. Please check LLAMA_BIN in .env file.",
30                llama_bin
31            ))
32        }
33    }
34}