chainlit 1.1.0rc0__py3-none-any.whl → 1.1.101__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of chainlit might be problematic. Click here for more details.
- chainlit/config.py +4 -2
- chainlit/context.py +19 -7
- chainlit/copilot/dist/index.js +639 -521
- chainlit/data/acl.py +4 -1
- chainlit/data/sql_alchemy.py +22 -21
- chainlit/discord/__init__.py +6 -0
- chainlit/discord/app.py +322 -0
- chainlit/element.py +5 -2
- chainlit/emitter.py +11 -2
- chainlit/frontend/dist/assets/{index-032fca02.js → index-37c9a5a9.js} +120 -120
- chainlit/frontend/dist/assets/react-plotly-c55d0c95.js +3602 -0
- chainlit/frontend/dist/index.html +1 -1
- chainlit/server.py +27 -4
- chainlit/session.py +72 -61
- chainlit/slack/__init__.py +6 -0
- chainlit/slack/app.py +379 -0
- chainlit/socket.py +21 -15
- chainlit/step.py +25 -1
- chainlit/types.py +2 -1
- chainlit/user_session.py +5 -2
- {chainlit-1.1.0rc0.dist-info → chainlit-1.1.101.dist-info}/METADATA +4 -3
- {chainlit-1.1.0rc0.dist-info → chainlit-1.1.101.dist-info}/RECORD +24 -20
- chainlit/frontend/dist/assets/react-plotly-8c993614.js +0 -3484
- {chainlit-1.1.0rc0.dist-info → chainlit-1.1.101.dist-info}/WHEEL +0 -0
- {chainlit-1.1.0rc0.dist-info → chainlit-1.1.101.dist-info}/entry_points.txt +0 -0
chainlit/socket.py
CHANGED
|
@@ -177,8 +177,8 @@ async def connection_successful(sid):
|
|
|
177
177
|
"first_interaction",
|
|
178
178
|
{"interaction": "resume", "thread_id": thread.get("id")},
|
|
179
179
|
)
|
|
180
|
-
await context.emitter.resume_thread(thread)
|
|
181
180
|
await config.code.on_chat_resume(thread)
|
|
181
|
+
await context.emitter.resume_thread(thread)
|
|
182
182
|
return
|
|
183
183
|
|
|
184
184
|
if config.code.on_chat_start:
|
|
@@ -188,36 +188,42 @@ async def connection_successful(sid):
|
|
|
188
188
|
|
|
189
189
|
@socket.on("clear_session")
|
|
190
190
|
async def clean_session(sid):
|
|
191
|
-
|
|
191
|
+
session = WebsocketSession.get(sid)
|
|
192
|
+
if session:
|
|
193
|
+
session.to_clear = True
|
|
192
194
|
|
|
193
195
|
|
|
194
196
|
@socket.on("disconnect")
|
|
195
|
-
async def disconnect(sid
|
|
197
|
+
async def disconnect(sid):
|
|
196
198
|
session = WebsocketSession.get(sid)
|
|
197
|
-
if session:
|
|
198
|
-
init_ws_context(session)
|
|
199
199
|
|
|
200
|
-
if
|
|
200
|
+
if not session:
|
|
201
|
+
return
|
|
202
|
+
|
|
203
|
+
init_ws_context(session)
|
|
204
|
+
|
|
205
|
+
if config.code.on_chat_end:
|
|
201
206
|
await config.code.on_chat_end()
|
|
202
207
|
|
|
203
|
-
if session
|
|
208
|
+
if session.thread_id and session.has_first_interaction:
|
|
204
209
|
await persist_user_session(session.thread_id, session.to_persistable())
|
|
205
210
|
|
|
206
|
-
def clear():
|
|
207
|
-
if session := WebsocketSession.get(
|
|
211
|
+
def clear(_sid):
|
|
212
|
+
if session := WebsocketSession.get(_sid):
|
|
208
213
|
# Clean up the user session
|
|
209
214
|
if session.id in user_sessions:
|
|
210
215
|
user_sessions.pop(session.id)
|
|
211
216
|
# Clean up the session
|
|
212
217
|
session.delete()
|
|
213
218
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
clear()
|
|
217
|
-
|
|
218
|
-
if force_clear:
|
|
219
|
-
clear()
|
|
219
|
+
if session.to_clear:
|
|
220
|
+
clear(sid)
|
|
220
221
|
else:
|
|
222
|
+
|
|
223
|
+
async def clear_on_timeout(_sid):
|
|
224
|
+
await asyncio.sleep(config.project.session_timeout)
|
|
225
|
+
clear(_sid)
|
|
226
|
+
|
|
221
227
|
asyncio.ensure_future(clear_on_timeout(sid))
|
|
222
228
|
|
|
223
229
|
|
chainlit/step.py
CHANGED
|
@@ -193,10 +193,34 @@ class Step:
|
|
|
193
193
|
self.persisted = False
|
|
194
194
|
self.fail_on_persist_error = False
|
|
195
195
|
|
|
196
|
+
def _clean_content(self, content):
|
|
197
|
+
"""
|
|
198
|
+
Recursively checks and converts bytes objects in content.
|
|
199
|
+
"""
|
|
200
|
+
|
|
201
|
+
def handle_bytes(item):
|
|
202
|
+
if isinstance(item, bytes):
|
|
203
|
+
return "STRIPPED_BINARY_DATA"
|
|
204
|
+
elif isinstance(item, dict):
|
|
205
|
+
return {k: handle_bytes(v) for k, v in item.items()}
|
|
206
|
+
elif isinstance(item, list):
|
|
207
|
+
return [handle_bytes(i) for i in item]
|
|
208
|
+
elif isinstance(item, tuple):
|
|
209
|
+
return tuple(handle_bytes(i) for i in item)
|
|
210
|
+
return item
|
|
211
|
+
|
|
212
|
+
return handle_bytes(content)
|
|
213
|
+
|
|
196
214
|
def _process_content(self, content, set_language=False):
|
|
197
215
|
if content is None:
|
|
198
216
|
return ""
|
|
199
|
-
|
|
217
|
+
content = self._clean_content(content)
|
|
218
|
+
|
|
219
|
+
if (
|
|
220
|
+
isinstance(content, dict)
|
|
221
|
+
or isinstance(content, list)
|
|
222
|
+
or isinstance(content, tuple)
|
|
223
|
+
):
|
|
200
224
|
try:
|
|
201
225
|
processed_content = json.dumps(content, indent=4, ensure_ascii=False)
|
|
202
226
|
if set_language:
|
chainlit/types.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from enum import Enum
|
|
2
|
+
from pathlib import Path
|
|
2
3
|
from typing import (
|
|
3
4
|
TYPE_CHECKING,
|
|
4
5
|
Any,
|
|
@@ -144,7 +145,7 @@ class FileReference(TypedDict):
|
|
|
144
145
|
class FileDict(TypedDict):
|
|
145
146
|
id: str
|
|
146
147
|
name: str
|
|
147
|
-
path:
|
|
148
|
+
path: Path
|
|
148
149
|
size: int
|
|
149
150
|
type: str
|
|
150
151
|
|
chainlit/user_session.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from typing import Dict
|
|
2
2
|
|
|
3
|
-
from chainlit.context import context
|
|
3
|
+
from chainlit.context import WebsocketSession, context
|
|
4
4
|
|
|
5
5
|
user_sessions: Dict[str, Dict] = {}
|
|
6
6
|
|
|
@@ -27,8 +27,11 @@ class UserSession:
|
|
|
27
27
|
user_session["chat_settings"] = context.session.chat_settings
|
|
28
28
|
user_session["user"] = context.session.user
|
|
29
29
|
user_session["chat_profile"] = context.session.chat_profile
|
|
30
|
-
user_session["languages"] = context.session.languages
|
|
31
30
|
user_session["http_referer"] = context.session.http_referer
|
|
31
|
+
user_session["client_type"] = context.session.client_type
|
|
32
|
+
|
|
33
|
+
if isinstance(context.session, WebsocketSession):
|
|
34
|
+
user_session["languages"] = context.session.languages
|
|
32
35
|
|
|
33
36
|
if context.session.root_message:
|
|
34
37
|
user_session["root_message"] = context.session.root_message
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: chainlit
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.101
|
|
4
4
|
Summary: Build Conversational AI.
|
|
5
5
|
Home-page: https://github.com/Chainlit/chainlit
|
|
6
6
|
License: Apache-2.0 license
|
|
@@ -22,13 +22,12 @@ Requires-Dist: fastapi-socketio (>=0.0.10,<0.0.11)
|
|
|
22
22
|
Requires-Dist: filetype (>=1.2.0,<2.0.0)
|
|
23
23
|
Requires-Dist: httpx (>=0.23.0)
|
|
24
24
|
Requires-Dist: lazify (>=0.4.0,<0.5.0)
|
|
25
|
-
Requires-Dist: literalai (==0.0.
|
|
25
|
+
Requires-Dist: literalai (==0.0.601)
|
|
26
26
|
Requires-Dist: nest-asyncio (>=1.5.6,<2.0.0)
|
|
27
27
|
Requires-Dist: packaging (>=23.1,<24.0)
|
|
28
28
|
Requires-Dist: pydantic (>=1,<3)
|
|
29
29
|
Requires-Dist: pyjwt (>=2.8.0,<3.0.0)
|
|
30
30
|
Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
|
|
31
|
-
Requires-Dist: python-graphql-client (>=0.4.3,<0.5.0)
|
|
32
31
|
Requires-Dist: python-multipart (>=0.0.9,<0.0.10)
|
|
33
32
|
Requires-Dist: starlette (>=0.37.2,<0.38.0)
|
|
34
33
|
Requires-Dist: syncer (>=2.0.3,<3.0.0)
|
|
@@ -51,6 +50,7 @@ Chainlit is an open-source async Python framework which allows developers to bui
|
|
|
51
50
|
|
|
52
51
|
- ✅ ChatGPT-like application
|
|
53
52
|
- ✅ Embedded Chatbot & Software Copilot
|
|
53
|
+
- ✅ Slack & Discord
|
|
54
54
|
- ✅ Custom frontend (build your own agentic experience)
|
|
55
55
|
- ✅ API Endpoint
|
|
56
56
|
|
|
@@ -113,6 +113,7 @@ $ chainlit run demo.py -w
|
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
<img src="/images/quick-start.png" alt="Quick Start"></img>
|
|
116
|
+
|
|
116
117
|
## 🎉 Key Features and Integrations
|
|
117
118
|
|
|
118
119
|
Full documentation is available [here](https://docs.chainlit.io). Key features:
|
|
@@ -6,24 +6,26 @@ chainlit/cache.py,sha256=Bv3dT4eHhE6Fq3c6Do0ZTpiyoXgXYewdxTgpYghEd9g,1361
|
|
|
6
6
|
chainlit/chat_settings.py,sha256=2ByenmwS8O6jQjDVJjhhbLrBPGA5aY2F7R3VvQQxXPk,877
|
|
7
7
|
chainlit/cli/__init__.py,sha256=JEB3Z3VWpzPgcfdSOQ6Z-L7dHdl7A1y47KUZP8H08GQ,4951
|
|
8
8
|
chainlit/cli/utils.py,sha256=mE2d9oOk-B2b9ZvDV1zENoDWxjfMriGP7bVwEFduZP4,717
|
|
9
|
-
chainlit/config.py,sha256=
|
|
10
|
-
chainlit/context.py,sha256=
|
|
9
|
+
chainlit/config.py,sha256=Knk88P47PHBNfxaqrrA_Tx0qSTxd_XYcTAfXxqtEnTs,16138
|
|
10
|
+
chainlit/context.py,sha256=kBnJiKKNhft1nrXFLQnAW6M-_mzMpYqDEFAG5-lrHyo,2813
|
|
11
11
|
chainlit/copilot/dist/assets/logo_dark-2a3cf740.svg,sha256=Kjz3QMh-oh-ag4YatjU0YCPqGF7F8nHh8VUQoJIs01E,8887
|
|
12
12
|
chainlit/copilot/dist/assets/logo_light-b078e7bc.svg,sha256=sHjnvEq1rfqh3bcexJNYUY7WEDdTQZq3aKZYpi4w4ck,8889
|
|
13
|
-
chainlit/copilot/dist/index.js,sha256=
|
|
13
|
+
chainlit/copilot/dist/index.js,sha256=uAFGOjqLkaHEMeHQ_2bW17x9l5h-VpYDZ2p3zuhirlM,6963944
|
|
14
14
|
chainlit/data/__init__.py,sha256=CUkwYx9GYqIbgrLh7gmQm4qvO1mu4D0Es-z31dc00DU,16486
|
|
15
|
-
chainlit/data/acl.py,sha256=
|
|
16
|
-
chainlit/data/sql_alchemy.py,sha256=
|
|
15
|
+
chainlit/data/acl.py,sha256=5EwZuKVcZediw77L661MohGce3JzGIaYmw6NutmMTw0,578
|
|
16
|
+
chainlit/data/sql_alchemy.py,sha256=XGiqUWnT64qv9tg08C7evCRoZolv8XtqtqJno3wg9H0,26524
|
|
17
17
|
chainlit/data/storage_clients.py,sha256=D9KY1XKDjZh2uuh01ECxeoEtjw-JlrCR-WCuOuePVQI,3007
|
|
18
|
-
chainlit/
|
|
19
|
-
chainlit/
|
|
20
|
-
chainlit/
|
|
18
|
+
chainlit/discord/__init__.py,sha256=kZ_AAMaCToqO-1FdeQ8_IHS2pqNT0QJ-yyd8bCMaHHs,198
|
|
19
|
+
chainlit/discord/app.py,sha256=fmmvPhlU2DQCFWdeYGBqASrx5igcafWWMFubfiTgmkY,9960
|
|
20
|
+
chainlit/element.py,sha256=MIp-iyvsnK2iJ6Z_1Q-9JGZz_j_rrIxMM_L1LPA_5hw,10414
|
|
21
|
+
chainlit/emitter.py,sha256=54MPYoYHkOCKJvT30Vvg9mWYzWunGN9I3cFaqIoQ8oU,13037
|
|
22
|
+
chainlit/frontend/dist/assets/index-37c9a5a9.js,sha256=UwXSFbvW198sUkd6lKC9fmr4PP7glkFRH7jUMLT55ZQ,3040265
|
|
21
23
|
chainlit/frontend/dist/assets/index-d088547c.css,sha256=0IhUfCm_IY1kjvlTR2edW1qKXAFDya3LZ6mnZnP6ovk,6605
|
|
22
24
|
chainlit/frontend/dist/assets/logo_dark-2a3cf740.svg,sha256=Kjz3QMh-oh-ag4YatjU0YCPqGF7F8nHh8VUQoJIs01E,8887
|
|
23
25
|
chainlit/frontend/dist/assets/logo_light-b078e7bc.svg,sha256=sHjnvEq1rfqh3bcexJNYUY7WEDdTQZq3aKZYpi4w4ck,8889
|
|
24
|
-
chainlit/frontend/dist/assets/react-plotly-
|
|
26
|
+
chainlit/frontend/dist/assets/react-plotly-c55d0c95.js,sha256=2bwqyyCYUkqT9iqxbDAeHVGBzqbGa3y-9W17CrE5wXE,3739251
|
|
25
27
|
chainlit/frontend/dist/favicon.svg,sha256=0Cy8x28obT5eWW3nxZRhsEvu6_zMqrqbg0y6hT3D0Q0,6455
|
|
26
|
-
chainlit/frontend/dist/index.html,sha256=
|
|
28
|
+
chainlit/frontend/dist/index.html,sha256=U6x7gyKZvjECDdxzlruR0z9-zcFLDv50vTntBmTlyDo,1005
|
|
27
29
|
chainlit/haystack/__init__.py,sha256=uZ77YiPy-qleSTi3dQCDO9HE6S6F6GpJWmh7jO4cxXA,217
|
|
28
30
|
chainlit/haystack/callbacks.py,sha256=tItLc6OmskPeDEJH2Qjtg7KgAgIy1TuYQYHTZm9cr3U,5209
|
|
29
31
|
chainlit/hello.py,sha256=LwENQWo5s5r8nNDn4iKSV77vX60Ky5r_qGjQhyi7qlY,416
|
|
@@ -49,20 +51,22 @@ chainlit/playground/providers/openai.py,sha256=9aDSgXVW3sW-gaybBBWMIE8cJPyk9ZuGv
|
|
|
49
51
|
chainlit/playground/providers/vertexai.py,sha256=zKy501f-MHnLrvuRzN50FqgB3xoHzfQFTVbw83Nsj20,5084
|
|
50
52
|
chainlit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
53
|
chainlit/secret.py,sha256=cQvIFGTQ7r2heC8EOGdgifSZZYqslh-qQxhUhKhD8vU,295
|
|
52
|
-
chainlit/server.py,sha256=
|
|
53
|
-
chainlit/session.py,sha256=
|
|
54
|
-
chainlit/
|
|
55
|
-
chainlit/
|
|
54
|
+
chainlit/server.py,sha256=dlxN9CM0jzrEvUrMYP8rlkGUGlGPqcBeAYrlQa25nvo,24630
|
|
55
|
+
chainlit/session.py,sha256=SOX2zFct3apiSNcIzCDWgDRsUFgUG_6hewqWU8gfIZE,9694
|
|
56
|
+
chainlit/slack/__init__.py,sha256=Q41ztJHeVmpoXVgVqAcwGOufQp_bjf7dDT7eEXDdhPI,207
|
|
57
|
+
chainlit/slack/app.py,sha256=eYA-ZGrgKLu0cwFwgmztNnNdl95vuGyKdpDeqDCNVZo,11246
|
|
58
|
+
chainlit/socket.py,sha256=KHabfdproCBlzF4VzLgtvqDA1xMB6_Xai6Ih6MZXogg,11703
|
|
59
|
+
chainlit/step.py,sha256=KEKpQngkp6hwT2mGz62DWhWfcFNtxXWuJwomi0CzauQ,13876
|
|
56
60
|
chainlit/sync.py,sha256=G1n-7-3WgXsN8y1bJkEyws_YwmHZIyDZoZUwhprigag,1235
|
|
57
61
|
chainlit/telemetry.py,sha256=Rk4dnZv0OnGOgV4kD-VHdhgl4i7i3ypqhSE_R-LZceM,3060
|
|
58
62
|
chainlit/translations/en-US.json,sha256=uUuS4hlNoYSlDp0DZGTAlPZxwLfsP4Jiu4ckrfr-fI0,7835
|
|
59
63
|
chainlit/translations.py,sha256=WG_r7HzxBYns-zk9tVvoGdoofv71okTZx8k1RlcoTIg,2034
|
|
60
|
-
chainlit/types.py,sha256=
|
|
64
|
+
chainlit/types.py,sha256=pS0kW3cRmMRQky6nU6_LX8UEwpp7lvkwhhjbHW8DZuE,5358
|
|
61
65
|
chainlit/user.py,sha256=Cw4uGz0ffivWFszv8W__EHwkvTHQ3Lj9hqpRCPxFujo,619
|
|
62
|
-
chainlit/user_session.py,sha256=
|
|
66
|
+
chainlit/user_session.py,sha256=G1amgs1_h2tVn4mtAXZmunm9nlBHQ_rCYvJQh3nsVwQ,1645
|
|
63
67
|
chainlit/utils.py,sha256=ObNTLIhRDWcx1tHhpULUkpgWSJBlsi2USat2TLaaiTM,2604
|
|
64
68
|
chainlit/version.py,sha256=iosXhlXclBwBqlADFKEilxAC2wWKbtuBKi87AmPi7s8,196
|
|
65
|
-
chainlit-1.1.
|
|
66
|
-
chainlit-1.1.
|
|
67
|
-
chainlit-1.1.
|
|
68
|
-
chainlit-1.1.
|
|
69
|
+
chainlit-1.1.101.dist-info/METADATA,sha256=ARm44kvlU6yO7zztkOWmWPThIOZ57tT_lI07koWOWMk,5529
|
|
70
|
+
chainlit-1.1.101.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
71
|
+
chainlit-1.1.101.dist-info/entry_points.txt,sha256=FrkqdjrFl8juSnvBndniyX7XuKojmUwO4ghRh-CFMQc,45
|
|
72
|
+
chainlit-1.1.101.dist-info/RECORD,,
|