chainlit 1.3.0__py3-none-any.whl → 1.3.0rc1__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/__init__.py +5 -2
- chainlit/auth.py +0 -2
- chainlit/callbacks.py +13 -4
- chainlit/config.py +6 -21
- chainlit/context.py +6 -4
- chainlit/copilot/dist/index.js +603 -296
- chainlit/data/sql_alchemy.py +1 -1
- chainlit/emitter.py +25 -0
- chainlit/frontend/dist/assets/DailyMotion-b4b7af47.js +1 -0
- chainlit/frontend/dist/assets/Facebook-572972a0.js +1 -0
- chainlit/frontend/dist/assets/FilePlayer-85c69ca8.js +1 -0
- chainlit/frontend/dist/assets/Kaltura-dfc24672.js +1 -0
- chainlit/frontend/dist/assets/Mixcloud-705011f4.js +1 -0
- chainlit/frontend/dist/assets/Mux-4201a9e6.js +1 -0
- chainlit/frontend/dist/assets/Preview-23ba40a6.js +1 -0
- chainlit/frontend/dist/assets/SoundCloud-1a582d51.js +1 -0
- chainlit/frontend/dist/assets/Streamable-5017c4ba.js +1 -0
- chainlit/frontend/dist/assets/Twitch-bb2de2fa.js +1 -0
- chainlit/frontend/dist/assets/Vidyard-54e269b1.js +1 -0
- chainlit/frontend/dist/assets/Vimeo-d92c37dd.js +1 -0
- chainlit/frontend/dist/assets/Wistia-25a1363b.js +1 -0
- chainlit/frontend/dist/assets/YouTube-616e8cb7.js +1 -0
- chainlit/frontend/dist/assets/index-f5df2072.js +1027 -0
- chainlit/frontend/dist/assets/{react-plotly-Dpmqg5Sy.js → react-plotly-f0315f86.js} +94 -94
- chainlit/frontend/dist/index.html +3 -2
- chainlit/oauth_providers.py +9 -43
- chainlit/openai/__init__.py +5 -3
- chainlit/server.py +9 -19
- chainlit/socket.py +19 -17
- chainlit/step.py +17 -9
- chainlit/translations/en-US.json +2 -1
- chainlit/types.py +6 -6
- {chainlit-1.3.0.dist-info → chainlit-1.3.0rc1.dist-info}/METADATA +4 -12
- {chainlit-1.3.0.dist-info → chainlit-1.3.0rc1.dist-info}/RECORD +41 -41
- chainlit/frontend/dist/assets/DailyMotion-CwoOhIL8.js +0 -1
- chainlit/frontend/dist/assets/Facebook-BhnGXlzq.js +0 -1
- chainlit/frontend/dist/assets/FilePlayer-CPSVT6fz.js +0 -1
- chainlit/frontend/dist/assets/Kaltura-COYaLzsL.js +0 -1
- chainlit/frontend/dist/assets/Mixcloud-JdadNiQ5.js +0 -1
- chainlit/frontend/dist/assets/Mux-CBN7RO2u.js +0 -1
- chainlit/frontend/dist/assets/Preview-CxAFvvjV.js +0 -1
- chainlit/frontend/dist/assets/SoundCloud-JlgmASWm.js +0 -1
- chainlit/frontend/dist/assets/Streamable-CUWgr6Zw.js +0 -1
- chainlit/frontend/dist/assets/Twitch-BiN1HEDM.js +0 -1
- chainlit/frontend/dist/assets/Vidyard-qhPmrhDm.js +0 -1
- chainlit/frontend/dist/assets/Vimeo-CrZVSCaT.js +0 -1
- chainlit/frontend/dist/assets/Wistia-C891KrBP.js +0 -1
- chainlit/frontend/dist/assets/YouTube-DKjw5Hbn.js +0 -1
- chainlit/frontend/dist/assets/index-DLRdQOIx.js +0 -723
- /chainlit/copilot/dist/assets/{logo_dark-IkGJ_IwC.svg → logo_dark-2a3cf740.svg} +0 -0
- /chainlit/copilot/dist/assets/{logo_light-Bb_IPh6r.svg → logo_light-b078e7bc.svg} +0 -0
- /chainlit/frontend/dist/assets/{index-CwmincdQ.css → index-aaf974a9.css} +0 -0
- /chainlit/frontend/dist/assets/{logo_dark-IkGJ_IwC.svg → logo_dark-2a3cf740.svg} +0 -0
- /chainlit/frontend/dist/assets/{logo_light-Bb_IPh6r.svg → logo_light-b078e7bc.svg} +0 -0
- {chainlit-1.3.0.dist-info → chainlit-1.3.0rc1.dist-info}/WHEEL +0 -0
- {chainlit-1.3.0.dist-info → chainlit-1.3.0rc1.dist-info}/entry_points.txt +0 -0
|
@@ -21,10 +21,11 @@
|
|
|
21
21
|
<script>
|
|
22
22
|
const global = globalThis;
|
|
23
23
|
</script>
|
|
24
|
-
<script type="module" crossorigin src="/assets/index-
|
|
25
|
-
<link rel="stylesheet"
|
|
24
|
+
<script type="module" crossorigin src="/assets/index-f5df2072.js"></script>
|
|
25
|
+
<link rel="stylesheet" href="/assets/index-aaf974a9.css">
|
|
26
26
|
</head>
|
|
27
27
|
<body>
|
|
28
28
|
<div id="root"></div>
|
|
29
|
+
|
|
29
30
|
</body>
|
|
30
31
|
</html>
|
chainlit/oauth_providers.py
CHANGED
|
@@ -16,7 +16,6 @@ class OAuthProvider:
|
|
|
16
16
|
client_secret: str
|
|
17
17
|
authorize_url: str
|
|
18
18
|
authorize_params: Dict[str, str]
|
|
19
|
-
default_prompt: Optional[str] = None
|
|
20
19
|
|
|
21
20
|
def is_configured(self):
|
|
22
21
|
return all([os.environ.get(env) for env in self.env])
|
|
@@ -27,21 +26,6 @@ class OAuthProvider:
|
|
|
27
26
|
async def get_user_info(self, token: str) -> Tuple[Dict[str, str], User]:
|
|
28
27
|
raise NotImplementedError()
|
|
29
28
|
|
|
30
|
-
def get_env_prefix(self) -> str:
|
|
31
|
-
"""Return environment prefix, like AZURE_AD."""
|
|
32
|
-
|
|
33
|
-
return self.id.replace("-", "_").upper()
|
|
34
|
-
|
|
35
|
-
def get_prompt(self) -> Optional[str]:
|
|
36
|
-
"""Return OAuth prompt param."""
|
|
37
|
-
if prompt := os.environ.get(f"OAUTH_{self.get_env_prefix()}_PROMPT"):
|
|
38
|
-
return prompt
|
|
39
|
-
|
|
40
|
-
if prompt := os.environ.get("OAUTH_PROMPT"):
|
|
41
|
-
return prompt
|
|
42
|
-
|
|
43
|
-
return self.default_prompt
|
|
44
|
-
|
|
45
29
|
|
|
46
30
|
class GithubOAuthProvider(OAuthProvider):
|
|
47
31
|
id = "github"
|
|
@@ -53,11 +37,9 @@ class GithubOAuthProvider(OAuthProvider):
|
|
|
53
37
|
self.client_secret = os.environ.get("OAUTH_GITHUB_CLIENT_SECRET")
|
|
54
38
|
self.authorize_params = {
|
|
55
39
|
"scope": "user:email",
|
|
40
|
+
"prompt": "consent",
|
|
56
41
|
}
|
|
57
42
|
|
|
58
|
-
if prompt := self.get_prompt():
|
|
59
|
-
self.authorize_params["prompt"] = prompt
|
|
60
|
-
|
|
61
43
|
async def get_token(self, code: str, url: str):
|
|
62
44
|
payload = {
|
|
63
45
|
"client_id": self.client_id,
|
|
@@ -114,11 +96,9 @@ class GoogleOAuthProvider(OAuthProvider):
|
|
|
114
96
|
"scope": "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
|
|
115
97
|
"response_type": "code",
|
|
116
98
|
"access_type": "offline",
|
|
99
|
+
"prompt": "login",
|
|
117
100
|
}
|
|
118
101
|
|
|
119
|
-
if prompt := self.get_prompt():
|
|
120
|
-
self.authorize_params["prompt"] = prompt
|
|
121
|
-
|
|
122
102
|
async def get_token(self, code: str, url: str):
|
|
123
103
|
payload = {
|
|
124
104
|
"client_id": self.client_id,
|
|
@@ -184,11 +164,9 @@ class AzureADOAuthProvider(OAuthProvider):
|
|
|
184
164
|
"response_type": "code",
|
|
185
165
|
"scope": "https://graph.microsoft.com/User.Read",
|
|
186
166
|
"response_mode": "query",
|
|
167
|
+
"prompt": "login",
|
|
187
168
|
}
|
|
188
169
|
|
|
189
|
-
if prompt := self.get_prompt():
|
|
190
|
-
self.authorize_params["prompt"] = prompt
|
|
191
|
-
|
|
192
170
|
async def get_token(self, code: str, url: str):
|
|
193
171
|
payload = {
|
|
194
172
|
"client_id": self.client_id,
|
|
@@ -271,11 +249,9 @@ class AzureADHybridOAuthProvider(OAuthProvider):
|
|
|
271
249
|
"scope": "https://graph.microsoft.com/User.Read https://graph.microsoft.com/openid",
|
|
272
250
|
"response_mode": "form_post",
|
|
273
251
|
"nonce": nonce,
|
|
252
|
+
"prompt": "login",
|
|
274
253
|
}
|
|
275
254
|
|
|
276
|
-
if prompt := self.get_prompt():
|
|
277
|
-
self.authorize_params["prompt"] = prompt
|
|
278
|
-
|
|
279
255
|
async def get_token(self, code: str, url: str):
|
|
280
256
|
payload = {
|
|
281
257
|
"client_id": self.client_id,
|
|
@@ -353,11 +329,9 @@ class OktaOAuthProvider(OAuthProvider):
|
|
|
353
329
|
"response_type": "code",
|
|
354
330
|
"scope": "openid profile email",
|
|
355
331
|
"response_mode": "query",
|
|
332
|
+
"prompt": "login",
|
|
356
333
|
}
|
|
357
334
|
|
|
358
|
-
if prompt := self.get_prompt():
|
|
359
|
-
self.authorize_params["prompt"] = prompt
|
|
360
|
-
|
|
361
335
|
def get_authorization_server_path(self):
|
|
362
336
|
if not self.authorization_server_id:
|
|
363
337
|
return "/default"
|
|
@@ -427,11 +401,9 @@ class Auth0OAuthProvider(OAuthProvider):
|
|
|
427
401
|
"response_type": "code",
|
|
428
402
|
"scope": "openid profile email",
|
|
429
403
|
"audience": f"{self.original_domain}/userinfo",
|
|
404
|
+
"prompt": "login",
|
|
430
405
|
}
|
|
431
406
|
|
|
432
|
-
if prompt := self.get_prompt():
|
|
433
|
-
self.authorize_params["prompt"] = prompt
|
|
434
|
-
|
|
435
407
|
async def get_token(self, code: str, url: str):
|
|
436
408
|
payload = {
|
|
437
409
|
"client_id": self.client_id,
|
|
@@ -487,11 +459,9 @@ class DescopeOAuthProvider(OAuthProvider):
|
|
|
487
459
|
"response_type": "code",
|
|
488
460
|
"scope": "openid profile email",
|
|
489
461
|
"audience": f"{self.domain}/userinfo",
|
|
462
|
+
"prompt": "login",
|
|
490
463
|
}
|
|
491
464
|
|
|
492
|
-
if prompt := self.get_prompt():
|
|
493
|
-
self.authorize_params["prompt"] = prompt
|
|
494
|
-
|
|
495
465
|
async def get_token(self, code: str, url: str):
|
|
496
466
|
payload = {
|
|
497
467
|
"client_id": self.client_id,
|
|
@@ -548,11 +518,9 @@ class AWSCognitoOAuthProvider(OAuthProvider):
|
|
|
548
518
|
"response_type": "code",
|
|
549
519
|
"client_id": self.client_id,
|
|
550
520
|
"scope": "openid profile email",
|
|
521
|
+
"prompt": "login",
|
|
551
522
|
}
|
|
552
523
|
|
|
553
|
-
if prompt := self.get_prompt():
|
|
554
|
-
self.authorize_params["prompt"] = prompt
|
|
555
|
-
|
|
556
524
|
async def get_token(self, code: str, url: str):
|
|
557
525
|
payload = {
|
|
558
526
|
"client_id": self.client_id,
|
|
@@ -619,11 +587,9 @@ class GitlabOAuthProvider(OAuthProvider):
|
|
|
619
587
|
self.authorize_params = {
|
|
620
588
|
"scope": "openid profile email",
|
|
621
589
|
"response_type": "code",
|
|
590
|
+
"prompt": "login",
|
|
622
591
|
}
|
|
623
592
|
|
|
624
|
-
if prompt := self.get_prompt():
|
|
625
|
-
self.authorize_params["prompt"] = prompt
|
|
626
|
-
|
|
627
593
|
async def get_token(self, code: str, url: str):
|
|
628
594
|
payload = {
|
|
629
595
|
"client_id": self.client_id,
|
chainlit/openai/__init__.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
from typing import Union
|
|
3
3
|
|
|
4
|
-
from chainlit.context import
|
|
4
|
+
from chainlit.context import get_context
|
|
5
5
|
from chainlit.step import Step
|
|
6
6
|
from chainlit.utils import check_module_version
|
|
7
7
|
from literalai import ChatGeneration, CompletionGeneration
|
|
@@ -19,9 +19,11 @@ def instrument_openai():
|
|
|
19
19
|
def on_new_generation(
|
|
20
20
|
generation: Union["ChatGeneration", "CompletionGeneration"], timing
|
|
21
21
|
):
|
|
22
|
-
|
|
22
|
+
context = get_context()
|
|
23
23
|
|
|
24
|
-
parent_id =
|
|
24
|
+
parent_id = None
|
|
25
|
+
if context.current_step:
|
|
26
|
+
parent_id = context.current_step.id
|
|
25
27
|
|
|
26
28
|
step = Step(
|
|
27
29
|
name=generation.model if generation.model else generation.provider,
|
chainlit/server.py
CHANGED
|
@@ -41,7 +41,6 @@ from fastapi import (
|
|
|
41
41
|
APIRouter,
|
|
42
42
|
Depends,
|
|
43
43
|
FastAPI,
|
|
44
|
-
File,
|
|
45
44
|
Form,
|
|
46
45
|
HTTPException,
|
|
47
46
|
Query,
|
|
@@ -646,7 +645,7 @@ async def oauth_azure_hf_callback(
|
|
|
646
645
|
|
|
647
646
|
|
|
648
647
|
_language_pattern = (
|
|
649
|
-
"^[a-zA-Z]{2,3}(-[a-zA-
|
|
648
|
+
"^[a-zA-Z]{2,3}(-[a-zA-Z]{2,3})?(-[a-zA-Z]{2,8})?(-x-[a-zA-Z0-9]{1,8})?$"
|
|
650
649
|
)
|
|
651
650
|
|
|
652
651
|
|
|
@@ -840,9 +839,11 @@ async def delete_thread(
|
|
|
840
839
|
|
|
841
840
|
@router.post("/project/file")
|
|
842
841
|
async def upload_file(
|
|
843
|
-
current_user: Annotated[Union[User, PersistedUser], Depends(get_current_user)],
|
|
844
842
|
session_id: str,
|
|
845
843
|
file: UploadFile,
|
|
844
|
+
current_user: Annotated[
|
|
845
|
+
Union[None, User, PersistedUser], Depends(get_current_user)
|
|
846
|
+
],
|
|
846
847
|
):
|
|
847
848
|
"""Upload a file to the session files directory."""
|
|
848
849
|
|
|
@@ -867,21 +868,17 @@ async def upload_file(
|
|
|
867
868
|
|
|
868
869
|
content = await file.read()
|
|
869
870
|
|
|
870
|
-
assert file.filename, "No filename for uploaded file"
|
|
871
|
-
assert file.content_type, "No content type for uploaded file"
|
|
872
|
-
|
|
873
871
|
file_response = await session.persist_file(
|
|
874
872
|
name=file.filename, content=content, mime=file.content_type
|
|
875
873
|
)
|
|
876
874
|
|
|
877
|
-
return JSONResponse(
|
|
875
|
+
return JSONResponse(file_response)
|
|
878
876
|
|
|
879
877
|
|
|
880
878
|
@router.get("/project/file/{file_id}")
|
|
881
879
|
async def get_file(
|
|
882
880
|
file_id: str,
|
|
883
|
-
session_id: str,
|
|
884
|
-
current_user: Annotated[Union[User, PersistedUser], Depends(get_current_user)],
|
|
881
|
+
session_id: Optional[str] = None,
|
|
885
882
|
):
|
|
886
883
|
"""Get a file from the session files directory."""
|
|
887
884
|
|
|
@@ -891,17 +888,10 @@ async def get_file(
|
|
|
891
888
|
|
|
892
889
|
if not session:
|
|
893
890
|
raise HTTPException(
|
|
894
|
-
status_code=
|
|
895
|
-
detail="
|
|
891
|
+
status_code=404,
|
|
892
|
+
detail="Session not found",
|
|
896
893
|
)
|
|
897
894
|
|
|
898
|
-
if current_user:
|
|
899
|
-
if not session.user or session.user.identifier != current_user.identifier:
|
|
900
|
-
raise HTTPException(
|
|
901
|
-
status_code=401,
|
|
902
|
-
detail="You are not authorized to download files from this session",
|
|
903
|
-
)
|
|
904
|
-
|
|
905
895
|
if file_id in session.files:
|
|
906
896
|
file = session.files[file_id]
|
|
907
897
|
return FileResponse(file["path"], media_type=file["type"])
|
|
@@ -971,7 +961,7 @@ async def get_logo(theme: Optional[Theme] = Query(Theme.light)):
|
|
|
971
961
|
@router.get("/avatars/{avatar_id:str}")
|
|
972
962
|
async def get_avatar(avatar_id: str):
|
|
973
963
|
"""Get the avatar for the user based on the avatar_id."""
|
|
974
|
-
if not re.match(r"^[a-zA-Z0-9_
|
|
964
|
+
if not re.match(r"^[a-zA-Z0-9_-]+$", avatar_id):
|
|
975
965
|
raise HTTPException(status_code=400, detail="Invalid avatar_id")
|
|
976
966
|
|
|
977
967
|
if avatar_id == "default":
|
chainlit/socket.py
CHANGED
|
@@ -18,9 +18,8 @@ from chainlit.server import sio
|
|
|
18
18
|
from chainlit.session import WebsocketSession
|
|
19
19
|
from chainlit.telemetry import trace_event
|
|
20
20
|
from chainlit.types import (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
AudioEndPayload,
|
|
21
|
+
InputAudioChunk,
|
|
22
|
+
InputAudioChunkPayload,
|
|
24
23
|
MessagePayload,
|
|
25
24
|
)
|
|
26
25
|
from chainlit.user_session import user_sessions
|
|
@@ -314,19 +313,31 @@ async def message(sid, payload: MessagePayload):
|
|
|
314
313
|
session.current_task = task
|
|
315
314
|
|
|
316
315
|
|
|
316
|
+
@sio.on("audio_start")
|
|
317
|
+
async def audio_start(sid):
|
|
318
|
+
"""Handle audio init."""
|
|
319
|
+
session = WebsocketSession.require(sid)
|
|
320
|
+
|
|
321
|
+
context = init_ws_context(session)
|
|
322
|
+
if config.code.on_audio_start:
|
|
323
|
+
connected = bool(await config.code.on_audio_start())
|
|
324
|
+
connection_state = "on" if connected else "off"
|
|
325
|
+
await context.emitter.update_audio_connection(connection_state)
|
|
326
|
+
|
|
327
|
+
|
|
317
328
|
@sio.on("audio_chunk")
|
|
318
|
-
async def audio_chunk(sid, payload:
|
|
329
|
+
async def audio_chunk(sid, payload: InputAudioChunkPayload):
|
|
319
330
|
"""Handle an audio chunk sent by the user."""
|
|
320
331
|
session = WebsocketSession.require(sid)
|
|
321
332
|
|
|
322
333
|
init_ws_context(session)
|
|
323
334
|
|
|
324
335
|
if config.code.on_audio_chunk:
|
|
325
|
-
asyncio.create_task(config.code.on_audio_chunk(
|
|
336
|
+
asyncio.create_task(config.code.on_audio_chunk(InputAudioChunk(**payload)))
|
|
326
337
|
|
|
327
338
|
|
|
328
339
|
@sio.on("audio_end")
|
|
329
|
-
async def audio_end(sid
|
|
340
|
+
async def audio_end(sid):
|
|
330
341
|
"""Handle the end of the audio stream."""
|
|
331
342
|
session = WebsocketSession.require(sid)
|
|
332
343
|
try:
|
|
@@ -337,18 +348,9 @@ async def audio_end(sid, payload: AudioEndPayload):
|
|
|
337
348
|
session.has_first_interaction = True
|
|
338
349
|
asyncio.create_task(context.emitter.init_thread("audio"))
|
|
339
350
|
|
|
340
|
-
file_elements = []
|
|
341
351
|
if config.code.on_audio_end:
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
files = [
|
|
345
|
-
session.files[file["id"]]
|
|
346
|
-
for file in file_refs
|
|
347
|
-
if file["id"] in session.files
|
|
348
|
-
]
|
|
349
|
-
file_elements = [Element.from_dict(file) for file in files]
|
|
350
|
-
|
|
351
|
-
await config.code.on_audio_end(file_elements)
|
|
352
|
+
await config.code.on_audio_end()
|
|
353
|
+
|
|
352
354
|
except asyncio.CancelledError:
|
|
353
355
|
pass
|
|
354
356
|
except Exception as e:
|
chainlit/step.py
CHANGED
|
@@ -65,7 +65,7 @@ class StepDict(TypedDict, total=False):
|
|
|
65
65
|
feedback: Optional[FeedbackDict]
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
def flatten_args_kwargs(func, args, kwargs):
|
|
68
|
+
def flatten_args_kwargs(func, *args, **kwargs):
|
|
69
69
|
signature = inspect.signature(func)
|
|
70
70
|
bound_arguments = signature.bind(*args, **kwargs)
|
|
71
71
|
bound_arguments.apply_defaults()
|
|
@@ -434,6 +434,7 @@ class Step:
|
|
|
434
434
|
if not self.parent_id:
|
|
435
435
|
if parent_step:
|
|
436
436
|
self.parent_id = parent_step.id
|
|
437
|
+
context.active_steps.append(self)
|
|
437
438
|
local_steps.set(previous_steps + [self])
|
|
438
439
|
await self.send()
|
|
439
440
|
return self
|
|
@@ -445,10 +446,13 @@ class Step:
|
|
|
445
446
|
self.output = str(exc_val)
|
|
446
447
|
self.is_error = True
|
|
447
448
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
449
|
+
if self in context.active_steps:
|
|
450
|
+
context.active_steps.remove(self)
|
|
451
|
+
|
|
452
|
+
local_active_steps = local_steps.get()
|
|
453
|
+
if local_active_steps and self in local_active_steps:
|
|
454
|
+
local_active_steps.remove(self)
|
|
455
|
+
local_steps.set(local_active_steps)
|
|
452
456
|
|
|
453
457
|
await self.update()
|
|
454
458
|
|
|
@@ -461,6 +465,7 @@ class Step:
|
|
|
461
465
|
if not self.parent_id:
|
|
462
466
|
if parent_step:
|
|
463
467
|
self.parent_id = parent_step.id
|
|
468
|
+
context.active_steps.append(self)
|
|
464
469
|
local_steps.set(previous_steps + [self])
|
|
465
470
|
|
|
466
471
|
asyncio.create_task(self.send())
|
|
@@ -473,9 +478,12 @@ class Step:
|
|
|
473
478
|
self.output = str(exc_val)
|
|
474
479
|
self.is_error = True
|
|
475
480
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
481
|
+
if self in context.active_steps:
|
|
482
|
+
context.active_steps.remove(self)
|
|
483
|
+
|
|
484
|
+
local_active_steps = local_steps.get()
|
|
485
|
+
if local_active_steps and self in local_active_steps:
|
|
486
|
+
local_active_steps.remove(self)
|
|
487
|
+
local_steps.set(local_active_steps)
|
|
480
488
|
|
|
481
489
|
asyncio.create_task(self.update())
|
chainlit/translations/en-US.json
CHANGED
chainlit/types.py
CHANGED
|
@@ -154,7 +154,7 @@ class MessagePayload(TypedDict):
|
|
|
154
154
|
fileReferences: Optional[List[FileReference]]
|
|
155
155
|
|
|
156
156
|
|
|
157
|
-
class
|
|
157
|
+
class InputAudioChunkPayload(TypedDict):
|
|
158
158
|
isStart: bool
|
|
159
159
|
mimeType: str
|
|
160
160
|
elapsedTime: float
|
|
@@ -162,16 +162,16 @@ class AudioChunkPayload(TypedDict):
|
|
|
162
162
|
|
|
163
163
|
|
|
164
164
|
@dataclass
|
|
165
|
-
class
|
|
165
|
+
class InputAudioChunk:
|
|
166
166
|
isStart: bool
|
|
167
167
|
mimeType: str
|
|
168
168
|
elapsedTime: float
|
|
169
169
|
data: bytes
|
|
170
170
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
class OutputAudioChunk(TypedDict):
|
|
172
|
+
track: str
|
|
173
|
+
mimeType: str
|
|
174
|
+
data: bytes
|
|
175
175
|
|
|
176
176
|
@dataclass
|
|
177
177
|
class AskFileResponse:
|
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: chainlit
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.0rc1
|
|
4
4
|
Summary: Build Conversational AI.
|
|
5
|
-
Home-page: https://
|
|
6
|
-
License:
|
|
5
|
+
Home-page: https://github.com/Chainlit/chainlit
|
|
6
|
+
License: Apache-2.0 license
|
|
7
7
|
Keywords: LLM,Agents,gen ai,chat ui,chatbot ui,openai,copilot,langchain,conversational ai
|
|
8
|
-
Author:
|
|
8
|
+
Author: Chainlit
|
|
9
9
|
Requires-Python: >=3.9,<4.0.0
|
|
10
|
-
Classifier: Environment :: Web Environment
|
|
11
|
-
Classifier: Framework :: FastAPI
|
|
12
10
|
Classifier: License :: Other/Proprietary License
|
|
13
|
-
Classifier: Programming Language :: JavaScript
|
|
14
11
|
Classifier: Programming Language :: Python :: 3
|
|
15
12
|
Classifier: Programming Language :: Python :: 3.9
|
|
16
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
15
|
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
|
|
23
16
|
Requires-Dist: aiofiles (>=23.1.0,<24.0.0)
|
|
24
17
|
Requires-Dist: asyncer (>=0.0.7,<0.0.8)
|
|
25
18
|
Requires-Dist: click (>=8.1.3,<9.0.0)
|
|
@@ -43,7 +36,6 @@ Requires-Dist: tomli (>=2.0.1,<3.0.0)
|
|
|
43
36
|
Requires-Dist: uptrace (>=1.22.0,<2.0.0)
|
|
44
37
|
Requires-Dist: uvicorn (>=0.25.0,<0.26.0)
|
|
45
38
|
Requires-Dist: watchfiles (>=0.20.0,<0.21.0)
|
|
46
|
-
Project-URL: Documentation, https://docs.chainlit.io/
|
|
47
39
|
Project-URL: Repository, https://github.com/Chainlit/chainlit
|
|
48
40
|
Description-Content-Type: text/markdown
|
|
49
41
|
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
chainlit/__init__.py,sha256=
|
|
1
|
+
chainlit/__init__.py,sha256=hzSPlB5Syel5sQ5H_pEr5ffZur9rbvxIJMZ2PvVftBQ,4418
|
|
2
2
|
chainlit/__main__.py,sha256=7Vg3w3T3qDuz4KDu5lQhLH6lQ3cYdume7gHH7Z1V97U,87
|
|
3
3
|
chainlit/_utils.py,sha256=vaKfEpXcL4kXktp54IRQWZRK4L_HGK8gJuAoIM29YYc,289
|
|
4
4
|
chainlit/action.py,sha256=k-GsblVHI4DnDWFyF-RZgq3KfdfAFICFh2OBeU4w8N8,1410
|
|
5
|
-
chainlit/auth.py,sha256=
|
|
5
|
+
chainlit/auth.py,sha256=5G7H0khUaXxLkxvJotHFYJMQgDlXkHgJrv9s8rtDuP4,2671
|
|
6
6
|
chainlit/cache.py,sha256=Bv3dT4eHhE6Fq3c6Do0ZTpiyoXgXYewdxTgpYghEd9g,1361
|
|
7
|
-
chainlit/callbacks.py,sha256=
|
|
7
|
+
chainlit/callbacks.py,sha256=cz8RBC4yT2M8mK--lrazMFt4ZPrdPKwca4iSLZFm_mI,8886
|
|
8
8
|
chainlit/chat_context.py,sha256=X1NInuCkhrfFhFUNIbipVaqf-90xXuyCAB9fvJlEUD4,1868
|
|
9
9
|
chainlit/chat_settings.py,sha256=2ByenmwS8O6jQjDVJjhhbLrBPGA5aY2F7R3VvQQxXPk,877
|
|
10
10
|
chainlit/cli/__init__.py,sha256=s-2SkMzIpo4ifEAJ0p1VARGM5F7fkb1so6G8Enj5iHs,6230
|
|
11
|
-
chainlit/config.py,sha256=
|
|
12
|
-
chainlit/context.py,sha256=
|
|
13
|
-
chainlit/copilot/dist/assets/logo_dark-
|
|
14
|
-
chainlit/copilot/dist/assets/logo_light-
|
|
15
|
-
chainlit/copilot/dist/index.js,sha256=
|
|
11
|
+
chainlit/config.py,sha256=2w1dL_0oBsiQH6YOmAEMg4sP_VibQtM8_ZgeOWkpd5k,16690
|
|
12
|
+
chainlit/context.py,sha256=RdLGlRjx8nBW1onooQdCdcbtMyIBGFlxYkL95oHacdk,3338
|
|
13
|
+
chainlit/copilot/dist/assets/logo_dark-2a3cf740.svg,sha256=Kjz3QMh-oh-ag4YatjU0YCPqGF7F8nHh8VUQoJIs01E,8887
|
|
14
|
+
chainlit/copilot/dist/assets/logo_light-b078e7bc.svg,sha256=sHjnvEq1rfqh3bcexJNYUY7WEDdTQZq3aKZYpi4w4ck,8889
|
|
15
|
+
chainlit/copilot/dist/index.js,sha256=BNvRUAhhwKmSeZijOKldJS5xOQBfKvRhcbdTfBCb_4Y,6801851
|
|
16
16
|
chainlit/data/__init__.py,sha256=oaKft5-ejrduen95fTMVmqLMLXVyEa97mQI72oDDSlE,751
|
|
17
17
|
chainlit/data/acl.py,sha256=5EwZuKVcZediw77L661MohGce3JzGIaYmw6NutmMTw0,578
|
|
18
18
|
chainlit/data/base.py,sha256=08CYstw0heUBfBzIjD6i-G3-83JMlhjxOxMEuoD0Epk,2907
|
|
19
19
|
chainlit/data/dynamodb.py,sha256=EgeYOeREswvtx7nfYJALh58u5ARJfWnIqk5H00sdwfw,19410
|
|
20
20
|
chainlit/data/literalai.py,sha256=H6fxhqwJVeA6movnmlcB_TToD7jslY1X8u2vg3gIku0,17256
|
|
21
|
-
chainlit/data/sql_alchemy.py,sha256=
|
|
21
|
+
chainlit/data/sql_alchemy.py,sha256=cspyQOz5IVs1TrFnujxW1_Zil_sUpGUoa11DnAbEkGE,29511
|
|
22
22
|
chainlit/data/storage_clients.py,sha256=uKVsl6oUSclj4h7QrBz13K46RZWtaHbpzf8ZdJg7bVo,3535
|
|
23
23
|
chainlit/data/utils.py,sha256=cVe8p9F-lITgmAD2xhON_h0nKJVrh1P0AUoLCq6JCWs,966
|
|
24
24
|
chainlit/discord/__init__.py,sha256=kZ_AAMaCToqO-1FdeQ8_IHS2pqNT0QJ-yyd8bCMaHHs,198
|
|
25
25
|
chainlit/discord/app.py,sha256=-efl4v9wNvfidYPjS2kqNqaaUCvvfBlErZe6lyQF_IE,11174
|
|
26
26
|
chainlit/element.py,sha256=CbpWgqeLAeyC0TONmzUc57cVg55a0cEnUDAxoa7qwB4,10954
|
|
27
|
-
chainlit/emitter.py,sha256=
|
|
28
|
-
chainlit/frontend/dist/assets/DailyMotion-
|
|
29
|
-
chainlit/frontend/dist/assets/Facebook-
|
|
30
|
-
chainlit/frontend/dist/assets/FilePlayer-
|
|
31
|
-
chainlit/frontend/dist/assets/Kaltura-
|
|
32
|
-
chainlit/frontend/dist/assets/Mixcloud-
|
|
33
|
-
chainlit/frontend/dist/assets/Mux-
|
|
34
|
-
chainlit/frontend/dist/assets/Preview-
|
|
35
|
-
chainlit/frontend/dist/assets/SoundCloud-
|
|
36
|
-
chainlit/frontend/dist/assets/Streamable-
|
|
37
|
-
chainlit/frontend/dist/assets/Twitch-
|
|
38
|
-
chainlit/frontend/dist/assets/Vidyard-
|
|
39
|
-
chainlit/frontend/dist/assets/Vimeo-
|
|
40
|
-
chainlit/frontend/dist/assets/Wistia-
|
|
41
|
-
chainlit/frontend/dist/assets/YouTube-
|
|
42
|
-
chainlit/frontend/dist/assets/index-
|
|
43
|
-
chainlit/frontend/dist/assets/index-
|
|
44
|
-
chainlit/frontend/dist/assets/logo_dark-
|
|
45
|
-
chainlit/frontend/dist/assets/logo_light-
|
|
46
|
-
chainlit/frontend/dist/assets/react-plotly-
|
|
27
|
+
chainlit/emitter.py,sha256=DvxpQYS_BKPHQ6WUEOOhAOkl9M14Tm1FQ8uFI2xi75E,13946
|
|
28
|
+
chainlit/frontend/dist/assets/DailyMotion-b4b7af47.js,sha256=mF1G6OZEaT2dqEVN2GbaTBsZmF0ghLUIA5go88bWMm8,2961
|
|
29
|
+
chainlit/frontend/dist/assets/Facebook-572972a0.js,sha256=_kfF7EMy96FalQIrGG4_MT4uB-1nfU1FPL_hgsdGx7A,3216
|
|
30
|
+
chainlit/frontend/dist/assets/FilePlayer-85c69ca8.js,sha256=CgrZxYliskov_av6t2VjkdblF12fVfVDlXtvn_Ienz0,9041
|
|
31
|
+
chainlit/frontend/dist/assets/Kaltura-dfc24672.js,sha256=wBtFsX3zn_ac-qqdl_YOBm2kEkSlXEbc4ypNJyqax0g,2790
|
|
32
|
+
chainlit/frontend/dist/assets/Mixcloud-705011f4.js,sha256=yI_MccqrCRJeoYtCw7yWGz1_VOCkRoHOm_wIAM5MPW4,2638
|
|
33
|
+
chainlit/frontend/dist/assets/Mux-4201a9e6.js,sha256=sBpsVAF5G--UaLBSCZnPjjmh7p_FicDuij9NnneVNp4,5360
|
|
34
|
+
chainlit/frontend/dist/assets/Preview-23ba40a6.js,sha256=beMjX5SVh1B2whxzKuTHi70jy7U0vBp2hYOvoNyrjSk,3011
|
|
35
|
+
chainlit/frontend/dist/assets/SoundCloud-1a582d51.js,sha256=JiiTaH1uNDDxU5weaUHnULLCKudFNP-br9a5W2gX5RU,2923
|
|
36
|
+
chainlit/frontend/dist/assets/Streamable-5017c4ba.js,sha256=G2jTT7srmzxlx6HLpuLM5pIdJuh7gW6ThwK_gnxHVRQ,2935
|
|
37
|
+
chainlit/frontend/dist/assets/Twitch-bb2de2fa.js,sha256=glTKOp7yBfBfa-Qhp7lKJiasPm7VQbiJkFyKiRXO1vU,3083
|
|
38
|
+
chainlit/frontend/dist/assets/Vidyard-54e269b1.js,sha256=9_OQkR2hr2sOQPYfVq9SgQ2bUq-ylbeB9EpJI5pCwHo,2857
|
|
39
|
+
chainlit/frontend/dist/assets/Vimeo-d92c37dd.js,sha256=zHmHzNx7M7y9cWvlhWjc-UxdgxYuX_Ggqyz6oQaZHik,3627
|
|
40
|
+
chainlit/frontend/dist/assets/Wistia-25a1363b.js,sha256=3cAZegM4xwgG6luxPafQTpYi-CY1-57obmoTlG6-VJg,3514
|
|
41
|
+
chainlit/frontend/dist/assets/YouTube-616e8cb7.js,sha256=xbfKpJbq0khfLpEghQxgGdRrewYzOK0BXE1xgXObvm0,4448
|
|
42
|
+
chainlit/frontend/dist/assets/index-aaf974a9.css,sha256=qvl0qUmR5u0JcmJAfkzaZpN-0ZKdQjzqCSE9cnrQpZQ,2559
|
|
43
|
+
chainlit/frontend/dist/assets/index-f5df2072.js,sha256=mcUQs_jSYtrw_JpGj5wy3MV90HYMi3nfCAA-iqlKA-c,2778550
|
|
44
|
+
chainlit/frontend/dist/assets/logo_dark-2a3cf740.svg,sha256=Kjz3QMh-oh-ag4YatjU0YCPqGF7F8nHh8VUQoJIs01E,8887
|
|
45
|
+
chainlit/frontend/dist/assets/logo_light-b078e7bc.svg,sha256=sHjnvEq1rfqh3bcexJNYUY7WEDdTQZq3aKZYpi4w4ck,8889
|
|
46
|
+
chainlit/frontend/dist/assets/react-plotly-f0315f86.js,sha256=neB_TetN5T1RABT3M0hsKFfAaCCryheqq7tgdLGyeS8,3763471
|
|
47
47
|
chainlit/frontend/dist/favicon.svg,sha256=0Cy8x28obT5eWW3nxZRhsEvu6_zMqrqbg0y6hT3D0Q0,6455
|
|
48
|
-
chainlit/frontend/dist/index.html,sha256=
|
|
48
|
+
chainlit/frontend/dist/index.html,sha256=mjv-9AYkyZr_OTwTY0VOXR8x9PssCmyDy4Ul_onLUmo,965
|
|
49
49
|
chainlit/haystack/__init__.py,sha256=uZ77YiPy-qleSTi3dQCDO9HE6S6F6GpJWmh7jO4cxXA,217
|
|
50
50
|
chainlit/haystack/callbacks.py,sha256=mh6CS6n0Z70u9B1s72iF0kSl-qi2N55T-AgaMtUvq9Y,5036
|
|
51
51
|
chainlit/hello.py,sha256=LwENQWo5s5r8nNDn4iKSV77vX60Ky5r_qGjQhyi7qlY,416
|
|
@@ -59,22 +59,22 @@ chainlit/logger.py,sha256=wTwRSZsLfXwWy6U4351IgWAm4KCMThgxm9EZpjGUEr4,373
|
|
|
59
59
|
chainlit/markdown.py,sha256=V-Op4hyqyTTvXInU5QrHfxs0nb71lBMU8trOSAlast8,2142
|
|
60
60
|
chainlit/message.py,sha256=kMPRE0L10WhJKcyPUNg3FRVPviby0LOn1KHAI4pGszM,17287
|
|
61
61
|
chainlit/mistralai/__init__.py,sha256=Zr3-mb-3ycNXR1e5ui_yX_7ZxGB0cu5d9E80ir7t-2w,1507
|
|
62
|
-
chainlit/oauth_providers.py,sha256=
|
|
63
|
-
chainlit/openai/__init__.py,sha256=
|
|
62
|
+
chainlit/oauth_providers.py,sha256=T17iFZdDXClzscki2v7AEgSGvrGYSiq2QG4MrgqgBzg,23242
|
|
63
|
+
chainlit/openai/__init__.py,sha256=aj8toIwvCktANU1TaH1verKS7ApS6tlhDZFtm1oTyCM,1715
|
|
64
64
|
chainlit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
65
65
|
chainlit/secret.py,sha256=cQvIFGTQ7r2heC8EOGdgifSZZYqslh-qQxhUhKhD8vU,295
|
|
66
|
-
chainlit/server.py,sha256=
|
|
66
|
+
chainlit/server.py,sha256=vCTBPiFfJYTM3vxkrmCuZJwbh3lszGdBEP_wjsZ8CZM,29961
|
|
67
67
|
chainlit/session.py,sha256=dU56wmJ9LSuSAOwKBpYF8ZofV5SoN1oPmWycHWEN85k,9219
|
|
68
68
|
chainlit/slack/__init__.py,sha256=Q41ztJHeVmpoXVgVqAcwGOufQp_bjf7dDT7eEXDdhPI,207
|
|
69
69
|
chainlit/slack/app.py,sha256=jzy6Nz9kmnJ6j1wfoI94cweSNDjdv7X-ur_lWnq5oVE,11741
|
|
70
|
-
chainlit/socket.py,sha256=
|
|
71
|
-
chainlit/step.py,sha256=
|
|
70
|
+
chainlit/socket.py,sha256=Hg1OC0diVii9o_KZjo1mqnFbgZjezrF3r60D1-UfoBs,12762
|
|
71
|
+
chainlit/step.py,sha256=YI6O_-FoJ24r1aAIMr7X_9floR_9RIwP4TuvEQlaz7s,14584
|
|
72
72
|
chainlit/sync.py,sha256=G1n-7-3WgXsN8y1bJkEyws_YwmHZIyDZoZUwhprigag,1235
|
|
73
73
|
chainlit/teams/__init__.py,sha256=ZSEbsRJHT_mKfGn6yuzM5NX-xItleSDS0af7vt8Z1OA,217
|
|
74
74
|
chainlit/teams/app.py,sha256=gJm_wBNzCawaTLIYtOEhDlpRwBDprnguTAIoWZhlO8o,10533
|
|
75
75
|
chainlit/telemetry.py,sha256=Rk4dnZv0OnGOgV4kD-VHdhgl4i7i3ypqhSE_R-LZceM,3060
|
|
76
76
|
chainlit/translations/bn.json,sha256=_44si0jO2AFZytfH9sBcINpOveQ4OZs77yf-_VlUtjs,13172
|
|
77
|
-
chainlit/translations/en-US.json,sha256=
|
|
77
|
+
chainlit/translations/en-US.json,sha256=eS9YSnca-MFpWeZI4JhI0Yl0YBQlrsxB-yFM62K03bI,7778
|
|
78
78
|
chainlit/translations/gu.json,sha256=CkhAowZ0mgMJhQUMrUADfKPfsDgj5mvHlC3WtQ0UjQE,12699
|
|
79
79
|
chainlit/translations/he-IL.json,sha256=fu6FXfoqYqydSh_NcDpS6ZN7byQ-WZkr4zU0qXznqwc,8789
|
|
80
80
|
chainlit/translations/hi.json,sha256=J15GBkMu45RJMj1p5sFVnlackwAp_jKySRsKN-wRCUg,12397
|
|
@@ -85,12 +85,12 @@ chainlit/translations/ta.json,sha256=kLXucUlMCD3jXlPhmOZ3FFZNdXfGDaqVxwqGqJqVF78
|
|
|
85
85
|
chainlit/translations/te.json,sha256=spOs9mYNITEUy_mKp4_9qmXP2yACVrruiQKb1zlRIWU,13608
|
|
86
86
|
chainlit/translations/zh-CN.json,sha256=Y3MhXUDFi4YMxX8-agpCM68efYXCGcHqyqRAen8LLfk,7508
|
|
87
87
|
chainlit/translations.py,sha256=WG_r7HzxBYns-zk9tVvoGdoofv71okTZx8k1RlcoTIg,2034
|
|
88
|
-
chainlit/types.py,sha256=
|
|
88
|
+
chainlit/types.py,sha256=7pY4iePG2s5nPxU9LnmKbmNI3vT6l5gs6jy9VEH3P4A,5181
|
|
89
89
|
chainlit/user.py,sha256=mUhnGhYQ__qEx8YzigHhF2Z9xxuqQo5C2U8opKpiVRs,752
|
|
90
90
|
chainlit/user_session.py,sha256=T1nQVN_weELXTrkDIV54YgdrA3zIvJGe1tN-nypunt4,1531
|
|
91
91
|
chainlit/utils.py,sha256=hXb5z3jb2syJP0P_jTz3zjDEuIfl0IAmQbA3MooSCTs,3989
|
|
92
92
|
chainlit/version.py,sha256=iosXhlXclBwBqlADFKEilxAC2wWKbtuBKi87AmPi7s8,196
|
|
93
|
-
chainlit-1.3.
|
|
94
|
-
chainlit-1.3.
|
|
95
|
-
chainlit-1.3.
|
|
96
|
-
chainlit-1.3.
|
|
93
|
+
chainlit-1.3.0rc1.dist-info/METADATA,sha256=VhZ78MpIAKpeqZVK2QOcxk2MaZ10I7t5Z4cHsIMMFmc,6398
|
|
94
|
+
chainlit-1.3.0rc1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
95
|
+
chainlit-1.3.0rc1.dist-info/entry_points.txt,sha256=FrkqdjrFl8juSnvBndniyX7XuKojmUwO4ghRh-CFMQc,45
|
|
96
|
+
chainlit-1.3.0rc1.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as P,r as v,u as D,a as O}from"./index-DLRdQOIx.js";function b(t,e){for(var r=0;r<e.length;r++){const o=e[r];if(typeof o!="string"&&!Array.isArray(o)){for(const a in o)if(a!=="default"&&!(a in t)){const i=Object.getOwnPropertyDescriptor(o,a);i&&Object.defineProperty(t,a,i.get?i:{enumerable:!0,get:()=>o[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var M=Object.create,s=Object.defineProperty,w=Object.getOwnPropertyDescriptor,S=Object.getOwnPropertyNames,j=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,E=(t,e,r)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of S(e))!T.call(t,a)&&a!==r&&s(t,a,{get:()=>e[a],enumerable:!(o=w(e,a))||o.enumerable});return t},L=(t,e,r)=>(r=t!=null?M(j(t)):{},h(!t||!t.__esModule?s(r,"default",{value:t,enumerable:!0}):r,t)),C=t=>h(s({},"__esModule",{value:!0}),t),n=(t,e,r)=>(E(t,typeof e!="symbol"?e+"":e,r),r),d={};A(d,{default:()=>p});var _=C(d),c=L(v),l=D,f=O;const N="https://api.dmcdn.net/all.js",x="DM",K="dmAsyncInit";class p extends c.Component{constructor(){super(...arguments),n(this,"callPlayer",l.callPlayer),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.callPlayer("setMuted",!0)}),n(this,"unmute",()=>{this.callPlayer("setMuted",!1)}),n(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{controls:r,config:o,onError:a,playing:i}=this.props,[,y]=e.match(f.MATCH_URL_DAILYMOTION);if(this.player){this.player.load(y,{start:(0,l.parseStartTime)(e),autoplay:i});return}(0,l.getSDK)(N,x,K,u=>u.player).then(u=>{if(!this.container)return;const g=u.player;this.player=new g(this.container,{width:"100%",height:"100%",video:y,params:{controls:r,autoplay:this.props.playing,mute:this.props.muted,start:(0,l.parseStartTime)(e),origin:window.location.origin,...o.params},events:{apiready:this.props.onReady,seeked:()=>this.props.onSeek(this.player.currentTime),video_end:this.props.onEnded,durationchange:this.onDurationChange,pause:this.props.onPause,playing:this.props.onPlay,waiting:this.props.onBuffer,error:m=>a(m)}})},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.player.duration||null}getCurrentTime(){return this.player.currentTime}getSecondsLoaded(){return this.player.bufferedTime}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return c.default.createElement("div",{style:r},c.default.createElement("div",{ref:this.ref}))}}n(p,"displayName","DailyMotion");n(p,"canPlay",f.canPlay.dailymotion);n(p,"loopOnEnded",!0);const R=P(_),I=b({__proto__:null,default:R},[_]);export{I as D};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as _,r as g,u as P,a as m}from"./index-DLRdQOIx.js";function v(t,e){for(var r=0;r<e.length;r++){const a=e[r];if(typeof a!="string"&&!Array.isArray(a)){for(const s in a)if(s!=="default"&&!(s in t)){const p=Object.getOwnPropertyDescriptor(a,s);p&&Object.defineProperty(t,s,p.get?p:{enumerable:!0,get:()=>a[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var O=Object.create,i=Object.defineProperty,D=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,S=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,I=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,k=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of E(e))!j.call(t,s)&&s!==r&&i(t,s,{get:()=>e[s],enumerable:!(a=D(e,s))||a.enumerable});return t},w=(t,e,r)=>(r=t!=null?O(S(t)):{},h(!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),F=t=>h(i({},"__esModule",{value:!0}),t),o=(t,e,r)=>(I(t,typeof e!="symbol"?e+"":e,r),r),b={};k(b,{default:()=>l});var d=F(b),u=w(g),n=P,x=m;const c="https://connect.facebook.net/en_US/sdk.js",y="FB",f="fbAsyncInit",L="facebook-player-";class l extends u.Component{constructor(){super(...arguments),o(this,"callPlayer",n.callPlayer),o(this,"playerID",this.props.config.playerId||`${L}${(0,n.randomString)()}`),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unmute")})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){if(r){(0,n.getSDK)(c,y,f).then(a=>a.XFBML.parse());return}(0,n.getSDK)(c,y,f).then(a=>{a.init({appId:this.props.config.appId,xfbml:!0,version:this.props.config.version}),a.Event.subscribe("xfbml.render",s=>{this.props.onLoaded()}),a.Event.subscribe("xfbml.ready",s=>{s.type==="video"&&s.id===this.playerID&&(this.player=s.instance,this.player.subscribe("startedPlaying",this.props.onPlay),this.player.subscribe("paused",this.props.onPause),this.player.subscribe("finishedPlaying",this.props.onEnded),this.player.subscribe("startedBuffering",this.props.onBuffer),this.player.subscribe("finishedBuffering",this.props.onBufferEnd),this.player.subscribe("error",this.props.onError),this.props.muted?this.callPlayer("mute"):this.callPlayer("unmute"),this.props.onReady(),document.getElementById(this.playerID).querySelector("iframe").style.visibility="visible")})})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentPosition")}getSecondsLoaded(){return null}render(){const{attributes:e}=this.props.config,r={width:"100%",height:"100%"};return u.default.createElement("div",{style:r,id:this.playerID,className:"fb-video","data-href":this.props.url,"data-autoplay":this.props.playing?"true":"false","data-allowfullscreen":"true","data-controls":this.props.controls?"true":"false",...e})}}o(l,"displayName","Facebook");o(l,"canPlay",x.canPlay.facebook);o(l,"loopOnEnded",!0);const M=_(d),B=v({__proto__:null,default:M},[d]);export{B as F};
|