feat: 01_06e
Browse files- README.md +4 -0
- app/app.py +4 -1
README.md
CHANGED
@@ -32,3 +32,7 @@ We have created some template code in `app/app.py` in the `app folder`.
|
|
32 |
```bash
|
33 |
chainlit run app/app.py -w
|
34 |
```
|
|
|
|
|
|
|
|
|
|
32 |
```bash
|
33 |
chainlit run app/app.py -w
|
34 |
```
|
35 |
+
|
36 |
+
## Solution
|
37 |
+
|
38 |
+
Please see app/app.py.
|
app/app.py
CHANGED
@@ -6,6 +6,7 @@ import chainlit as cl
|
|
6 |
# Please add the proper decorator to this main function so Chainlit will call
|
7 |
# this function when it receives a message
|
8 |
##############################################################################
|
|
|
9 |
async def main(message: cl.Message):
|
10 |
|
11 |
##############################################################################
|
@@ -13,4 +14,6 @@ async def main(message: cl.Message):
|
|
13 |
# Please get the content of the chainlit Message and send it back as a
|
14 |
# response
|
15 |
##############################################################################
|
16 |
-
|
|
|
|
|
|
6 |
# Please add the proper decorator to this main function so Chainlit will call
|
7 |
# this function when it receives a message
|
8 |
##############################################################################
|
9 |
+
@cl.on_message
|
10 |
async def main(message: cl.Message):
|
11 |
|
12 |
##############################################################################
|
|
|
14 |
# Please get the content of the chainlit Message and send it back as a
|
15 |
# response
|
16 |
##############################################################################
|
17 |
+
response = message.content
|
18 |
+
|
19 |
+
await cl.Message(content=f"Received: {response}").send()
|