Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,21 +14,21 @@ def chat(message, history=None):
|
|
| 14 |
if history is None:
|
| 15 |
history = []
|
| 16 |
|
| 17 |
-
# Get agent response as a
|
| 18 |
result = agent.run(message)
|
| 19 |
response = result if isinstance(result, str) else str(result)
|
| 20 |
|
| 21 |
-
# Append
|
| 22 |
history = list(history)
|
| 23 |
history.append((message, response))
|
| 24 |
|
| 25 |
-
# Return response and
|
| 26 |
return response, history
|
| 27 |
|
| 28 |
|
| 29 |
-
# --- Graph rendering (
|
| 30 |
def render_graph():
|
| 31 |
-
return "Graph visualization placeholder
|
| 32 |
|
| 33 |
|
| 34 |
# --- Build Gradio UI ---
|
|
@@ -37,7 +37,7 @@ with gr.Blocks(title="Aventra OS") as demo:
|
|
| 37 |
|
| 38 |
chatbot = gr.Chatbot(
|
| 39 |
label="Aventra Chat",
|
| 40 |
-
type="
|
| 41 |
show_label=True,
|
| 42 |
height=500
|
| 43 |
)
|
|
@@ -49,7 +49,6 @@ with gr.Blocks(title="Aventra OS") as demo:
|
|
| 49 |
)
|
| 50 |
|
| 51 |
send_btn = gr.Button("Send", variant="primary")
|
| 52 |
-
|
| 53 |
send_btn.click(chat, inputs=[msg_box, chatbot], outputs=[msg_box, chatbot])
|
| 54 |
|
| 55 |
gr.Markdown("---")
|
|
|
|
| 14 |
if history is None:
|
| 15 |
history = []
|
| 16 |
|
| 17 |
+
# Get agent response as a clean string
|
| 18 |
result = agent.run(message)
|
| 19 |
response = result if isinstance(result, str) else str(result)
|
| 20 |
|
| 21 |
+
# Append conversation tuple
|
| 22 |
history = list(history)
|
| 23 |
history.append((message, response))
|
| 24 |
|
| 25 |
+
# Return response and history in valid Gradio format
|
| 26 |
return response, history
|
| 27 |
|
| 28 |
|
| 29 |
+
# --- Graph rendering (placeholder for Phase 4 visualization) ---
|
| 30 |
def render_graph():
|
| 31 |
+
return "🧠 Graph visualization placeholder — coming in Phase 4"
|
| 32 |
|
| 33 |
|
| 34 |
# --- Build Gradio UI ---
|
|
|
|
| 37 |
|
| 38 |
chatbot = gr.Chatbot(
|
| 39 |
label="Aventra Chat",
|
| 40 |
+
type="tuples", # ✅ Correct keyword
|
| 41 |
show_label=True,
|
| 42 |
height=500
|
| 43 |
)
|
|
|
|
| 49 |
)
|
| 50 |
|
| 51 |
send_btn = gr.Button("Send", variant="primary")
|
|
|
|
| 52 |
send_btn.click(chat, inputs=[msg_box, chatbot], outputs=[msg_box, chatbot])
|
| 53 |
|
| 54 |
gr.Markdown("---")
|