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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(component): enhance chat input component #5131

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

raphaelchristi
Copy link
Contributor

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.

- Replace MultilineInput with StrInput for better text handling
- Remove input handle for cleaner playground integration
- Maintain image support through FileInput
- Keep essential styling and session management options
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. enhancement New feature or request labels Dec 6, 2024
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Dec 6, 2024
Copy link
Collaborator

@erichare erichare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@raphaelchristi
Copy link
Contributor Author

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.

ogabrielluiz
ogabrielluiz previously approved these changes Dec 12, 2024
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 12, 2024
@@ -13,7 +13,7 @@ class ChatInput(ChatComponent):
name = "ChatInput"

inputs = [
MultilineInput(
StrInput(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raphaelchristi Could we do this instead:

  1. Keep it as a MultilineInput as before
  2. But, pass input_types=[] so that the handle should disappear

Multiline has some nice properties when composing the text, so i think if we do this, we get the advantage of your PR (the handle being hidden for UI cleanliness) but also the multiline advantage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @erichare for this suggestion! I agree this is a much better approach.

Keep MultilineInput for text composition advantage but hide the handle
for UI cleanliness by setting input_types=[].

This preserves the multiline functionality while improving the visual
interface by removing the unnecessary connection handle.
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Dec 23, 2024
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants