feat(component): enhance chat input component
Description
This PR enhances the Chat Input component by simplifying the input structure and improving text handling.
Changes
-
Improved Text Handling:
- Replaced
MultilineInputwithStrInputfor more efficient text management.
- Replaced
-
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
FileInputusingTEXT_FILE_TYPES + IMG_FILE_TYPES.
- Maintained support for images and text files through
-
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.
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.
CodSpeed Performance Report
Merging #5131 will not alter performance
Comparing raphaelchristi:feat/chat-input-improvements (297bacf) with main (75c3c1c)
Summary
✅ 15 untouched benchmarks
@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 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