langflow icon indicating copy to clipboard operation
langflow copied to clipboard

feat(component): enhance chat input component

Open raphaelchristi opened this issue 1 year ago • 1 comments

Description

This PR enhances the Chat Input component by simplifying the input structure and improving text handling.


Changes

  • Improved Text Handling:

    • Replaced MultilineInput with StrInput for more efficient text management.
  • Playground Integration:

    • Removed input handle to streamline functionality and enhance integration with the playground.
  • Image and File Support:

    • Maintained support for images and text files through FileInput using TEXT_FILE_TYPES + IMG_FILE_TYPES.
  • Styling and Session Management:

    • Retained essential styling and session management options to ensure consistent user experience.

Code Comparison

Before

inputs = [
    MultilineInput(
        name="input_value",
        display_name="Text",
        value="",
        info="Message to be passed as input.",
    ),
    # ...
]

After

inputs = [
    StrInput(
        name="input_value",
        display_name="Text",
        value="",
        info="Message to be passed as input.",
    ),
    # ...
]

Benefits

  • Simplified code for better readability and maintenance.
  • Enhanced compatibility with the playground environment.
  • Continued support for multimedia input types.
  • Improved overall user experience and functionality.

raphaelchristi avatar Dec 06 '24 18:12 raphaelchristi

What are the advantages of using a StrInput over a MultilineInput for this case?

The main reason for using StrInput instead of MultilineInput is that both provide the same functionality, but StrInput does not include a handle. This makes the Chat Input component cleaner and more streamlined.

Additionally, as the Chat Input is a primary component, having a handle is unnecessary. Removing the handle ensures a simpler and more intuitive design, focusing on the component's core functionality.

raphaelchristi avatar Dec 12 '24 17:12 raphaelchristi

CodSpeed Performance Report

Merging #5131 will not alter performance

Comparing raphaelchristi:feat/chat-input-improvements (297bacf) with main (75c3c1c)

Summary

✅ 15 untouched benchmarks

codspeed-hq[bot] avatar Jan 06 '25 17:01 codspeed-hq[bot]

@raphaelchristi it looks like some unit tests are failing still. I think this is a good addition... let me know if you have a chance to take a look.

Hi @erichare , thanks for flagging this! I've taken a look and made the following changes:

  • Fixed the type mismatch in the cycle detection test by using router.message instead of router.false_response
  • Added skip conditions for OpenAI-dependent tests when no API key is configured
  • Verified all tests are now passing (3 passed, 3 skipped) The changes are in commit 297bacf with message: 'Fix type mismatch in cycle test and skip OpenAI-dependent tests

raphaelchristi avatar Jan 09 '25 05:01 raphaelchristi

@raphaelchristi it looks like some unit tests are failing still. I think this is a good addition... let me know if you have a chance to take a look.

Hi @erichare , thanks for flagging this! I've taken a look and made the following changes:

  • Fixed the type mismatch in the cycle detection test by using router.message instead of router.false_response
  • Added skip conditions for OpenAI-dependent tests when no API key is configured
  • Verified all tests are now passing (3 passed, 3 skipped) The changes are in commit 297bacf with message: 'Fix type mismatch in cycle test and skip OpenAI-dependent tests

fantastic, thanks @raphaelchristi

erichare avatar Jan 09 '25 16:01 erichare