Tpayne101 commited on
Commit
93d62e3
·
verified ·
1 Parent(s): f422e00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
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 pure string
18
  result = agent.run(message)
19
  response = result if isinstance(result, str) else str(result)
20
 
21
- # Append cleanly formatted conversation
22
  history = list(history)
23
  history.append((message, response))
24
 
25
- # Return response and full history (Gradio-safe)
26
  return response, history
27
 
28
 
29
- # --- Graph rendering (optional visual debugging tool) ---
30
  def render_graph():
31
- return "Graph visualization placeholder (coming Phase 4+)"
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="tuple",
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("---")