Skip to content

Commit

Permalink
bugfix: 修复修复损坏的历史记录的时候出错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
GaiZhenbiao committed Nov 16, 2023
1 parent 40b0dd7 commit 64764e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ def load_chat_history(self, new_history_file_path=None, username=None):
logging.info(new_history)
except:
pass
if len(json_s["chatbot"]) < len(json_s["history"]):
if len(json_s["chatbot"]) < len(json_s["history"])//2:
logging.info("Trimming corrupted history...")
json_s["history"] = json_s["history"][-len(json_s["chatbot"]):]
logging.info(f"Trimmed history: {json_s['history']}")
Expand Down

0 comments on commit 64764e8

Please sign in to comment.