Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
·
d7487c3
1
Parent(s):
bef1526
bugfix: 现在保存文件名可以被自动加载
Browse files- ChuanhuChatbot.py +4 -3
- modules/models/base_model.py +2 -1
ChuanhuChatbot.py
CHANGED
@@ -483,13 +483,14 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
|
483 |
model_name=MODELS[DEFAULT_MODEL], access_key=my_api_key)[0]
|
484 |
current_model.set_user_identifier(user_name)
|
485 |
if not hide_history_when_not_logged_in or user_name:
|
486 |
-
system_prompt, chatbot = current_model.auto_load()
|
487 |
else:
|
488 |
system_prompt = gr.update()
|
|
|
489 |
chatbot = gr.Chatbot.update(label=MODELS[DEFAULT_MODEL])
|
490 |
-
return user_info, user_name, current_model, toggle_like_btn_visibility(DEFAULT_MODEL), system_prompt, chatbot, init_history_list(user_name)
|
491 |
demo.load(create_greeting, inputs=None, outputs=[
|
492 |
-
user_info, user_name, current_model, like_dislike_area, systemPromptTxt, chatbot, historySelectList], api_name="load")
|
493 |
chatgpt_predict_args = dict(
|
494 |
fn=predict,
|
495 |
inputs=[
|
|
|
483 |
model_name=MODELS[DEFAULT_MODEL], access_key=my_api_key)[0]
|
484 |
current_model.set_user_identifier(user_name)
|
485 |
if not hide_history_when_not_logged_in or user_name:
|
486 |
+
filename, system_prompt, chatbot = current_model.auto_load()
|
487 |
else:
|
488 |
system_prompt = gr.update()
|
489 |
+
filename = gr.update()
|
490 |
chatbot = gr.Chatbot.update(label=MODELS[DEFAULT_MODEL])
|
491 |
+
return user_info, user_name, current_model, toggle_like_btn_visibility(DEFAULT_MODEL), filename, system_prompt, chatbot, init_history_list(user_name)
|
492 |
demo.load(create_greeting, inputs=None, outputs=[
|
493 |
+
user_info, user_name, current_model, like_dislike_area, saveFileName, systemPromptTxt, chatbot, historySelectList], api_name="load")
|
494 |
chatgpt_predict_args = dict(
|
495 |
fn=predict,
|
496 |
inputs=[
|
modules/models/base_model.py
CHANGED
@@ -746,7 +746,8 @@ class BaseLLMModel:
|
|
746 |
def auto_load(self):
|
747 |
self.history_file_path = get_history_filepath(self.user_identifier)
|
748 |
filename, system_prompt, chatbot = self.load_chat_history()
|
749 |
-
|
|
|
750 |
|
751 |
def like(self):
|
752 |
"""like the last response, implement if needed
|
|
|
746 |
def auto_load(self):
|
747 |
self.history_file_path = get_history_filepath(self.user_identifier)
|
748 |
filename, system_prompt, chatbot = self.load_chat_history()
|
749 |
+
filename = filename[:-5]
|
750 |
+
return filename, system_prompt, chatbot
|
751 |
|
752 |
def like(self):
|
753 |
"""like the last response, implement if needed
|