langflow icon indicating copy to clipboard operation
langflow copied to clipboard

feat(component): implement directory component enhancements

Open raphaelchristi opened this issue 1 year ago • 3 comments

Directory Component Improvements

Implements two key improvements to the Directory component:

1. Changes 'Types' field to dropdown format

Before:

MessageTextInput(
    name="types",
    display_name="Types",
    info="File types to load. Leave empty to load all default supported types.",
    is_list=True,
)

After:

DropdownInput(
    name="types",
    display_name="Types",
    info="File types to load. Select types or leave empty to load all supported types.",
    options=TEXT_FILE_TYPES,
    value=TEXT_FILE_TYPES[0],
)

2. Sets default path to current directory

MessageTextInput(
    name="path",
    display_name="Path",
    info="Path to the directory to load files from. Defaults to current directory ('.')",
    value=".",
)

Improvements

  • Provides a clearer file type selection interface
  • Sets a sensible default path
  • Adds better tooltip information about the default directory

raphaelchristi avatar Dec 02 '24 21:12 raphaelchristi

CodSpeed Performance Report

Merging #5012 will degrade performances by 25.52%

Comparing raphaelchristi:enhance-directory-input (923ae7c) with main (c1bd7c8)

Summary

❌ 1 regressions
✅ 14 untouched benchmarks

:warning: Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main raphaelchristi:enhance-directory-input Change
test_successful_run_with_input_type_any 259.2 ms 348 ms -25.52%

codspeed-hq[bot] avatar Dec 05 '24 15:12 codspeed-hq[bot]

Very nice improvements @raphaelchristi , thank you!

EDIT: @raphaelchristi i just realized, i dont think the DropdownInput supports multi-select...

erichare avatar Dec 10 '24 17:12 erichare

Very nice improvements @raphaelchristi , thank you!

EDIT: @raphaelchristi i just realized, i dont think the DropdownInput supports multi-select...

Thanks @erichare That's a good point... Which input do you suggest for this implementation?

EDIT: I think to accept multi-select we can do something like:

        StrInput(
            name="types",
            display_name="Types",
            info="File types to load (comma-separated). Leave empty to load all supported types.",
            value=",".join(TEXT_FILE_TYPES[0:3]),  # Default to first 3 types
            list=True,  # This will allow multiple values
        ),
        

raphaelchristi avatar Dec 10 '24 17:12 raphaelchristi

Very nice improvements @raphaelchristi , thank you! EDIT: @raphaelchristi i just realized, i dont think the DropdownInput supports multi-select...

Thanks @erichare That's a good point... Which input do you suggest for this implementation?

EDIT: I think to accept multi-select we can do something like:

        StrInput(
            name="types",
            display_name="Types",
            info="File types to load (comma-separated). Leave empty to load all supported types.",
            value=",".join(TEXT_FILE_TYPES[0:3]),  # Default to first 3 types
            list=True,  # This will allow multiple values
        ),
        

This is good!

Can you check the mypy linting issues here?

erichare avatar Dec 12 '24 17:12 erichare

Mypy failures are the main thing here.

Thanks for the review @erichare !

I checked the mypy linting and it's passing without any issues now. image

raphaelchristi avatar Dec 12 '24 18:12 raphaelchristi

Thanks @raphaelchristi !!

erichare avatar Dec 12 '24 18:12 erichare