# Nova função post_analysis_comment com formatação melhor async def post_analysis_comment(ticket: dict, result: dict): """Post analysis result back to TicketHub as a comment""" ticket_id = ticket.get("id") if not ticket_id: return confidence_pct = int(result.get("confidence", 0) * 100) files = ", ".join(result.get("affected_files", ["Unknown"])) # Formatação texto plano com quebras de linha claras comment = f"""🤖 AI ANALYSIS COMPLETE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 📋 ROOT CAUSE: {result.get('analysis', 'Unable to determine')} 📁 AFFECTED FILES: {files} 🔧 SUGGESTED FIX: ──────────────────────────────────────── {result.get('suggested_fix', 'No fix suggested')} ──────────────────────────────────────── 📊 CONFIDENCE: {confidence_pct}% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Analyzed by JIRA AI Fixer""" async with httpx.AsyncClient(timeout=10.0) as client: try: await client.post( f"https://tickethub.startdata.com.br/api/tickets/{ticket_id}/comments", json={"author": "AI Fixer", "content": comment} ) except: pass