Update configuration loading with Cargo.toml path and clean up .gitignore

---

This commit message concisely communicates the key changes:

1. The code now builds an absolute path to the `Cargo.toml` file, enhancing clarity in configuration loading.
2. The addition of `PathBuf` usage improves type safety.
3. The removal of unnecessary entries from `.gitignore` helps maintain a clean project structure.

These updates reflect improvements in both functionality and project organization.
This commit is contained in:
geoffsee
2025-08-31 14:06:44 -04:00
parent 7bc9479a11
commit 38d51722f2
3 changed files with 14 additions and 15 deletions

1
.gitignore vendored
View File

@@ -23,7 +23,6 @@ package-lock.json
# Web frontend build outputs # Web frontend build outputs
dist/ dist/
.trunk/
# ML model and embedding caches # ML model and embedding caches
.fastembed_cache/ .fastembed_cache/

View File

@@ -85,11 +85,6 @@ The architecture supports multiple deployment patterns:
- **Bun**: Required for TypeScript CLI client: `curl -fsSL https://bun.sh/install | bash` - **Bun**: Required for TypeScript CLI client: `curl -fsSL https://bun.sh/install | bash`
- **Node.js**: Alternative to Bun, supports OpenAI SDK v5.16.0+ - **Node.js**: Alternative to Bun, supports OpenAI SDK v5.16.0+
#### WASM Frontend Toolchain
- **Trunk**: Required for Leptos frontend builds: `cargo install trunk`
- **wasm-pack**: `cargo install wasm-pack`
- **WASM target**: `rustup target add wasm32-unknown-unknown`
#### ML Framework Dependencies #### ML Framework Dependencies
- **Candle**: Version 0.9.1 with conditional compilation: - **Candle**: Version 0.9.1 with conditional compilation:
- macOS: Metal support with CPU fallback for stability - macOS: Metal support with CPU fallback for stability
@@ -134,11 +129,6 @@ cargo build --bin cli --package inference-engine --release
cargo build --bin embeddings-engine --release cargo build --bin embeddings-engine --release
``` ```
**Web Frontend:**
```bash
cd crates/leptos-app
trunk build --release
```
### Running Services ### Running Services
@@ -435,8 +425,7 @@ For Kubernetes deployment details, see the [ARCHITECTURE.md](docs/ARCHITECTURE.m
**Symptom:** WASM compilation failures **Symptom:** WASM compilation failures
**Solution:** **Solution:**
1. Install required targets: `rustup target add wasm32-unknown-unknown` 1. Install required targets: `rustup target add wasm32-unknown-unknown`
2. Install trunk: `cargo install trunk` 2. Check RUSTFLAGS in leptos-app/run.sh
3. Check RUSTFLAGS in leptos-app/run.sh
### Network/Timeout Issues ### Network/Timeout Issues
**Symptom:** First-time model downloads timing out **Symptom:** First-time model downloads timing out
@@ -484,7 +473,6 @@ cd crates/leptos-app && ./run.sh &
**Cleanup:** **Cleanup:**
```bash ```bash
pkill -f "predict-otron-9000" pkill -f "predict-otron-9000"
pkill -f "trunk"
``` ```
For networked tests and full functionality, ensure Hugging Face authentication is configured as described above. For networked tests and full functionality, ensure Hugging Face authentication is configured as described above.

View File

@@ -1,3 +1,5 @@
use std::path::PathBuf;
pub mod app; pub mod app;
#[cfg(feature = "hydrate")] #[cfg(feature = "hydrate")]
@@ -15,7 +17,17 @@ pub fn create_leptos_router() -> axum::Router {
use leptos::prelude::*; use leptos::prelude::*;
use leptos_axum::{generate_route_list, LeptosRoutes}; use leptos_axum::{generate_route_list, LeptosRoutes};
let conf = get_configuration(None).unwrap();
// Build an absolute path to THIS crate's Cargo.toml
let mut cargo_toml = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
cargo_toml.push("Cargo.toml");
let conf = get_configuration(Some(
cargo_toml.to_str().expect("valid utf-8 path to Cargo.toml"),
))
.expect("load leptos config");
let conf = get_configuration(Some(cargo_toml.to_str().unwrap())).unwrap();
let leptos_options = conf.leptos_options; let leptos_options = conf.leptos_options;
// Generate the list of routes in your Leptos App // Generate the list of routes in your Leptos App
let routes = generate_route_list(App); let routes = generate_route_list(App);