updated
Browse files- frontend/app.py +15 -2
frontend/app.py
CHANGED
|
@@ -2,6 +2,7 @@ import gradio as gr
|
|
| 2 |
import uuid
|
| 3 |
import sys
|
| 4 |
import os
|
|
|
|
| 5 |
|
| 6 |
# Add project root to Python path
|
| 7 |
sys.path.append(
|
|
@@ -19,7 +20,7 @@ from backend import Agent
|
|
| 19 |
def chat_with_agent(message, history, session_id):
|
| 20 |
"""
|
| 21 |
Directly calls Agent.run_agent()
|
| 22 |
-
|
| 23 |
"""
|
| 24 |
|
| 25 |
try:
|
|
@@ -31,7 +32,19 @@ def chat_with_agent(message, history, session_id):
|
|
| 31 |
return response
|
| 32 |
|
| 33 |
except Exception as e:
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
|
| 37 |
with gr.Blocks(
|
|
|
|
| 2 |
import uuid
|
| 3 |
import sys
|
| 4 |
import os
|
| 5 |
+
import traceback
|
| 6 |
|
| 7 |
# Add project root to Python path
|
| 8 |
sys.path.append(
|
|
|
|
| 20 |
def chat_with_agent(message, history, session_id):
|
| 21 |
"""
|
| 22 |
Directly calls Agent.run_agent()
|
| 23 |
+
and prints detailed errors to HF Space logs.
|
| 24 |
"""
|
| 25 |
|
| 26 |
try:
|
|
|
|
| 32 |
return response
|
| 33 |
|
| 34 |
except Exception as e:
|
| 35 |
+
|
| 36 |
+
error_trace = traceback.format_exc()
|
| 37 |
+
|
| 38 |
+
print("\n" + "=" * 80)
|
| 39 |
+
print("SMART SUPPORT AI ERROR")
|
| 40 |
+
print("=" * 80)
|
| 41 |
+
print(error_trace)
|
| 42 |
+
print("=" * 80 + "\n")
|
| 43 |
+
|
| 44 |
+
return (
|
| 45 |
+
f"⚠️ Error Type: {type(e).__name__}\n\n"
|
| 46 |
+
f"Error Message:\n{str(e)}"
|
| 47 |
+
)
|
| 48 |
|
| 49 |
|
| 50 |
with gr.Blocks(
|