rwitz commited on
Commit
d1d734e
1 Parent(s): d1fb9a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -244,9 +244,11 @@ def refresh_leaderboard():
244
  collection = init_database()
245
  async def direct_chat(model, user_input, state, chatbot, character_name, character_description, user_name):
246
  adapter = next(entry['adapter'] for entry in chatbots_data if entry['original_model'] == model)
247
-
248
  if "direct_history" not in state:
249
  state["direct_history"] = []
 
 
250
 
251
  state["direct_history"].append({"role": "user", "content": user_input})
252
 
 
244
  collection = init_database()
245
  async def direct_chat(model, user_input, state, chatbot, character_name, character_description, user_name):
246
  adapter = next(entry['adapter'] for entry in chatbots_data if entry['original_model'] == model)
247
+
248
  if "direct_history" not in state:
249
  state["direct_history"] = []
250
+ if len(state["direct_history"])>20:
251
+ state["direct_history"] = state["direct_history"][-20:]
252
 
253
  state["direct_history"].append({"role": "user", "content": user_input})
254