diff --git a/backend/app/main.py b/backend/app/main.py index 29c6eb4..1770124 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -276,7 +276,7 @@ def extract_pdf_text_smart(pdf_content: bytes, max_chars: int = None) -> dict: } -BACKEND_VERSION = "1.2.1" +BACKEND_VERSION = "1.2.2" app = FastAPI(title="Checklist Inteligente API", version=BACKEND_VERSION) # S3/MinIO configuration @@ -3211,6 +3211,53 @@ NOTA: ai_response = response.choices[0].message.content + elif ai_config.provider == "anthropic": + import anthropic + + client = anthropic.Anthropic(api_key=ai_config.api_key) + + if is_pdf: + # Para PDF, solo texto + response = client.messages.create( + model=ai_config.model_name or "claude-sonnet-4-5", + max_tokens=500, + system=system_prompt, + messages=[ + { + "role": "user", + "content": f"{user_message}\n\n--- CONTENIDO DEL DOCUMENTO PDF ({len(pdf_text)} caracteres) ---\n{pdf_text[:100000]}" + } + ] + ) + else: + # Para imagen, usar vision + response = client.messages.create( + model=ai_config.model_name or "claude-sonnet-4-5", + max_tokens=500, + system=system_prompt, + messages=[ + { + "role": "user", + "content": [ + { + "type": "text", + "text": user_message + }, + { + "type": "image", + "source": { + "type": "base64", + "media_type": "image/jpeg", + "data": image_b64 + } + } + ] + } + ] + ) + + ai_response = response.content[0].text + elif ai_config.provider == "gemini": import google.generativeai as genai from PIL import Image diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 30fffe1..a8f01d9 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1953,23 +1953,24 @@ function QuestionsManagerModal({ checklist, onClose }) { {formData.photo_requirement === 'required' && '• El mecánico DEBE adjuntar al menos 1 archivo'}
-- Cantidad máxima de fotos/PDFs permitidos -
-+ Cantidad máxima de fotos/PDFs permitidos +
+