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:
@@ -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
|
||||
)
|
||||
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
|
||||
44
commit_ocr_fix.sh
Normal file
44
commit_ocr_fix.sh
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
cd /var/www/fastuser/data/www/crm.clientright.ru/erv_platform
|
||||
|
||||
git add -A
|
||||
|
||||
git commit -m "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"
|
||||
|
||||
git push origin main
|
||||
|
||||
echo ""
|
||||
echo "✅ OCR endpoint исправлен!"
|
||||
echo ""
|
||||
echo "⚠️ ОБЯЗАТЕЛЬНО перезапусти backend:"
|
||||
echo " pkill -9 -f 'uvicorn app.main'"
|
||||
echo " cd backend && source venv/bin/activate"
|
||||
echo " python -m uvicorn app.main:app --host 0.0.0.0 --port 8100"
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user