Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
|
36 |
-
|
|
|
|
|
|
|
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)
|