fix: Better comment formatting with plain text and line separators
This commit is contained in:
parent
5c8ceadb77
commit
b8e38870e3
|
|
@ -0,0 +1,37 @@
|
||||||
|
# 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
|
||||||
|
|
@ -290,21 +290,24 @@ async def post_analysis_comment(ticket: dict, result: dict):
|
||||||
confidence_pct = int(result.get("confidence", 0) * 100)
|
confidence_pct = int(result.get("confidence", 0) * 100)
|
||||||
files = ", ".join(result.get("affected_files", ["Unknown"]))
|
files = ", ".join(result.get("affected_files", ["Unknown"]))
|
||||||
|
|
||||||
comment = f"""🤖 **AI Analysis Complete**
|
# Formatação texto plano com quebras de linha claras
|
||||||
|
comment = f"""🤖 AI ANALYSIS COMPLETE
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
|
||||||
**Root Cause:** {result.get('analysis', 'Unable to determine')}
|
📋 ROOT CAUSE:
|
||||||
|
{result.get('analysis', 'Unable to determine')}
|
||||||
|
|
||||||
**Affected Files:** {files}
|
📁 AFFECTED FILES: {files}
|
||||||
|
|
||||||
**Suggested Fix:**
|
🔧 SUGGESTED FIX:
|
||||||
```cobol
|
────────────────────────────────────────
|
||||||
{result.get('suggested_fix', 'No fix suggested')}
|
{result.get('suggested_fix', 'No fix suggested')}
|
||||||
```
|
────────────────────────────────────────
|
||||||
|
|
||||||
**Confidence:** {confidence_pct}%
|
📊 CONFIDENCE: {confidence_pct}%
|
||||||
|
|
||||||
---
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
_Analyzed by JIRA AI Fixer_"""
|
Analyzed by JIRA AI Fixer"""
|
||||||
|
|
||||||
async with httpx.AsyncClient(timeout=10.0) as client:
|
async with httpx.AsyncClient(timeout=10.0) as client:
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue