Spaces:
Sleeping
Sleeping
feat: Implement Streamlined Flow UI redesign (Linear Layout)
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
"""
|
| 2 |
-
DebugGenie -
|
| 3 |
-
|
| 4 |
"""
|
| 5 |
import os
|
| 6 |
import gradio as gr
|
|
@@ -10,8 +10,8 @@ from theme import debuggenie_theme
|
|
| 10 |
# Check if Modal URL is configured
|
| 11 |
MODAL_API_URL = os.environ.get("MODAL_API_URL")
|
| 12 |
|
| 13 |
-
# --- CSS ARCHITECTURE (
|
| 14 |
-
|
| 15 |
/* π Base Styles */
|
| 16 |
body {
|
| 17 |
background-color: #09090b;
|
|
@@ -33,8 +33,8 @@ h1, h2, h3, h4, h5, h6 {
|
|
| 33 |
.pro-card {
|
| 34 |
background-color: #18181b !important;
|
| 35 |
border: 1px solid #27272a !important;
|
| 36 |
-
border-radius:
|
| 37 |
-
padding:
|
| 38 |
transition: border-color 0.2s ease;
|
| 39 |
}
|
| 40 |
|
|
@@ -46,7 +46,9 @@ h1, h2, h3, h4, h5, h6 {
|
|
| 46 |
background-color: #09090b !important;
|
| 47 |
border: 1px solid #27272a !important;
|
| 48 |
font-family: 'JetBrains Mono', monospace !important;
|
| 49 |
-
font-size:
|
|
|
|
|
|
|
| 50 |
}
|
| 51 |
|
| 52 |
.input-area textarea:focus {
|
|
@@ -54,19 +56,36 @@ h1, h2, h3, h4, h5, h6 {
|
|
| 54 |
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
|
| 55 |
}
|
| 56 |
|
| 57 |
-
/*
|
| 58 |
-
.
|
| 59 |
-
margin-bottom:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
}
|
| 61 |
|
| 62 |
/* π·οΈ Badges */
|
| 63 |
.badge {
|
| 64 |
display: inline-flex;
|
| 65 |
align-items: center;
|
| 66 |
-
padding:
|
| 67 |
-
border-radius:
|
| 68 |
font-size: 12px;
|
| 69 |
-
font-weight:
|
| 70 |
border: 1px solid transparent;
|
| 71 |
}
|
| 72 |
|
|
@@ -82,70 +101,35 @@ h1, h2, h3, h4, h5, h6 {
|
|
| 82 |
border-color: rgba(245, 158, 11, 0.2);
|
| 83 |
}
|
| 84 |
|
| 85 |
-
/* π Custom Scrollbar (Subtle) */
|
| 86 |
-
::-webkit-scrollbar {
|
| 87 |
-
width: 6px;
|
| 88 |
-
height: 6px;
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
::-webkit-scrollbar-track {
|
| 92 |
-
background: #09090b;
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
::-webkit-scrollbar-thumb {
|
| 96 |
-
background: #27272a;
|
| 97 |
-
border-radius: 3px;
|
| 98 |
-
}
|
| 99 |
-
|
| 100 |
-
::-webkit-scrollbar-thumb:hover {
|
| 101 |
-
background: #3f3f46;
|
| 102 |
-
}
|
| 103 |
-
|
| 104 |
-
/* Spacing Helpers */
|
| 105 |
-
.solutions-header {
|
| 106 |
-
margin-top: 24px !important;
|
| 107 |
-
}
|
| 108 |
-
|
| 109 |
-
.action-bar {
|
| 110 |
-
margin-top: 16px !important;
|
| 111 |
-
}
|
| 112 |
-
|
| 113 |
/* Header Responsiveness */
|
| 114 |
.header-container {
|
| 115 |
display: flex;
|
| 116 |
align-items: center;
|
|
|
|
| 117 |
gap: 12px;
|
| 118 |
-
margin-bottom:
|
|
|
|
| 119 |
}
|
| 120 |
|
| 121 |
.logo-icon {
|
| 122 |
-
font-size: clamp(
|
| 123 |
}
|
| 124 |
|
| 125 |
.logo-text h1 {
|
| 126 |
margin: 0;
|
| 127 |
-
font-size: clamp(
|
| 128 |
color: #f4f4f5;
|
| 129 |
}
|
| 130 |
|
| 131 |
.logo-text p {
|
| 132 |
margin: 0;
|
| 133 |
-
font-size: clamp(
|
| 134 |
color: #a1a1aa;
|
| 135 |
}
|
| 136 |
-
|
| 137 |
-
.version-badge {
|
| 138 |
-
font-size: 12px;
|
| 139 |
-
color: #52525b;
|
| 140 |
-
border: 1px solid #27272a;
|
| 141 |
-
padding: 4px 8px;
|
| 142 |
-
border-radius: 4px;
|
| 143 |
-
white-space: nowrap;
|
| 144 |
-
}
|
| 145 |
"""
|
| 146 |
|
| 147 |
def create_header():
|
| 148 |
-
"""Create a
|
| 149 |
return gr.Markdown("""
|
| 150 |
<div class="header-container">
|
| 151 |
<div class="logo-icon">π§</div>
|
|
@@ -153,20 +137,16 @@ def create_header():
|
|
| 153 |
<h1>DebugGenie</h1>
|
| 154 |
<p>Enterprise Error Analysis</p>
|
| 155 |
</div>
|
| 156 |
-
<div style="flex-grow: 1;"></div>
|
| 157 |
-
<div class="version-badge">
|
| 158 |
-
v2.1 Onyx
|
| 159 |
-
</div>
|
| 160 |
</div>
|
| 161 |
""")
|
| 162 |
|
| 163 |
def create_main_interface():
|
| 164 |
-
"""Create the main interface with
|
| 165 |
|
| 166 |
with gr.Blocks(
|
| 167 |
theme=debuggenie_theme,
|
| 168 |
-
title="DebugGenie
|
| 169 |
-
css=
|
| 170 |
) as demo:
|
| 171 |
|
| 172 |
create_header()
|
|
@@ -174,159 +154,155 @@ def create_main_interface():
|
|
| 174 |
# Configuration Check
|
| 175 |
if not MODAL_API_URL:
|
| 176 |
with gr.Row():
|
| 177 |
-
with gr.Column(elem_classes=["pro-card"]):
|
| 178 |
gr.Markdown("### β οΈ Configuration Required")
|
| 179 |
gr.Markdown("Please configure `MODAL_API_URL` in Space settings.")
|
| 180 |
else:
|
| 181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
|
| 183 |
-
|
| 184 |
-
with gr.Tab("Workspace", id=0):
|
| 185 |
-
|
| 186 |
with gr.Row():
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
lines=10,
|
| 196 |
-
max_lines=20,
|
| 197 |
-
elem_classes=["input-area"],
|
| 198 |
-
show_label=False
|
| 199 |
-
)
|
| 200 |
-
|
| 201 |
-
with gr.Accordion("Additional Context", open=False):
|
| 202 |
-
screenshot_input = gr.Image(
|
| 203 |
-
label="Screenshot",
|
| 204 |
-
type="pil",
|
| 205 |
-
height=150
|
| 206 |
-
)
|
| 207 |
-
files_input = gr.File(
|
| 208 |
-
label="Source Files",
|
| 209 |
-
file_count="multiple",
|
| 210 |
-
height=100
|
| 211 |
-
)
|
| 212 |
-
|
| 213 |
-
analyze_btn = gr.Button(
|
| 214 |
-
"Analyze Error",
|
| 215 |
-
variant="primary",
|
| 216 |
-
size="lg"
|
| 217 |
-
)
|
| 218 |
-
|
| 219 |
-
gr.Markdown("### History", visible=True)
|
| 220 |
-
history_list = gr.DataFrame(
|
| 221 |
-
headers=["Time", "Error"],
|
| 222 |
-
datatype=["str", "str"],
|
| 223 |
-
row_count=5,
|
| 224 |
-
interactive=False,
|
| 225 |
-
elem_classes=["pro-card"]
|
| 226 |
-
)
|
| 227 |
-
|
| 228 |
-
# RIGHT COLUMN: Analysis & Solutions (70%)
|
| 229 |
-
with gr.Column(scale=7):
|
| 230 |
-
|
| 231 |
-
# Agent Activity Feed
|
| 232 |
-
with gr.Group(elem_classes=["pro-card"]):
|
| 233 |
-
gr.Markdown("### Agent Collaboration")
|
| 234 |
-
agent_status = gr.Chatbot(
|
| 235 |
-
label="Agent Activity",
|
| 236 |
-
type="messages",
|
| 237 |
-
height=300,
|
| 238 |
-
show_label=False,
|
| 239 |
-
bubble_full_width=False,
|
| 240 |
-
avatar_images=(None, "https://api.iconify.design/fluent-emoji:robot.svg")
|
| 241 |
-
)
|
| 242 |
-
status_bar = gr.Markdown("**Status:** Ready", elem_id="status-bar")
|
| 243 |
-
|
| 244 |
-
# Solutions Area
|
| 245 |
-
gr.Markdown("### Solutions", elem_classes=["solutions-header"])
|
| 246 |
-
|
| 247 |
-
with gr.Row():
|
| 248 |
-
root_cause_box = gr.Markdown(
|
| 249 |
-
"**Root Cause:** Waiting for analysis...",
|
| 250 |
-
elem_classes=["pro-card"]
|
| 251 |
-
)
|
| 252 |
-
|
| 253 |
-
with gr.Row():
|
| 254 |
-
solution_1 = gr.Markdown(visible=False, elem_classes=["pro-card"])
|
| 255 |
-
solution_2 = gr.Markdown(visible=False, elem_classes=["pro-card"])
|
| 256 |
-
|
| 257 |
-
# Action Bar
|
| 258 |
-
with gr.Row(elem_classes=["action-bar"]):
|
| 259 |
-
export_btn = gr.Button("Export Report", size="sm", variant="secondary")
|
| 260 |
-
voice_btn = gr.Button("Voice Briefing", size="sm", variant="secondary")
|
| 261 |
-
audio_output = gr.Audio(visible=False, interactive=False)
|
| 262 |
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
|
| 274 |
# Event Handlers
|
| 275 |
def mock_analyze(error_text, screenshot, files, progress=gr.Progress()):
|
| 276 |
import time
|
| 277 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
messages = []
|
| 279 |
|
| 280 |
# Step 1
|
| 281 |
progress(0.2, desc="Initializing...")
|
| 282 |
-
messages.append({"role": "assistant", "content": "π **System:** Initializing
|
| 283 |
-
yield messages, "**Status:** Initializing...", gr.update(), gr.update(), gr.update()
|
| 284 |
-
time.sleep(0.
|
| 285 |
|
| 286 |
# Step 2
|
| 287 |
progress(0.5, desc="Analyzing...")
|
| 288 |
messages.append({"role": "assistant", "content": "π€ **Claude:** Analyzing stack trace structure..."})
|
| 289 |
messages.append({"role": "assistant", "content": "π§ **Gemini:** Checking documentation..."})
|
| 290 |
-
yield messages, "**Status:** Analyzing...", gr.update(), gr.update(), gr.update()
|
| 291 |
time.sleep(1.0)
|
| 292 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
# Results
|
| 294 |
root_cause = """
|
| 295 |
-
|
|
|
|
| 296 |
|
| 297 |
-
The error `ModuleNotFoundError: No module named 'gradio'` indicates the package is not installed in
|
| 298 |
"""
|
| 299 |
|
| 300 |
sol1 = """
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
Run: `pip install gradio`
|
| 304 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 305 |
<span class="badge badge-success">High Confidence</span>
|
| 306 |
"""
|
| 307 |
|
| 308 |
sol2 = """
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
Ensure you are in the correct virtualenv.
|
| 312 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
<span class="badge badge-warning">Medium Confidence</span>
|
| 314 |
"""
|
| 315 |
|
| 316 |
messages.append({"role": "assistant", "content": "β
**System:** Analysis complete."})
|
| 317 |
|
|
|
|
| 318 |
yield (
|
|
|
|
|
|
|
| 319 |
messages,
|
| 320 |
"**Status:** Complete",
|
| 321 |
root_cause,
|
| 322 |
-
|
| 323 |
-
|
| 324 |
)
|
| 325 |
|
| 326 |
analyze_btn.click(
|
| 327 |
fn=mock_analyze,
|
| 328 |
inputs=[error_input, screenshot_input, files_input],
|
| 329 |
-
outputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
)
|
| 331 |
|
| 332 |
return demo
|
|
|
|
| 1 |
"""
|
| 2 |
+
DebugGenie - Streamlined Flow Edition
|
| 3 |
+
Intuitive, linear workflow: Input -> Analysis -> Solution.
|
| 4 |
"""
|
| 5 |
import os
|
| 6 |
import gradio as gr
|
|
|
|
| 10 |
# Check if Modal URL is configured
|
| 11 |
MODAL_API_URL = os.environ.get("MODAL_API_URL")
|
| 12 |
|
| 13 |
+
# --- CSS ARCHITECTURE (Streamlined) ---
|
| 14 |
+
STREAMLINED_CSS = """
|
| 15 |
/* π Base Styles */
|
| 16 |
body {
|
| 17 |
background-color: #09090b;
|
|
|
|
| 33 |
.pro-card {
|
| 34 |
background-color: #18181b !important;
|
| 35 |
border: 1px solid #27272a !important;
|
| 36 |
+
border-radius: 12px !important;
|
| 37 |
+
padding: 24px !important;
|
| 38 |
transition: border-color 0.2s ease;
|
| 39 |
}
|
| 40 |
|
|
|
|
| 46 |
background-color: #09090b !important;
|
| 47 |
border: 1px solid #27272a !important;
|
| 48 |
font-family: 'JetBrains Mono', monospace !important;
|
| 49 |
+
font-size: 16px !important;
|
| 50 |
+
padding: 16px !important;
|
| 51 |
+
border-radius: 12px !important;
|
| 52 |
}
|
| 53 |
|
| 54 |
.input-area textarea:focus {
|
|
|
|
| 56 |
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
|
| 57 |
}
|
| 58 |
|
| 59 |
+
/* π Flow Containers */
|
| 60 |
+
.flow-section {
|
| 61 |
+
margin-bottom: 40px;
|
| 62 |
+
max-width: 1000px;
|
| 63 |
+
margin-left: auto;
|
| 64 |
+
margin-right: auto;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
.step-number {
|
| 68 |
+
display: inline-block;
|
| 69 |
+
width: 24px;
|
| 70 |
+
height: 24px;
|
| 71 |
+
background-color: #27272a;
|
| 72 |
+
color: #a1a1aa;
|
| 73 |
+
border-radius: 50%;
|
| 74 |
+
text-align: center;
|
| 75 |
+
line-height: 24px;
|
| 76 |
+
font-size: 12px;
|
| 77 |
+
margin-right: 8px;
|
| 78 |
+
font-weight: bold;
|
| 79 |
}
|
| 80 |
|
| 81 |
/* π·οΈ Badges */
|
| 82 |
.badge {
|
| 83 |
display: inline-flex;
|
| 84 |
align-items: center;
|
| 85 |
+
padding: 4px 10px;
|
| 86 |
+
border-radius: 6px;
|
| 87 |
font-size: 12px;
|
| 88 |
+
font-weight: 600;
|
| 89 |
border: 1px solid transparent;
|
| 90 |
}
|
| 91 |
|
|
|
|
| 101 |
border-color: rgba(245, 158, 11, 0.2);
|
| 102 |
}
|
| 103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
/* Header Responsiveness */
|
| 105 |
.header-container {
|
| 106 |
display: flex;
|
| 107 |
align-items: center;
|
| 108 |
+
justify-content: center;
|
| 109 |
gap: 12px;
|
| 110 |
+
margin-bottom: 40px;
|
| 111 |
+
padding-top: 20px;
|
| 112 |
}
|
| 113 |
|
| 114 |
.logo-icon {
|
| 115 |
+
font-size: clamp(24px, 5vw, 32px);
|
| 116 |
}
|
| 117 |
|
| 118 |
.logo-text h1 {
|
| 119 |
margin: 0;
|
| 120 |
+
font-size: clamp(20px, 4vw, 28px);
|
| 121 |
color: #f4f4f5;
|
| 122 |
}
|
| 123 |
|
| 124 |
.logo-text p {
|
| 125 |
margin: 0;
|
| 126 |
+
font-size: clamp(14px, 2vw, 16px);
|
| 127 |
color: #a1a1aa;
|
| 128 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
"""
|
| 130 |
|
| 131 |
def create_header():
|
| 132 |
+
"""Create a centered, minimal header."""
|
| 133 |
return gr.Markdown("""
|
| 134 |
<div class="header-container">
|
| 135 |
<div class="logo-icon">π§</div>
|
|
|
|
| 137 |
<h1>DebugGenie</h1>
|
| 138 |
<p>Enterprise Error Analysis</p>
|
| 139 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
</div>
|
| 141 |
""")
|
| 142 |
|
| 143 |
def create_main_interface():
|
| 144 |
+
"""Create the main interface with Streamlined Flow layout."""
|
| 145 |
|
| 146 |
with gr.Blocks(
|
| 147 |
theme=debuggenie_theme,
|
| 148 |
+
title="DebugGenie Flow",
|
| 149 |
+
css=STREAMLINED_CSS
|
| 150 |
) as demo:
|
| 151 |
|
| 152 |
create_header()
|
|
|
|
| 154 |
# Configuration Check
|
| 155 |
if not MODAL_API_URL:
|
| 156 |
with gr.Row():
|
| 157 |
+
with gr.Column(elem_classes=["pro-card", "flow-section"]):
|
| 158 |
gr.Markdown("### β οΈ Configuration Required")
|
| 159 |
gr.Markdown("Please configure `MODAL_API_URL` in Space settings.")
|
| 160 |
else:
|
| 161 |
+
|
| 162 |
+
# SECTION 1: THE ASK (Input)
|
| 163 |
+
with gr.Column(elem_classes=["flow-section"]):
|
| 164 |
+
gr.Markdown("### <span class='step-number'>1</span> Describe the Problem")
|
| 165 |
+
|
| 166 |
+
error_input = gr.Textbox(
|
| 167 |
+
label="Error Trace",
|
| 168 |
+
placeholder="Paste your stack trace, error message, or describe the bug...",
|
| 169 |
+
lines=6,
|
| 170 |
+
max_lines=15,
|
| 171 |
+
elem_classes=["input-area"],
|
| 172 |
+
show_label=False
|
| 173 |
+
)
|
| 174 |
|
| 175 |
+
with gr.Accordion("Add Context (Screenshot / Files)", open=False):
|
|
|
|
|
|
|
| 176 |
with gr.Row():
|
| 177 |
+
screenshot_input = gr.Image(label="Screenshot", type="pil", height=150)
|
| 178 |
+
files_input = gr.File(label="Source Files", file_count="multiple", height=100)
|
| 179 |
+
|
| 180 |
+
analyze_btn = gr.Button(
|
| 181 |
+
"Start Analysis",
|
| 182 |
+
variant="primary",
|
| 183 |
+
size="lg"
|
| 184 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
|
| 186 |
+
# SECTION 2: THE THINKING (Agent Activity)
|
| 187 |
+
# Initially hidden, revealed on click
|
| 188 |
+
with gr.Column(visible=False, elem_classes=["flow-section"]) as analysis_section:
|
| 189 |
+
gr.Markdown("### <span class='step-number'>2</span> Agent Analysis")
|
| 190 |
+
|
| 191 |
+
with gr.Group(elem_classes=["pro-card"]):
|
| 192 |
+
agent_status = gr.Chatbot(
|
| 193 |
+
label="Agent Activity",
|
| 194 |
+
type="messages",
|
| 195 |
+
height=250,
|
| 196 |
+
show_label=False,
|
| 197 |
+
bubble_full_width=False,
|
| 198 |
+
avatar_images=(None, "https://api.iconify.design/fluent-emoji:robot.svg")
|
| 199 |
+
)
|
| 200 |
+
status_bar = gr.Markdown("**Status:** Initializing...", elem_id="status-bar")
|
| 201 |
+
|
| 202 |
+
# SECTION 3: THE ANSWER (Solutions)
|
| 203 |
+
# Initially hidden, revealed on completion
|
| 204 |
+
with gr.Column(visible=False, elem_classes=["flow-section"]) as results_section:
|
| 205 |
+
gr.Markdown("### <span class='step-number'>3</span> Recommended Solutions")
|
| 206 |
+
|
| 207 |
+
root_cause_box = gr.Markdown(elem_classes=["pro-card"])
|
| 208 |
+
|
| 209 |
+
gr.Markdown("#### Actionable Fixes", style="margin-top: 20px;")
|
| 210 |
+
with gr.Row():
|
| 211 |
+
solution_1 = gr.Markdown(elem_classes=["pro-card"])
|
| 212 |
+
solution_2 = gr.Markdown(elem_classes=["pro-card"])
|
| 213 |
+
|
| 214 |
+
with gr.Row(style="margin-top: 30px; border-top: 1px solid #27272a; padding-top: 20px;"):
|
| 215 |
+
export_btn = gr.Button("π Export Report", size="sm", variant="secondary")
|
| 216 |
+
voice_btn = gr.Button("π Listen to Briefing", size="sm", variant="secondary")
|
| 217 |
+
audio_output = gr.Audio(visible=False, interactive=False)
|
| 218 |
|
| 219 |
# Event Handlers
|
| 220 |
def mock_analyze(error_text, screenshot, files, progress=gr.Progress()):
|
| 221 |
import time
|
| 222 |
|
| 223 |
+
# Reveal Analysis Section
|
| 224 |
+
yield (
|
| 225 |
+
gr.update(visible=True), # Show Analysis Section
|
| 226 |
+
gr.update(visible=False), # Hide Results Section (reset)
|
| 227 |
+
[], # Clear Chat
|
| 228 |
+
"**Status:** Initializing...",
|
| 229 |
+
gr.update(), gr.update(), gr.update()
|
| 230 |
+
)
|
| 231 |
+
|
| 232 |
messages = []
|
| 233 |
|
| 234 |
# Step 1
|
| 235 |
progress(0.2, desc="Initializing...")
|
| 236 |
+
messages.append({"role": "assistant", "content": "π **System:** Initializing multi-agent swarm..."})
|
| 237 |
+
yield (gr.update(), gr.update(), messages, "**Status:** Initializing...", gr.update(), gr.update(), gr.update())
|
| 238 |
+
time.sleep(0.8)
|
| 239 |
|
| 240 |
# Step 2
|
| 241 |
progress(0.5, desc="Analyzing...")
|
| 242 |
messages.append({"role": "assistant", "content": "π€ **Claude:** Analyzing stack trace structure..."})
|
| 243 |
messages.append({"role": "assistant", "content": "π§ **Gemini:** Checking documentation..."})
|
| 244 |
+
yield (gr.update(), gr.update(), messages, "**Status:** Analyzing...", gr.update(), gr.update(), gr.update())
|
| 245 |
time.sleep(1.0)
|
| 246 |
|
| 247 |
+
# Step 3
|
| 248 |
+
progress(0.8, desc="Synthesizing...")
|
| 249 |
+
messages.append({"role": "assistant", "content": "π‘ **GPT-4:** Synthesizing optimal solutions..."})
|
| 250 |
+
yield (gr.update(), gr.update(), messages, "**Status:** Synthesizing...", gr.update(), gr.update(), gr.update())
|
| 251 |
+
time.sleep(0.8)
|
| 252 |
+
|
| 253 |
# Results
|
| 254 |
root_cause = """
|
| 255 |
+
### π― Root Cause Identified
|
| 256 |
+
**Missing Dependency: `gradio`**
|
| 257 |
|
| 258 |
+
The error `ModuleNotFoundError: No module named 'gradio'` indicates that the `gradio` package is not installed in your current Python environment.
|
| 259 |
"""
|
| 260 |
|
| 261 |
sol1 = """
|
| 262 |
+
#### β
Solution 1: Install Package
|
|
|
|
|
|
|
| 263 |
|
| 264 |
+
Run the following command:
|
| 265 |
+
```bash
|
| 266 |
+
pip install gradio
|
| 267 |
+
```
|
| 268 |
<span class="badge badge-success">High Confidence</span>
|
| 269 |
"""
|
| 270 |
|
| 271 |
sol2 = """
|
| 272 |
+
#### π Solution 2: Check Environment
|
|
|
|
|
|
|
| 273 |
|
| 274 |
+
Ensure you are in the correct virtualenv:
|
| 275 |
+
```bash
|
| 276 |
+
source venv/bin/activate
|
| 277 |
+
```
|
| 278 |
<span class="badge badge-warning">Medium Confidence</span>
|
| 279 |
"""
|
| 280 |
|
| 281 |
messages.append({"role": "assistant", "content": "β
**System:** Analysis complete."})
|
| 282 |
|
| 283 |
+
# Reveal Results Section
|
| 284 |
yield (
|
| 285 |
+
gr.update(),
|
| 286 |
+
gr.update(visible=True), # Show Results
|
| 287 |
messages,
|
| 288 |
"**Status:** Complete",
|
| 289 |
root_cause,
|
| 290 |
+
sol1,
|
| 291 |
+
sol2
|
| 292 |
)
|
| 293 |
|
| 294 |
analyze_btn.click(
|
| 295 |
fn=mock_analyze,
|
| 296 |
inputs=[error_input, screenshot_input, files_input],
|
| 297 |
+
outputs=[
|
| 298 |
+
analysis_section,
|
| 299 |
+
results_section,
|
| 300 |
+
agent_status,
|
| 301 |
+
status_bar,
|
| 302 |
+
root_cause_box,
|
| 303 |
+
solution_1,
|
| 304 |
+
solution_2
|
| 305 |
+
]
|
| 306 |
)
|
| 307 |
|
| 308 |
return demo
|