Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -33,13 +33,16 @@ def chat(
|
|
33 |
top_p=top_p)
|
34 |
|
35 |
# remove the first phrase identical to user prompt
|
36 |
-
|
|
|
37 |
bot_response = bot_response.replace("\n", "<br>")
|
|
|
38 |
# trip the last phrase
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
43 |
|
44 |
history.append({
|
45 |
"role": "user",
|
|
|
33 |
top_p=top_p)
|
34 |
|
35 |
# remove the first phrase identical to user prompt
|
36 |
+
if include_input:
|
37 |
+
bot_response = bot_response[0][len(user_input):]
|
38 |
bot_response = bot_response.replace("\n", "<br>")
|
39 |
+
|
40 |
# trip the last phrase
|
41 |
+
if truncate:
|
42 |
+
try:
|
43 |
+
bot_response = bot_response[:bot_response.rfind(".")+1]
|
44 |
+
except:
|
45 |
+
pass
|
46 |
|
47 |
history.append({
|
48 |
"role": "user",
|