Skip to content

Commit

Permalink
fix [Bug]: 配置"hide_history_when_not_logged_in": true后,界面报错 #1101
Browse files Browse the repository at this point in the history
  • Loading branch information
GaiZhenbiao committed Apr 17, 2024
1 parent fccd3de commit 5881220
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ChuanhuChatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,9 @@ def create_greeting(request: gr.Request):
if not hide_history_when_not_logged_in or user_name:
loaded_stuff = current_model.auto_load()
else:
current_model.new_auto_history_filename()
loaded_stuff = [gr.update(), gr.update(), gr.Chatbot(label=MODELS[DEFAULT_MODEL]), current_model.single_turn, current_model.temperature, current_model.top_p, current_model.n_choices, current_model.stop_sequence, current_model.token_upper_limit, current_model.max_generation_token, current_model.presence_penalty, current_model.frequency_penalty, current_model.logit_bias, current_model.user_identifier]
return user_info, user_name, current_model, toggle_like_btn_visibility(DEFAULT_MODEL), *loaded_stuff, init_history_list(user_name, prepend=current_model.history_file_path[:-5])
return user_info, user_name, current_model, toggle_like_btn_visibility(DEFAULT_MODEL), *loaded_stuff, init_history_list(user_name, prepend=current_model.history_file_path.rstrip(".json"))
demo.load(create_greeting, inputs=None, outputs=[
user_info, user_name, current_model, like_dislike_area, saveFileName, systemPromptTxt, chatbot, single_turn_checkbox, temperature_slider, top_p_slider, n_choices_slider, stop_sequence_txt, max_context_length_slider, max_generation_slider, presence_penalty_slider, frequency_penalty_slider, logit_bias_txt, user_identifier_txt, historySelectList], api_name="load")
chatgpt_predict_args = dict(
Expand Down
5 changes: 4 additions & 1 deletion modules/models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1106,9 +1106,12 @@ def delete_chat_history(self, filename):
)

def auto_load(self):
self.history_file_path = new_auto_history_filename(self.user_name)
self.new_auto_history_filename()
return self.load_chat_history()

def new_auto_history_filename(self):
self.history_file_path = new_auto_history_filename(self.user_name)

def like(self):
"""like the last response, implement if needed"""
return gr.update()
Expand Down

0 comments on commit 5881220

Please sign in to comment.