chansung commited on
Commit
349875c
1 Parent(s): c7bc1b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
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
- bot_response = bot_response[0][len(user_input):]
 
37
  bot_response = bot_response.replace("\n", "<br>")
 
38
  # trip the last phrase
39
- try:
40
- bot_response = bot_response[:bot_response.rfind(".")]
41
- except:
42
- pass
 
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",