Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes new line issue in chatbot #4491

Merged
merged 5 commits into from Jun 14, 2023
Merged

Fixes new line issue in chatbot #4491

merged 5 commits into from Jun 14, 2023

Conversation

dawoodkhan82
Copy link
Collaborator

@dawoodkhan82 dawoodkhan82 commented Jun 13, 2023

Description

Adds margin between <p> tags

Screenshot 2023-06-13 at 12 57 06 AM

Please include:

  • relevant motivation
  • a summary of the change
  • which issue is fixed.
  • any additional dependencies that are required for this change.

Closes: #4344

Checklist:

  • I have performed a self-review of my own code
  • I have added a short summary of my change to the CHANGELOG.md
  • My code follows the style guidelines of this project
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

A note about the CHANGELOG

Hello 馃憢 and thank you for contributing to Gradio!

All pull requests must update the change log located in CHANGELOG.md, unless the pull request is labeled with the "no-changelog-update" label.

Please add a brief summary of the change to the Upcoming Release > Full Changelog section of the CHANGELOG.md file and include
a link to the PR (formatted in markdown) and a link to your github profile (if you like). For example, "* Added a cool new feature by [@myusername](link-to-your-github-profile) in [PR 11111](https://github.com/gradio-app/gradio/pull/11111)".

If you would like to elaborate on your change further, feel free to include a longer explanation in the other sections.
If you would like an image/gif/video showcasing your feature, it may be best to edit the CHANGELOG file using the
GitHub web UI since that lets you upload files directly via drag-and-drop.

@gradio-pr-bot
Copy link
Contributor

All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-4491-all-demos

@abidlabs
Copy link
Member

Perfect! Tested with

import gradio as gr

message = [(
    "Single newline:\nMessage continues here",
    "Double newline:\n\nMessage continues here",    
),(
    "Triple newline:\n\n\nMessage continues here",    
    "Quadruple newline:\n\n\n\nMessage continues here",        
)]

with gr.Blocks() as demo:
    gr.Chatbot(message)
    
demo.launch()

And behaves the same as GFM!

@abidlabs
Copy link
Member

abidlabs commented Jun 13, 2023

By the way, as I was testing the gr.Chatbot, I noticed something else that seems to be broken on main. Any codeblocks seem to have huge vertical padding on top. For example:

import gradio as gr

code = """
```python
def greet(x):
    return "hello, " + x
```
"""

message = [(
    "write a python program",
    code
)]

with gr.Blocks() as demo:
    gr.Chatbot(message)
    
demo.launch()

produces this:

image

This is broken on main, not from this PR, but if it's easier, perhaps you can fix in this PR as well? It's not broken on pypi from what I can tell.

@dawoodkhan82
Copy link
Collaborator Author

@abidlabs seems like its an issue with the copy button that was added. Will fix in this pr

@dawoodkhan82
Copy link
Collaborator Author

will address copy button issue in new pr.

@dawoodkhan82 dawoodkhan82 merged commit 72fbce2 into main Jun 14, 2023
15 checks passed
@dawoodkhan82 dawoodkhan82 deleted the spacing branch June 14, 2023 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad handling of \n in chatbot
3 participants