pub mod batch;
pub mod config;
pub mod doctor;
pub mod mcp;
pub mod ocr;
pub mod serve;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OcrResult {
pub file: PathBuf,
pub text: String,
pub latex: Option<String>,
pub confidence: f64,
pub processing_time_ms: u64,
pub errors: Vec<String>,
}
impl OcrResult {
pub fn new(file: PathBuf, text: String, confidence: f64) -> Self {
Self {
file,
text,
latex: None,
confidence,
processing_time_ms: 0,
errors: Vec::new(),
}
}
pub fn with_latex(mut self, latex: String) -> Self {
self.latex = Some(latex);
self
}
pub fn with_processing_time(mut self, time_ms: u64) -> Self {
self.processing_time_ms = time_ms;
self
}
pub fn add_error(&mut self, error: String) {
self.errors.push(error);
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OcrConfig {
pub min_confidence: f64,
pub max_image_size: usize,
pub supported_extensions: Vec<String>,
pub api_endpoint: Option<String>,
pub api_key: Option<String>,
}
impl Default for OcrConfig {
fn default() -> Self {
Self {
min_confidence: 0.7,
max_image_size: 10 * 1024 * 1024, supported_extensions: vec![
"png".to_string(),
"jpg".to_string(),
"jpeg".to_string(),
"pdf".to_string(),
"gif".to_string(),
],
api_endpoint: None,
api_key: None,
}
}
}