Update app.py
Browse files
app.py
CHANGED
|
@@ -1667,20 +1667,6 @@ def create_enhanced_ui():
|
|
| 1667 |
label="Predictive Forecasts",
|
| 1668 |
value={}
|
| 1669 |
)
|
| 1670 |
-
|
| 1671 |
-
with gr.Accordion("π€ Claude AI Synthesis", open=True):
|
| 1672 |
-
gr.Markdown("""
|
| 1673 |
-
**Claude Opus 4.5 Executive Summary:**
|
| 1674 |
-
- π Incident synthesis from all agents
|
| 1675 |
-
- π― Root cause identification
|
| 1676 |
-
- π‘ Recommended recovery actions
|
| 1677 |
-
- β° Impact and recovery time estimates
|
| 1678 |
-
""")
|
| 1679 |
-
|
| 1680 |
-
claude_output = gr.Markdown(
|
| 1681 |
-
value="*Claude AI synthesis will appear here after incident analysis*",
|
| 1682 |
-
label="AI Executive Summary"
|
| 1683 |
-
)
|
| 1684 |
|
| 1685 |
gr.Markdown("### π Recent Events (Last 15)")
|
| 1686 |
events_table = gr.Dataframe(
|
|
@@ -1805,44 +1791,12 @@ def create_enhanced_ui():
|
|
| 1805 |
|
| 1806 |
agent_insights_data = result.get("multi_agent_analysis", {})
|
| 1807 |
predictive_insights_data = agent_insights_data.get('predictive_insights', {})
|
| 1808 |
-
|
| 1809 |
-
# Extract Claude synthesis for display
|
| 1810 |
-
claude_synthesis = result.get('claude_synthesis', {})
|
| 1811 |
-
claude_text = claude_synthesis.get('summary', '*No Claude synthesis available*')
|
| 1812 |
-
|
| 1813 |
-
# Format Claude output beautifully
|
| 1814 |
-
claude_display = f"""
|
| 1815 |
-
### π€ Claude Opus 4.5 Executive Analysis
|
| 1816 |
-
|
| 1817 |
-
{claude_text}
|
| 1818 |
-
|
| 1819 |
-
---
|
| 1820 |
-
*Generated: {claude_synthesis.get('timestamp', 'N/A')}*
|
| 1821 |
-
*Model: {claude_synthesis.get('source', 'claude-opus-4')}*
|
| 1822 |
-
"""
|
| 1823 |
-
|
| 1824 |
-
return (
|
| 1825 |
-
output_msg,
|
| 1826 |
-
agent_insights_data,
|
| 1827 |
-
predictive_insights_data,
|
| 1828 |
-
claude_display,
|
| 1829 |
-
gr.Dataframe(
|
| 1830 |
-
headers=["Timestamp", "Component", "Latency", "Error Rate", "Throughput", "Severity", "Analysis"],
|
| 1831 |
-
value=table_data,
|
| 1832 |
-
wrap=True
|
| 1833 |
-
)
|
| 1834 |
-
)
|
| 1835 |
-
|
| 1836 |
-
except Exception as e:
|
| 1837 |
-
error_msg = f"β Error processing event: {str(e)}"
|
| 1838 |
-
logger.error(error_msg, exc_info=True)
|
| 1839 |
-
return error_msg, {}, {}, "*Processing error*", gr.Dataframe(value=[])
|
| 1840 |
|
| 1841 |
# FIXED: Use async handler directly
|
| 1842 |
submit_btn.click(
|
| 1843 |
fn=submit_event_enhanced_async,
|
| 1844 |
inputs=[component, latency, error_rate, throughput, cpu_util, memory_util],
|
| 1845 |
-
outputs=[output_text, agent_insights, predictive_insights,
|
| 1846 |
)
|
| 1847 |
|
| 1848 |
return demo
|
|
|
|
| 1667 |
label="Predictive Forecasts",
|
| 1668 |
value={}
|
| 1669 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1670 |
|
| 1671 |
gr.Markdown("### π Recent Events (Last 15)")
|
| 1672 |
events_table = gr.Dataframe(
|
|
|
|
| 1791 |
|
| 1792 |
agent_insights_data = result.get("multi_agent_analysis", {})
|
| 1793 |
predictive_insights_data = agent_insights_data.get('predictive_insights', {})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1794 |
|
| 1795 |
# FIXED: Use async handler directly
|
| 1796 |
submit_btn.click(
|
| 1797 |
fn=submit_event_enhanced_async,
|
| 1798 |
inputs=[component, latency, error_rate, throughput, cpu_util, memory_util],
|
| 1799 |
+
outputs=[output_text, agent_insights, predictive_insights, events_table]
|
| 1800 |
)
|
| 1801 |
|
| 1802 |
return demo
|