Tuchuanhuhuhu commited on
Commit
8dbdf7a
1 Parent(s): efd54c9

bugfix: 隐藏历史记录时出现问题 fix #883

Browse files
Files changed (2) hide show
  1. modules/models/OpenAI.py +1 -1
  2. modules/utils.py +2 -0
modules/models/OpenAI.py CHANGED
@@ -253,7 +253,7 @@ class OpenAIClient(BaseLLMModel):
253
 
254
 
255
  def auto_name_chat_history(self, name_chat_method, user_question, chatbot, user_name, single_turn_checkbox):
256
- if len(self.history) == 2 and not single_turn_checkbox:
257
  user_question = self.history[0]["content"]
258
  if name_chat_method == i18n("模型自动总结(消耗tokens)"):
259
  ai_answer = self.history[1]["content"]
 
253
 
254
 
255
  def auto_name_chat_history(self, name_chat_method, user_question, chatbot, user_name, single_turn_checkbox):
256
+ if len(self.history) == 2 and not single_turn_checkbox and not hide_history_when_not_logged_in:
257
  user_question = self.history[0]["content"]
258
  if name_chat_method == i18n("模型自动总结(消耗tokens)"):
259
  ai_answer = self.history[1]["content"]
modules/utils.py CHANGED
@@ -332,6 +332,8 @@ def construct_assistant(text):
332
 
333
  def save_file(filename, system, history, chatbot, user_name):
334
  os.makedirs(os.path.join(HISTORY_DIR, user_name), exist_ok=True)
 
 
335
  if filename.endswith(".md"):
336
  filename = filename[:-3]
337
  if not filename.endswith(".json") and not filename.endswith(".md"):
 
332
 
333
  def save_file(filename, system, history, chatbot, user_name):
334
  os.makedirs(os.path.join(HISTORY_DIR, user_name), exist_ok=True)
335
+ if filename is None:
336
+ filename = new_auto_history_filename(user_name)
337
  if filename.endswith(".md"):
338
  filename = filename[:-3]
339
  if not filename.endswith(".json") and not filename.endswith(".md"):