chainlit
chainlit copied to clipboard
Multi-select Checkbox
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']]
This is interesting! Two feedback:
- It would be nice to have a test for this (you can look at the AskAction test for instance)
- The save button taking the whole width seems a bit too much. Maybe auto width and aligned to the right or left?
@willydouhard Done.
I could really use this. Looking forward to it being merged!
@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 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. ;)
From now on expect a reply of 1-3 days. :)
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: @.***>