diff --git a/backend/app/main.py b/backend/app/main.py index e81a572..160df65 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -278,7 +278,7 @@ def extract_pdf_text_smart(pdf_content: bytes, max_chars: int = None) -> dict: } -BACKEND_VERSION = "1.2.11" +BACKEND_VERSION = "1.2.12" app = FastAPI(title="Checklist Inteligente API", version=BACKEND_VERSION) # S3/MinIO configuration @@ -2025,7 +2025,14 @@ def generate_inspection_pdf(inspection_id: int, db: Session) -> str: # Detectar si es pregunta con chat assistant is_ai_assistant = question.options and question.options.get('type') == 'ai_assistant' - # Estado visual + # Detectar tipo de pregunta para determinar si debe mostrar estado + question_type = question.options.get('type') if question.options else question.type + + # Tipos de pregunta que NO deben mostrar estado de color (son informativas/texto libre) + text_based_types = ['text', 'number', 'date', 'time', 'photo_only', 'ai_assistant'] + should_show_status = question_type not in text_based_types + + # Estado visual (solo para preguntas con estado) status_colors = { 'ok': colors.HexColor('#22c55e'), 'warning': colors.HexColor('#eab308'), @@ -2036,8 +2043,14 @@ def generate_inspection_pdf(inspection_id: int, db: Session) -> str: 'warning': '⚠', 'critical': '✕' } - status_color = status_colors.get(ans.status, colors.HexColor('#64748b')) - status_icon = status_icons.get(ans.status, '●') + + if should_show_status: + status_color = status_colors.get(ans.status, colors.HexColor('#64748b')) + status_icon = status_icons.get(ans.status, '●') + else: + # Para preguntas de texto/info, usar estilo neutral + status_color = colors.HexColor('#64748b') + status_icon = '📝' # Tabla de pregunta/respuesta question_data = [] @@ -2091,18 +2104,26 @@ def generate_inspection_pdf(inspection_id: int, db: Session) -> str: # ===== LÓGICA NORMAL PARA OTROS TIPOS ===== else: - # Fila 2: Respuesta y estado - Convertir valor técnico a etiqueta legible + # Fila 2: Respuesta - Convertir valor técnico a etiqueta legible answer_text = get_readable_answer(ans.answer_value, question.options) - question_data.append([ - Table([ - [ - Paragraph(f"Respuesta: {answer_text}", answer_style), - Paragraph(f"Estado: {ans.status.upper()}", - ParagraphStyle('status', parent=answer_style, - textColor=status_color, fontName='Helvetica-Bold')) - ] - ], colWidths=[120*mm, 50*mm]) - ]) + + # Solo mostrar estado para preguntas que lo requieren (no texto libre) + if should_show_status: + question_data.append([ + Table([ + [ + Paragraph(f"Respuesta: {answer_text}", answer_style), + Paragraph(f"Estado: {ans.status.upper()}", + ParagraphStyle('status', parent=answer_style, + textColor=status_color, fontName='Helvetica-Bold')) + ] + ], colWidths=[120*mm, 50*mm]) + ]) + else: + # Para preguntas de texto, solo mostrar la respuesta sin estado + question_data.append([ + Paragraph(f"Respuesta: {answer_text}", answer_style) + ]) # Fila 3: Comentario mejorado (si existe) if ans.comment: diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index f8fafe9..7ae0bb0 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -5069,12 +5069,12 @@ function InspectionModal({ checklist, existingInspection, user, onClose, onCompl : 'bg-blue-50 border-blue-200' }`}>
- 🤖 + 🛠️

- {checklist.ai_mode === 'full' ? 'Modo AUTOCOMPLETADO activado' : 'Modo ASISTIDO activado'} + {checklist.ai_mode === 'full' ? 'Modo AUTOCOMPLETADO activado' : ' '}