AIencoder commited on
Commit
c09d256
·
verified ·
1 Parent(s): b4869ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -17,7 +17,7 @@ def chat_logic(message, image_file, history, mode):
17
  return history, "", None
18
 
19
  if not chimera:
20
- history.append([message, "❌ Error: API Keys missing."])
21
  return history, "", None
22
 
23
  # 2. Process Request
@@ -26,14 +26,13 @@ def chat_logic(message, image_file, history, mode):
26
  # 3. Format Output
27
  final_response = f"**[{active_module} Active]**\n\n{response_text}"
28
 
29
- # 4. Append to History (Universal List Format)
30
- # We use simple lists [User, Bot] which works on Gradio 5.x
31
  if image_file:
32
- user_msg = f"[Uploaded Image] {message}"
33
  else:
34
- user_msg = message
35
-
36
- history.append([user_msg, final_response])
37
 
38
  return history, "", None
39
 
@@ -48,7 +47,8 @@ with gr.Blocks(title="Axon God Mode", css=custom_css) as demo:
48
  gr.Markdown("*> Modules: VIM (Vision) | NET (Web) | IGM (Art) | ASM (Code)*")
49
 
50
  with gr.Row():
51
- chatbot = gr.Chatbot(height=500, elem_id="chatbot")
 
52
 
53
  with gr.Row():
54
  with gr.Column(scale=4):
 
17
  return history, "", None
18
 
19
  if not chimera:
20
+ history.append({"role": "assistant", "content": "❌ Error: API Keys missing."})
21
  return history, "", None
22
 
23
  # 2. Process Request
 
26
  # 3. Format Output
27
  final_response = f"**[{active_module} Active]**\n\n{response_text}"
28
 
29
+ # 4. Append to History (DICTIONARY FORMAT - Required for 4.44.1)
 
30
  if image_file:
31
+ history.append({"role": "user", "content": f"[Uploaded Image] {message}"})
32
  else:
33
+ history.append({"role": "user", "content": message})
34
+
35
+ history.append({"role": "assistant", "content": final_response})
36
 
37
  return history, "", None
38
 
 
47
  gr.Markdown("*> Modules: VIM (Vision) | NET (Web) | IGM (Art) | ASM (Code)*")
48
 
49
  with gr.Row():
50
+ # Type="messages" is REQUIRED for Gradio 4.44.1
51
+ chatbot = gr.Chatbot(height=500, elem_id="chatbot", type="messages")
52
 
53
  with gr.Row():
54
  with gr.Column(scale=4):