use std::fs::File; use std::io::{ BufRead, BufReader}; pub fn load_knowledge() -> String { let path = "output/english_master.jsonl"; let file = match File::open(path) { Ok(f) => f, Err(e) => { eprintln!("❌ Could not open {}: {}", path, e); return "Knowledge base not found.".to_string(); } }; let reader = BufReader::new(file); let mut knowledge = String::from("=== ENGLISH MASTERY KNOWLEDGE BASE ===\n\n"); let mut count = 0; for line in reader.lines() { let line = match line { Ok(l) => l, Err(_) => continue, }; let trimmed = line.trim(); if trimmed.is_empty() { continue; } // Just add the raw line as-is (since it's JSONL) knowledge.push_str(trimmed); knowledge.push_str("\n\n"); count += 1; } knowledge.push_str(&format!("\n=== TOTAL: {} EXAMPLES LOADED ===\n", count)); println!("📚 Successfully loaded {} examples from english_master.jsonl", count); knowledge }