nxphi47 commited on
Commit
465454c
1 Parent(s): 4271b57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -938,8 +938,9 @@ def chat_response_stream_multiturn(
938
  if STREAM_CHECK_MULTIPLE > 0 and j % STREAM_CHECK_MULTIPLE == 0:
939
  message_safety = safety_check(cur_out, history=None)
940
  if message_safety is not None and not is_by_pass:
941
- yield message_safety
942
- return
 
943
 
944
  yield cur_out
945
  assert len(gen) == 1, f'{gen}'
@@ -964,8 +965,9 @@ def chat_response_stream_multiturn(
964
 
965
  message_safety = safety_check(cur_out, history=None)
966
  if message_safety is not None and not is_by_pass:
967
- yield message_safety
968
- return
 
969
 
970
 
971
 
 
938
  if STREAM_CHECK_MULTIPLE > 0 and j % STREAM_CHECK_MULTIPLE == 0:
939
  message_safety = safety_check(cur_out, history=None)
940
  if message_safety is not None and not is_by_pass:
941
+ # yield message_safety
942
+ raise gr.Error(message_safety)
943
+ # return
944
 
945
  yield cur_out
946
  assert len(gen) == 1, f'{gen}'
 
965
 
966
  message_safety = safety_check(cur_out, history=None)
967
  if message_safety is not None and not is_by_pass:
968
+ # yield message_safety
969
+ raise gr.Error(message_safety)
970
+ # return
971
 
972
 
973