scutcyr commited on
Commit
df8d5c1
1 Parent(s): e917743

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -32,8 +32,11 @@ def answer(user_history, bot_history, sample=True, top_p=1, temperature=0.7):
32
  top_p:0-1之间,生成的内容越多样
33
  max_new_tokens=512 lost...'''
34
 
35
- context = "\n".join([f"用户:{user_history[i]}\n小元:{bot_history[i]}" for i in range(len(bot_history))])
36
- input_text = context + "\n用户:" + user_history[-1] + "\n小元:"
 
 
 
37
 
38
  input_text = preprocess(input_text)
39
  print(input_text)
 
32
  top_p:0-1之间,生成的内容越多样
33
  max_new_tokens=512 lost...'''
34
 
35
+ if len(bot_history)>0:
36
+ context = "\n".join([f"用户:{user_history[i]}\n小元:{bot_history[i]}" for i in range(len(bot_history))])
37
+ input_text = context + "\n用户:" + user_history[-1] + "\n小元:"
38
+ else:
39
+ input_text = "用户:" + user_history[-1] + "\n小元:"
40
 
41
  input_text = preprocess(input_text)
42
  print(input_text)