Spaces:
Sleeping
Sleeping
Update BuildingAChainlitApp.md
Browse files- BuildingAChainlitApp.md +9 -0
BuildingAChainlitApp.md
CHANGED
|
@@ -105,6 +105,12 @@ Notice a few things:
|
|
| 105 |
|
| 106 |
Why do we want to support streaming? What about streaming is important, or useful?
|
| 107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
## On Chat Start:
|
| 109 |
|
| 110 |
The next scope is where "the magic happens". On Chat Start is when a user begins a chat session. This will happen whenever a user opens a new chat window, or refreshes an existing chat window.
|
|
@@ -138,6 +144,9 @@ NOTE: Chainlit has some great documentation about User Session.
|
|
| 138 |
|
| 139 |
Why are we using User Session here? What about Python makes us need to use this? Why not just store everything in a global variable?
|
| 140 |
|
|
|
|
|
|
|
|
|
|
| 141 |
## On Message
|
| 142 |
|
| 143 |
First, we load our chain from the user session:
|
|
|
|
| 105 |
|
| 106 |
Why do we want to support streaming? What about streaming is important, or useful?
|
| 107 |
|
| 108 |
+
|
| 109 |
+
#### Question #1 Answer:
|
| 110 |
+
|
| 111 |
+
Streaming the response allows the user to see the response being generated contemporaneously. I suppose it's a better UX as users don't have to wait for the entire response to be loaded in.
|
| 112 |
+
|
| 113 |
+
|
| 114 |
## On Chat Start:
|
| 115 |
|
| 116 |
The next scope is where "the magic happens". On Chat Start is when a user begins a chat session. This will happen whenever a user opens a new chat window, or refreshes an existing chat window.
|
|
|
|
| 144 |
|
| 145 |
Why are we using User Session here? What about Python makes us need to use this? Why not just store everything in a global variable?
|
| 146 |
|
| 147 |
+
#### Question #2 Answer:
|
| 148 |
+
|
| 149 |
+
The reason we use user session is so that the chats that we are having are stored directly within the current session and if we start a new chat we can clear the current session and begin a new one - aka a new version, which is defined at the on_start level.
|
| 150 |
## On Message
|
| 151 |
|
| 152 |
First, we load our chain from the user session:
|