chainlit 1.1.0__py3-none-any.whl → 1.1.0rc0__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 +2 -4
- chainlit/context.py +7 -19
- chainlit/copilot/dist/index.js +521 -639
- chainlit/data/acl.py +1 -4
- chainlit/data/sql_alchemy.py +21 -22
- chainlit/element.py +2 -5
- chainlit/emitter.py +2 -11
- chainlit/frontend/dist/assets/{index-0a52365d.js → index-032fca02.js} +120 -120
- chainlit/frontend/dist/assets/react-plotly-8c993614.js +3484 -0
- chainlit/frontend/dist/index.html +1 -1
- chainlit/server.py +4 -27
- chainlit/session.py +61 -72
- chainlit/socket.py +15 -21
- chainlit/step.py +1 -25
- chainlit/types.py +1 -2
- chainlit/user_session.py +2 -5
- {chainlit-1.1.0.dist-info → chainlit-1.1.0rc0.dist-info}/METADATA +3 -4
- {chainlit-1.1.0.dist-info → chainlit-1.1.0rc0.dist-info}/RECORD +20 -24
- chainlit/discord/__init__.py +0 -6
- chainlit/discord/app.py +0 -304
- chainlit/frontend/dist/assets/react-plotly-509d26a7.js +0 -3602
- chainlit/slack/__init__.py +0 -6
- chainlit/slack/app.py +0 -368
- {chainlit-1.1.0.dist-info → chainlit-1.1.0rc0.dist-info}/WHEEL +0 -0
- {chainlit-1.1.0.dist-info → chainlit-1.1.0rc0.dist-info}/entry_points.txt +0 -0
chainlit/config.py
CHANGED
|
@@ -4,7 +4,7 @@ import site
|
|
|
4
4
|
import sys
|
|
5
5
|
from importlib import util
|
|
6
6
|
from pathlib import Path
|
|
7
|
-
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union
|
|
7
|
+
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union
|
|
8
8
|
|
|
9
9
|
import tomli
|
|
10
10
|
from chainlit.logger import logger
|
|
@@ -132,10 +132,9 @@ hide_cot = false
|
|
|
132
132
|
# Be careful: If this is a relative path, it should not start with a slash.
|
|
133
133
|
# custom_build = "./public/build"
|
|
134
134
|
|
|
135
|
+
# Override default MUI light theme. (Check theme.ts)
|
|
135
136
|
[UI.theme]
|
|
136
|
-
#layout = "wide"
|
|
137
137
|
#font_family = "Inter, sans-serif"
|
|
138
|
-
# Override default MUI light theme. (Check theme.ts)
|
|
139
138
|
[UI.theme.light]
|
|
140
139
|
#background = "#FAFAFA"
|
|
141
140
|
#paper = "#FFFFFF"
|
|
@@ -195,7 +194,6 @@ class Palette(DataClassJsonMixin):
|
|
|
195
194
|
@dataclass()
|
|
196
195
|
class Theme(DataClassJsonMixin):
|
|
197
196
|
font_family: Optional[str] = None
|
|
198
|
-
layout: Optional[Literal["default", "wide"]] = "default"
|
|
199
197
|
light: Optional[Palette] = None
|
|
200
198
|
dark: Optional[Palette] = None
|
|
201
199
|
|
chainlit/context.py
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
import uuid
|
|
3
3
|
from contextvars import ContextVar
|
|
4
|
-
from typing import TYPE_CHECKING, Dict,
|
|
4
|
+
from typing import TYPE_CHECKING, Dict, Optional, Union, List
|
|
5
5
|
|
|
6
|
-
from chainlit.session import
|
|
6
|
+
from chainlit.session import HTTPSession, WebsocketSession
|
|
7
7
|
from lazify import LazyProxy
|
|
8
8
|
|
|
9
9
|
if TYPE_CHECKING:
|
|
10
10
|
from chainlit.emitter import BaseChainlitEmitter
|
|
11
|
-
from chainlit.step import Step
|
|
12
11
|
from chainlit.user import PersistedUser, User
|
|
12
|
+
from chainlit.step import Step
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class ChainlitContextException(Exception):
|
|
@@ -28,20 +28,13 @@ class ChainlitContext:
|
|
|
28
28
|
if self.active_steps:
|
|
29
29
|
return self.active_steps[-1]
|
|
30
30
|
|
|
31
|
-
def __init__(
|
|
32
|
-
self,
|
|
33
|
-
session: Union["HTTPSession", "WebsocketSession"],
|
|
34
|
-
emitter: Optional["BaseChainlitEmitter"] = None,
|
|
35
|
-
):
|
|
31
|
+
def __init__(self, session: Union["HTTPSession", "WebsocketSession"]):
|
|
36
32
|
from chainlit.emitter import BaseChainlitEmitter, ChainlitEmitter
|
|
37
33
|
|
|
38
34
|
self.loop = asyncio.get_running_loop()
|
|
39
35
|
self.session = session
|
|
40
36
|
self.active_steps = []
|
|
41
|
-
|
|
42
|
-
if emitter:
|
|
43
|
-
self.emitter = emitter
|
|
44
|
-
elif isinstance(self.session, HTTPSession):
|
|
37
|
+
if isinstance(self.session, HTTPSession):
|
|
45
38
|
self.emitter = BaseChainlitEmitter(self.session)
|
|
46
39
|
elif isinstance(self.session, WebsocketSession):
|
|
47
40
|
self.emitter = ChainlitEmitter(self.session)
|
|
@@ -63,20 +56,15 @@ def init_ws_context(session_or_sid: Union[WebsocketSession, str]) -> ChainlitCon
|
|
|
63
56
|
|
|
64
57
|
|
|
65
58
|
def init_http_context(
|
|
66
|
-
thread_id: Optional[str] = None,
|
|
67
59
|
user: Optional[Union["User", "PersistedUser"]] = None,
|
|
68
60
|
auth_token: Optional[str] = None,
|
|
69
61
|
user_env: Optional[Dict[str, str]] = None,
|
|
70
|
-
client_type: ClientType = "webapp",
|
|
71
62
|
) -> ChainlitContext:
|
|
72
|
-
session_id = str(uuid.uuid4())
|
|
73
|
-
thread_id = thread_id or str(uuid.uuid4())
|
|
74
63
|
session = HTTPSession(
|
|
75
|
-
id=
|
|
76
|
-
thread_id=thread_id,
|
|
64
|
+
id=str(uuid.uuid4()),
|
|
77
65
|
token=auth_token,
|
|
78
66
|
user=user,
|
|
79
|
-
client_type=
|
|
67
|
+
client_type="app",
|
|
80
68
|
user_env=user_env,
|
|
81
69
|
)
|
|
82
70
|
context = ChainlitContext(session)
|