chainlit 2.0.dev0__tar.gz → 2.0.dev2__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-2.0.dev0 → chainlit-2.0.dev2}/PKG-INFO +25 -7
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/README.md +12 -2
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/__init__.py +1 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/auth.py +9 -3
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/cache.py +2 -5
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/cli/__init__.py +1 -1
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/config.py +6 -1
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/context.py +6 -8
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/copilot/dist/index.js +459 -398
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/data/base.py +0 -14
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/data/dynamodb.py +2 -1
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/data/sql_alchemy.py +3 -3
- chainlit-2.0.dev0/chainlit/data/storage_clients.py → chainlit-2.0.dev2/chainlit/data/storage_clients/azure.py +1 -33
- chainlit-2.0.dev2/chainlit/data/storage_clients/base.py +16 -0
- chainlit-2.0.dev2/chainlit/data/storage_clients/s3.py +36 -0
- chainlit-2.0.dev2/chainlit/discord/__init__.py +6 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/element.py +29 -1
- chainlit-2.0.dev2/chainlit/frontend/dist/assets/DailyMotion-D1ipkdPJ.js +1 -0
- chainlit-2.0.dev2/chainlit/frontend/dist/assets/Facebook-d4TLeTik.js +1 -0
- chainlit-2.0.dev2/chainlit/frontend/dist/assets/FilePlayer-BcU7tttX.js +1 -0
- chainlit-2.0.dev2/chainlit/frontend/dist/assets/Kaltura-DdaRjZrh.js +1 -0
- chainlit-2.0.dev2/chainlit/frontend/dist/assets/Mixcloud-BaJoMsaU.js +1 -0
- chainlit-2.0.dev2/chainlit/frontend/dist/assets/Mux-DxPCM5d3.js +1 -0
- chainlit-2.0.dev2/chainlit/frontend/dist/assets/Preview-tUK_Z9pZ.js +1 -0
- chainlit-2.0.dev2/chainlit/frontend/dist/assets/SoundCloud-K8-lFZC6.js +1 -0
- chainlit-2.0.dev2/chainlit/frontend/dist/assets/Streamable-hB-AQ54w.js +1 -0
- chainlit-2.0.dev2/chainlit/frontend/dist/assets/Twitch-pmuNY0J5.js +1 -0
- chainlit-2.0.dev2/chainlit/frontend/dist/assets/Vidyard-BSUm6trV.js +1 -0
- chainlit-2.0.dev2/chainlit/frontend/dist/assets/Vimeo-JIPn71zS.js +1 -0
- chainlit-2.0.dev2/chainlit/frontend/dist/assets/Wistia-D75KkqOG.js +1 -0
- chainlit-2.0.dev2/chainlit/frontend/dist/assets/YouTube-CPlwqNm_.js +1 -0
- chainlit-2.0.dev2/chainlit/frontend/dist/assets/index-CuSbXjG5.js +1091 -0
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/react-plotly-f0315f86.js → chainlit-2.0.dev2/chainlit/frontend/dist/assets/react-plotly-DALmanjC.js +94 -94
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/frontend/dist/index.html +2 -3
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/message.py +2 -3
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/oauth_providers.py +43 -9
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/openai/__init__.py +3 -5
- chainlit-2.0.dev2/chainlit/py.typed +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/server.py +21 -10
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/slack/__init__.py +3 -3
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/step.py +10 -18
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/teams/__init__.py +3 -3
- chainlit-2.0.dev2/chainlit/version.py +8 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/pyproject.toml +23 -6
- chainlit-2.0.dev0/chainlit/discord/__init__.py +0 -6
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/DailyMotion-b4b7af47.js +0 -1
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/Facebook-572972a0.js +0 -1
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/FilePlayer-85c69ca8.js +0 -1
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/Kaltura-dfc24672.js +0 -1
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/Mixcloud-705011f4.js +0 -1
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/Mux-4201a9e6.js +0 -1
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/Preview-23ba40a6.js +0 -1
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/SoundCloud-1a582d51.js +0 -1
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/Streamable-5017c4ba.js +0 -1
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/Twitch-bb2de2fa.js +0 -1
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/Vidyard-54e269b1.js +0 -1
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/Vimeo-d92c37dd.js +0 -1
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/Wistia-25a1363b.js +0 -1
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/YouTube-616e8cb7.js +0 -1
- chainlit-2.0.dev0/chainlit/frontend/dist/assets/index-f5df2072.js +0 -1027
- chainlit-2.0.dev0/chainlit/version.py +0 -7
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/__main__.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/_utils.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/action.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/callbacks.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/chat_context.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/chat_settings.py +0 -0
- /chainlit-2.0.dev0/chainlit/copilot/dist/assets/logo_dark-2a3cf740.svg → /chainlit-2.0.dev2/chainlit/copilot/dist/assets/logo_dark-IkGJ_IwC.svg +0 -0
- /chainlit-2.0.dev0/chainlit/copilot/dist/assets/logo_light-b078e7bc.svg → /chainlit-2.0.dev2/chainlit/copilot/dist/assets/logo_light-Bb_IPh6r.svg +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/data/__init__.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/data/acl.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/data/literalai.py +0 -0
- /chainlit-2.0.dev0/chainlit/py.typed → /chainlit-2.0.dev2/chainlit/data/storage_clients/__init__.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/data/utils.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/discord/app.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/emitter.py +0 -0
- /chainlit-2.0.dev0/chainlit/frontend/dist/assets/index-aaf974a9.css → /chainlit-2.0.dev2/chainlit/frontend/dist/assets/index-CwmincdQ.css +0 -0
- /chainlit-2.0.dev0/chainlit/frontend/dist/assets/logo_dark-2a3cf740.svg → /chainlit-2.0.dev2/chainlit/frontend/dist/assets/logo_dark-IkGJ_IwC.svg +0 -0
- /chainlit-2.0.dev0/chainlit/frontend/dist/assets/logo_light-b078e7bc.svg → /chainlit-2.0.dev2/chainlit/frontend/dist/assets/logo_light-Bb_IPh6r.svg +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/frontend/dist/favicon.svg +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/haystack/__init__.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/haystack/callbacks.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/hello.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/input_widget.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/langchain/__init__.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/langchain/callbacks.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/langflow/__init__.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/llama_index/__init__.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/llama_index/callbacks.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/logger.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/markdown.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/mistralai/__init__.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/secret.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/session.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/slack/app.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/socket.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/sync.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/teams/app.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/telemetry.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/translations/bn.json +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/translations/en-US.json +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/translations/gu.json +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/translations/he-IL.json +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/translations/hi.json +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/translations/kn.json +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/translations/ml.json +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/translations/mr.json +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/translations/ta.json +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/translations/te.json +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/translations/zh-CN.json +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/translations.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/types.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/user.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/user_session.py +0 -0
- {chainlit-2.0.dev0 → chainlit-2.0.dev2}/chainlit/utils.py +0 -0
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: chainlit
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.dev2
|
|
4
4
|
Summary: Build Conversational AI.
|
|
5
|
-
Home-page: https://
|
|
6
|
-
License: Apache-2.0
|
|
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:
|
|
10
|
+
Classifier: Environment :: Web Environment
|
|
11
|
+
Classifier: Framework :: FastAPI
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software 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)
|
|
@@ -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
|
|
|
@@ -59,9 +67,9 @@ Chainlit is an open-source async Python framework which allows developers to bui
|
|
|
59
67
|
|
|
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
|
-
> [!NOTE]
|
|
70
|
+
> [!NOTE]
|
|
63
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.
|
|
64
|
-
>
|
|
72
|
+
>
|
|
65
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.
|
|
66
74
|
|
|
67
75
|
<p align="center">
|
|
@@ -79,6 +87,16 @@ chainlit hello
|
|
|
79
87
|
|
|
80
88
|
If this opens the `hello app` in your browser, you're all set!
|
|
81
89
|
|
|
90
|
+
### Development version
|
|
91
|
+
|
|
92
|
+
The latest in-development version can be installed straight from GitHub with:
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
pip install git+https://github.com/Chainlit/chainlit.git#subdirectory=backend/
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
(Requires Node and pnpm installed on the system.)
|
|
99
|
+
|
|
82
100
|
## 🚀 Quickstart
|
|
83
101
|
|
|
84
102
|
### 🐍 Pure Python
|
|
@@ -18,9 +18,9 @@ Chainlit is an open-source async Python framework which allows developers to bui
|
|
|
18
18
|
|
|
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
|
-
> [!NOTE]
|
|
21
|
+
> [!NOTE]
|
|
22
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
|
-
>
|
|
23
|
+
>
|
|
24
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.
|
|
25
25
|
|
|
26
26
|
<p align="center">
|
|
@@ -38,6 +38,16 @@ chainlit hello
|
|
|
38
38
|
|
|
39
39
|
If this opens the `hello app` in your browser, you're all set!
|
|
40
40
|
|
|
41
|
+
### Development version
|
|
42
|
+
|
|
43
|
+
The latest in-development version can be installed straight from GitHub with:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
pip install git+https://github.com/Chainlit/chainlit.git#subdirectory=backend/
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
(Requires Node and pnpm installed on the system.)
|
|
50
|
+
|
|
41
51
|
## 🚀 Quickstart
|
|
42
52
|
|
|
43
53
|
### 🐍 Pure Python
|
|
@@ -52,7 +52,9 @@ def create_jwt(data: User) -> str:
|
|
|
52
52
|
to_encode: Dict[str, Any] = data.to_dict()
|
|
53
53
|
to_encode.update(
|
|
54
54
|
{
|
|
55
|
-
"exp": datetime.utcnow() + timedelta(
|
|
55
|
+
"exp": datetime.utcnow() + timedelta(
|
|
56
|
+
seconds=config.project.user_session_timeout
|
|
57
|
+
),
|
|
56
58
|
}
|
|
57
59
|
)
|
|
58
60
|
encoded_jwt = jwt.encode(to_encode, get_jwt_secret(), algorithm="HS256")
|
|
@@ -69,8 +71,10 @@ async def authenticate_user(token: str = Depends(reuseable_oauth)):
|
|
|
69
71
|
)
|
|
70
72
|
del dict["exp"]
|
|
71
73
|
user = User(**dict)
|
|
72
|
-
except Exception:
|
|
73
|
-
raise HTTPException(
|
|
74
|
+
except Exception as e:
|
|
75
|
+
raise HTTPException(
|
|
76
|
+
status_code=401, detail="Invalid authentication token"
|
|
77
|
+
) from e
|
|
74
78
|
if data_layer := get_data_layer():
|
|
75
79
|
try:
|
|
76
80
|
persisted_user = await data_layer.get_user(user.identifier)
|
|
@@ -79,6 +83,8 @@ async def authenticate_user(token: str = Depends(reuseable_oauth)):
|
|
|
79
83
|
except Exception:
|
|
80
84
|
return user
|
|
81
85
|
|
|
86
|
+
if user and user.display_name:
|
|
87
|
+
persisted_user.display_name = user.display_name
|
|
82
88
|
return persisted_user
|
|
83
89
|
else:
|
|
84
90
|
return user
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import importlib.util
|
|
1
2
|
import os
|
|
2
3
|
import threading
|
|
3
4
|
|
|
@@ -8,11 +9,7 @@ from chainlit.logger import logger
|
|
|
8
9
|
def init_lc_cache():
|
|
9
10
|
use_cache = config.project.cache is True and config.run.no_cache is False
|
|
10
11
|
|
|
11
|
-
if use_cache:
|
|
12
|
-
try:
|
|
13
|
-
import langchain
|
|
14
|
-
except ImportError:
|
|
15
|
-
return
|
|
12
|
+
if use_cache and importlib.util.find_spec("langchain") is not None:
|
|
16
13
|
from langchain.cache import SQLiteCache
|
|
17
14
|
from langchain.globals import set_llm_cache
|
|
18
15
|
|
|
@@ -186,7 +186,7 @@ def chainlit_run(
|
|
|
186
186
|
# This is required to have OpenAI LLM providers available for the CI run
|
|
187
187
|
os.environ["OPENAI_API_KEY"] = "sk-FAKE-OPENAI-API-KEY"
|
|
188
188
|
# This is required for authentication tests
|
|
189
|
-
os.environ["CHAINLIT_AUTH_SECRET"] = "SUPER_SECRET"
|
|
189
|
+
os.environ["CHAINLIT_AUTH_SECRET"] = "SUPER_SECRET" # nosec B105
|
|
190
190
|
else:
|
|
191
191
|
trace_event("chainlit run")
|
|
192
192
|
|
|
@@ -62,6 +62,9 @@ user_env = []
|
|
|
62
62
|
# Duration (in seconds) during which the session is saved when the connection is lost
|
|
63
63
|
session_timeout = 3600
|
|
64
64
|
|
|
65
|
+
# Duration (in seconds) of the user session expiry
|
|
66
|
+
user_session_timeout = 1296000 # 15 days
|
|
67
|
+
|
|
65
68
|
# Enable third parties caching (e.g LangChain cache)
|
|
66
69
|
cache = false
|
|
67
70
|
|
|
@@ -306,6 +309,8 @@ class ProjectSettings(DataClassJsonMixin):
|
|
|
306
309
|
# Path to the local chat db
|
|
307
310
|
# Duration (in seconds) during which the session is saved when the connection is lost
|
|
308
311
|
session_timeout: int = 3600
|
|
312
|
+
# Duration (in seconds) of the user session expiry
|
|
313
|
+
user_session_timeout: int = 1296000 # 15 days
|
|
309
314
|
# Enable third parties caching (e.g LangChain cache)
|
|
310
315
|
cache: bool = False
|
|
311
316
|
# Follow symlink for asset mount (see https://github.com/Chainlit/chainlit/issues/317)
|
|
@@ -447,7 +452,7 @@ def load_settings():
|
|
|
447
452
|
|
|
448
453
|
if not meta or meta.get("generated_by") <= "0.3.0":
|
|
449
454
|
raise ValueError(
|
|
450
|
-
"Your config file is outdated. Please delete it and restart the app to regenerate it."
|
|
455
|
+
f"Your config file '{config_file}' is outdated. Please delete it and restart the app to regenerate it."
|
|
451
456
|
)
|
|
452
457
|
|
|
453
458
|
lc_cache_path = os.path.join(config_dir, ".langchain.db")
|
|
@@ -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
|
|
@@ -105,8 +103,8 @@ def init_http_context(
|
|
|
105
103
|
def get_context() -> ChainlitContext:
|
|
106
104
|
try:
|
|
107
105
|
return context_var.get()
|
|
108
|
-
except LookupError:
|
|
109
|
-
raise ChainlitContextException()
|
|
106
|
+
except LookupError as e:
|
|
107
|
+
raise ChainlitContextException() from e
|
|
110
108
|
|
|
111
109
|
|
|
112
110
|
context: ChainlitContext = LazyProxy(get_context, enable_cache=False)
|