feat(image.ocr): request_timeout_secs config knob + closure of v0.17.1 미진행

v0.17.1 (PR #162) 가 LLM 쪽 hard-coded 300s 를 [models.llm]
request_timeout_secs 로 풀어준 것과 같은 패턴을 OCR 어댑터에 적용.
사용자 결정으로 별 노브 분리 ([image.ocr] request_timeout_secs) —
OCR 는 LLM 대비 cold start 패턴이 달라 독립 조절이 편함.

- OcrCfg.request_timeout_secs: u64 (serde default 300)
- KEBAB_IMAGE_OCR_REQUEST_TIMEOUT_SECS env override
- OllamaVisionOcr::build / from_parts 시그니처에 timeout 인자 추가
- REQUEST_TIMEOUT 상수 제거
- 3 신규 unit test (default / env / legacy parse) — LlmCfg 패턴 그대로
- HOTFIXES 2026-05-25 v0.17.1 entry 의 두 미진행 항목 모두 closure
  (OCR timeout = 본 PR, --stream docs = PR #163 에서 이미 완료)

기존 config / 옛 KB 영향 없음 — 새 필드는 default 로 채워지고
동작도 동일 (300s). vision 모델 cold start 가 길면 env 또는
config 로 늘릴 수 있음.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-25 05:06:53 +00:00
parent d02149c010
commit 41c5edc517
4 changed files with 174 additions and 17 deletions

View File

@@ -322,7 +322,8 @@ async fn ocr_downscales_large_image_before_sending() {
#[test]
fn from_parts_clamps_max_pixels_into_legal_range() {
// Below MIN_LONG_EDGE — bumped up to the floor.
let too_small = OllamaVisionOcr::from_parts("http://x", "m", vec![], 10).unwrap();
let too_small =
OllamaVisionOcr::from_parts("http://x", "m", vec![], 10, 300).unwrap();
assert_eq!(
too_small.max_pixels(),
256,
@@ -331,7 +332,7 @@ fn from_parts_clamps_max_pixels_into_legal_range() {
// Above MAX_LONG_EDGE — capped at the ceiling.
let too_big =
OllamaVisionOcr::from_parts("http://x", "m", vec![], 99_999).unwrap();
OllamaVisionOcr::from_parts("http://x", "m", vec![], 99_999, 300).unwrap();
assert_eq!(
too_big.max_pixels(),
4096,
@@ -339,7 +340,8 @@ fn from_parts_clamps_max_pixels_into_legal_range() {
);
// Inside the legal range — pass through untouched.
let in_range = OllamaVisionOcr::from_parts("http://x", "m", vec![], 1024).unwrap();
let in_range =
OllamaVisionOcr::from_parts("http://x", "m", vec![], 1024, 300).unwrap();
assert_eq!(in_range.max_pixels(), 1024);
}