aucnm commited on
Commit
89f4d37
·
1 Parent(s): 11d94fc

Update modules/base_model.py

Browse files
Files changed (1) hide show
  1. modules/base_model.py +6 -2
modules/base_model.py CHANGED
@@ -524,10 +524,14 @@ class BaseLLMModel:
524
 
525
  def load_chat_history(self, filename, chatbot, user_name):
526
  logging.debug(f"{user_name} 加载对话历史中……")
527
- if type(filename) != str:
528
  filename = filename.name
529
  try:
530
- with open(os.path.join(HISTORY_DIR, user_name, filename), "r") as f:
 
 
 
 
531
  json_s = json.load(f)
532
  try:
533
  if type(json_s["history"][0]) == str:
 
524
 
525
  def load_chat_history(self, filename, chatbot, user_name):
526
  logging.debug(f"{user_name} 加载对话历史中……")
527
+ if type(filename) != str and filename is not None:
528
  filename = filename.name
529
  try:
530
+ if "/" not in filename:
531
+ history_file_path = os.path.join(HISTORY_DIR, user_name, filename)
532
+ else:
533
+ history_file_path = filename
534
+ with open(history_file_path, "r") as f:
535
  json_s = json.load(f)
536
  try:
537
  if type(json_s["history"][0]) == str: