Spaces:
Sleeping
Sleeping
fix: 单次对话禁用自动命名
Browse files- ChuanhuChatbot.py +1 -1
- modules/models/base_model.py +2 -2
- modules/models/models.py +2 -2
ChuanhuChatbot.py
CHANGED
@@ -554,7 +554,7 @@ with gr.Blocks(theme=small_and_beautiful_theme) as demo:
|
|
554 |
|
555 |
auto_name_chat_history_args = dict(
|
556 |
fn=auto_name_chat_history,
|
557 |
-
inputs=[current_model, name_chat_method, user_question, chatbot, user_name,
|
558 |
outputs=[historySelectList],
|
559 |
show_progress=False,
|
560 |
)
|
|
|
554 |
|
555 |
auto_name_chat_history_args = dict(
|
556 |
fn=auto_name_chat_history,
|
557 |
+
inputs=[current_model, name_chat_method, user_question, chatbot, user_name, single_turn_checkbox],
|
558 |
outputs=[historySelectList],
|
559 |
show_progress=False,
|
560 |
)
|
modules/models/base_model.py
CHANGED
@@ -679,8 +679,8 @@ class BaseLLMModel:
|
|
679 |
save_file(filename, self.system_prompt, self.history, chatbot, user_name)
|
680 |
return init_history_list(user_name)
|
681 |
|
682 |
-
def auto_name_chat_history(self, name_chat_method, user_question, chatbot, user_name,
|
683 |
-
if len(self.history) == 2:
|
684 |
user_question = self.history[0]["content"]
|
685 |
filename = user_question[:16] + ".json"
|
686 |
return self.rename_chat_history(filename, chatbot, user_name)
|
|
|
679 |
save_file(filename, self.system_prompt, self.history, chatbot, user_name)
|
680 |
return init_history_list(user_name)
|
681 |
|
682 |
+
def auto_name_chat_history(self, name_chat_method, user_question, chatbot, user_name, single_turn_checkbox):
|
683 |
+
if len(self.history) == 2 and not single_turn_checkbox:
|
684 |
user_question = self.history[0]["content"]
|
685 |
filename = user_question[:16] + ".json"
|
686 |
return self.rename_chat_history(filename, chatbot, user_name)
|
modules/models/models.py
CHANGED
@@ -256,8 +256,8 @@ class OpenAIClient(BaseLLMModel):
|
|
256 |
return response
|
257 |
|
258 |
|
259 |
-
def auto_name_chat_history(self, name_chat_method, user_question, chatbot, user_name,
|
260 |
-
if len(self.history) == 2:
|
261 |
user_question = self.history[0]["content"]
|
262 |
if name_chat_method == i18n("模型自动总结(消耗tokens)"):
|
263 |
ai_answer = self.history[1]["content"]
|
|
|
256 |
return response
|
257 |
|
258 |
|
259 |
+
def auto_name_chat_history(self, name_chat_method, user_question, chatbot, user_name, single_turn_checkbox):
|
260 |
+
if len(self.history) == 2 and not single_turn_checkbox:
|
261 |
user_question = self.history[0]["content"]
|
262 |
if name_chat_method == i18n("模型自动总结(消耗tokens)"):
|
263 |
ai_answer = self.history[1]["content"]
|