Tuchuanhuhuhu commited on
Commit
65dd753
1 Parent(s): 06630d4

bugfix: 修复重新生成时有时内容包含HTML标签的问题

Browse files
Files changed (1) hide show
  1. modules/models/base_model.py +5 -2
modules/models/base_model.py CHANGED
@@ -523,10 +523,13 @@ class BaseLLMModel:
523
  if len(self.history) > 0:
524
  inputs = self.history[-2]["content"]
525
  del self.history[-2:]
526
- if len(self.all_token_counts) > 0:
527
- self.all_token_counts.pop()
528
  elif len(chatbot) > 0:
529
  inputs = chatbot[-1][0]
 
 
 
530
  else:
531
  yield chatbot, f"{STANDARD_ERROR_MSG}上下文是空的"
532
  return
 
523
  if len(self.history) > 0:
524
  inputs = self.history[-2]["content"]
525
  del self.history[-2:]
526
+ if len(self.all_token_counts) > 0:
527
+ self.all_token_counts.pop()
528
  elif len(chatbot) > 0:
529
  inputs = chatbot[-1][0]
530
+ if '<div class="user-message">' in inputs:
531
+ inputs = inputs.split('<div class="user-message">')[1]
532
+ inputs = inputs.split("</div>")[0]
533
  else:
534
  yield chatbot, f"{STANDARD_ERROR_MSG}上下文是空的"
535
  return