YC-Chen commited on
Commit
b87693b
1 Parent(s): 35a45f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -170,15 +170,15 @@ with gr.Blocks() as demo:
170
  else:
171
  history[-1][1] += delta
172
 
173
- # if refusal_condition(history[-1][1]):
174
- # history = [['[安全拒答啟動]', '[安全拒答啟動] 請清除再開啟對話']]
175
- # yield history
176
- # break
177
  yield history
178
 
179
  if history[-1][1].endswith('</s>'):
180
  history[-1][1] = history[-1][1][:-4]
181
  yield history
 
 
 
 
182
 
183
  print('== Record ==\nQuery: {query}\nResponse: {response}'.format(query=repr(message), response=repr(history[-1][1])))
184
 
 
170
  else:
171
  history[-1][1] += delta
172
 
 
 
 
 
173
  yield history
174
 
175
  if history[-1][1].endswith('</s>'):
176
  history[-1][1] = history[-1][1][:-4]
177
  yield history
178
+
179
+ if refusal_condition(history[-1][1]):
180
+ history[-1][1] = history[-1][1] + '\n\n**系統指示:以上內容有錯誤的疑慮**'
181
+ yield history
182
 
183
  print('== Record ==\nQuery: {query}\nResponse: {response}'.format(query=repr(message), response=repr(history[-1][1])))
184