ruvector_scipix/cli/commands/
mod.rs1pub mod ocr;
2pub mod batch;
3pub mod serve;
4pub mod config;
5pub mod mcp;
6pub mod doctor;
7
8use serde::{Deserialize, Serialize};
9use std::path::PathBuf;
10
11#[derive(Debug, Clone, Serialize, Deserialize)]
13pub struct OcrResult {
14 pub file: PathBuf,
16
17 pub text: String,
19
20 pub latex: Option<String>,
22
23 pub confidence: f64,
25
26 pub processing_time_ms: u64,
28
29 pub errors: Vec<String>,
31}
32
33impl OcrResult {
34 pub fn new(file: PathBuf, text: String, confidence: f64) -> Self {
36 Self {
37 file,
38 text,
39 latex: None,
40 confidence,
41 processing_time_ms: 0,
42 errors: Vec::new(),
43 }
44 }
45
46 pub fn with_latex(mut self, latex: String) -> Self {
48 self.latex = Some(latex);
49 self
50 }
51
52 pub fn with_processing_time(mut self, time_ms: u64) -> Self {
54 self.processing_time_ms = time_ms;
55 self
56 }
57
58 pub fn add_error(&mut self, error: String) {
60 self.errors.push(error);
61 }
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize)]
66pub struct OcrConfig {
67 pub min_confidence: f64,
69
70 pub max_image_size: usize,
72
73 pub supported_extensions: Vec<String>,
75
76 pub api_endpoint: Option<String>,
78
79 pub api_key: Option<String>,
81}
82
83impl Default for OcrConfig {
84 fn default() -> Self {
85 Self {
86 min_confidence: 0.7,
87 max_image_size: 10 * 1024 * 1024, supported_extensions: vec![
89 "png".to_string(),
90 "jpg".to_string(),
91 "jpeg".to_string(),
92 "pdf".to_string(),
93 "gif".to_string(),
94 ],
95 api_endpoint: None,
96 api_key: None,
97 }
98 }
99}