Tuchuanhuhuhu commited on
Commit
5dc3671
·
1 Parent(s): fd3d76e

缓解生成大量</br>标签的问题

Browse files
Files changed (1) hide show
  1. ChuanhuChatbot.py +5 -2
ChuanhuChatbot.py CHANGED
@@ -56,8 +56,11 @@ def parse_text(text):
56
  line = line.replace("<", "&lt;")
57
  line = line.replace(">", "&gt;")
58
  line = line.replace(" ", "&nbsp;")
59
- if not line.startswith("<br/>"):
60
- lines[i] = '<br/>'+line
 
 
 
61
  return "".join(lines)
62
 
63
  def predict(inputs, top_p, temperature, openai_api_key, chatbot=[], history=[], system_prompt=initial_prompt, retry=False, summary=False): # repetition_penalty, top_k
 
56
  line = line.replace("<", "&lt;")
57
  line = line.replace(">", "&gt;")
58
  line = line.replace(" ", "&nbsp;")
59
+ # lines[i] = '<br/>'+line
60
+ if i > 0 and count % 2 == 0:
61
+ lines[i] = "<br/>"+line
62
+ else:
63
+ lines[i] = line
64
  return "".join(lines)
65
 
66
  def predict(inputs, top_p, temperature, openai_api_key, chatbot=[], history=[], system_prompt=initial_prompt, retry=False, summary=False): # repetition_penalty, top_k