refactor(config): v3 레이아웃 — 미디어 ingest 통합 + pdf paddle 대칭 + float 직렬화
Config 의 indexing/chunking/image/pdf top-level 필드를 ingest: IngestCfg 하나로 통합. leaf 구조체는 불변, 부모 경로만 [ingest.*] 하위로 이동. PdfOcrCfg 에 paddle 대칭 6키(det/rec/dict/score_thresh/unclip_ratio/ max_boxes) 추가. ser_f32_clean 으로 f32 직렬화 정리(0.3000000119→0.3). apply_env RHS 를 self.ingest.* 로 갱신(env 키 문자열 LHS 불변). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -47,20 +47,20 @@ lang_hint = "kor"
|
||||
#[test]
|
||||
fn pdf_ocr_defaults_off_with_qwen_3b() {
|
||||
let cfg = Config::defaults();
|
||||
assert!(!cfg.pdf.ocr.enabled);
|
||||
assert!(!cfg.pdf.ocr.always_on);
|
||||
assert_eq!(cfg.pdf.ocr.engine, "ollama-vision");
|
||||
assert_eq!(cfg.pdf.ocr.model, "qwen2.5vl:3b");
|
||||
assert!(cfg.pdf.ocr.endpoint.is_none());
|
||||
assert!(!cfg.ingest.pdf.ocr.enabled);
|
||||
assert!(!cfg.ingest.pdf.ocr.always_on);
|
||||
assert_eq!(cfg.ingest.pdf.ocr.engine, "ollama-vision");
|
||||
assert_eq!(cfg.ingest.pdf.ocr.model, "qwen2.5vl:3b");
|
||||
assert!(cfg.ingest.pdf.ocr.endpoint.is_none());
|
||||
assert_eq!(
|
||||
cfg.pdf.ocr.languages,
|
||||
cfg.ingest.pdf.ocr.languages,
|
||||
vec!["eng".to_string(), "kor".to_string()]
|
||||
);
|
||||
assert_eq!(cfg.pdf.ocr.max_pixels, 2048);
|
||||
assert_eq!(cfg.pdf.ocr.request_timeout_secs, 180); // Bug #11: 600 → 60 → 180 (HOTFIXES 2026-05-28)
|
||||
assert!((cfg.pdf.ocr.valid_ratio_threshold - 0.5).abs() < 1e-6);
|
||||
assert_eq!(cfg.pdf.ocr.min_char_count, 20);
|
||||
assert_eq!(cfg.pdf.ocr.lang_hint.as_deref(), Some("kor"));
|
||||
assert_eq!(cfg.ingest.pdf.ocr.max_pixels, 2048);
|
||||
assert_eq!(cfg.ingest.pdf.ocr.request_timeout_secs, 180); // Bug #11: 600 → 60 → 180 (HOTFIXES 2026-05-28)
|
||||
assert!((cfg.ingest.pdf.ocr.valid_ratio_threshold - 0.5).abs() < 1e-6);
|
||||
assert_eq!(cfg.ingest.pdf.ocr.min_char_count, 20);
|
||||
assert_eq!(cfg.ingest.pdf.ocr.lang_hint.as_deref(), Some("kor"));
|
||||
}
|
||||
|
||||
// Test 3: env var override — 4 keys 의 typical override case.
|
||||
@@ -80,12 +80,12 @@ fn pdf_ocr_env_overrides() {
|
||||
|
||||
let cfg = Config::defaults().apply_env(&env);
|
||||
|
||||
assert!(cfg.pdf.ocr.enabled);
|
||||
assert_eq!(cfg.pdf.ocr.model, "qwen2.5vl:7b");
|
||||
assert!(cfg.pdf.ocr.always_on);
|
||||
assert!((cfg.pdf.ocr.valid_ratio_threshold - 0.75).abs() < 1e-6);
|
||||
assert!(cfg.ingest.pdf.ocr.enabled);
|
||||
assert_eq!(cfg.ingest.pdf.ocr.model, "qwen2.5vl:7b");
|
||||
assert!(cfg.ingest.pdf.ocr.always_on);
|
||||
assert!((cfg.ingest.pdf.ocr.valid_ratio_threshold - 0.75).abs() < 1e-6);
|
||||
|
||||
// 다른 env var 가 default 보존
|
||||
assert_eq!(cfg.pdf.ocr.engine, "ollama-vision");
|
||||
assert_eq!(cfg.pdf.ocr.min_char_count, 20);
|
||||
assert_eq!(cfg.ingest.pdf.ocr.engine, "ollama-vision");
|
||||
assert_eq!(cfg.ingest.pdf.ocr.min_char_count, 20);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user