diff --git a/api-reference/ask/ask-for-file.mdx b/api-reference/ask/ask-for-file.mdx index 2e18cfd..c172f4f 100644 --- a/api-reference/ask/ask-for-file.mdx +++ b/api-reference/ask/ask-for-file.mdx @@ -11,11 +11,12 @@ If a project ID is configured, the messages will be uploaded to the cloud storag Text displayed above the upload button. - - List of mime type to accept like ["text/csv", "application/pdf"] + + List of mime type to accept like ["text/csv", "application/pdf"] or a dict like {"text/plain": [".txt", ".py"]}. + More infos here https://react-dropzone.org/#!/Accepting%20specific%20file%20types. - Maximum file size in MB. Defaults to 2. + Maximum file size in MB. Defaults to 2. Max 100. The number of seconds to wait for an answer before raising a TimeoutError. @@ -53,3 +54,13 @@ def start(): content=f"`{file.name}` uploaded, it contains {len(text)} characters!" ).send() ``` + +You can also pass a dict to the `accept` parameter to precise the file extension for each mime type: + +```python Code Example +import chainlit as cl + +file = cl.AskFileMessage( + content="Please upload a python file to begin!", accept={"text/plain": [".py"]} + ).send() +```