Open skye0402 opened 1 week ago
The issue is the call to inspect.cleandoc
in post process. It removes all trailing white space. I think we can remove @dawoodkhan82 ?
@freddyaboulton I think we can remove. I'll check and make sure there's no regressions especially with markdown messages.
Sweet thanks @dawoodkhan82 !!
@freddyaboulton Double checked and it would lead to breaking markdown messages. inspect.cleandoc
maintains proper indentation, handles line endings and spacing that's necessary for the markdown messages. We can change the functionality to only use inspect.cleandoc
when render_markdown
is true. thoughts @freddyaboulton?
Actually the better solution here is to probably implement a custom inspect.cleandoc
function that preserves empty new lines, but handles all other cases the same.
Yes we should keep the trailing whitelines and keep the rest the same. But jw how does it break the markdown? The frontend expects a specific format?
Describe the bug
When using Gradio.Chatbot with "messages" I found the streaming has a flaw in it. It removes the "\n" from a stream which makes it formatting the message incorrect. Can you look into it?
You can use your own examples that you published for chatbot_simple and chatbot_streaming: https://www.gradio.app/docs/gradio/chatbot
You just have to add a
\n
into the sample response text. Simple works, Streaming doesn't. Please check if that is the only escaped character that has issues. I tried\\
and\r
which seem to work.Working:
Not working:
Have you searched existing issues? 🔎
Reproduction
Screenshot
See message above.
Logs
System Info
Severity
Blocking usage of gradio