Crackershoot commited on
Commit
7037e96
·
verified ·
1 Parent(s): 5cdd18a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -321,7 +321,7 @@ with gr.Blocks(
321
  # LEFT SIDE (CHAT)
322
  with gr.Column(scale=3):
323
 
324
- chatbot = gr.Chatbot(label="💬 Conversation", elem_classes="chatbot")
325
 
326
  question = gr.Textbox(
327
  label="Ask Dox a question:",
@@ -358,10 +358,21 @@ with gr.Blocks(
358
  # Chat Logic
359
  # -----------------------------
360
  def chat_ui(user_message, chat_history):
 
 
 
361
  response_text, link = ask_agent(user_message)
362
-
363
- chat_history = chat_history + [[user_message, response_text]]
364
-
 
 
 
 
 
 
 
 
365
  return (
366
  chat_history,
367
  link,
 
321
  # LEFT SIDE (CHAT)
322
  with gr.Column(scale=3):
323
 
324
+ chatbot = gr.Chatbot(label="💬 Conversation", type="messages")
325
 
326
  question = gr.Textbox(
327
  label="Ask Dox a question:",
 
358
  # Chat Logic
359
  # -----------------------------
360
  def chat_ui(user_message, chat_history):
361
+ if chat_history is None:
362
+ chat_history = []
363
+
364
  response_text, link = ask_agent(user_message)
365
+
366
+ chat_history.append({
367
+ "role": "user",
368
+ "content": user_message
369
+ })
370
+
371
+ chat_history.append({
372
+ "role": "assistant",
373
+ "content": response_text
374
+ })
375
+
376
  return (
377
  chat_history,
378
  link,