Spaces:
Running
Running
Upload folder using huggingface_hub
Browse filesFiles changed (4)
268 unmodified lines269270271272273274275268 unmodified lines created_at: datetime = Field(default_factory=datetime.utcnow) completed_at: datetime | None = None processing_ms: int | None = Field(None, description="Total triage latency in milliseconds.") error_message: str | None = Field(None, description="Detailed error message if processing failed.")
class HealthResponse(BaseModel):122 unmodified lines123124125126127128129122 unmodified lines created_at=created_at or datetime.utcnow(), completed_at=completed_at, processing_ms=processing_ms, error_message=row.get("error_message"), )
1214 unmodified lines1215121612171218121812191220122112221223122412251226122712281229123011 unmodified lines124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761214 unmodified lines
const data = await response.json(); if(data.status !== "pending" || attempts >= maxAttempts) { if (data.status === "processing") { document.getElementById('metric-resolution').innerText = `Triage active: Supervisor routing & agent network running (attempt ${attempts}/15)...`; } if(data.status !== "pending" && data.status !== "processing" || attempts >= maxAttempts) { clearInterval(pollInterval); if (attempts >= maxAttempts && (data.status === "pending" || data.status === "processing")) { data.status = "failed"; data.error_message = "Triage pipeline execution timed out after 15 seconds. The supervisor did not complete in time."; } displayTriageResults(data); btn.disabled = false; btn.innerText = "Dispatch to Triage Pipeline";11 unmodified lines
// Display results in dashboard metrics cards function displayTriageResults(data) { if (data.status === "failed") { const priorityEl = document.getElementById('metric-priority'); priorityEl.innerText = "FAILED"; priorityEl.className = "metric-value priority-badge priority-critical";
document.getElementById('metric-routing').innerText = "Aborted"; document.getElementById('metric-outage').innerText = "Error"; document.getElementById('metric-churn').innerText = "N/A"; document.getElementById('churn-progress').style.width = "0%";
const resolutionEl = document.getElementById('metric-resolution'); resolutionEl.innerHTML = ` <div style="color: var(--danger); font-weight: 700; font-size: 15px; margin-bottom: 8px;">Triage Pipeline Execution Failed ❌</div> <div style="font-family: monospace; background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.2); padding: 12px; border-radius: 8px; color: #fca5a5; font-size: 12.5px; margin-bottom: 12px; overflow-x: auto; white-space: pre-wrap; line-height: 1.4;">${data.error_message || 'An unexpected exception occurred.'}</div> <div style="font-size: 12px; color: var(--text-muted);"> <strong>Next Steps:</strong> Check system logs, verify Supabase credentials/IP reachability, and check the status of external LLM endpoints (e.g. OpenRouter key balance). </div> `;
document.getElementById('metric-pii-log').innerText = `[Pipeline Aborted]\n- Ticket ID: ${data.ticket_id || '--'}\n- Status: Failed\n- Error: ${data.error_message || 'unknown'}`; const safetyEl = document.getElementById('safety-indicator'); const safetyText = document.getElementById('safety-text'); safetyEl.className = "safety-banner safety-blocked"; safetyText.innerText = "🛡️ AI Compliance Check: Aborted due to system error."; safetyEl.style.display = "flex"; return; }
// Priority const priorityVal = data.priority || "Low"; const priorityEl = document.getElementById('metric-priority');400 unmodified lines401402403404404405406407400 unmodified lines try: query = ( sb.table("tickets") .select("id,status,priority,category,channel,created_at,hitl_required,customer_id,customer_tier,masked_text") .select("*") .eq("tenant_id", self.tenant_id) .order("created_at", desc=True) .limit(limit)src/api/models.py+1
src/api/routers/triage.py+1
src/api/ui.py+38-1
src/db/repository.py+1-1