Skip to content

Commit d4451bb

Browse files
committed
fix #1163
1 parent 952fc8c commit d4451bb

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

ChuanhuChatbot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ def create_greeting(request: gr.Request):
575575

576576
auto_name_chat_history_args = dict(
577577
fn=auto_name_chat_history,
578-
inputs=[current_model, name_chat_method, user_question, chatbot, single_turn_checkbox],
578+
inputs=[current_model, name_chat_method, user_question, single_turn_checkbox],
579579
outputs=[historySelectList],
580580
show_progress=False,
581581
)

modules/models/OpenAIVision.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def _single_query_at_once(self, history, temperature=1.0):
290290

291291
return response
292292

293-
def auto_name_chat_history(self, name_chat_method, user_question, chatbot, single_turn_checkbox):
293+
def auto_name_chat_history(self, name_chat_method, user_question, single_turn_checkbox):
294294
if len(self.history) == 2 and not single_turn_checkbox and not hide_history_when_not_logged_in:
295295
user_question = self.history[0]["content"]
296296
if name_chat_method == i18n("模型自动总结(消耗tokens)"):
@@ -307,10 +307,10 @@ def auto_name_chat_history(self, name_chat_method, user_question, chatbot, singl
307307
except Exception as e:
308308
logging.info(f"自动命名失败。{e}")
309309
filename = replace_special_symbols(user_question)[:16] + ".json"
310-
return self.rename_chat_history(filename, chatbot)
310+
return self.rename_chat_history(filename)
311311
elif name_chat_method == i18n("第一条提问"):
312312
filename = replace_special_symbols(user_question)[:16] + ".json"
313-
return self.rename_chat_history(filename, chatbot)
313+
return self.rename_chat_history(filename)
314314
else:
315315
return gr.update()
316316
else:

modules/models/base_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,6 @@ def retry(
758758
iter = self.predict(
759759
inputs,
760760
chatbot,
761-
stream=self.stream,
762761
use_websearch=use_websearch,
763762
files=files,
764763
reply_language=reply_language,
@@ -944,7 +943,7 @@ def token_message(self, token_lst=None):
944943
+ f"{token_sum} tokens"
945944
)
946945

947-
def rename_chat_history(self, filename, chatbot):
946+
def rename_chat_history(self, filename):
948947
if filename == "":
949948
return gr.update()
950949
if not filename.endswith(".json"):
@@ -965,14 +964,14 @@ def rename_chat_history(self, filename, chatbot):
965964
return init_history_list(self.user_name)
966965

967966
def auto_name_chat_history(
968-
self, name_chat_method, user_question, chatbot, single_turn_checkbox
967+
self, name_chat_method, user_question, single_turn_checkbox
969968
):
970969
if len(self.history) == 2 and not single_turn_checkbox:
971970
user_question = self.history[0]["content"]
972971
if type(user_question) == list:
973972
user_question = user_question[0]["text"]
974973
filename = replace_special_symbols(user_question)[:16] + ".json"
975-
return self.rename_chat_history(filename, chatbot)
974+
return self.rename_chat_history(filename)
976975
else:
977976
return gr.update()
978977

@@ -1039,6 +1038,7 @@ def load_chat_history(self, new_history_file_path=None):
10391038
-len(saved_json["chatbot"]) :
10401039
]
10411040
logging.info(f"Trimmed history: {saved_json['history']}")
1041+
10421042
# Sanitize chatbot
10431043
saved_json["chatbot"] = remove_html_tags(saved_json["chatbot"])
10441044
logging.debug(f"{self.user_name} 加载对话历史完毕")

modules/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,6 @@ def clean_text(text):
249249
cleaned = re.sub(r'<[^>]+>', '', text)
250250
# Remove any remaining HTML entities
251251
cleaned = re.sub(r'&[#\w]+;', '', cleaned)
252-
# Remove extra whitespace and newlines
253-
cleaned = re.sub(r'\s+', ' ', cleaned)
254252
return cleaned.strip()
255253

256254
return [

0 commit comments

Comments
 (0)