vpcom commited on
Commit
7bae9c3
1 Parent(s): b029f96

fix: filter unfinished verses

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -860,9 +860,11 @@ class Chatbot(gr.Chatbot):
860
  raise TypeError(
861
  f"Expected a list of lists of length 2 or list of tuples of length 2. Received: {message_pair}"
862
  )
 
 
863
  processed_messages.append(
864
  [
865
- None,self._postprocess_chat_messages((result).replace('؛','\n').replace('/',' ** ').strip())
866
  #self._postprocess_chat_messages(message_pair[1])),
867
  ]
868
  )
 
860
  raise TypeError(
861
  f"Expected a list of lists of length 2 or list of tuples of length 2. Received: {message_pair}"
862
  )
863
+ result = result.replace('؛','\n').replace('/',' ** ').strip()
864
+ result = result[:result.rfind('\n')] # filter till the end verse, do not publish not complete verses
865
  processed_messages.append(
866
  [
867
+ None,self._postprocess_chat_messages(result)
868
  #self._postprocess_chat_messages(message_pair[1])),
869
  ]
870
  )