Skip to content

Chainlit (2.2.0 - 2.4.201) Still Has Several Issues Formatting Copy/Pasted Code & Text Content #2032

@AidanShipperley

Description

@AidanShipperley

Describe the bug

While Chainlit 2.2.1 resolved most issues with content discrepancies post 2.0.0 release, there are still quite a few discrepancies existing in the latest release (2.4.201) with how content is rendered and sent to the LLM API in both the message box and sent user messages that were not present pre-2.0.0. This causes the user to lose formatting of their original content, and it causes the LLM to receive improperly formatted text & code, potentially leading to worse responses.

I've outlined all of the issues I am currently aware of along with short videos to clearly showcase the problems and how you can reproduce them.

The issues I have found so far since 2.2.1:

  1. Copying and Pasting Code & Text Does Not Properly Render Tabbed (\t) or Indented Content in Message Box
  2. Sending Pasted Code in Code Blocks (w/ triple back-tick ```) Adds Newlines Between Each Line
  3. Spaces Before Text on New Line Are Not Rendered When Sent
  4. CTRL+Z (Undo) Does Not Work on Pasted Content
  5. Some Text Gets Rendered into Code Blocks Improperly

To Reproduce

Issue 1: Copying and Pasting Code & Text Does Not Properly Render Tabbed (\t) or Indented Content in Message Box

  • Code

    • Chainlit_Copy_Paste_Code_Issue.mp4
    • As you can see in the video, the indentation from the original code is not preserved when pasting it into the message box.
  • Text

    • Chainlit-Word-Bullets-Tabs-Copy-Paste-Issue.mp4
    • The indentation is not preserved for text content as well, which is especially noticeable with bulleted lists.

Issue 2: Sending Pasted Code in Code Blocks (w/ triple back-tick ```) Adds Newlines Between Each Line

  • Chainlit_Sending_Code_Newlines_Issue.mp4
  • The original Python code now has newline characters between each line, making it impossible to copy the originally pasted code and these newlines are sent to the model, causing spacing issues in the response.

Issue 3: Spaces Before Text on New Line Are Not Rendered When Sent

  • Chainlit-Spaces-Not-Visible.mp4

Issue 4: CTRL+Z (Undo) Does Not Work on Pasted Content

  • Chainlit_Ctrl_Z_Not_Working_Pasted_Content.mp4

Issue 5: Some Text Gets Rendered into Code Blocks Improperly

  • Chainlit_Sending_Bullets_Issue.mp4
  • The above video showcases that indented content sent gets improperly formatted into a code block, when there was no backticks present in the message.

Expected behavior

Chainlit should be able to match the content pasted into it, and render user content consistently with what the user sent.

Desktop

  • OS: Windows 11
  • Browser: Microsoft Edge
  • Version: 134.0.3124.72 (Official build) (64-bit)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions