chainlit 1.1.300rc4__tar.gz → 1.1.301__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.

Files changed (80) hide show
  1. {chainlit-1.1.300rc4 → chainlit-1.1.301}/PKG-INFO +2 -2
  2. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/__init__.py +3 -1
  3. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/cli/__init__.py +53 -6
  4. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/config.py +4 -0
  5. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/context.py +9 -0
  6. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/copilot/dist/index.js +180 -180
  7. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/data/__init__.py +6 -3
  8. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/data/sql_alchemy.py +3 -3
  9. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/element.py +33 -9
  10. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/emitter.py +4 -4
  11. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/DailyMotion-1a2b7d60.js → chainlit-1.1.301/chainlit/frontend/dist/assets/DailyMotion-578b63e6.js +1 -1
  12. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/Facebook-8422f48c.js → chainlit-1.1.301/chainlit/frontend/dist/assets/Facebook-b825e5bb.js +1 -1
  13. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/FilePlayer-a0a41349.js → chainlit-1.1.301/chainlit/frontend/dist/assets/FilePlayer-bcba3b4e.js +1 -1
  14. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/Kaltura-aa7990f2.js → chainlit-1.1.301/chainlit/frontend/dist/assets/Kaltura-fc1c9497.js +1 -1
  15. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/Mixcloud-1647b3e4.js → chainlit-1.1.301/chainlit/frontend/dist/assets/Mixcloud-4cfb2724.js +1 -1
  16. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/Mux-7e57be81.js → chainlit-1.1.301/chainlit/frontend/dist/assets/Mux-aa92055c.js +1 -1
  17. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/Preview-cb89b2c6.js → chainlit-1.1.301/chainlit/frontend/dist/assets/Preview-9f55905a.js +1 -1
  18. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/SoundCloud-c0d86d55.js → chainlit-1.1.301/chainlit/frontend/dist/assets/SoundCloud-f991fe03.js +1 -1
  19. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/Streamable-57c43c18.js → chainlit-1.1.301/chainlit/frontend/dist/assets/Streamable-53128f49.js +1 -1
  20. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/Twitch-bed3f21d.js → chainlit-1.1.301/chainlit/frontend/dist/assets/Twitch-fce8b9f5.js +1 -1
  21. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/Vidyard-4dd76e44.js → chainlit-1.1.301/chainlit/frontend/dist/assets/Vidyard-e35c6102.js +1 -1
  22. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/Vimeo-93bb5ae2.js → chainlit-1.1.301/chainlit/frontend/dist/assets/Vimeo-fff35f8e.js +1 -1
  23. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/Wistia-97199246.js → chainlit-1.1.301/chainlit/frontend/dist/assets/Wistia-ec07dc64.js +1 -1
  24. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/YouTube-fe1a7afe.js → chainlit-1.1.301/chainlit/frontend/dist/assets/YouTube-ad068e2a.js +1 -1
  25. chainlit-1.1.301/chainlit/frontend/dist/assets/index-d40d41cc.js +727 -0
  26. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/react-plotly-b416b8f9.js → chainlit-1.1.301/chainlit/frontend/dist/assets/react-plotly-b2c6442b.js +1 -1
  27. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/frontend/dist/index.html +1 -2
  28. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/message.py +13 -8
  29. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/oauth_providers.py +96 -4
  30. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/server.py +182 -57
  31. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/slack/app.py +2 -2
  32. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/socket.py +24 -21
  33. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/step.py +12 -3
  34. chainlit-1.1.301/chainlit/teams/__init__.py +6 -0
  35. chainlit-1.1.301/chainlit/teams/app.py +332 -0
  36. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/translations/en-US.json +1 -1
  37. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/types.py +7 -17
  38. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/user.py +9 -1
  39. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/utils.py +43 -0
  40. {chainlit-1.1.300rc4 → chainlit-1.1.301}/pyproject.toml +4 -3
  41. chainlit-1.1.300rc4/chainlit/cli/utils.py +0 -24
  42. chainlit-1.1.300rc4/chainlit/frontend/dist/assets/index-919bea8f.js +0 -727
  43. {chainlit-1.1.300rc4 → chainlit-1.1.301}/README.md +0 -0
  44. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/__main__.py +0 -0
  45. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/action.py +0 -0
  46. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/auth.py +0 -0
  47. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/cache.py +0 -0
  48. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/chat_settings.py +0 -0
  49. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/copilot/dist/assets/logo_dark-2a3cf740.svg +0 -0
  50. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/copilot/dist/assets/logo_light-b078e7bc.svg +0 -0
  51. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/data/acl.py +0 -0
  52. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/data/dynamodb.py +0 -0
  53. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/data/storage_clients.py +0 -0
  54. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/discord/__init__.py +0 -0
  55. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/discord/app.py +0 -0
  56. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/frontend/dist/assets/index-aaf974a9.css +0 -0
  57. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/frontend/dist/assets/logo_dark-2a3cf740.svg +0 -0
  58. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/frontend/dist/assets/logo_light-b078e7bc.svg +0 -0
  59. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/frontend/dist/favicon.svg +0 -0
  60. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/haystack/__init__.py +0 -0
  61. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/haystack/callbacks.py +0 -0
  62. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/hello.py +0 -0
  63. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/input_widget.py +0 -0
  64. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/langchain/__init__.py +0 -0
  65. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/langchain/callbacks.py +0 -0
  66. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/langflow/__init__.py +0 -0
  67. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/llama_index/__init__.py +0 -0
  68. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/llama_index/callbacks.py +0 -0
  69. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/logger.py +0 -0
  70. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/markdown.py +0 -0
  71. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/openai/__init__.py +0 -0
  72. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/py.typed +0 -0
  73. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/secret.py +0 -0
  74. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/session.py +0 -0
  75. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/slack/__init__.py +0 -0
  76. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/sync.py +0 -0
  77. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/telemetry.py +0 -0
  78. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/translations.py +0 -0
  79. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/user_session.py +0 -0
  80. {chainlit-1.1.300rc4 → chainlit-1.1.301}/chainlit/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chainlit
3
- Version: 1.1.300rc4
3
+ Version: 1.1.301
4
4
  Summary: Build Conversational AI.
5
5
  Home-page: https://github.com/Chainlit/chainlit
6
6
  License: Apache-2.0 license
@@ -18,7 +18,6 @@ Requires-Dist: asyncer (>=0.0.2,<0.0.3)
18
18
  Requires-Dist: click (>=8.1.3,<9.0.0)
19
19
  Requires-Dist: dataclasses_json (>=0.5.7,<0.6.0)
20
20
  Requires-Dist: fastapi (>=0.110.1,<0.111.0)
21
- Requires-Dist: fastapi-socketio (>=0.0.10,<0.0.11)
22
21
  Requires-Dist: filetype (>=1.2.0,<2.0.0)
23
22
  Requires-Dist: httpx (>=0.23.0)
24
23
  Requires-Dist: lazify (>=0.4.0,<0.5.0)
@@ -31,6 +30,7 @@ Requires-Dist: pydantic (>=1,<3)
31
30
  Requires-Dist: pyjwt (>=2.8.0,<3.0.0)
32
31
  Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
33
32
  Requires-Dist: python-multipart (>=0.0.9,<0.0.10)
33
+ Requires-Dist: python-socketio (>=5.11.0,<6.0.0)
34
34
  Requires-Dist: starlette (>=0.37.2,<0.38.0)
35
35
  Requires-Dist: syncer (>=2.0.3,<3.0.0)
36
36
  Requires-Dist: tomli (>=2.0.1,<3.0.0)
@@ -28,6 +28,7 @@ from chainlit.config import config
28
28
  from chainlit.context import context
29
29
  from chainlit.element import (
30
30
  Audio,
31
+ Component,
31
32
  File,
32
33
  Image,
33
34
  Pdf,
@@ -114,7 +115,7 @@ def oauth_callback(
114
115
 
115
116
  Example:
116
117
  @cl.oauth_callback
117
- async def oauth_callback(provider_id: str, token: str, raw_user_data: Dict[str, str], default_app_user: User) -> Optional[User]:
118
+ async def oauth_callback(provider_id: str, token: str, raw_user_data: Dict[str, str], default_app_user: User, id_token: Optional[str]) -> Optional[User]:
118
119
 
119
120
  Returns:
120
121
  Callable[[str, str, Dict[str, str], User], Optional[User]]: The decorated authentication callback.
@@ -376,6 +377,7 @@ __all__ = [
376
377
  "Plotly",
377
378
  "Image",
378
379
  "Text",
380
+ "Component",
379
381
  "Pyplot",
380
382
  "File",
381
383
  "Task",
@@ -7,13 +7,12 @@ import uvicorn
7
7
 
8
8
  nest_asyncio.apply()
9
9
 
10
- from chainlit.auth import ensure_jwt_secret
11
10
  from chainlit.cache import init_lc_cache
12
- from chainlit.cli.utils import check_file
13
11
  from chainlit.config import (
14
12
  BACKEND_ROOT,
15
13
  DEFAULT_HOST,
16
14
  DEFAULT_PORT,
15
+ DEFAULT_ROOT_PATH,
17
16
  config,
18
17
  init_config,
19
18
  lint_translations,
@@ -22,8 +21,8 @@ from chainlit.config import (
22
21
  from chainlit.logger import logger
23
22
  from chainlit.markdown import init_markdown
24
23
  from chainlit.secret import random_secret
25
- from chainlit.server import app, register_wildcard_route_handler
26
24
  from chainlit.telemetry import trace_event
25
+ from chainlit.utils import check_file, ensure_jwt_secret
27
26
 
28
27
 
29
28
  # Create the main command group for Chainlit CLI
@@ -35,8 +34,14 @@ def cli():
35
34
 
36
35
  # Define the function to run Chainlit with provided options
37
36
  def run_chainlit(target: str):
37
+ from chainlit.server import combined_asgi_app as app
38
+
38
39
  host = os.environ.get("CHAINLIT_HOST", DEFAULT_HOST)
39
40
  port = int(os.environ.get("CHAINLIT_PORT", DEFAULT_PORT))
41
+ root_path = os.environ.get("CHAINLIT_ROOT_PATH", DEFAULT_ROOT_PATH)
42
+
43
+ ssl_certfile = os.environ.get("CHAINLIT_SSL_CERT", None)
44
+ ssl_keyfile = os.environ.get("CHAINLIT_SSL_KEY", None)
40
45
 
41
46
  ws_per_message_deflate_env = os.environ.get(
42
47
  "UVICORN_WS_PER_MESSAGE_DEFLATE", "true"
@@ -47,8 +52,13 @@ def run_chainlit(target: str):
47
52
  "yes",
48
53
  ] # Convert to boolean
49
54
 
55
+ ws_protocol = os.environ.get(
56
+ "UVICORN_WS_PROTOCOL", "auto"
57
+ )
58
+
50
59
  config.run.host = host
51
60
  config.run.port = port
61
+ config.run.root_path = root_path
52
62
 
53
63
  check_file(target)
54
64
  # Load the module provided by the user
@@ -57,8 +67,6 @@ def run_chainlit(target: str):
57
67
 
58
68
  ensure_jwt_secret()
59
69
 
60
- register_wildcard_route_handler()
61
-
62
70
  # Create the chainlit.md file if it doesn't exist
63
71
  init_markdown(config.root)
64
72
 
@@ -73,8 +81,11 @@ def run_chainlit(target: str):
73
81
  app,
74
82
  host=host,
75
83
  port=port,
84
+ ws=ws_protocol,
76
85
  log_level=log_level,
77
86
  ws_per_message_deflate=ws_per_message_deflate,
87
+ ssl_keyfile=ssl_keyfile,
88
+ ssl_certfile=ssl_certfile,
78
89
  )
79
90
  server = uvicorn.Server(config)
80
91
  await server.serve()
@@ -126,13 +137,47 @@ def run_chainlit(target: str):
126
137
  envvar="NO_CACHE",
127
138
  help="Useful to disable third parties cache, such as langchain.",
128
139
  )
140
+ @click.option(
141
+ "--ssl-cert",
142
+ default=None,
143
+ envvar="CHAINLIT_SSL_CERT",
144
+ help="Specify the file path for the SSL certificate.",
145
+ )
146
+ @click.option(
147
+ "--ssl-key",
148
+ default=None,
149
+ envvar="CHAINLIT_SSL_KEY",
150
+ help="Specify the file path for the SSL key",
151
+ )
129
152
  @click.option("--host", help="Specify a different host to run the server on")
130
153
  @click.option("--port", help="Specify a different port to run the server on")
131
- def chainlit_run(target, watch, headless, debug, ci, no_cache, host, port):
154
+ @click.option("--root-path", help="Specify a different root path to run the server on")
155
+ def chainlit_run(
156
+ target,
157
+ watch,
158
+ headless,
159
+ debug,
160
+ ci,
161
+ no_cache,
162
+ ssl_cert,
163
+ ssl_key,
164
+ host,
165
+ port,
166
+ root_path,
167
+ ):
132
168
  if host:
133
169
  os.environ["CHAINLIT_HOST"] = host
134
170
  if port:
135
171
  os.environ["CHAINLIT_PORT"] = port
172
+ if bool(ssl_cert) != bool(ssl_key):
173
+ raise click.UsageError(
174
+ "Both --ssl-cert and --ssl-key must be provided together."
175
+ )
176
+ if ssl_cert:
177
+ os.environ["CHAINLIT_SSL_CERT"] = ssl_cert
178
+ os.environ["CHAINLIT_SSL_KEY"] = ssl_key
179
+ if root_path:
180
+ os.environ["CHAINLIT_ROOT_PATH"] = root_path
136
181
  if ci:
137
182
  logger.info("Running in CI mode")
138
183
 
@@ -150,6 +195,8 @@ def chainlit_run(target, watch, headless, debug, ci, no_cache, host, port):
150
195
  config.run.no_cache = no_cache
151
196
  config.run.ci = ci
152
197
  config.run.watch = watch
198
+ config.run.ssl_cert = ssl_cert
199
+ config.run.ssl_key = ssl_key
153
200
 
154
201
  run_chainlit(target)
155
202
 
@@ -163,6 +163,7 @@ generated_by = "{__version__}"
163
163
 
164
164
  DEFAULT_HOST = "0.0.0.0"
165
165
  DEFAULT_PORT = 8000
166
+ DEFAULT_ROOT_PATH = ""
166
167
 
167
168
 
168
169
  @dataclass()
@@ -171,6 +172,9 @@ class RunSettings:
171
172
  module_name: Optional[str] = None
172
173
  host: str = DEFAULT_HOST
173
174
  port: int = DEFAULT_PORT
175
+ ssl_cert: Optional[str] = None
176
+ ssl_key: Optional[str] = None
177
+ root_path: str = DEFAULT_ROOT_PATH
174
178
  headless: bool = False
175
179
  watch: bool = False
176
180
  no_cache: bool = False
@@ -69,6 +69,8 @@ def init_http_context(
69
69
  user_env: Optional[Dict[str, str]] = None,
70
70
  client_type: ClientType = "webapp",
71
71
  ) -> ChainlitContext:
72
+ from chainlit.data import get_data_layer
73
+
72
74
  session_id = str(uuid.uuid4())
73
75
  thread_id = thread_id or str(uuid.uuid4())
74
76
  session = HTTPSession(
@@ -81,6 +83,13 @@ def init_http_context(
81
83
  )
82
84
  context = ChainlitContext(session)
83
85
  context_var.set(context)
86
+
87
+ if data_layer := get_data_layer():
88
+ if user_id := getattr(user, "id", None):
89
+ asyncio.create_task(
90
+ data_layer.update_thread(thread_id=thread_id, user_id=user_id)
91
+ )
92
+
84
93
  return context
85
94
 
86
95