Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,8 +10,7 @@ except Exception as e:
|
|
| 10 |
|
| 11 |
def chat_logic(message, history, mode_selection):
|
| 12 |
if not chimera:
|
| 13 |
-
|
| 14 |
-
history.append((message, "❌ Error: API Keys missing. Check Settings -> Secrets."))
|
| 15 |
return history, ""
|
| 16 |
|
| 17 |
# Map friendly names
|
|
@@ -29,9 +28,10 @@ def chat_logic(message, history, mode_selection):
|
|
| 29 |
# Format output
|
| 30 |
final_response = f"**[{active_module} Active]**\n\n{response_text}"
|
| 31 |
|
| 32 |
-
# --- THE FIX:
|
| 33 |
-
#
|
| 34 |
-
history.append(
|
|
|
|
| 35 |
|
| 36 |
return history, ""
|
| 37 |
|
|
@@ -48,13 +48,14 @@ header {display: none !important;}
|
|
| 48 |
}
|
| 49 |
"""
|
| 50 |
|
| 51 |
-
# NOTE: Removed type="messages" from Chatbot to fix the crash
|
| 52 |
with gr.Blocks(title="Axon Trinity") as demo:
|
| 53 |
gr.Markdown("# ⚔️ AXON: QWEN TRINITY")
|
| 54 |
gr.Markdown("*> Pipeline: Gemini (Plan) ➔ Qwen 3 (Code) ➔ Llama 3.3 (Refine)*")
|
| 55 |
|
| 56 |
with gr.Row():
|
| 57 |
with gr.Column(scale=4):
|
|
|
|
|
|
|
| 58 |
chatbot = gr.Chatbot(elem_id="chatbot")
|
| 59 |
|
| 60 |
with gr.Column(scale=1):
|
|
|
|
| 10 |
|
| 11 |
def chat_logic(message, history, mode_selection):
|
| 12 |
if not chimera:
|
| 13 |
+
history.append({"role": "assistant", "content": "❌ Error: API Keys missing. Check Settings -> Secrets."})
|
|
|
|
| 14 |
return history, ""
|
| 15 |
|
| 16 |
# Map friendly names
|
|
|
|
| 28 |
# Format output
|
| 29 |
final_response = f"**[{active_module} Active]**\n\n{response_text}"
|
| 30 |
|
| 31 |
+
# --- THE FIX: DICTIONARY FORMAT ---
|
| 32 |
+
# The error explicitly asked for 'role' and 'content' keys.
|
| 33 |
+
history.append({"role": "user", "content": message})
|
| 34 |
+
history.append({"role": "assistant", "content": final_response})
|
| 35 |
|
| 36 |
return history, ""
|
| 37 |
|
|
|
|
| 48 |
}
|
| 49 |
"""
|
| 50 |
|
|
|
|
| 51 |
with gr.Blocks(title="Axon Trinity") as demo:
|
| 52 |
gr.Markdown("# ⚔️ AXON: QWEN TRINITY")
|
| 53 |
gr.Markdown("*> Pipeline: Gemini (Plan) ➔ Qwen 3 (Code) ➔ Llama 3.3 (Refine)*")
|
| 54 |
|
| 55 |
with gr.Row():
|
| 56 |
with gr.Column(scale=4):
|
| 57 |
+
# We do NOT put type="messages" here (to avoid the first error)
|
| 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):
|