脕lvaro Valenzuela Valdes
feat: implement Groq integration, robust multi-agent synthesis and UX performance optimization
863be56 | from typing import Any | |
| def _value(analysis: Any, key: str): | |
| if isinstance(analysis, dict): | |
| return analysis.get(key, "") | |
| return getattr(analysis, key, "") | |
| def generate_markdown_report(analysis: Any) -> str: | |
| lines = [ | |
| f"# Informe de An谩lisis: {_value(analysis, 'fit_score')}% de ajuste", | |
| "", | |
| f"**Decisi贸n:** {_value(analysis, 'decision')}", | |
| "", | |
| "## Resumen Ejecutivo", | |
| _value(analysis, "executive_summary"), | |
| "", | |
| "## Requisitos Clave", | |
| ] | |
| for req in _value(analysis, "key_requirements") or []: | |
| lines.append(f"- {req}") | |
| lines.append("") | |
| lines.append("## Riesgos") | |
| for risk in _value(analysis, "risks") or []: | |
| if isinstance(risk, dict): | |
| lines.append(f"- **{risk.get('title', 'Riesgo')}** ({risk.get('severity', 'Medium')}): {risk.get('explanation', '')}") | |
| else: | |
| lines.append(f"- {str(risk)}") | |
| lines.append("") | |
| lines.append("## Brechas de Cumplimiento") | |
| for gap in _value(analysis, "compliance_gaps") or []: | |
| lines.append(f"- {str(gap)}") | |
| lines.append("") | |
| lines.append("## Plan de Acci贸n") | |
| for item in _value(analysis, "action_plan") or []: | |
| if isinstance(item, dict): | |
| lines.append( | |
| f"- **{item.get('task', 'Tarea')}** | Prioridad: {item.get('priority', 'Medium')} | Responsable: {item.get('owner', 'Team')} | Tiempo: {item.get('timeline', 'TBD')}" | |
| ) | |
| else: | |
| lines.append(f"- {str(item)}") | |
| lines.append("") | |
| lines.append("## Borrador de Propuesta") | |
| lines.append(_value(analysis, "proposal_draft")) | |
| return "\n".join(lines) | |