Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,8 +9,13 @@ except Exception as e:
|
|
| 9 |
print(f"Startup Error: {e}")
|
| 10 |
|
| 11 |
def chat_logic(message, history, mode_selection):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
if not chimera:
|
| 13 |
-
|
|
|
|
| 14 |
return history, ""
|
| 15 |
|
| 16 |
# Map friendly names
|
|
@@ -28,10 +33,10 @@ def chat_logic(message, history, mode_selection):
|
|
| 28 |
# Format output
|
| 29 |
final_response = f"**[{active_module} Active]**\n\n{response_text}"
|
| 30 |
|
| 31 |
-
# --- THE FIX:
|
| 32 |
-
#
|
| 33 |
-
|
| 34 |
-
history.append(
|
| 35 |
|
| 36 |
return history, ""
|
| 37 |
|
|
@@ -54,8 +59,7 @@ with gr.Blocks(title="Axon Trinity") as demo:
|
|
| 54 |
|
| 55 |
with gr.Row():
|
| 56 |
with gr.Column(scale=4):
|
| 57 |
-
#
|
| 58 |
-
# But we DO feed it dictionaries (to avoid the second error)
|
| 59 |
chatbot = gr.Chatbot(elem_id="chatbot")
|
| 60 |
|
| 61 |
with gr.Column(scale=1):
|
|
|
|
| 9 |
print(f"Startup Error: {e}")
|
| 10 |
|
| 11 |
def chat_logic(message, history, mode_selection):
|
| 12 |
+
# Ensure history is a list
|
| 13 |
+
if history is None:
|
| 14 |
+
history = []
|
| 15 |
+
|
| 16 |
if not chimera:
|
| 17 |
+
# Universal Format: [User Message, Bot Message]
|
| 18 |
+
history.append([message, "❌ Error: API Keys missing. Check Settings -> Secrets."])
|
| 19 |
return history, ""
|
| 20 |
|
| 21 |
# Map friendly names
|
|
|
|
| 33 |
# Format output
|
| 34 |
final_response = f"**[{active_module} Active]**\n\n{response_text}"
|
| 35 |
|
| 36 |
+
# --- THE FIX: UNIVERSAL LIST FORMAT ---
|
| 37 |
+
# We append a simple list: [User, Assistant]
|
| 38 |
+
# This works on ALL Gradio versions.
|
| 39 |
+
history.append([message, final_response])
|
| 40 |
|
| 41 |
return history, ""
|
| 42 |
|
|
|
|
| 59 |
|
| 60 |
with gr.Row():
|
| 61 |
with gr.Column(scale=4):
|
| 62 |
+
# No 'type' argument -> Defaults to Universal Mode
|
|
|
|
| 63 |
chatbot = gr.Chatbot(elem_id="chatbot")
|
| 64 |
|
| 65 |
with gr.Column(scale=1):
|