Reality123b commited on
Commit
f92d4d6
·
verified ·
1 Parent(s): f95a698

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -80,7 +80,6 @@ class XylariaChat:
80
  print(f"Error resetting API client: {e}")
81
 
82
  self.save_chat() # Save the empty chat history
83
- #return None # To clear the chatbot interface
84
 
85
  def get_response(self, user_input):
86
  # Prepare messages with conversation context and persistent memory
@@ -264,7 +263,8 @@ class XylariaChat:
264
  height=500,
265
  show_copy_button=True,
266
  avatar_images=("user.png", "xylaria.png"), # Replace with your image paths
267
- bubble_full_width=False
 
268
  )
269
 
270
  # Clear history and memory buttons
@@ -303,7 +303,7 @@ class XylariaChat:
303
  queue=False
304
  ).then(
305
  fn=lambda: toggle_page("start"),
306
- inputs=gr.State("start"),
307
  outputs=[chat_page, start_page]
308
  )
309
 
@@ -311,7 +311,7 @@ class XylariaChat:
311
  clear_memory.click(
312
  fn=self.reset_conversation,
313
  inputs=None,
314
- outputs=[chatbot],
315
  queue=False
316
  ).then(
317
  fn=lambda: toggle_page("start"),
@@ -319,8 +319,8 @@ class XylariaChat:
319
  outputs=[chat_page, start_page]
320
  )
321
 
322
- # Load chat history on interface load
323
- demo.load(self.reset_conversation, [], None)
324
 
325
  return demo
326
 
 
80
  print(f"Error resetting API client: {e}")
81
 
82
  self.save_chat() # Save the empty chat history
 
83
 
84
  def get_response(self, user_input):
85
  # Prepare messages with conversation context and persistent memory
 
263
  height=500,
264
  show_copy_button=True,
265
  avatar_images=("user.png", "xylaria.png"), # Replace with your image paths
266
+ bubble_full_width=False,
267
+ type="messages"
268
  )
269
 
270
  # Clear history and memory buttons
 
303
  queue=False
304
  ).then(
305
  fn=lambda: toggle_page("start"),
306
+ inputs=None,
307
  outputs=[chat_page, start_page]
308
  )
309
 
 
311
  clear_memory.click(
312
  fn=self.reset_conversation,
313
  inputs=None,
314
+ outputs=None,
315
  queue=False
316
  ).then(
317
  fn=lambda: toggle_page("start"),
 
319
  outputs=[chat_page, start_page]
320
  )
321
 
322
+ # Load on startup
323
+ demo.load(fn=self.reset_conversation, inputs=None, outputs=None)
324
 
325
  return demo
326