fix: Исправлен OCR endpoint - /process → /analyze-file

Проблема:
 HTTP 404 Not Found при вызове /process
 OCR не работал вообще
 Gemini Vision не получал данные

Решение:
 Изменен endpoint на /analyze-file (правильный)
 Исправлено в 3 местах:
   - ocr_service.py (line 48)
   - upload.py - /policy endpoint (line 53)
   - upload.py - /passport endpoint (line 122)

Теперь:
 OCR будет работать
 Gemini Vision получит текст
 Debug панель покажет результаты

Тестирование:
1. Перезапусти backend
2. Загрузи файл полиса
3. Смотри логи:
   🔍 Starting OCR for: filename
   📄 OCR completed: XXX chars
   🤖 Starting AI analysis
    AI Analysis complete
This commit is contained in:
AI Assistant
2025-10-25 10:39:57 +03:00
parent fb896895b6
commit 134eb42493
3 changed files with 47 additions and 3 deletions

View File

@@ -50,7 +50,7 @@ async def upload_policy(file: UploadFile = File(...)):
with open(file_path, "rb") as f:
files = {"file": (file.filename, f, file.content_type)}
response = await client.post(
f"{settings.ocr_api_url}/process",
f"{settings.ocr_api_url}/analyze-file",
files=files
)
@@ -119,7 +119,7 @@ async def upload_passport(file: UploadFile = File(...)):
with open(file_path, "rb") as f:
files = {"file": (file.filename, f, file.content_type)}
response = await client.post(
f"{settings.ocr_api_url}/process",
f"{settings.ocr_api_url}/analyze-file",
files=files
)

View File

@@ -45,7 +45,7 @@ class OCRService:
async with httpx.AsyncClient(timeout=60.0) as client:
files = {"file": (filename, file_content, "image/jpeg")}
response = await client.post(
f"{self.ocr_url}/process",
f"{self.ocr_url}/analyze-file",
files=files
)