Skip to content

Commit 9f91c72

Browse files
authored
Merge pull request #2 from Chainlit/wd/ask-file-accept
update doc for unreleased change
2 parents b97b49c + e46ae93 commit 9f91c72

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

api-reference/ask/ask-for-file.mdx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ If a project ID is configured, the messages will be uploaded to the cloud storag
1111
<ParamField path="content" type="str">
1212
Text displayed above the upload button.
1313
</ParamField>
14-
<ParamField path="accept" type="List[str]">
15-
List of mime type to accept like ["text/csv", "application/pdf"]
14+
<ParamField path="accept" type="Union[List[str], Dict[str, List[str]]]">
15+
List of mime type to accept like ["text/csv", "application/pdf"] or a dict like {"text/plain": [".txt", ".py"]}.
16+
More infos here https://react-dropzone.org/#!/Accepting%20specific%20file%20types.
1617
</ParamField>
1718
<ParamField path="max_size_mb" type="int" optional>
18-
Maximum file size in MB. Defaults to 2.
19+
Maximum file size in MB. Defaults to 2. Max 100.
1920
</ParamField>
2021
<ParamField path="timeout" type="int" optional>
2122
The number of seconds to wait for an answer before raising a TimeoutError.
@@ -53,3 +54,13 @@ def start():
5354
content=f"`{file.name}` uploaded, it contains {len(text)} characters!"
5455
).send()
5556
```
57+
58+
You can also pass a dict to the `accept` parameter to precise the file extension for each mime type:
59+
60+
```python Code Example
61+
import chainlit as cl
62+
63+
file = cl.AskFileMessage(
64+
content="Please upload a python file to begin!", accept={"text/plain": [".py"]}
65+
).send()
66+
```

0 commit comments

Comments
 (0)