Spaces:
Sleeping
Sleeping
feat: Implement Cyber-Glass UI with Bento Grid and Neon effects
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
"""
|
| 2 |
-
DebugGenie -
|
| 3 |
Redesigned for MCP 1st Birthday Hackathon
|
| 4 |
"""
|
| 5 |
import os
|
|
@@ -10,336 +10,415 @@ from theme import debuggenie_theme
|
|
| 10 |
# Check if Modal URL is configured
|
| 11 |
MODAL_API_URL = os.environ.get("MODAL_API_URL")
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
def create_hero_section():
|
| 14 |
"""Create the hero/header section with branding."""
|
| 15 |
return gr.Markdown("""
|
| 16 |
-
|
| 17 |
-
##
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
<
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
def create_main_interface():
|
| 25 |
-
"""Create the main
|
| 26 |
|
| 27 |
with gr.Blocks(
|
| 28 |
theme=debuggenie_theme,
|
| 29 |
-
title="DebugGenie -
|
| 30 |
-
css=
|
| 31 |
-
.gradio-container {
|
| 32 |
-
max-width: 1400px !important;
|
| 33 |
-
}
|
| 34 |
-
.agent-card {
|
| 35 |
-
background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
|
| 36 |
-
border-left: 4px solid #6366f1;
|
| 37 |
-
padding: 16px;
|
| 38 |
-
border-radius: 8px;
|
| 39 |
-
margin: 8px 0;
|
| 40 |
-
}
|
| 41 |
-
.solution-card {
|
| 42 |
-
border: 2px solid #475569;
|
| 43 |
-
border-radius: 12px;
|
| 44 |
-
padding: 20px;
|
| 45 |
-
background: #1e293b;
|
| 46 |
-
transition: all 0.3s ease;
|
| 47 |
-
}
|
| 48 |
-
.solution-card:hover {
|
| 49 |
-
border-color: #6366f1;
|
| 50 |
-
transform: translateY(-2px);
|
| 51 |
-
box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
|
| 52 |
-
}
|
| 53 |
-
.confidence-badge {
|
| 54 |
-
display: inline-block;
|
| 55 |
-
padding: 6px 12px;
|
| 56 |
-
border-radius: 20px;
|
| 57 |
-
font-weight: bold;
|
| 58 |
-
font-size: 14px;
|
| 59 |
-
}
|
| 60 |
-
.high-confidence {
|
| 61 |
-
background: linear-gradient(90deg, #10b981 0%, #059669 100%);
|
| 62 |
-
color: white;
|
| 63 |
-
}
|
| 64 |
-
.medium-confidence {
|
| 65 |
-
background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
|
| 66 |
-
color: white;
|
| 67 |
-
}
|
| 68 |
-
.low-confidence {
|
| 69 |
-
background: linear-gradient(90deg, #6b7280 0%, #4b5563 100%);
|
| 70 |
-
color: white;
|
| 71 |
-
}
|
| 72 |
-
"""
|
| 73 |
) as demo:
|
| 74 |
|
| 75 |
-
#
|
| 76 |
-
|
|
|
|
| 77 |
|
| 78 |
# Configuration Check
|
| 79 |
if not MODAL_API_URL:
|
| 80 |
-
gr.
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
else:
|
| 104 |
-
# Main
|
| 105 |
with gr.Tabs() as tabs:
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
| 108 |
with gr.Row():
|
| 109 |
-
|
| 110 |
-
|
|
|
|
| 111 |
gr.Markdown("### π₯ Error Input")
|
| 112 |
|
| 113 |
error_input = gr.Textbox(
|
| 114 |
label="Error Message / Stack Trace",
|
| 115 |
-
placeholder="Paste your error message
|
| 116 |
lines=8,
|
| 117 |
-
max_lines=15
|
|
|
|
| 118 |
)
|
| 119 |
|
| 120 |
with gr.Row():
|
| 121 |
screenshot_input = gr.Image(
|
| 122 |
-
label="πΈ Screenshot
|
| 123 |
type="pil",
|
| 124 |
-
height=
|
| 125 |
)
|
| 126 |
files_input = gr.File(
|
| 127 |
-
label="π
|
| 128 |
file_count="multiple",
|
| 129 |
-
|
| 130 |
)
|
| 131 |
|
| 132 |
with gr.Row():
|
| 133 |
analyze_btn = gr.Button(
|
| 134 |
-
"
|
| 135 |
variant="primary",
|
| 136 |
size="lg",
|
| 137 |
-
|
| 138 |
)
|
| 139 |
clear_btn = gr.Button(
|
| 140 |
-
"ποΈ
|
| 141 |
variant="secondary",
|
| 142 |
-
size="lg"
|
| 143 |
-
scale=1
|
| 144 |
)
|
| 145 |
-
|
| 146 |
-
# RIGHT
|
| 147 |
-
with gr.Column(scale=3):
|
| 148 |
-
gr.Markdown("### π€
|
| 149 |
|
| 150 |
agent_status = gr.Chatbot(
|
| 151 |
-
label="",
|
| 152 |
type="messages",
|
| 153 |
-
height=
|
| 154 |
bubble_full_width=False,
|
| 155 |
-
show_copy_button=True
|
|
|
|
| 156 |
)
|
| 157 |
|
| 158 |
status_bar = gr.Markdown(
|
| 159 |
-
"**Status:** Ready
|
| 160 |
-
elem_classes=["
|
| 161 |
)
|
| 162 |
-
|
| 163 |
-
#
|
| 164 |
gr.Markdown("---")
|
| 165 |
-
gr.Markdown("##
|
| 166 |
|
| 167 |
with gr.Row():
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
with gr.Row():
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
variant="secondary"
|
| 185 |
-
)
|
| 186 |
-
export_json_btn = gr.DownloadButton(
|
| 187 |
-
"π Export as JSON",
|
| 188 |
-
visible=False,
|
| 189 |
-
variant="secondary"
|
| 190 |
-
)
|
| 191 |
-
voice_btn = gr.Button(
|
| 192 |
-
"π Generate Voice Explanation",
|
| 193 |
-
visible=False,
|
| 194 |
-
variant="secondary"
|
| 195 |
-
)
|
| 196 |
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
visible=False
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
gr.Markdown("
|
| 207 |
-
|
| 208 |
-
# TAB 3: HISTORY
|
| 209 |
-
with gr.Tab("π― History", id=2):
|
| 210 |
-
gr.Markdown("### Analysis History")
|
| 211 |
history_df = gr.Dataframe(
|
| 212 |
-
headers=["Timestamp", "Error
|
| 213 |
datatype=["str", "str", "number", "str"],
|
| 214 |
-
|
| 215 |
-
|
| 216 |
)
|
| 217 |
-
|
| 218 |
-
# TAB
|
| 219 |
-
with gr.Tab("βοΈ
|
| 220 |
-
gr.Markdown("### Configuration")
|
| 221 |
-
|
| 222 |
with gr.Row():
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
# Event Handlers
|
| 240 |
def mock_analyze(error_text, screenshot, files, progress=gr.Progress()):
|
| 241 |
-
"""Mock analysis function for demo purposes."""
|
| 242 |
import time
|
| 243 |
|
| 244 |
-
# Simulate agent collaboration
|
| 245 |
messages = []
|
| 246 |
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
yield messages, "**Status:** π Analyzing with Claude...", gr.update(), gr.update(), gr.update(), gr.update()
|
| 253 |
-
time.sleep(0.5)
|
| 254 |
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
yield messages, "**Status:** π§ Gemini analyzing imports...", gr.update(), gr.update(), gr.update(), gr.update()
|
| 261 |
-
time.sleep(0.5)
|
| 262 |
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
yield messages, "**Status:** π‘ GPT-4 finding solutions...", gr.update(), gr.update(), gr.update(), gr.update()
|
| 269 |
-
time.sleep(0.5)
|
| 270 |
|
| 271 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 272 |
|
| 273 |
-
# Final
|
| 274 |
root_cause = """
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
</
|
| 281 |
"""
|
| 282 |
|
| 283 |
sol1 = """
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
|
|
|
|
|
|
| 290 |
"""
|
| 291 |
|
| 292 |
sol2 = """
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
|
|
|
|
|
|
|
|
|
| 298 |
"""
|
| 299 |
|
| 300 |
sol3 = """
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
<
|
| 306 |
-
</div>
|
| 307 |
"""
|
| 308 |
|
| 309 |
-
progress(1.0, desc="Analysis
|
|
|
|
| 310 |
|
| 311 |
yield (
|
| 312 |
messages,
|
| 313 |
-
"**Status:**
|
| 314 |
root_cause,
|
| 315 |
-
sol1,
|
| 316 |
-
sol2,
|
| 317 |
-
sol3
|
| 318 |
)
|
| 319 |
-
|
| 320 |
-
# Wire up the analyze button
|
| 321 |
analyze_btn.click(
|
| 322 |
fn=mock_analyze,
|
| 323 |
inputs=[error_input, screenshot_input, files_input],
|
| 324 |
outputs=[agent_status, status_bar, root_cause_box, solution_1, solution_2, solution_3]
|
| 325 |
)
|
| 326 |
|
| 327 |
-
# Clear button
|
| 328 |
clear_btn.click(
|
| 329 |
-
fn=lambda: ("", None, None, [], "**Status:**
|
| 330 |
-
outputs=[error_input, screenshot_input, files_input, agent_status, status_bar,
|
| 331 |
-
root_cause_box, solution_1, solution_2, solution_3]
|
| 332 |
)
|
| 333 |
-
|
| 334 |
-
# Footer
|
| 335 |
-
gr.Markdown("""
|
| 336 |
-
---
|
| 337 |
-
<div style="text-align: center; color: #94a3b8; font-size: 14px;">
|
| 338 |
-
π§ DebugGenie v2.0 | Powered by Claude, Gemini & GPT-4 |
|
| 339 |
-
<a href="https://github.com/nihald2000/debugging-assistant" style="color: #6366f1;">View on GitHub</a>
|
| 340 |
-
</div>
|
| 341 |
-
""")
|
| 342 |
-
|
| 343 |
return demo
|
| 344 |
|
| 345 |
if __name__ == "__main__":
|
|
|
|
| 1 |
"""
|
| 2 |
+
DebugGenie - Cyber-Glass UI Edition
|
| 3 |
Redesigned for MCP 1st Birthday Hackathon
|
| 4 |
"""
|
| 5 |
import os
|
|
|
|
| 10 |
# Check if Modal URL is configured
|
| 11 |
MODAL_API_URL = os.environ.get("MODAL_API_URL")
|
| 12 |
|
| 13 |
+
# --- CSS ARCHITECTURE ---
|
| 14 |
+
CYBER_GLASS_CSS = """
|
| 15 |
+
/* π Background Animation */
|
| 16 |
+
@keyframes gradient-animation {
|
| 17 |
+
0% { background-position: 0% 50%; }
|
| 18 |
+
50% { background-position: 100% 50%; }
|
| 19 |
+
100% { background-position: 0% 50%; }
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
body {
|
| 23 |
+
background: linear-gradient(-45deg, #020617, #0f172a, #1e1b4b, #0f172a);
|
| 24 |
+
background-size: 400% 400%;
|
| 25 |
+
animation: gradient-animation 15s ease infinite;
|
| 26 |
+
color: #f8fafc;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/* πͺ Glassmorphism Base Class */
|
| 30 |
+
.glass-panel {
|
| 31 |
+
background: rgba(30, 41, 59, 0.4) !important;
|
| 32 |
+
backdrop-filter: blur(12px);
|
| 33 |
+
-webkit-backdrop-filter: blur(12px);
|
| 34 |
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
| 35 |
+
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
|
| 36 |
+
border-radius: 16px !important;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
/* β‘ Neon Accents */
|
| 40 |
+
.neon-border {
|
| 41 |
+
border: 1px solid rgba(99, 102, 241, 0.3);
|
| 42 |
+
box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
|
| 43 |
+
transition: all 0.3s ease;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
.neon-border:hover {
|
| 47 |
+
border-color: #6366f1;
|
| 48 |
+
box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
/* π± Bento Grid Layout Components */
|
| 52 |
+
|
| 53 |
+
/* Header */
|
| 54 |
+
.header-glass {
|
| 55 |
+
background: rgba(15, 23, 42, 0.6);
|
| 56 |
+
backdrop-filter: blur(10px);
|
| 57 |
+
border-bottom: 1px solid rgba(99, 102, 241, 0.2);
|
| 58 |
+
padding: 20px;
|
| 59 |
+
margin-bottom: 20px;
|
| 60 |
+
border-radius: 0 0 20px 20px;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/* Agent Command Deck (Right Panel) */
|
| 64 |
+
.agent-deck {
|
| 65 |
+
background: rgba(15, 23, 42, 0.5) !important;
|
| 66 |
+
border-left: 2px solid #6366f1;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
/* Solution Cards */
|
| 70 |
+
.solution-card-glass {
|
| 71 |
+
background: rgba(30, 41, 59, 0.4);
|
| 72 |
+
backdrop-filter: blur(8px);
|
| 73 |
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
| 74 |
+
border-radius: 12px;
|
| 75 |
+
padding: 20px;
|
| 76 |
+
transition: all 0.3s ease;
|
| 77 |
+
height: 100%;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
.solution-card-glass:hover {
|
| 81 |
+
transform: translateY(-5px);
|
| 82 |
+
background: rgba(30, 41, 59, 0.6);
|
| 83 |
+
border-color: #8b5cf6;
|
| 84 |
+
box-shadow: 0 10px 30px -10px rgba(139, 92, 246, 0.3);
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
/* Confidence Badges */
|
| 88 |
+
.badge-high {
|
| 89 |
+
background: linear-gradient(135deg, #059669 0%, #10b981 100%);
|
| 90 |
+
color: white;
|
| 91 |
+
padding: 4px 12px;
|
| 92 |
+
border-radius: 20px;
|
| 93 |
+
font-weight: 600;
|
| 94 |
+
box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
.badge-med {
|
| 98 |
+
background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
|
| 99 |
+
color: white;
|
| 100 |
+
padding: 4px 12px;
|
| 101 |
+
border-radius: 20px;
|
| 102 |
+
font-weight: 600;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
.badge-low {
|
| 106 |
+
background: linear-gradient(135deg, #4b5563 0%, #6b7280 100%);
|
| 107 |
+
color: white;
|
| 108 |
+
padding: 4px 12px;
|
| 109 |
+
border-radius: 20px;
|
| 110 |
+
font-weight: 600;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
/* Custom Scrollbar */
|
| 114 |
+
::-webkit-scrollbar {
|
| 115 |
+
width: 8px;
|
| 116 |
+
height: 8px;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
::-webkit-scrollbar-track {
|
| 120 |
+
background: rgba(15, 23, 42, 0.5);
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
::-webkit-scrollbar-thumb {
|
| 124 |
+
background: #475569;
|
| 125 |
+
border-radius: 4px;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
::-webkit-scrollbar-thumb:hover {
|
| 129 |
+
background: #6366f1;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
/* Typewriter Effect for Logs */
|
| 133 |
+
.typewriter {
|
| 134 |
+
font-family: 'JetBrains Mono', monospace;
|
| 135 |
+
overflow: hidden;
|
| 136 |
+
white-space: nowrap;
|
| 137 |
+
border-right: 2px solid #6366f1;
|
| 138 |
+
animation: typing 3.5s steps(40, end), blink-caret .75s step-end infinite;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
/* Pulse Animation for Active Agents */
|
| 142 |
+
@keyframes pulse-glow {
|
| 143 |
+
0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
|
| 144 |
+
70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
|
| 145 |
+
100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
.agent-active {
|
| 149 |
+
animation: pulse-glow 2s infinite;
|
| 150 |
+
border-color: #6366f1 !important;
|
| 151 |
+
}
|
| 152 |
+
"""
|
| 153 |
+
|
| 154 |
def create_hero_section():
|
| 155 |
"""Create the hero/header section with branding."""
|
| 156 |
return gr.Markdown("""
|
| 157 |
+
<div style="text-align: center; margin-bottom: 20px;">
|
| 158 |
+
<h1 style="font-size: 3.5rem; background: linear-gradient(to right, #818cf8, #c084fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 0;">
|
| 159 |
+
π§ DebugGenie
|
| 160 |
+
</h1>
|
| 161 |
+
<p style="font-size: 1.2rem; color: #94a3b8; margin-top: 10px;">
|
| 162 |
+
<span style="border: 1px solid #6366f1; padding: 4px 12px; border-radius: 20px; color: #818cf8; font-size: 0.9rem;">v2.0</span>
|
| 163 |
+
AI-Powered Multi-Agent Debugging Assistant
|
| 164 |
+
</p>
|
| 165 |
+
</div>
|
| 166 |
+
""")
|
| 167 |
|
| 168 |
def create_main_interface():
|
| 169 |
+
"""Create the main interface with Bento Grid layout."""
|
| 170 |
|
| 171 |
with gr.Blocks(
|
| 172 |
theme=debuggenie_theme,
|
| 173 |
+
title="DebugGenie - Cyber-Glass Edition",
|
| 174 |
+
css=CYBER_GLASS_CSS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
) as demo:
|
| 176 |
|
| 177 |
+
# 1. Header Section (Glass)
|
| 178 |
+
with gr.Row(elem_classes=["header-glass"]):
|
| 179 |
+
create_hero_section()
|
| 180 |
|
| 181 |
# Configuration Check
|
| 182 |
if not MODAL_API_URL:
|
| 183 |
+
with gr.Row():
|
| 184 |
+
with gr.Column(elem_classes=["glass-panel", "neon-border"]):
|
| 185 |
+
gr.Markdown("""
|
| 186 |
+
## β οΈ Configuration Required
|
| 187 |
+
|
| 188 |
+
This Space requires a `MODAL_API_URL` secret to be configured.
|
| 189 |
+
|
| 190 |
+
### Setup Instructions:
|
| 191 |
+
|
| 192 |
+
1. **Deploy Modal Backend** (if not done already):
|
| 193 |
+
```bash
|
| 194 |
+
modal deploy modal_app.py
|
| 195 |
+
```
|
| 196 |
+
Copy the URL from the output.
|
| 197 |
+
|
| 198 |
+
2. **Configure Secret**:
|
| 199 |
+
- Go to Settings β Repository secrets
|
| 200 |
+
- Add a new secret:
|
| 201 |
+
- Name: `MODAL_API_URL`
|
| 202 |
+
- Value: Your Modal endpoint URL
|
| 203 |
+
|
| 204 |
+
3. **Restart this Space** (it will restart automatically after adding the secret)
|
| 205 |
+
""")
|
| 206 |
else:
|
| 207 |
+
# Main Bento Grid Layout
|
| 208 |
with gr.Tabs() as tabs:
|
| 209 |
+
|
| 210 |
+
# TAB 1: COMMAND CENTER (Main Analysis)
|
| 211 |
+
with gr.Tab("π Command Center", id=0):
|
| 212 |
+
|
| 213 |
+
# Top Row: Input & Live Feed
|
| 214 |
with gr.Row():
|
| 215 |
+
|
| 216 |
+
# LEFT: Input Control Panel (Glass)
|
| 217 |
+
with gr.Column(scale=2, elem_classes=["glass-panel"]):
|
| 218 |
gr.Markdown("### π₯ Error Input")
|
| 219 |
|
| 220 |
error_input = gr.Textbox(
|
| 221 |
label="Error Message / Stack Trace",
|
| 222 |
+
placeholder="Paste your error message here...",
|
| 223 |
lines=8,
|
| 224 |
+
max_lines=15,
|
| 225 |
+
elem_id="error-input"
|
| 226 |
)
|
| 227 |
|
| 228 |
with gr.Row():
|
| 229 |
screenshot_input = gr.Image(
|
| 230 |
+
label="πΈ Screenshot",
|
| 231 |
type="pil",
|
| 232 |
+
height=150
|
| 233 |
)
|
| 234 |
files_input = gr.File(
|
| 235 |
+
label="π Context Files",
|
| 236 |
file_count="multiple",
|
| 237 |
+
height=150
|
| 238 |
)
|
| 239 |
|
| 240 |
with gr.Row():
|
| 241 |
analyze_btn = gr.Button(
|
| 242 |
+
"β‘ Initialize Analysis",
|
| 243 |
variant="primary",
|
| 244 |
size="lg",
|
| 245 |
+
elem_classes=["neon-border"]
|
| 246 |
)
|
| 247 |
clear_btn = gr.Button(
|
| 248 |
+
"ποΈ Reset System",
|
| 249 |
variant="secondary",
|
| 250 |
+
size="lg"
|
|
|
|
| 251 |
)
|
| 252 |
+
|
| 253 |
+
# RIGHT: Agent Command Deck (Glass)
|
| 254 |
+
with gr.Column(scale=3, elem_classes=["glass-panel", "agent-deck"]):
|
| 255 |
+
gr.Markdown("### π€ Agent Neural Link")
|
| 256 |
|
| 257 |
agent_status = gr.Chatbot(
|
| 258 |
+
label="Live Agent Communication",
|
| 259 |
type="messages",
|
| 260 |
+
height=450,
|
| 261 |
bubble_full_width=False,
|
| 262 |
+
show_copy_button=True,
|
| 263 |
+
avatar_images=(None, "https://api.iconify.design/fluent-emoji:robot.svg")
|
| 264 |
)
|
| 265 |
|
| 266 |
status_bar = gr.Markdown(
|
| 267 |
+
"**System Status:** π’ Ready for input",
|
| 268 |
+
elem_classes=["glass-panel"]
|
| 269 |
)
|
| 270 |
+
|
| 271 |
+
# Bottom Row: Solution Matrix
|
| 272 |
gr.Markdown("---")
|
| 273 |
+
gr.Markdown("## π§© Solution Matrix")
|
| 274 |
|
| 275 |
with gr.Row():
|
| 276 |
+
# Root Cause Card
|
| 277 |
+
with gr.Column(scale=1):
|
| 278 |
+
root_cause_box = gr.Markdown(
|
| 279 |
+
"""
|
| 280 |
+
<div style="text-align: center; padding: 40px; color: #64748b;">
|
| 281 |
+
Waiting for analysis data...
|
| 282 |
+
</div>
|
| 283 |
+
""",
|
| 284 |
+
elem_classes=["solution-card-glass", "neon-border"]
|
| 285 |
+
)
|
| 286 |
+
|
| 287 |
+
# Solution Cards
|
| 288 |
with gr.Row():
|
| 289 |
+
solution_1 = gr.Markdown(visible=False, elem_classes=["solution-card-glass"])
|
| 290 |
+
solution_2 = gr.Markdown(visible=False, elem_classes=["solution-card-glass"])
|
| 291 |
+
solution_3 = gr.Markdown(visible=False, elem_classes=["solution-card-glass"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 292 |
|
| 293 |
+
# Action Bar
|
| 294 |
+
with gr.Row(elem_classes=["glass-panel"], style="margin-top: 20px; padding: 10px;"):
|
| 295 |
+
export_md_btn = gr.DownloadButton("π Export Report", visible=False)
|
| 296 |
+
export_json_btn = gr.DownloadButton("π Export Data", visible=False)
|
| 297 |
+
voice_btn = gr.Button("π Voice Briefing", visible=False)
|
| 298 |
+
audio_output = gr.Audio(label="Voice Output", visible=False, interactive=False)
|
| 299 |
+
|
| 300 |
+
# TAB 2: DATA VAULT (History)
|
| 301 |
+
with gr.Tab("πΎ Data Vault", id=1):
|
| 302 |
+
gr.Markdown("### π Analysis Logs")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 303 |
history_df = gr.Dataframe(
|
| 304 |
+
headers=["Timestamp", "Error Signature", "Confidence", "Status"],
|
| 305 |
datatype=["str", "str", "number", "str"],
|
| 306 |
+
interactive=False,
|
| 307 |
+
elem_classes=["glass-panel"]
|
| 308 |
)
|
| 309 |
+
|
| 310 |
+
# TAB 3: SYSTEM CONFIG
|
| 311 |
+
with gr.Tab("βοΈ System Config", id=2):
|
|
|
|
|
|
|
| 312 |
with gr.Row():
|
| 313 |
+
with gr.Column(elem_classes=["glass-panel"]):
|
| 314 |
+
gr.Markdown("### π§ Agent Configuration")
|
| 315 |
+
model_choice = gr.Dropdown(
|
| 316 |
+
choices=["All Agents (Swarm Mode)", "Claude Only", "Gemini Only", "GPT-4 Only"],
|
| 317 |
+
value="All Agents (Swarm Mode)",
|
| 318 |
+
label="Active Neural Network"
|
| 319 |
+
)
|
| 320 |
+
voice_enabled = gr.Checkbox(
|
| 321 |
+
label="Enable Vocal Synthesis",
|
| 322 |
+
value=True
|
| 323 |
+
)
|
| 324 |
+
|
| 325 |
+
gr.Markdown(f"""
|
| 326 |
+
**Backend Uplink:** `{MODAL_API_URL or 'Disconnected π΄'}`
|
| 327 |
+
""")
|
| 328 |
+
|
| 329 |
+
# Event Handlers (Mock Logic for UI Demo)
|
| 330 |
def mock_analyze(error_text, screenshot, files, progress=gr.Progress()):
|
|
|
|
| 331 |
import time
|
| 332 |
|
|
|
|
| 333 |
messages = []
|
| 334 |
|
| 335 |
+
# Step 1: Initialization
|
| 336 |
+
progress(0.1, desc="Establishing neural link...")
|
| 337 |
+
messages.append({"role": "assistant", "content": "π **System:** Initializing multi-agent swarm..."})
|
| 338 |
+
yield messages, "**Status:** π‘ Initializing...", gr.update(), gr.update(), gr.update(), gr.update()
|
| 339 |
+
time.sleep(0.8)
|
|
|
|
|
|
|
| 340 |
|
| 341 |
+
# Step 2: Claude Analysis
|
| 342 |
+
progress(0.3, desc="Claude analyzing syntax...")
|
| 343 |
+
messages.append({"role": "assistant", "content": "π€ **Claude:** Scanning code structure and syntax trees..."})
|
| 344 |
+
yield messages, "**Status:** π΅ Claude Analyzing...", gr.update(), gr.update(), gr.update(), gr.update()
|
| 345 |
+
time.sleep(1.0)
|
|
|
|
|
|
|
| 346 |
|
| 347 |
+
# Step 3: Gemini Analysis
|
| 348 |
+
progress(0.5, desc="Gemini checking context...")
|
| 349 |
+
messages.append({"role": "assistant", "content": "π§ **Gemini:** Cross-referencing with documentation and known issues..."})
|
| 350 |
+
yield messages, "**Status:** π£ Gemini Processing...", gr.update(), gr.update(), gr.update(), gr.update()
|
| 351 |
+
time.sleep(1.0)
|
|
|
|
|
|
|
| 352 |
|
| 353 |
+
# Step 4: GPT-4 Synthesis
|
| 354 |
+
progress(0.8, desc="GPT-4 synthesizing solutions...")
|
| 355 |
+
messages.append({"role": "assistant", "content": "π‘ **GPT-4:** Synthesizing findings and generating optimal solutions..."})
|
| 356 |
+
yield messages, "**Status:** π’ Synthesizing...", gr.update(), gr.update(), gr.update(), gr.update()
|
| 357 |
+
time.sleep(1.0)
|
| 358 |
|
| 359 |
+
# Final Results
|
| 360 |
root_cause = """
|
| 361 |
+
### π― Root Cause Identified
|
| 362 |
+
**ImportError: Module not found**
|
| 363 |
+
|
| 364 |
+
The system detected a missing dependency in the environment configuration. The module `gradio` is attempting to access a resource that is not installed.
|
| 365 |
+
|
| 366 |
+
<span class="badge-high">98% Confidence</span>
|
| 367 |
"""
|
| 368 |
|
| 369 |
sol1 = """
|
| 370 |
+
#### β
Optimal Solution
|
| 371 |
+
**Install Missing Package**
|
| 372 |
+
|
| 373 |
+
Run the following command:
|
| 374 |
+
```bash
|
| 375 |
+
pip install gradio[mcp]
|
| 376 |
+
```
|
| 377 |
+
<span class="badge-high">98% Success Rate</span>
|
| 378 |
"""
|
| 379 |
|
| 380 |
sol2 = """
|
| 381 |
+
#### π Alternative
|
| 382 |
+
**Check Virtual Environment**
|
| 383 |
+
|
| 384 |
+
Ensure you are active in the correct venv:
|
| 385 |
+
```bash
|
| 386 |
+
source venv/bin/activate
|
| 387 |
+
```
|
| 388 |
+
<span class="badge-med">75% Probability</span>
|
| 389 |
"""
|
| 390 |
|
| 391 |
sol3 = """
|
| 392 |
+
#### π§ Patch
|
| 393 |
+
**Manual Path Add**
|
| 394 |
+
|
| 395 |
+
Add the library path manually to `sys.path`.
|
| 396 |
+
<span class="badge-low">40% Recommended</span>
|
|
|
|
| 397 |
"""
|
| 398 |
|
| 399 |
+
progress(1.0, desc="Analysis Complete")
|
| 400 |
+
messages.append({"role": "assistant", "content": "β
**System:** Analysis complete. Solutions generated."})
|
| 401 |
|
| 402 |
yield (
|
| 403 |
messages,
|
| 404 |
+
"**Status:** π’ Ready",
|
| 405 |
root_cause,
|
| 406 |
+
gr.update(value=sol1, visible=True),
|
| 407 |
+
gr.update(value=sol2, visible=True),
|
| 408 |
+
gr.update(value=sol3, visible=True)
|
| 409 |
)
|
| 410 |
+
|
|
|
|
| 411 |
analyze_btn.click(
|
| 412 |
fn=mock_analyze,
|
| 413 |
inputs=[error_input, screenshot_input, files_input],
|
| 414 |
outputs=[agent_status, status_bar, root_cause_box, solution_1, solution_2, solution_3]
|
| 415 |
)
|
| 416 |
|
|
|
|
| 417 |
clear_btn.click(
|
| 418 |
+
fn=lambda: ("", None, None, [], "**Status:** π’ Ready", "", gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)),
|
| 419 |
+
outputs=[error_input, screenshot_input, files_input, agent_status, status_bar, root_cause_box, solution_1, solution_2, solution_3]
|
|
|
|
| 420 |
)
|
| 421 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 422 |
return demo
|
| 423 |
|
| 424 |
if __name__ == "__main__":
|
theme.py
CHANGED
|
@@ -1,12 +1,13 @@
|
|
| 1 |
"""
|
| 2 |
DebugGenie Custom Theme for Gradio 6
|
| 3 |
-
Professional dark theme optimized for developer tools
|
| 4 |
"""
|
| 5 |
import gradio as gr
|
| 6 |
|
| 7 |
def create_debuggenie_theme():
|
| 8 |
"""Create the custom DebugGenie theme with professional dark mode."""
|
| 9 |
|
|
|
|
| 10 |
theme = gr.themes.Soft(
|
| 11 |
primary_hue="indigo",
|
| 12 |
secondary_hue="purple",
|
|
@@ -30,16 +31,16 @@ def create_debuggenie_theme():
|
|
| 30 |
body_text_color="#f1f5f9",
|
| 31 |
body_text_color_subdued="#cbd5e1",
|
| 32 |
|
| 33 |
-
# Backgrounds
|
| 34 |
-
body_background_fill="
|
| 35 |
-
block_background_fill="
|
| 36 |
|
| 37 |
# Borders
|
| 38 |
-
border_color_primary="
|
| 39 |
|
| 40 |
# Shadows for depth
|
| 41 |
-
shadow_drop="0 10px 15px -3px rgba(0, 0, 0, 0.
|
| 42 |
-
shadow_drop_lg="0 20px 25px -5px rgba(0, 0, 0, 0.
|
| 43 |
)
|
| 44 |
|
| 45 |
return theme
|
|
|
|
| 1 |
"""
|
| 2 |
DebugGenie Custom Theme for Gradio 6
|
| 3 |
+
Professional dark theme optimized for developer tools with Cyber-Glass aesthetics
|
| 4 |
"""
|
| 5 |
import gradio as gr
|
| 6 |
|
| 7 |
def create_debuggenie_theme():
|
| 8 |
"""Create the custom DebugGenie theme with professional dark mode."""
|
| 9 |
|
| 10 |
+
# Base theme - using Slate as neutral for that deep code-editor feel
|
| 11 |
theme = gr.themes.Soft(
|
| 12 |
primary_hue="indigo",
|
| 13 |
secondary_hue="purple",
|
|
|
|
| 31 |
body_text_color="#f1f5f9",
|
| 32 |
body_text_color_subdued="#cbd5e1",
|
| 33 |
|
| 34 |
+
# Backgrounds - Deep dark for contrast with glass elements
|
| 35 |
+
body_background_fill="#020617", # Slate 950
|
| 36 |
+
block_background_fill="#0f172a", # Slate 900
|
| 37 |
|
| 38 |
# Borders
|
| 39 |
+
border_color_primary="#334155", # Slate 700
|
| 40 |
|
| 41 |
# Shadows for depth
|
| 42 |
+
shadow_drop="0 10px 15px -3px rgba(0, 0, 0, 0.5)",
|
| 43 |
+
shadow_drop_lg="0 20px 25px -5px rgba(0, 0, 0, 0.6)",
|
| 44 |
)
|
| 45 |
|
| 46 |
return theme
|