Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -181,7 +181,6 @@ async def user_ask(state, chatbot1, chatbot2, textbox, character_name, character
|
|
181 |
|
182 |
collection = init_database() # Initialize the collection object
|
183 |
# Keep only the last 10 messages in history
|
184 |
-
state["history"] = state["history"][-10:]
|
185 |
# Updating state with the current ELO ratings
|
186 |
state["elo_ratings"] = get_user_elo_ratings(collection)
|
187 |
if "history" not in state:
|
@@ -190,6 +189,8 @@ async def user_ask(state, chatbot1, chatbot2, textbox, character_name, character
|
|
190 |
{"role": "user", "content": user_input}])
|
191 |
state["history"][1].extend([
|
192 |
{"role": "user", "content": user_input}])
|
|
|
|
|
193 |
# Chat with bots
|
194 |
bot1_response, bot2_response = await chat_with_bots(user_input, state, character_name, character_description, user_name)
|
195 |
|
|
|
181 |
|
182 |
collection = init_database() # Initialize the collection object
|
183 |
# Keep only the last 10 messages in history
|
|
|
184 |
# Updating state with the current ELO ratings
|
185 |
state["elo_ratings"] = get_user_elo_ratings(collection)
|
186 |
if "history" not in state:
|
|
|
189 |
{"role": "user", "content": user_input}])
|
190 |
state["history"][1].extend([
|
191 |
{"role": "user", "content": user_input}])
|
192 |
+
if len(state["history"])>20:
|
193 |
+
state["history"] = state["history"][-20:]
|
194 |
# Chat with bots
|
195 |
bot1_response, bot2_response = await chat_with_bots(user_input, state, character_name, character_description, user_name)
|
196 |
|