chainlit 1.2.0__py3-none-any.whl → 1.3.0__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/auth.py +9 -7
- chainlit/cli/__init__.py +3 -1
- chainlit/context.py +4 -6
- chainlit/copilot/dist/index.js +252 -261
- chainlit/data/__init__.py +11 -6
- chainlit/data/dynamodb.py +10 -6
- chainlit/data/literalai.py +168 -59
- chainlit/data/sql_alchemy.py +91 -16
- chainlit/element.py +3 -2
- chainlit/frontend/dist/assets/DailyMotion-CwoOhIL8.js +1 -0
- chainlit/frontend/dist/assets/Facebook-BhnGXlzq.js +1 -0
- chainlit/frontend/dist/assets/FilePlayer-CPSVT6fz.js +1 -0
- chainlit/frontend/dist/assets/Kaltura-COYaLzsL.js +1 -0
- chainlit/frontend/dist/assets/Mixcloud-JdadNiQ5.js +1 -0
- chainlit/frontend/dist/assets/Mux-CBN7RO2u.js +1 -0
- chainlit/frontend/dist/assets/Preview-CxAFvvjV.js +1 -0
- chainlit/frontend/dist/assets/SoundCloud-JlgmASWm.js +1 -0
- chainlit/frontend/dist/assets/Streamable-CUWgr6Zw.js +1 -0
- chainlit/frontend/dist/assets/Twitch-BiN1HEDM.js +1 -0
- chainlit/frontend/dist/assets/Vidyard-qhPmrhDm.js +1 -0
- chainlit/frontend/dist/assets/Vimeo-CrZVSCaT.js +1 -0
- chainlit/frontend/dist/assets/Wistia-C891KrBP.js +1 -0
- chainlit/frontend/dist/assets/YouTube-DKjw5Hbn.js +1 -0
- chainlit/frontend/dist/assets/index-DLRdQOIx.js +723 -0
- chainlit/frontend/dist/assets/{react-plotly-f52a41eb.js → react-plotly-Dpmqg5Sy.js} +94 -94
- chainlit/frontend/dist/index.html +2 -3
- chainlit/haystack/callbacks.py +1 -3
- chainlit/langchain/callbacks.py +1 -2
- chainlit/message.py +1 -1
- chainlit/mistralai/__init__.py +0 -1
- chainlit/oauth_providers.py +46 -3
- chainlit/openai/__init__.py +3 -5
- chainlit/server.py +19 -9
- chainlit/session.py +8 -19
- chainlit/socket.py +3 -3
- chainlit/step.py +13 -20
- {chainlit-1.2.0.dist-info → chainlit-1.3.0.dist-info}/METADATA +24 -16
- {chainlit-1.2.0.dist-info → chainlit-1.3.0.dist-info}/RECORD +45 -45
- chainlit/frontend/dist/assets/DailyMotion-05f4fe48.js +0 -1
- chainlit/frontend/dist/assets/Facebook-f25411d1.js +0 -1
- chainlit/frontend/dist/assets/FilePlayer-40ff3414.js +0 -1
- chainlit/frontend/dist/assets/Kaltura-6cbf3897.js +0 -1
- chainlit/frontend/dist/assets/Mixcloud-34e7c912.js +0 -1
- chainlit/frontend/dist/assets/Mux-8aaff6ac.js +0 -1
- chainlit/frontend/dist/assets/Preview-2d3bf558.js +0 -1
- chainlit/frontend/dist/assets/SoundCloud-b835f90f.js +0 -1
- chainlit/frontend/dist/assets/Streamable-1293e4f3.js +0 -1
- chainlit/frontend/dist/assets/Twitch-c69660cd.js +0 -1
- chainlit/frontend/dist/assets/Vidyard-43bda599.js +0 -1
- chainlit/frontend/dist/assets/Vimeo-54150039.js +0 -1
- chainlit/frontend/dist/assets/Wistia-aa3c721b.js +0 -1
- chainlit/frontend/dist/assets/YouTube-dd0f3cc2.js +0 -1
- chainlit/frontend/dist/assets/index-cf48bedd.js +0 -729
- /chainlit/copilot/dist/assets/{logo_dark-2a3cf740.svg → logo_dark-IkGJ_IwC.svg} +0 -0
- /chainlit/copilot/dist/assets/{logo_light-b078e7bc.svg → logo_light-Bb_IPh6r.svg} +0 -0
- /chainlit/frontend/dist/assets/{index-aaf974a9.css → index-CwmincdQ.css} +0 -0
- /chainlit/frontend/dist/assets/{logo_dark-2a3cf740.svg → logo_dark-IkGJ_IwC.svg} +0 -0
- /chainlit/frontend/dist/assets/{logo_light-b078e7bc.svg → logo_light-Bb_IPh6r.svg} +0 -0
- {chainlit-1.2.0.dist-info → chainlit-1.3.0.dist-info}/WHEEL +0 -0
- {chainlit-1.2.0.dist-info → chainlit-1.3.0.dist-info}/entry_points.txt +0 -0
chainlit/auth.py
CHANGED
|
@@ -42,14 +42,14 @@ def get_configuration():
|
|
|
42
42
|
"requireLogin": require_login(),
|
|
43
43
|
"passwordAuth": config.code.password_auth_callback is not None,
|
|
44
44
|
"headerAuth": config.code.header_auth_callback is not None,
|
|
45
|
-
"oauthProviders":
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
"oauthProviders": (
|
|
46
|
+
get_configured_oauth_providers() if is_oauth_enabled() else []
|
|
47
|
+
),
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
def create_jwt(data: User) -> str:
|
|
52
|
-
to_encode
|
|
52
|
+
to_encode: Dict[str, Any] = data.to_dict()
|
|
53
53
|
to_encode.update(
|
|
54
54
|
{
|
|
55
55
|
"exp": datetime.utcnow() + timedelta(minutes=60 * 24 * 15), # 15 days
|
|
@@ -69,16 +69,18 @@ async def authenticate_user(token: str = Depends(reuseable_oauth)):
|
|
|
69
69
|
)
|
|
70
70
|
del dict["exp"]
|
|
71
71
|
user = User(**dict)
|
|
72
|
-
except Exception
|
|
72
|
+
except Exception:
|
|
73
73
|
raise HTTPException(status_code=401, detail="Invalid authentication token")
|
|
74
74
|
if data_layer := get_data_layer():
|
|
75
75
|
try:
|
|
76
76
|
persisted_user = await data_layer.get_user(user.identifier)
|
|
77
|
-
if persisted_user
|
|
77
|
+
if persisted_user is None:
|
|
78
78
|
persisted_user = await data_layer.create_user(user)
|
|
79
|
-
except Exception
|
|
79
|
+
except Exception:
|
|
80
80
|
return user
|
|
81
81
|
|
|
82
|
+
if user and user.display_name:
|
|
83
|
+
persisted_user.display_name = user.display_name
|
|
82
84
|
return persisted_user
|
|
83
85
|
else:
|
|
84
86
|
return user
|
chainlit/cli/__init__.py
CHANGED
|
@@ -5,8 +5,10 @@ import click
|
|
|
5
5
|
import nest_asyncio
|
|
6
6
|
import uvicorn
|
|
7
7
|
|
|
8
|
+
# Not sure if it is necessary to call nest_asyncio.apply() before the other imports
|
|
8
9
|
nest_asyncio.apply()
|
|
9
10
|
|
|
11
|
+
# ruff: noqa: E402
|
|
10
12
|
from chainlit.cache import init_lc_cache
|
|
11
13
|
from chainlit.config import (
|
|
12
14
|
BACKEND_ROOT,
|
|
@@ -183,7 +185,7 @@ def chainlit_run(
|
|
|
183
185
|
no_cache = True
|
|
184
186
|
# This is required to have OpenAI LLM providers available for the CI run
|
|
185
187
|
os.environ["OPENAI_API_KEY"] = "sk-FAKE-OPENAI-API-KEY"
|
|
186
|
-
# This is required for
|
|
188
|
+
# This is required for authentication tests
|
|
187
189
|
os.environ["CHAINLIT_AUTH_SECRET"] = "SUPER_SECRET"
|
|
188
190
|
else:
|
|
189
191
|
trace_event("chainlit run")
|
chainlit/context.py
CHANGED
|
@@ -23,18 +23,17 @@ class ChainlitContext:
|
|
|
23
23
|
loop: asyncio.AbstractEventLoop
|
|
24
24
|
emitter: "BaseChainlitEmitter"
|
|
25
25
|
session: Union["HTTPSession", "WebsocketSession"]
|
|
26
|
-
active_steps: List["Step"]
|
|
27
26
|
|
|
28
27
|
@property
|
|
29
28
|
def current_step(self):
|
|
30
|
-
if
|
|
31
|
-
return
|
|
29
|
+
if previous_steps := local_steps.get():
|
|
30
|
+
return previous_steps[-1]
|
|
32
31
|
|
|
33
32
|
@property
|
|
34
33
|
def current_run(self):
|
|
35
|
-
if
|
|
34
|
+
if previous_steps := local_steps.get():
|
|
36
35
|
return next(
|
|
37
|
-
(step for step in
|
|
36
|
+
(step for step in previous_steps if step.name in CL_RUN_NAMES), None
|
|
38
37
|
)
|
|
39
38
|
|
|
40
39
|
def __init__(
|
|
@@ -46,7 +45,6 @@ class ChainlitContext:
|
|
|
46
45
|
|
|
47
46
|
self.loop = asyncio.get_running_loop()
|
|
48
47
|
self.session = session
|
|
49
|
-
self.active_steps = []
|
|
50
48
|
|
|
51
49
|
if emitter:
|
|
52
50
|
self.emitter = emitter
|