chainlit 1.0.400__tar.gz → 1.0.500__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.
- {chainlit-1.0.400 → chainlit-1.0.500}/PKG-INFO +3 -3
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/cli/__init__.py +9 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/config.py +62 -7
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/copilot/dist/index.js +531 -676
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/data/__init__.py +96 -54
- chainlit-1.0.500/chainlit/frontend/dist/assets/index-dc38064c.js +698 -0
- chainlit-1.0.500/chainlit/frontend/dist/assets/react-plotly-df285644.js +3484 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/frontend/dist/index.html +1 -1
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/langchain/callbacks.py +5 -5
- chainlit-1.0.500/chainlit/llama_index/__init__.py +6 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/llama_index/callbacks.py +3 -3
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/markdown.py +12 -2
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/message.py +1 -1
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/server.py +56 -6
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/socket.py +1 -1
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/step.py +2 -2
- chainlit-1.0.500/chainlit/translations/de.json +161 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/translations/en-US.json +77 -1
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/translations/pt-BR.json +2 -0
- chainlit-1.0.500/chainlit/translations.py +60 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/types.py +12 -8
- {chainlit-1.0.400 → chainlit-1.0.500}/pyproject.toml +4 -4
- chainlit-1.0.400/chainlit/frontend/dist/assets/index-9711593e.js +0 -723
- chainlit-1.0.400/chainlit/frontend/dist/assets/react-plotly-d8762cc2.js +0 -3602
- chainlit-1.0.400/chainlit/llama_index/__init__.py +0 -6
- {chainlit-1.0.400 → chainlit-1.0.500}/README.md +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/__init__.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/__main__.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/action.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/auth.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/cache.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/chat_settings.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/cli/utils.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/context.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/copilot/dist/assets/logo_dark-2a3cf740.svg +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/copilot/dist/assets/logo_light-b078e7bc.svg +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/data/acl.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/element.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/emitter.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/frontend/dist/assets/index-d088547c.css +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/frontend/dist/assets/logo_dark-2a3cf740.svg +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/frontend/dist/assets/logo_light-b078e7bc.svg +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/frontend/dist/favicon.svg +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/haystack/__init__.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/haystack/callbacks.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/hello.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/input_widget.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/langchain/__init__.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/langflow/__init__.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/logger.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/oauth_providers.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/openai/__init__.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/playground/__init__.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/playground/config.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/playground/provider.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/playground/providers/__init__.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/playground/providers/anthropic.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/playground/providers/huggingface.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/playground/providers/langchain.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/playground/providers/openai.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/playground/providers/vertexai.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/py.typed +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/secret.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/session.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/sync.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/telemetry.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/user.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/user_session.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/utils.py +0 -0
- {chainlit-1.0.400 → chainlit-1.0.500}/chainlit/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: chainlit
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.500
|
|
4
4
|
Summary: Build Conversational AI.
|
|
5
5
|
Home-page: https://github.com/Chainlit/chainlit
|
|
6
6
|
License: Apache-2.0 license
|
|
@@ -22,14 +22,14 @@ Requires-Dist: fastapi-socketio (>=0.0.10,<0.0.11)
|
|
|
22
22
|
Requires-Dist: filetype (>=1.2.0,<2.0.0)
|
|
23
23
|
Requires-Dist: httpx (>=0.23.0)
|
|
24
24
|
Requires-Dist: lazify (>=0.4.0,<0.5.0)
|
|
25
|
-
Requires-Dist: literalai (==0.0.
|
|
25
|
+
Requires-Dist: literalai (==0.0.401)
|
|
26
26
|
Requires-Dist: nest-asyncio (>=1.5.6,<2.0.0)
|
|
27
27
|
Requires-Dist: packaging (>=23.1,<24.0)
|
|
28
28
|
Requires-Dist: pydantic (>=1,<3)
|
|
29
29
|
Requires-Dist: pyjwt (>=2.8.0,<3.0.0)
|
|
30
30
|
Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
|
|
31
31
|
Requires-Dist: python-graphql-client (>=0.4.3,<0.5.0)
|
|
32
|
-
Requires-Dist: python-multipart (>=0.0.
|
|
32
|
+
Requires-Dist: python-multipart (>=0.0.9,<0.0.10)
|
|
33
33
|
Requires-Dist: starlette (<0.33.0)
|
|
34
34
|
Requires-Dist: syncer (>=2.0.3,<3.0.0)
|
|
35
35
|
Requires-Dist: tomli (>=2.0.1,<3.0.0)
|
|
@@ -16,6 +16,7 @@ from chainlit.config import (
|
|
|
16
16
|
DEFAULT_PORT,
|
|
17
17
|
config,
|
|
18
18
|
init_config,
|
|
19
|
+
lint_translations,
|
|
19
20
|
load_module,
|
|
20
21
|
)
|
|
21
22
|
from chainlit.logger import logger
|
|
@@ -176,3 +177,11 @@ def chainlit_create_secret(args=None, **kwargs):
|
|
|
176
177
|
print(
|
|
177
178
|
f"Copy the following secret into your .env file. Once it is set, changing it will logout all users with active sessions.\nCHAINLIT_AUTH_SECRET={random_secret()}"
|
|
178
179
|
)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
@cli.command("lint-translations")
|
|
183
|
+
@click.argument("args", nargs=-1)
|
|
184
|
+
def chainlit_lint_translations(args=None, **kwargs):
|
|
185
|
+
trace_event("chainlit lint-translation")
|
|
186
|
+
|
|
187
|
+
lint_translations()
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import os
|
|
3
|
+
import site
|
|
3
4
|
import sys
|
|
4
5
|
from importlib import util
|
|
5
6
|
from pathlib import Path
|
|
6
|
-
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional
|
|
7
|
+
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union
|
|
7
8
|
|
|
8
9
|
import tomli
|
|
9
10
|
from chainlit.logger import logger
|
|
11
|
+
from chainlit.translations import lint_translation_json
|
|
10
12
|
from chainlit.version import __version__
|
|
11
13
|
from dataclasses_json import DataClassJsonMixin
|
|
12
14
|
from pydantic.dataclasses import Field, dataclass
|
|
@@ -50,7 +52,7 @@ session_timeout = 3600
|
|
|
50
52
|
# Enable third parties caching (e.g LangChain cache)
|
|
51
53
|
cache = false
|
|
52
54
|
|
|
53
|
-
# Authorized origins
|
|
55
|
+
# Authorized origins
|
|
54
56
|
allow_origins = ["*"]
|
|
55
57
|
|
|
56
58
|
# Follow symlink for asset mount (see https://github.com/Chainlit/chainlit/issues/317)
|
|
@@ -67,7 +69,11 @@ unsafe_allow_html = false
|
|
|
67
69
|
latex = false
|
|
68
70
|
|
|
69
71
|
# Authorize users to upload files with messages
|
|
70
|
-
multi_modal
|
|
72
|
+
[features.multi_modal]
|
|
73
|
+
enabled = true
|
|
74
|
+
accept = ["*/*"]
|
|
75
|
+
max_files = 20
|
|
76
|
+
max_size_mb = 500
|
|
71
77
|
|
|
72
78
|
# Allows user to use speech to text
|
|
73
79
|
[features.speech_to_text]
|
|
@@ -108,6 +114,11 @@ hide_cot = false
|
|
|
108
114
|
# Specify a custom font url.
|
|
109
115
|
# custom_font = "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap"
|
|
110
116
|
|
|
117
|
+
# Specify a custom build directory for the frontend.
|
|
118
|
+
# This can be used to customize the frontend code.
|
|
119
|
+
# Be careful: If this is a relative path, it should not start with a slash.
|
|
120
|
+
# custom_build = "./public/build"
|
|
121
|
+
|
|
111
122
|
# Override default MUI light theme. (Check theme.ts)
|
|
112
123
|
[UI.theme]
|
|
113
124
|
#font_family = "Inter, sans-serif"
|
|
@@ -180,10 +191,18 @@ class SpeechToTextFeature:
|
|
|
180
191
|
language: Optional[str] = None
|
|
181
192
|
|
|
182
193
|
|
|
194
|
+
@dataclass
|
|
195
|
+
class MultiModalFeature:
|
|
196
|
+
enabled: Optional[bool] = None
|
|
197
|
+
accept: Optional[Union[List[str], Dict[str, List[str]]]] = None
|
|
198
|
+
max_files: Optional[int] = None
|
|
199
|
+
max_size_mb: Optional[int] = None
|
|
200
|
+
|
|
201
|
+
|
|
183
202
|
@dataclass()
|
|
184
203
|
class FeaturesSettings(DataClassJsonMixin):
|
|
185
204
|
prompt_playground: bool = True
|
|
186
|
-
multi_modal:
|
|
205
|
+
multi_modal: Optional[MultiModalFeature] = None
|
|
187
206
|
latex: bool = False
|
|
188
207
|
unsafe_allow_html: bool = False
|
|
189
208
|
speech_to_text: Optional[SpeechToTextFeature] = None
|
|
@@ -204,6 +223,7 @@ class UISettings(DataClassJsonMixin):
|
|
|
204
223
|
custom_css: Optional[str] = None
|
|
205
224
|
custom_js: Optional[str] = None
|
|
206
225
|
custom_font: Optional[str] = None
|
|
226
|
+
custom_build: Optional[str] = None
|
|
207
227
|
|
|
208
228
|
|
|
209
229
|
@dataclass()
|
|
@@ -226,9 +246,9 @@ class CodeSettings:
|
|
|
226
246
|
on_message: Optional[Callable[[str], Any]] = None
|
|
227
247
|
author_rename: Optional[Callable[[str], str]] = None
|
|
228
248
|
on_settings_update: Optional[Callable[[Dict[str, Any]], Any]] = None
|
|
229
|
-
set_chat_profiles: Optional[
|
|
230
|
-
|
|
231
|
-
|
|
249
|
+
set_chat_profiles: Optional[
|
|
250
|
+
Callable[[Optional["User"]], List["ChatProfile"]]
|
|
251
|
+
] = None
|
|
232
252
|
|
|
233
253
|
|
|
234
254
|
@dataclass()
|
|
@@ -263,10 +283,15 @@ class ChainlitConfig:
|
|
|
263
283
|
def load_translation(self, language: str):
|
|
264
284
|
translation = {}
|
|
265
285
|
default_language = "en-US"
|
|
286
|
+
# fallback to root language (ex: `de` when `de-DE` is not found)
|
|
287
|
+
parent_language = language.split("-")[0]
|
|
266
288
|
|
|
267
289
|
translation_lib_file_path = os.path.join(
|
|
268
290
|
config_translation_dir, f"{language}.json"
|
|
269
291
|
)
|
|
292
|
+
translation_lib_parent_language_file_path = os.path.join(
|
|
293
|
+
config_translation_dir, f"{parent_language}.json"
|
|
294
|
+
)
|
|
270
295
|
default_translation_lib_file_path = os.path.join(
|
|
271
296
|
config_translation_dir, f"{default_language}.json"
|
|
272
297
|
)
|
|
@@ -274,6 +299,14 @@ class ChainlitConfig:
|
|
|
274
299
|
if os.path.exists(translation_lib_file_path):
|
|
275
300
|
with open(translation_lib_file_path, "r", encoding="utf-8") as f:
|
|
276
301
|
translation = json.load(f)
|
|
302
|
+
elif os.path.exists(translation_lib_parent_language_file_path):
|
|
303
|
+
logger.warning(
|
|
304
|
+
f"Translation file for {language} not found. Using parent translation {parent_language}."
|
|
305
|
+
)
|
|
306
|
+
with open(
|
|
307
|
+
translation_lib_parent_language_file_path, "r", encoding="utf-8"
|
|
308
|
+
) as f:
|
|
309
|
+
translation = json.load(f)
|
|
277
310
|
elif os.path.exists(default_translation_lib_file_path):
|
|
278
311
|
logger.warning(
|
|
279
312
|
f"Translation file for {language} not found. Using default translation {default_language}."
|
|
@@ -322,12 +355,16 @@ def load_module(target: str, force_refresh: bool = False):
|
|
|
322
355
|
sys.path.insert(0, target_dir)
|
|
323
356
|
|
|
324
357
|
if force_refresh:
|
|
358
|
+
# Get current site packages dirs
|
|
359
|
+
site_package_dirs = site.getsitepackages()
|
|
360
|
+
|
|
325
361
|
# Clear the modules related to the app from sys.modules
|
|
326
362
|
for module_name, module in list(sys.modules.items()):
|
|
327
363
|
if (
|
|
328
364
|
hasattr(module, "__file__")
|
|
329
365
|
and module.__file__
|
|
330
366
|
and module.__file__.startswith(target_dir)
|
|
367
|
+
and not any(module.__file__.startswith(p) for p in site_package_dirs)
|
|
331
368
|
):
|
|
332
369
|
sys.modules.pop(module_name, None)
|
|
333
370
|
|
|
@@ -411,4 +448,22 @@ def load_config():
|
|
|
411
448
|
return config
|
|
412
449
|
|
|
413
450
|
|
|
451
|
+
def lint_translations():
|
|
452
|
+
# Load the ground truth (en-US.json file from chainlit source code)
|
|
453
|
+
src = os.path.join(TRANSLATIONS_DIR, "en-US.json")
|
|
454
|
+
with open(src, "r", encoding="utf-8") as f:
|
|
455
|
+
truth = json.load(f)
|
|
456
|
+
|
|
457
|
+
# Find the local app translations
|
|
458
|
+
for file in os.listdir(config_translation_dir):
|
|
459
|
+
if file.endswith(".json"):
|
|
460
|
+
# Load the translation file
|
|
461
|
+
to_lint = os.path.join(config_translation_dir, file)
|
|
462
|
+
with open(to_lint, "r", encoding="utf-8") as f:
|
|
463
|
+
translation = json.load(f)
|
|
464
|
+
|
|
465
|
+
# Lint the translation file
|
|
466
|
+
lint_translation_json(file, truth, translation)
|
|
467
|
+
|
|
468
|
+
|
|
414
469
|
config = load_config()
|