Chainlit / chainlit

Build Conversational AI in minutes ⚡️
https://docs.chainlit.io
Apache License 2.0
6.1k stars 777 forks source link

How can I use select in chat not in settings ? #476

Open Byusa opened 8 months ago

Byusa commented 8 months ago

How can I use select in chat not in settings ? I tried this but it does not work with Message, it only works with ChatSettings.

import chainlit as cl
from chainlit.input_widget import Select

# @cl.on_message
async def main(message: str):
    settings = await cl.Message( content="Select a among these",
        [
            Select(
                id="Drinks",
                label="Drink options",
                values=["Water", "Milk", "Beer", "Juice"],
                initial_index=0,
            )
        ]
    ).send()
    value = settings["Drinks"]
Spritan commented 2 weeks ago

https://docs.chainlit.io/api-reference/ask/ask-for-action

use AskUserAction this gives similar outcomes