chainlit 1.2.0__tar.gz → 1.3.0__tar.gz
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-1.2.0 → chainlit-1.3.0}/PKG-INFO +24 -16
- {chainlit-1.2.0 → chainlit-1.3.0}/README.md +11 -11
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/auth.py +9 -7
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/cli/__init__.py +3 -1
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/context.py +4 -6
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/copilot/dist/index.js +252 -261
- chainlit-1.3.0/chainlit/data/__init__.py +25 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/data/dynamodb.py +10 -6
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/data/literalai.py +168 -59
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/data/sql_alchemy.py +91 -16
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/element.py +3 -2
- chainlit-1.3.0/chainlit/frontend/dist/assets/DailyMotion-CwoOhIL8.js +1 -0
- chainlit-1.3.0/chainlit/frontend/dist/assets/Facebook-BhnGXlzq.js +1 -0
- chainlit-1.3.0/chainlit/frontend/dist/assets/FilePlayer-CPSVT6fz.js +1 -0
- chainlit-1.3.0/chainlit/frontend/dist/assets/Kaltura-COYaLzsL.js +1 -0
- chainlit-1.3.0/chainlit/frontend/dist/assets/Mixcloud-JdadNiQ5.js +1 -0
- chainlit-1.3.0/chainlit/frontend/dist/assets/Mux-CBN7RO2u.js +1 -0
- chainlit-1.3.0/chainlit/frontend/dist/assets/Preview-CxAFvvjV.js +1 -0
- chainlit-1.3.0/chainlit/frontend/dist/assets/SoundCloud-JlgmASWm.js +1 -0
- chainlit-1.3.0/chainlit/frontend/dist/assets/Streamable-CUWgr6Zw.js +1 -0
- chainlit-1.3.0/chainlit/frontend/dist/assets/Twitch-BiN1HEDM.js +1 -0
- chainlit-1.3.0/chainlit/frontend/dist/assets/Vidyard-qhPmrhDm.js +1 -0
- chainlit-1.3.0/chainlit/frontend/dist/assets/Vimeo-CrZVSCaT.js +1 -0
- chainlit-1.3.0/chainlit/frontend/dist/assets/Wistia-C891KrBP.js +1 -0
- chainlit-1.3.0/chainlit/frontend/dist/assets/YouTube-DKjw5Hbn.js +1 -0
- chainlit-1.3.0/chainlit/frontend/dist/assets/index-DLRdQOIx.js +723 -0
- chainlit-1.2.0/chainlit/frontend/dist/assets/react-plotly-f52a41eb.js → chainlit-1.3.0/chainlit/frontend/dist/assets/react-plotly-Dpmqg5Sy.js +94 -94
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/frontend/dist/index.html +2 -3
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/haystack/callbacks.py +1 -3
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/langchain/callbacks.py +1 -2
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/message.py +1 -1
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/mistralai/__init__.py +0 -1
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/oauth_providers.py +46 -3
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/openai/__init__.py +3 -5
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/server.py +19 -9
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/session.py +8 -19
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/socket.py +3 -3
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/step.py +13 -20
- {chainlit-1.2.0 → chainlit-1.3.0}/pyproject.toml +25 -5
- chainlit-1.2.0/chainlit/data/__init__.py +0 -20
- chainlit-1.2.0/chainlit/frontend/dist/assets/DailyMotion-05f4fe48.js +0 -1
- chainlit-1.2.0/chainlit/frontend/dist/assets/Facebook-f25411d1.js +0 -1
- chainlit-1.2.0/chainlit/frontend/dist/assets/FilePlayer-40ff3414.js +0 -1
- chainlit-1.2.0/chainlit/frontend/dist/assets/Kaltura-6cbf3897.js +0 -1
- chainlit-1.2.0/chainlit/frontend/dist/assets/Mixcloud-34e7c912.js +0 -1
- chainlit-1.2.0/chainlit/frontend/dist/assets/Mux-8aaff6ac.js +0 -1
- chainlit-1.2.0/chainlit/frontend/dist/assets/Preview-2d3bf558.js +0 -1
- chainlit-1.2.0/chainlit/frontend/dist/assets/SoundCloud-b835f90f.js +0 -1
- chainlit-1.2.0/chainlit/frontend/dist/assets/Streamable-1293e4f3.js +0 -1
- chainlit-1.2.0/chainlit/frontend/dist/assets/Twitch-c69660cd.js +0 -1
- chainlit-1.2.0/chainlit/frontend/dist/assets/Vidyard-43bda599.js +0 -1
- chainlit-1.2.0/chainlit/frontend/dist/assets/Vimeo-54150039.js +0 -1
- chainlit-1.2.0/chainlit/frontend/dist/assets/Wistia-aa3c721b.js +0 -1
- chainlit-1.2.0/chainlit/frontend/dist/assets/YouTube-dd0f3cc2.js +0 -1
- chainlit-1.2.0/chainlit/frontend/dist/assets/index-cf48bedd.js +0 -729
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/__init__.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/__main__.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/_utils.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/action.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/cache.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/callbacks.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/chat_context.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/chat_settings.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/config.py +0 -0
- /chainlit-1.2.0/chainlit/copilot/dist/assets/logo_dark-2a3cf740.svg → /chainlit-1.3.0/chainlit/copilot/dist/assets/logo_dark-IkGJ_IwC.svg +0 -0
- /chainlit-1.2.0/chainlit/copilot/dist/assets/logo_light-b078e7bc.svg → /chainlit-1.3.0/chainlit/copilot/dist/assets/logo_light-Bb_IPh6r.svg +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/data/acl.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/data/base.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/data/storage_clients.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/data/utils.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/discord/__init__.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/discord/app.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/emitter.py +0 -0
- /chainlit-1.2.0/chainlit/frontend/dist/assets/index-aaf974a9.css → /chainlit-1.3.0/chainlit/frontend/dist/assets/index-CwmincdQ.css +0 -0
- /chainlit-1.2.0/chainlit/frontend/dist/assets/logo_dark-2a3cf740.svg → /chainlit-1.3.0/chainlit/frontend/dist/assets/logo_dark-IkGJ_IwC.svg +0 -0
- /chainlit-1.2.0/chainlit/frontend/dist/assets/logo_light-b078e7bc.svg → /chainlit-1.3.0/chainlit/frontend/dist/assets/logo_light-Bb_IPh6r.svg +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/frontend/dist/favicon.svg +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/haystack/__init__.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/hello.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/input_widget.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/langchain/__init__.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/langflow/__init__.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/llama_index/__init__.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/llama_index/callbacks.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/logger.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/markdown.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/py.typed +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/secret.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/slack/__init__.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/slack/app.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/sync.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/teams/__init__.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/teams/app.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/telemetry.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/bn.json +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/en-US.json +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/gu.json +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/he-IL.json +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/hi.json +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/kn.json +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/ml.json +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/mr.json +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/ta.json +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/te.json +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations/zh-CN.json +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/translations.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/types.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/user.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/user_session.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/utils.py +0 -0
- {chainlit-1.2.0 → chainlit-1.3.0}/chainlit/version.py +0 -0
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: chainlit
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Build Conversational AI.
|
|
5
|
-
Home-page: https://
|
|
6
|
-
License:
|
|
5
|
+
Home-page: https://chainlit.io/
|
|
6
|
+
License: Apache-2.0
|
|
7
7
|
Keywords: LLM,Agents,gen ai,chat ui,chatbot ui,openai,copilot,langchain,conversational ai
|
|
8
|
-
Author:
|
|
8
|
+
Author: Willy Douhard
|
|
9
9
|
Requires-Python: >=3.9,<4.0.0
|
|
10
|
+
Classifier: Environment :: Web Environment
|
|
11
|
+
Classifier: Framework :: FastAPI
|
|
10
12
|
Classifier: License :: Other/Proprietary License
|
|
13
|
+
Classifier: Programming Language :: JavaScript
|
|
11
14
|
Classifier: Programming Language :: Python :: 3
|
|
12
15
|
Classifier: Programming Language :: Python :: 3.9
|
|
13
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Communications :: Chat
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
16
23
|
Requires-Dist: aiofiles (>=23.1.0,<24.0.0)
|
|
17
24
|
Requires-Dist: asyncer (>=0.0.7,<0.0.8)
|
|
18
25
|
Requires-Dist: click (>=8.1.3,<9.0.0)
|
|
@@ -21,7 +28,7 @@ Requires-Dist: fastapi (>=0.110.1,<0.113)
|
|
|
21
28
|
Requires-Dist: filetype (>=1.2.0,<2.0.0)
|
|
22
29
|
Requires-Dist: httpx (>=0.23.0)
|
|
23
30
|
Requires-Dist: lazify (>=0.4.0,<0.5.0)
|
|
24
|
-
Requires-Dist: literalai (==0.0.
|
|
31
|
+
Requires-Dist: literalai (==0.0.623)
|
|
25
32
|
Requires-Dist: nest-asyncio (>=1.6.0,<2.0.0)
|
|
26
33
|
Requires-Dist: numpy (>=1.26,<2.0)
|
|
27
34
|
Requires-Dist: packaging (>=23.1,<24.0)
|
|
@@ -36,6 +43,7 @@ Requires-Dist: tomli (>=2.0.1,<3.0.0)
|
|
|
36
43
|
Requires-Dist: uptrace (>=1.22.0,<2.0.0)
|
|
37
44
|
Requires-Dist: uvicorn (>=0.25.0,<0.26.0)
|
|
38
45
|
Requires-Dist: watchfiles (>=0.20.0,<0.21.0)
|
|
46
|
+
Project-URL: Documentation, https://docs.chainlit.io/
|
|
39
47
|
Project-URL: Repository, https://github.com/Chainlit/chainlit
|
|
40
48
|
Description-Content-Type: text/markdown
|
|
41
49
|
|
|
@@ -60,20 +68,21 @@ Chainlit is an open-source async Python framework which allows developers to bui
|
|
|
60
68
|
Full documentation is available [here](https://docs.chainlit.io). You can ask Chainlit related questions to [Chainlit Help](https://help.chainlit.io/), an app built using Chainlit!
|
|
61
69
|
|
|
62
70
|
> [!NOTE]
|
|
63
|
-
> Contact us [here](https://forms.gle/BX3UNBLmTF75KgZVA) for **Enterprise Support**.
|
|
64
71
|
> Check out [Literal AI](https://literalai.com), our product to monitor and evaluate LLM applications! It works with any Python or TypeScript applications and [seamlessly](https://docs.chainlit.io/data-persistence/overview) with Chainlit by adding a `LITERAL_API_KEY` in your project.
|
|
72
|
+
>
|
|
73
|
+
> Chainlit is developed and maintained by the Literal AI team, which is currently focused on expanding the capabilities of Literal AI. While we continue to support and maintain Chainlit, we are also committed to enabling the community to contribute, particularly in areas like integrations and data layers.
|
|
65
74
|
|
|
66
75
|
<p align="center">
|
|
67
|
-
<img src="https://github.com/Chainlit/chainlit/assets/13104895/0c2cc7a9-766c-41d3-aae2-117a2d0eb8ed" width="80%"
|
|
76
|
+
<img src="https://github.com/Chainlit/chainlit/assets/13104895/0c2cc7a9-766c-41d3-aae2-117a2d0eb8ed" alt="Chainlit user interface" width="80%"></img>
|
|
68
77
|
</p>
|
|
69
78
|
|
|
70
79
|
## Installation
|
|
71
80
|
|
|
72
81
|
Open a terminal and run:
|
|
73
82
|
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
```sh
|
|
84
|
+
pip install chainlit
|
|
85
|
+
chainlit hello
|
|
77
86
|
```
|
|
78
87
|
|
|
79
88
|
If this opens the `hello app` in your browser, you're all set!
|
|
@@ -108,18 +117,17 @@ async def main(message: cl.Message):
|
|
|
108
117
|
None.
|
|
109
118
|
"""
|
|
110
119
|
|
|
111
|
-
final_answer = await cl.Message(content="").send()
|
|
112
120
|
|
|
113
121
|
# Call the tool
|
|
114
|
-
|
|
122
|
+
tool_res = await tool()
|
|
115
123
|
|
|
116
|
-
await
|
|
124
|
+
await cl.Message(content=tool_res).send()
|
|
117
125
|
```
|
|
118
126
|
|
|
119
127
|
Now run it!
|
|
120
128
|
|
|
121
|
-
```
|
|
122
|
-
|
|
129
|
+
```sh
|
|
130
|
+
chainlit run demo.py -w
|
|
123
131
|
```
|
|
124
132
|
|
|
125
133
|
<img src="/images/quick-start.png" alt="Quick Start"></img>
|
|
@@ -129,7 +137,7 @@ $ chainlit run demo.py -w
|
|
|
129
137
|
Full documentation is available [here](https://docs.chainlit.io). Key features:
|
|
130
138
|
|
|
131
139
|
- [💬 Multi Modal chats](https://docs.chainlit.io/advanced-features/multi-modal)
|
|
132
|
-
- [💭 Chain of Thought
|
|
140
|
+
- [💭 Chain of Thought visualization](https://docs.chainlit.io/concepts/step)
|
|
133
141
|
- [💾 Data persistence + human feedback](https://docs.chainlit.io/data-persistence/overview)
|
|
134
142
|
- [🐛 Debug Mode](https://docs.chainlit.io/data-persistence/enterprise#debug-mode)
|
|
135
143
|
- [👤 Authentication](https://docs.chainlit.io/authentication/overview)
|
|
@@ -19,20 +19,21 @@ Chainlit is an open-source async Python framework which allows developers to bui
|
|
|
19
19
|
Full documentation is available [here](https://docs.chainlit.io). You can ask Chainlit related questions to [Chainlit Help](https://help.chainlit.io/), an app built using Chainlit!
|
|
20
20
|
|
|
21
21
|
> [!NOTE]
|
|
22
|
-
> Contact us [here](https://forms.gle/BX3UNBLmTF75KgZVA) for **Enterprise Support**.
|
|
23
22
|
> Check out [Literal AI](https://literalai.com), our product to monitor and evaluate LLM applications! It works with any Python or TypeScript applications and [seamlessly](https://docs.chainlit.io/data-persistence/overview) with Chainlit by adding a `LITERAL_API_KEY` in your project.
|
|
23
|
+
>
|
|
24
|
+
> Chainlit is developed and maintained by the Literal AI team, which is currently focused on expanding the capabilities of Literal AI. While we continue to support and maintain Chainlit, we are also committed to enabling the community to contribute, particularly in areas like integrations and data layers.
|
|
24
25
|
|
|
25
26
|
<p align="center">
|
|
26
|
-
<img src="https://github.com/Chainlit/chainlit/assets/13104895/0c2cc7a9-766c-41d3-aae2-117a2d0eb8ed" width="80%"
|
|
27
|
+
<img src="https://github.com/Chainlit/chainlit/assets/13104895/0c2cc7a9-766c-41d3-aae2-117a2d0eb8ed" alt="Chainlit user interface" width="80%"></img>
|
|
27
28
|
</p>
|
|
28
29
|
|
|
29
30
|
## Installation
|
|
30
31
|
|
|
31
32
|
Open a terminal and run:
|
|
32
33
|
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
```sh
|
|
35
|
+
pip install chainlit
|
|
36
|
+
chainlit hello
|
|
36
37
|
```
|
|
37
38
|
|
|
38
39
|
If this opens the `hello app` in your browser, you're all set!
|
|
@@ -67,18 +68,17 @@ async def main(message: cl.Message):
|
|
|
67
68
|
None.
|
|
68
69
|
"""
|
|
69
70
|
|
|
70
|
-
final_answer = await cl.Message(content="").send()
|
|
71
71
|
|
|
72
72
|
# Call the tool
|
|
73
|
-
|
|
73
|
+
tool_res = await tool()
|
|
74
74
|
|
|
75
|
-
await
|
|
75
|
+
await cl.Message(content=tool_res).send()
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
Now run it!
|
|
79
79
|
|
|
80
|
-
```
|
|
81
|
-
|
|
80
|
+
```sh
|
|
81
|
+
chainlit run demo.py -w
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
<img src="/images/quick-start.png" alt="Quick Start"></img>
|
|
@@ -88,7 +88,7 @@ $ chainlit run demo.py -w
|
|
|
88
88
|
Full documentation is available [here](https://docs.chainlit.io). Key features:
|
|
89
89
|
|
|
90
90
|
- [💬 Multi Modal chats](https://docs.chainlit.io/advanced-features/multi-modal)
|
|
91
|
-
- [💭 Chain of Thought
|
|
91
|
+
- [💭 Chain of Thought visualization](https://docs.chainlit.io/concepts/step)
|
|
92
92
|
- [💾 Data persistence + human feedback](https://docs.chainlit.io/data-persistence/overview)
|
|
93
93
|
- [🐛 Debug Mode](https://docs.chainlit.io/data-persistence/enterprise#debug-mode)
|
|
94
94
|
- [👤 Authentication](https://docs.chainlit.io/authentication/overview)
|
|
@@ -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
|
|
@@ -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")
|
|
@@ -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
|