vpcom commited on
Commit
89c7e88
·
1 Parent(s): a4230c4

fix: post process messages

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -172,7 +172,7 @@ def generate(
172
  else:
173
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=False, details=True, return_full_text=False)
174
 
175
- output = f"{prompt}"
176
  for response in stream:
177
  #print('stream',response)
178
 
@@ -412,8 +412,8 @@ class Chatbot(gr.Chatbot):
412
  )
413
  processed_messages.append(
414
  [
415
- self._postprocess_chat_messages(message_pair[0]),
416
- self._postprocess_chat_messages(message_pair[1]),
417
  ]
418
  )
419
  return processed_messages
@@ -527,9 +527,8 @@ class ChatInterface(gr.ChatInterface):
527
  self.fn, *inputs, limiter=self.limiter
528
  )
529
 
530
- #history.append([message,response])
531
- # always forget the history
532
- history = [[message,response]]
533
  return history, history
534
 
535
  chat_interface = ChatInterface(
 
172
  else:
173
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=False, details=True, return_full_text=False)
174
 
175
+ output = "" #f"{prompt}"
176
  for response in stream:
177
  #print('stream',response)
178
 
 
412
  )
413
  processed_messages.append(
414
  [
415
+ None,self._postprocess_chat_messages((message_pair[0]+message_pair[1]).replace(';','\n').replace('\\','\t'))
416
+ #self._postprocess_chat_messages(message_pair[1])),
417
  ]
418
  )
419
  return processed_messages
 
527
  self.fn, *inputs, limiter=self.limiter
528
  )
529
 
530
+ history.append([message,response])
531
+
 
532
  return history, history
533
 
534
  chat_interface = ChatInterface(