Spaces:
Runtime error
Runtime error
fix: sanity check message pairs in the post process
Browse files
app.py
CHANGED
@@ -402,6 +402,12 @@ class Chatbot(gr.Chatbot):
|
|
402 |
return []
|
403 |
processed_messages = []
|
404 |
for message_pair in y:
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
if not isinstance(message_pair, (tuple, list)):
|
406 |
raise TypeError(
|
407 |
f"Expected a list of lists or list of tuples. Received: {message_pair}"
|
@@ -412,7 +418,7 @@ class Chatbot(gr.Chatbot):
|
|
412 |
)
|
413 |
processed_messages.append(
|
414 |
[
|
415 |
-
None,self._postprocess_chat_messages((
|
416 |
#self._postprocess_chat_messages(message_pair[1])),
|
417 |
]
|
418 |
)
|
|
|
402 |
return []
|
403 |
processed_messages = []
|
404 |
for message_pair in y:
|
405 |
+
result = ""
|
406 |
+
print('Message Pairs: ',message_pair[0],message_pair[1])
|
407 |
+
if message_pair[0] is not None:
|
408 |
+
result += message_pair[0]
|
409 |
+
if message_pair[1] is not None:
|
410 |
+
result += message_pair[1]
|
411 |
if not isinstance(message_pair, (tuple, list)):
|
412 |
raise TypeError(
|
413 |
f"Expected a list of lists or list of tuples. Received: {message_pair}"
|
|
|
418 |
)
|
419 |
processed_messages.append(
|
420 |
[
|
421 |
+
None,self._postprocess_chat_messages((result).replace(';','\n').replace('\\','\t'))
|
422 |
#self._postprocess_chat_messages(message_pair[1])),
|
423 |
]
|
424 |
)
|