Opera8 commited on
Commit
81db30a
·
verified ·
1 Parent(s): 1916360

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -2
main.py CHANGED
@@ -264,8 +264,9 @@ async def process_gemini(client, chat_id, prompt):
264
  else:
265
  history.append({"role": "user", "parts":[{"text": prompt}]})
266
 
267
- if len(history) > 10:
268
- history = history[-10:]
 
269
  if history[0]["role"] == "model":
270
  history = history[1:]
271
 
 
264
  else:
265
  history.append({"role": "user", "parts":[{"text": prompt}]})
266
 
267
+ # تغییر تاریخچه به ۴۰ مورد برای ذخیره کردن ۲۰ سوال و جواب (۲۰ پیام رفت و برگشت)
268
+ if len(history) > 40:
269
+ history = history[-40:]
270
  if history[0]["role"] == "model":
271
  history = history[1:]
272