feat(backend): refactor OCR client to support HTTP + subprocess dual mode
- runtime-config.js: add baseUrl field to ocr type definition - default.cjs: add ocr.baseUrl default (empty string = subprocess mode) - runtime.js: add OCR_BASE_URL env var parsing - ocr.js: add HTTP mode (when OCR_BASE_URL set) alongside existing subprocess mode - resolveOcrMode() detects mode from runtimeConfig.ocr.baseUrl - callOcrViaHttp() calls FastAPI endpoints directly with payload - warmupOcrViaHttp() calls /health endpoint for HTTP mode warmup - callOcrRequest() routes between HTTP and subprocess based on mode - All 5 original exports preserved (recognizeTencentCaptcha, etc.) - Subprocess mode remains backward compatible (default when no OCR_BASE_URL)
This commit is contained in:
@@ -20,6 +20,7 @@ module.exports = {
|
||||
|
||||
ocr: {
|
||||
projectRoot: path.resolve(__dirname, '../subservices/ocr-worker'),
|
||||
baseUrl: '',
|
||||
},
|
||||
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user