Skip to content

Commit

Permalink
bugfix: error when saving history
Browse files Browse the repository at this point in the history
  • Loading branch information
GaiZhenbiao committed Sep 18, 2024
1 parent 526c615 commit c2c2b86
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions modules/models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,8 @@ def delete_chat_history(self, filename):
md_history_file_path = history_file_path[:-5] + ".md"
# check if history file path matches user_name
# if user access control is not enabled, user_name is empty, don't check
assert os.path.dirname(history_file_path) == self.user_name or self.user_name == ""
assert os.path.dirname(md_history_file_path) == self.user_name or self.user_name == ""
assert os.path.basename(os.path.dirname(history_file_path)) == self.user_name or self.user_name == ""
assert os.path.basename(os.path.dirname(md_history_file_path)) == self.user_name or self.user_name == ""
try:
os.remove(history_file_path)
os.remove(md_history_file_path)
Expand Down
2 changes: 1 addition & 1 deletion modules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def save_file(filename, model, chatbot):

# check if history file path matches user_name
# if user access control is not enabled, user_name is empty, don't check
assert os.path.dirname(history_file_path) == model.user_name or model.user_name == ""
assert os.path.basename(os.path.dirname(history_file_path)) == model.user_name or model.user_name == ""
with open(history_file_path, "w", encoding="utf-8") as f:
json.dump(json_s, f, ensure_ascii=False, indent=4)

Expand Down

0 comments on commit c2c2b86

Please sign in to comment.