refactor(ai): OCR sidecar canonical naming cleanup — typhoon→np-dms, remove hardcoded keys, asyncio.to_thread, ADR-040/041
CI / CD Pipeline / build (push) Successful in 7m37s
CI / CD Pipeline / deploy (push) Failing after 20m15s

This commit is contained in:
2026-06-20 16:37:04 +07:00
parent d418d791a4
commit a80ebef285
70 changed files with 5762 additions and 452 deletions
@@ -1,5 +1,5 @@
# File: specs/04-Infrastructure-OPS/04-00-docker-compose/Desk-5439/ocr-sidecar/docker-compose.yml
# Tesseract OCR Sidecar — รันบน Desk-5439 (AI Isolation Host) ตาม ADR-023A
# OCR Sidecar — รันบน Desk-5439 (AI Isolation Host) ตาม ADR-023A/ADR-040
# Change Log:
# - 2026-05-25: Initial compose file สำหรับ Tesseract OCR HTTP sidecar
# - 2026-05-25: แก้ volumes ให้ถูกต้องสำหรับ Windows + Docker Desktop
@@ -16,6 +16,7 @@
# - 2026-06-11: US2 & US3 - เพิ่ม VRAM headroom, residency window, pressure threshold, retrieval timeout env variables
# - 2026-06-13: ADR-036 — เปลี่ยน TYPHOON_OCR_MODEL เป็น OCR_MODEL=np-dms-ocr:latest
# - 2026-06-17: ลบชื่อ Typhoon ออกจากทุก environment variable และ comment (เปลี่ยนเป็น OCR_* ตาม ADR-036)
# - 2026-06-20: ADR-040 Phase 6+8 — ลบ OCR_LANG, USE_GPU (stale Tesseract config); เพิ่ม OCR_SIDECAR_API_KEY, OCR_ACTIVE_PROFILE
#
# วิธีรัน:
# docker compose up -d --build
@@ -39,8 +40,12 @@ services:
OCR_CHAR_THRESHOLD: "100"
OCR_PORT: "8765"
OCR_MAX_PAGES: "0"
OCR_LANG: "tha+eng" # Tesseract language code (Thai + English)
USE_GPU: "false" # OCR sidecar รันบน CPU, np-dms-ocr ใช้ Ollama แยก
# ─── Security (ADR-040 Phase 1) ─────────────────────────────────
# OCR_SIDECAR_API_KEY: อ่านจาก .env file (ห้าม hardcode ใน compose)
OCR_SIDECAR_API_KEY: ${OCR_SIDECAR_API_KEY}
# ─── Adaptive OCR Residency (ADR-040 Phase 4) ───────────────────
# OCR_ACTIVE_PROFILE: ชื่อ profile ใน ai_execution_profiles (ถ้าไม่ระบุ จะใช้ default)
OCR_ACTIVE_PROFILE: ${OCR_ACTIVE_PROFILE:-}
# ─── OCR via Ollama (ADR-034) ───────────────────────────────────
# ชี้ตรงไปยัง Ollama (port 11434) ไม่ผ่าน metrics proxy
# (proxy ไม่ forward /api/generate ได้ถูกต้อง — ทำให้ response ว่าง)