added api for ai; got backend working

This commit is contained in:
2026-03-26 23:39:31 -06:00
parent 164b2f87d4
commit 4a857d8cbf
20 changed files with 1436 additions and 280 deletions

30
src-tauri/src/paths.rs Normal file
View File

@ -0,0 +1,30 @@
use std::path::PathBuf;
/// Resolve the project root from the executable path.
/// In dev mode, the binary lives at: <root>/src-tauri/target/debug/<bin>
/// So the project root is 4 levels above the binary.
pub fn project_root() -> PathBuf {
let exe = std::env::current_exe().expect("Failed to get executable path");
// exe -> debug/ -> target/ -> src-tauri/ -> root
exe.parent()
.and_then(|p| p.parent())
.and_then(|p| p.parent())
.and_then(|p| p.parent())
.map(|p| p.to_path_buf())
.unwrap_or_else(|| PathBuf::from("."))
}
/// Absolute path to the venv Python 3.10 interpreter.
pub fn python_exe() -> PathBuf {
project_root().join(".venv/bin/python3.10")
}
/// Absolute path to a script in the backend directory.
pub fn backend_script(name: &str) -> PathBuf {
project_root().join("backend").join(name)
}
/// Absolute path to a script at the project root.
pub fn root_script(name: &str) -> PathBuf {
project_root().join(name)
}