chainlit icon indicating copy to clipboard operation
chainlit copied to clipboard

Multi-select Checkbox

Open kvnn opened this issue 9 months ago • 2 comments

Screenshot_2024-05-08_at_9 39 44_AM

This adds a multi-select checkbox type , similar to Actions:

    options = [
        cl.CheckboxGroupOption(name='townhouse', value='townhouse', label='townhouse'),
        cl.CheckboxGroupOption(name='condo', value='condo', label='condo'),
        cl.CheckboxGroupOption(name='single_family', value='single_family', label='single_family'),
        cl.CheckboxGroupOption(name='multi_family', value='multi_family', label='multi_family'),
        cl.CheckboxGroupOption(name='land', value='land', label='land'),
        cl.CheckboxGroupOption(name='other', value='other', label='other')
    ]

    checkbox_group = cl.CheckboxGroup(
        name=current_model.__tablename__,
        options=options
    )

    res = await cl.AskCheckboxMessage(
        content=message,
        checkbox_group=checkbox_group
    ).send()
 
    if res:
        print(res['selected'])
        selected_names = [option['name'] for option in res['selected']]

kvnn avatar May 06 '24 01:05 kvnn

This is interesting! Two feedback:

  1. It would be nice to have a test for this (you can look at the AskAction test for instance)
  2. The save button taking the whole width seems a bit too much. Maybe auto width and aligned to the right or left?

willydouhard avatar May 10 '24 08:05 willydouhard

@willydouhard Done.

Screenshot 2024-05-10 at 2 05 09 PM Screenshot 2024-05-10 at 2 05 56 PM

kvnn avatar May 11 '24 00:05 kvnn

I could really use this. Looking forward to it being merged!

wildermuthn avatar Jun 17 '24 20:06 wildermuthn

@wildermuthn Ah, looks like there are conflicts to resolve now ... You can use this in the meantime by running chainlit from this fork branch: https://github.com/kvnn/chainlit/tree/feature/checkbox

It takes some configuration to make that work. If you need help , feel free to email me. I'm not sure when I'll get around to these conflicts, and the Chainlit team is very behind on getting PR's merged .

cc @willydouhard

kvnn avatar Jun 17 '24 21:06 kvnn

@kvnn Any chance you could resolve pending merge conflicts, so we can do a final review and get this in!

Sorry it's taken so long, I just joined the team and am hard at work catching up on pending PR's. ;)

dokterbob avatar Aug 22 '24 10:08 dokterbob

From now on expect a reply of 1-3 days. :)

dokterbob avatar Aug 22 '24 10:08 dokterbob

Sure,  I’ll revisit it soon.On Aug 22, 2024, at 12:58 AM, Mathijs de Bruin @.***> wrote: From now on expect a reply of 1-3 days. :)

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

kvnn avatar Aug 22 '24 16:08 kvnn