chainlit 1.3.0rc1__py3-none-any.whl → 1.3.1__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 +2 -5
- chainlit/auth.py +2 -0
- chainlit/callbacks.py +4 -13
- chainlit/config.py +21 -6
- chainlit/context.py +4 -6
- chainlit/copilot/dist/index.js +296 -603
- chainlit/data/sql_alchemy.py +1 -1
- chainlit/emitter.py +0 -25
- chainlit/frontend/dist/assets/DailyMotion-CwoOhIL8.js +1 -0
- chainlit/frontend/dist/assets/Facebook-BhnGXlzq.js +1 -0
- chainlit/frontend/dist/assets/FilePlayer-CPSVT6fz.js +1 -0
- chainlit/frontend/dist/assets/Kaltura-COYaLzsL.js +1 -0
- chainlit/frontend/dist/assets/Mixcloud-JdadNiQ5.js +1 -0
- chainlit/frontend/dist/assets/Mux-CBN7RO2u.js +1 -0
- chainlit/frontend/dist/assets/Preview-CxAFvvjV.js +1 -0
- chainlit/frontend/dist/assets/SoundCloud-JlgmASWm.js +1 -0
- chainlit/frontend/dist/assets/Streamable-CUWgr6Zw.js +1 -0
- chainlit/frontend/dist/assets/Twitch-BiN1HEDM.js +1 -0
- chainlit/frontend/dist/assets/Vidyard-qhPmrhDm.js +1 -0
- chainlit/frontend/dist/assets/Vimeo-CrZVSCaT.js +1 -0
- chainlit/frontend/dist/assets/Wistia-C891KrBP.js +1 -0
- chainlit/frontend/dist/assets/YouTube-DKjw5Hbn.js +1 -0
- chainlit/frontend/dist/assets/index-DLRdQOIx.js +723 -0
- chainlit/frontend/dist/assets/{react-plotly-f0315f86.js → react-plotly-Dpmqg5Sy.js} +94 -94
- chainlit/frontend/dist/index.html +2 -3
- chainlit/oauth_providers.py +43 -9
- chainlit/openai/__init__.py +3 -5
- chainlit/server.py +20 -9
- chainlit/socket.py +17 -19
- chainlit/step.py +9 -17
- chainlit/translations/en-US.json +1 -2
- chainlit/types.py +6 -6
- {chainlit-1.3.0rc1.dist-info → chainlit-1.3.1.dist-info}/METADATA +12 -4
- {chainlit-1.3.0rc1.dist-info → chainlit-1.3.1.dist-info}/RECORD +41 -41
- chainlit/frontend/dist/assets/DailyMotion-b4b7af47.js +0 -1
- chainlit/frontend/dist/assets/Facebook-572972a0.js +0 -1
- chainlit/frontend/dist/assets/FilePlayer-85c69ca8.js +0 -1
- chainlit/frontend/dist/assets/Kaltura-dfc24672.js +0 -1
- chainlit/frontend/dist/assets/Mixcloud-705011f4.js +0 -1
- chainlit/frontend/dist/assets/Mux-4201a9e6.js +0 -1
- chainlit/frontend/dist/assets/Preview-23ba40a6.js +0 -1
- chainlit/frontend/dist/assets/SoundCloud-1a582d51.js +0 -1
- chainlit/frontend/dist/assets/Streamable-5017c4ba.js +0 -1
- chainlit/frontend/dist/assets/Twitch-bb2de2fa.js +0 -1
- chainlit/frontend/dist/assets/Vidyard-54e269b1.js +0 -1
- chainlit/frontend/dist/assets/Vimeo-d92c37dd.js +0 -1
- chainlit/frontend/dist/assets/Wistia-25a1363b.js +0 -1
- chainlit/frontend/dist/assets/YouTube-616e8cb7.js +0 -1
- chainlit/frontend/dist/assets/index-f5df2072.js +0 -1027
- /chainlit/copilot/dist/assets/{logo_dark-2a3cf740.svg → logo_dark-IkGJ_IwC.svg} +0 -0
- /chainlit/copilot/dist/assets/{logo_light-b078e7bc.svg → logo_light-Bb_IPh6r.svg} +0 -0
- /chainlit/frontend/dist/assets/{index-aaf974a9.css → index-CwmincdQ.css} +0 -0
- /chainlit/frontend/dist/assets/{logo_dark-2a3cf740.svg → logo_dark-IkGJ_IwC.svg} +0 -0
- /chainlit/frontend/dist/assets/{logo_light-b078e7bc.svg → logo_light-Bb_IPh6r.svg} +0 -0
- {chainlit-1.3.0rc1.dist-info → chainlit-1.3.1.dist-info}/WHEEL +0 -0
- {chainlit-1.3.0rc1.dist-info → chainlit-1.3.1.dist-info}/entry_points.txt +0 -0
|
@@ -21,11 +21,10 @@
|
|
|
21
21
|
<script>
|
|
22
22
|
const global = globalThis;
|
|
23
23
|
</script>
|
|
24
|
-
<script type="module" crossorigin src="/assets/index-
|
|
25
|
-
<link rel="stylesheet" href="/assets/index-
|
|
24
|
+
<script type="module" crossorigin src="/assets/index-DLRdQOIx.js"></script>
|
|
25
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CwmincdQ.css">
|
|
26
26
|
</head>
|
|
27
27
|
<body>
|
|
28
28
|
<div id="root"></div>
|
|
29
|
-
|
|
30
29
|
</body>
|
|
31
30
|
</html>
|
chainlit/oauth_providers.py
CHANGED
|
@@ -16,6 +16,7 @@ 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
|
|
19
20
|
|
|
20
21
|
def is_configured(self):
|
|
21
22
|
return all([os.environ.get(env) for env in self.env])
|
|
@@ -26,6 +27,21 @@ class OAuthProvider:
|
|
|
26
27
|
async def get_user_info(self, token: str) -> Tuple[Dict[str, str], User]:
|
|
27
28
|
raise NotImplementedError()
|
|
28
29
|
|
|
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
|
+
|
|
29
45
|
|
|
30
46
|
class GithubOAuthProvider(OAuthProvider):
|
|
31
47
|
id = "github"
|
|
@@ -37,9 +53,11 @@ class GithubOAuthProvider(OAuthProvider):
|
|
|
37
53
|
self.client_secret = os.environ.get("OAUTH_GITHUB_CLIENT_SECRET")
|
|
38
54
|
self.authorize_params = {
|
|
39
55
|
"scope": "user:email",
|
|
40
|
-
"prompt": "consent",
|
|
41
56
|
}
|
|
42
57
|
|
|
58
|
+
if prompt := self.get_prompt():
|
|
59
|
+
self.authorize_params["prompt"] = prompt
|
|
60
|
+
|
|
43
61
|
async def get_token(self, code: str, url: str):
|
|
44
62
|
payload = {
|
|
45
63
|
"client_id": self.client_id,
|
|
@@ -96,9 +114,11 @@ class GoogleOAuthProvider(OAuthProvider):
|
|
|
96
114
|
"scope": "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
|
|
97
115
|
"response_type": "code",
|
|
98
116
|
"access_type": "offline",
|
|
99
|
-
"prompt": "login",
|
|
100
117
|
}
|
|
101
118
|
|
|
119
|
+
if prompt := self.get_prompt():
|
|
120
|
+
self.authorize_params["prompt"] = prompt
|
|
121
|
+
|
|
102
122
|
async def get_token(self, code: str, url: str):
|
|
103
123
|
payload = {
|
|
104
124
|
"client_id": self.client_id,
|
|
@@ -164,9 +184,11 @@ class AzureADOAuthProvider(OAuthProvider):
|
|
|
164
184
|
"response_type": "code",
|
|
165
185
|
"scope": "https://graph.microsoft.com/User.Read",
|
|
166
186
|
"response_mode": "query",
|
|
167
|
-
"prompt": "login",
|
|
168
187
|
}
|
|
169
188
|
|
|
189
|
+
if prompt := self.get_prompt():
|
|
190
|
+
self.authorize_params["prompt"] = prompt
|
|
191
|
+
|
|
170
192
|
async def get_token(self, code: str, url: str):
|
|
171
193
|
payload = {
|
|
172
194
|
"client_id": self.client_id,
|
|
@@ -249,9 +271,11 @@ class AzureADHybridOAuthProvider(OAuthProvider):
|
|
|
249
271
|
"scope": "https://graph.microsoft.com/User.Read https://graph.microsoft.com/openid",
|
|
250
272
|
"response_mode": "form_post",
|
|
251
273
|
"nonce": nonce,
|
|
252
|
-
"prompt": "login",
|
|
253
274
|
}
|
|
254
275
|
|
|
276
|
+
if prompt := self.get_prompt():
|
|
277
|
+
self.authorize_params["prompt"] = prompt
|
|
278
|
+
|
|
255
279
|
async def get_token(self, code: str, url: str):
|
|
256
280
|
payload = {
|
|
257
281
|
"client_id": self.client_id,
|
|
@@ -329,9 +353,11 @@ class OktaOAuthProvider(OAuthProvider):
|
|
|
329
353
|
"response_type": "code",
|
|
330
354
|
"scope": "openid profile email",
|
|
331
355
|
"response_mode": "query",
|
|
332
|
-
"prompt": "login",
|
|
333
356
|
}
|
|
334
357
|
|
|
358
|
+
if prompt := self.get_prompt():
|
|
359
|
+
self.authorize_params["prompt"] = prompt
|
|
360
|
+
|
|
335
361
|
def get_authorization_server_path(self):
|
|
336
362
|
if not self.authorization_server_id:
|
|
337
363
|
return "/default"
|
|
@@ -401,9 +427,11 @@ class Auth0OAuthProvider(OAuthProvider):
|
|
|
401
427
|
"response_type": "code",
|
|
402
428
|
"scope": "openid profile email",
|
|
403
429
|
"audience": f"{self.original_domain}/userinfo",
|
|
404
|
-
"prompt": "login",
|
|
405
430
|
}
|
|
406
431
|
|
|
432
|
+
if prompt := self.get_prompt():
|
|
433
|
+
self.authorize_params["prompt"] = prompt
|
|
434
|
+
|
|
407
435
|
async def get_token(self, code: str, url: str):
|
|
408
436
|
payload = {
|
|
409
437
|
"client_id": self.client_id,
|
|
@@ -459,9 +487,11 @@ class DescopeOAuthProvider(OAuthProvider):
|
|
|
459
487
|
"response_type": "code",
|
|
460
488
|
"scope": "openid profile email",
|
|
461
489
|
"audience": f"{self.domain}/userinfo",
|
|
462
|
-
"prompt": "login",
|
|
463
490
|
}
|
|
464
491
|
|
|
492
|
+
if prompt := self.get_prompt():
|
|
493
|
+
self.authorize_params["prompt"] = prompt
|
|
494
|
+
|
|
465
495
|
async def get_token(self, code: str, url: str):
|
|
466
496
|
payload = {
|
|
467
497
|
"client_id": self.client_id,
|
|
@@ -518,9 +548,11 @@ class AWSCognitoOAuthProvider(OAuthProvider):
|
|
|
518
548
|
"response_type": "code",
|
|
519
549
|
"client_id": self.client_id,
|
|
520
550
|
"scope": "openid profile email",
|
|
521
|
-
"prompt": "login",
|
|
522
551
|
}
|
|
523
552
|
|
|
553
|
+
if prompt := self.get_prompt():
|
|
554
|
+
self.authorize_params["prompt"] = prompt
|
|
555
|
+
|
|
524
556
|
async def get_token(self, code: str, url: str):
|
|
525
557
|
payload = {
|
|
526
558
|
"client_id": self.client_id,
|
|
@@ -587,9 +619,11 @@ class GitlabOAuthProvider(OAuthProvider):
|
|
|
587
619
|
self.authorize_params = {
|
|
588
620
|
"scope": "openid profile email",
|
|
589
621
|
"response_type": "code",
|
|
590
|
-
"prompt": "login",
|
|
591
622
|
}
|
|
592
623
|
|
|
624
|
+
if prompt := self.get_prompt():
|
|
625
|
+
self.authorize_params["prompt"] = prompt
|
|
626
|
+
|
|
593
627
|
async def get_token(self, code: str, url: str):
|
|
594
628
|
payload = {
|
|
595
629
|
"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 local_steps
|
|
5
5
|
from chainlit.step import Step
|
|
6
6
|
from chainlit.utils import check_module_version
|
|
7
7
|
from literalai import ChatGeneration, CompletionGeneration
|
|
@@ -19,11 +19,9 @@ def instrument_openai():
|
|
|
19
19
|
def on_new_generation(
|
|
20
20
|
generation: Union["ChatGeneration", "CompletionGeneration"], timing
|
|
21
21
|
):
|
|
22
|
-
|
|
22
|
+
previous_steps = local_steps.get()
|
|
23
23
|
|
|
24
|
-
parent_id = None
|
|
25
|
-
if context.current_step:
|
|
26
|
-
parent_id = context.current_step.id
|
|
24
|
+
parent_id = previous_steps[-1].id if previous_steps else None
|
|
27
25
|
|
|
28
26
|
step = Step(
|
|
29
27
|
name=generation.model if generation.model else generation.provider,
|
chainlit/server.py
CHANGED
|
@@ -41,6 +41,7 @@ from fastapi import (
|
|
|
41
41
|
APIRouter,
|
|
42
42
|
Depends,
|
|
43
43
|
FastAPI,
|
|
44
|
+
File,
|
|
44
45
|
Form,
|
|
45
46
|
HTTPException,
|
|
46
47
|
Query,
|
|
@@ -645,7 +646,7 @@ async def oauth_azure_hf_callback(
|
|
|
645
646
|
|
|
646
647
|
|
|
647
648
|
_language_pattern = (
|
|
648
|
-
"^[a-zA-Z]{2,3}(-[a-zA-
|
|
649
|
+
"^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,3})?(-[a-zA-Z0-9]{2,8})?(-x-[a-zA-Z0-9]{1,8})?$"
|
|
649
650
|
)
|
|
650
651
|
|
|
651
652
|
|
|
@@ -839,11 +840,9 @@ async def delete_thread(
|
|
|
839
840
|
|
|
840
841
|
@router.post("/project/file")
|
|
841
842
|
async def upload_file(
|
|
843
|
+
current_user: Annotated[Union[User, PersistedUser], Depends(get_current_user)],
|
|
842
844
|
session_id: str,
|
|
843
845
|
file: UploadFile,
|
|
844
|
-
current_user: Annotated[
|
|
845
|
-
Union[None, User, PersistedUser], Depends(get_current_user)
|
|
846
|
-
],
|
|
847
846
|
):
|
|
848
847
|
"""Upload a file to the session files directory."""
|
|
849
848
|
|
|
@@ -868,17 +867,21 @@ async def upload_file(
|
|
|
868
867
|
|
|
869
868
|
content = await file.read()
|
|
870
869
|
|
|
870
|
+
assert file.filename, "No filename for uploaded file"
|
|
871
|
+
assert file.content_type, "No content type for uploaded file"
|
|
872
|
+
|
|
871
873
|
file_response = await session.persist_file(
|
|
872
874
|
name=file.filename, content=content, mime=file.content_type
|
|
873
875
|
)
|
|
874
876
|
|
|
875
|
-
return JSONResponse(file_response)
|
|
877
|
+
return JSONResponse(content=file_response)
|
|
876
878
|
|
|
877
879
|
|
|
878
880
|
@router.get("/project/file/{file_id}")
|
|
879
881
|
async def get_file(
|
|
880
882
|
file_id: str,
|
|
881
|
-
session_id:
|
|
883
|
+
session_id: str,
|
|
884
|
+
# current_user: Annotated[Union[User, PersistedUser], Depends(get_current_user)], #TODO: Causes 401 error. See https://github.com/Chainlit/chainlit/issues/1472
|
|
882
885
|
):
|
|
883
886
|
"""Get a file from the session files directory."""
|
|
884
887
|
|
|
@@ -888,10 +891,18 @@ async def get_file(
|
|
|
888
891
|
|
|
889
892
|
if not session:
|
|
890
893
|
raise HTTPException(
|
|
891
|
-
status_code=
|
|
892
|
-
detail="
|
|
894
|
+
status_code=401,
|
|
895
|
+
detail="Unauthorized",
|
|
893
896
|
)
|
|
894
897
|
|
|
898
|
+
#TODO: Causes 401 error. See https://github.com/Chainlit/chainlit/issues/1472
|
|
899
|
+
# if current_user:
|
|
900
|
+
# if not session.user or session.user.identifier != current_user.identifier:
|
|
901
|
+
# raise HTTPException(
|
|
902
|
+
# status_code=401,
|
|
903
|
+
# detail="You are not authorized to download files from this session",
|
|
904
|
+
# )
|
|
905
|
+
|
|
895
906
|
if file_id in session.files:
|
|
896
907
|
file = session.files[file_id]
|
|
897
908
|
return FileResponse(file["path"], media_type=file["type"])
|
|
@@ -961,7 +972,7 @@ async def get_logo(theme: Optional[Theme] = Query(Theme.light)):
|
|
|
961
972
|
@router.get("/avatars/{avatar_id:str}")
|
|
962
973
|
async def get_avatar(avatar_id: str):
|
|
963
974
|
"""Get the avatar for the user based on the avatar_id."""
|
|
964
|
-
if not re.match(r"^[a-zA-Z0-9_-]+$", avatar_id):
|
|
975
|
+
if not re.match(r"^[a-zA-Z0-9_ -]+$", avatar_id):
|
|
965
976
|
raise HTTPException(status_code=400, detail="Invalid avatar_id")
|
|
966
977
|
|
|
967
978
|
if avatar_id == "default":
|
chainlit/socket.py
CHANGED
|
@@ -18,8 +18,9 @@ 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
|
-
|
|
21
|
+
AudioChunk,
|
|
22
|
+
AudioChunkPayload,
|
|
23
|
+
AudioEndPayload,
|
|
23
24
|
MessagePayload,
|
|
24
25
|
)
|
|
25
26
|
from chainlit.user_session import user_sessions
|
|
@@ -313,31 +314,19 @@ async def message(sid, payload: MessagePayload):
|
|
|
313
314
|
session.current_task = task
|
|
314
315
|
|
|
315
316
|
|
|
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
|
-
|
|
328
317
|
@sio.on("audio_chunk")
|
|
329
|
-
async def audio_chunk(sid, payload:
|
|
318
|
+
async def audio_chunk(sid, payload: AudioChunkPayload):
|
|
330
319
|
"""Handle an audio chunk sent by the user."""
|
|
331
320
|
session = WebsocketSession.require(sid)
|
|
332
321
|
|
|
333
322
|
init_ws_context(session)
|
|
334
323
|
|
|
335
324
|
if config.code.on_audio_chunk:
|
|
336
|
-
asyncio.create_task(config.code.on_audio_chunk(
|
|
325
|
+
asyncio.create_task(config.code.on_audio_chunk(AudioChunk(**payload)))
|
|
337
326
|
|
|
338
327
|
|
|
339
328
|
@sio.on("audio_end")
|
|
340
|
-
async def audio_end(sid):
|
|
329
|
+
async def audio_end(sid, payload: AudioEndPayload):
|
|
341
330
|
"""Handle the end of the audio stream."""
|
|
342
331
|
session = WebsocketSession.require(sid)
|
|
343
332
|
try:
|
|
@@ -348,9 +337,18 @@ async def audio_end(sid):
|
|
|
348
337
|
session.has_first_interaction = True
|
|
349
338
|
asyncio.create_task(context.emitter.init_thread("audio"))
|
|
350
339
|
|
|
340
|
+
file_elements = []
|
|
351
341
|
if config.code.on_audio_end:
|
|
352
|
-
|
|
353
|
-
|
|
342
|
+
file_refs = payload.get("fileReferences")
|
|
343
|
+
if file_refs:
|
|
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)
|
|
354
352
|
except asyncio.CancelledError:
|
|
355
353
|
pass
|
|
356
354
|
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,
|
|
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,7 +434,6 @@ 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)
|
|
438
437
|
local_steps.set(previous_steps + [self])
|
|
439
438
|
await self.send()
|
|
440
439
|
return self
|
|
@@ -446,13 +445,10 @@ class Step:
|
|
|
446
445
|
self.output = str(exc_val)
|
|
447
446
|
self.is_error = True
|
|
448
447
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
if local_active_steps and self in local_active_steps:
|
|
454
|
-
local_active_steps.remove(self)
|
|
455
|
-
local_steps.set(local_active_steps)
|
|
448
|
+
current_steps = local_steps.get()
|
|
449
|
+
if current_steps and self in current_steps:
|
|
450
|
+
current_steps.remove(self)
|
|
451
|
+
local_steps.set(current_steps)
|
|
456
452
|
|
|
457
453
|
await self.update()
|
|
458
454
|
|
|
@@ -465,7 +461,6 @@ class Step:
|
|
|
465
461
|
if not self.parent_id:
|
|
466
462
|
if parent_step:
|
|
467
463
|
self.parent_id = parent_step.id
|
|
468
|
-
context.active_steps.append(self)
|
|
469
464
|
local_steps.set(previous_steps + [self])
|
|
470
465
|
|
|
471
466
|
asyncio.create_task(self.send())
|
|
@@ -478,12 +473,9 @@ class Step:
|
|
|
478
473
|
self.output = str(exc_val)
|
|
479
474
|
self.is_error = True
|
|
480
475
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
if local_active_steps and self in local_active_steps:
|
|
486
|
-
local_active_steps.remove(self)
|
|
487
|
-
local_steps.set(local_active_steps)
|
|
476
|
+
current_steps = local_steps.get()
|
|
477
|
+
if current_steps and self in current_steps:
|
|
478
|
+
current_steps.remove(self)
|
|
479
|
+
local_steps.set(current_steps)
|
|
488
480
|
|
|
489
481
|
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 AudioChunkPayload(TypedDict):
|
|
158
158
|
isStart: bool
|
|
159
159
|
mimeType: str
|
|
160
160
|
elapsedTime: float
|
|
@@ -162,16 +162,16 @@ class InputAudioChunkPayload(TypedDict):
|
|
|
162
162
|
|
|
163
163
|
|
|
164
164
|
@dataclass
|
|
165
|
-
class
|
|
165
|
+
class AudioChunk:
|
|
166
166
|
isStart: bool
|
|
167
167
|
mimeType: str
|
|
168
168
|
elapsedTime: float
|
|
169
169
|
data: bytes
|
|
170
170
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
|
|
172
|
+
class AudioEndPayload(TypedDict):
|
|
173
|
+
fileReferences: Optional[List[FileReference]]
|
|
174
|
+
|
|
175
175
|
|
|
176
176
|
@dataclass
|
|
177
177
|
class AskFileResponse:
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: chainlit
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.1
|
|
4
4
|
Summary: Build Conversational AI.
|
|
5
|
-
Home-page: https://
|
|
6
|
-
License:
|
|
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: Environment :: Web Environment
|
|
11
|
+
Classifier: Framework :: FastAPI
|
|
10
12
|
Classifier: License :: Other/Proprietary 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
|
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
chainlit/__init__.py,sha256=
|
|
1
|
+
chainlit/__init__.py,sha256=DS5myAgKWFdM2L2jlXDyKBrZiuCg9N9VmXDXs61YGiU,4324
|
|
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=53trhZr3j_QBxNn8xo512s8qKdLo0IyZGvNwU84jLuc,2770
|
|
6
6
|
chainlit/cache.py,sha256=Bv3dT4eHhE6Fq3c6Do0ZTpiyoXgXYewdxTgpYghEd9g,1361
|
|
7
|
-
chainlit/callbacks.py,sha256=
|
|
7
|
+
chainlit/callbacks.py,sha256=3t5Z799SLN7CE23DhuXeOfEVA07Hs_1PJRb2WfXmXZI,8723
|
|
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=j6wAlRQG5Kr_2CcVLqm1za94pr0bcC5VY2vDqOHoQFM,17306
|
|
12
|
+
chainlit/context.py,sha256=0eyhjQuMY7N1_-pcMXs_z1JxtuEsGmGzEeyctLOfPVc,3306
|
|
13
|
+
chainlit/copilot/dist/assets/logo_dark-IkGJ_IwC.svg,sha256=Kjz3QMh-oh-ag4YatjU0YCPqGF7F8nHh8VUQoJIs01E,8887
|
|
14
|
+
chainlit/copilot/dist/assets/logo_light-Bb_IPh6r.svg,sha256=sHjnvEq1rfqh3bcexJNYUY7WEDdTQZq3aKZYpi4w4ck,8889
|
|
15
|
+
chainlit/copilot/dist/index.js,sha256=xGnKQfdFfCoXyfUtNtP-VXh06bZo7g5hm5cpwprP6LM,6775931
|
|
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=LQVDnGuk-r8t1ldzNGMb6NbDmB4IUi4RLFcuomj6-U0,29517
|
|
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=vfPtgqeHfm5CxZrMHIUXjw7U0wGWYCrQonaEC2SK0vo,13036
|
|
28
|
+
chainlit/frontend/dist/assets/DailyMotion-CwoOhIL8.js,sha256=kdg8jO-13L-4Mg3uxt20-avLIQdlErP9NO3ahmV_a2c,2958
|
|
29
|
+
chainlit/frontend/dist/assets/Facebook-BhnGXlzq.js,sha256=U_tXeKVfiK1RibDiURO1-trylK7Yq_T2YvE1m-xQ_G4,3213
|
|
30
|
+
chainlit/frontend/dist/assets/FilePlayer-CPSVT6fz.js,sha256=4Ocju0lGAUjfMjg6aK6LonRlHY2OAjhNi9iAEVwnwSs,9038
|
|
31
|
+
chainlit/frontend/dist/assets/Kaltura-COYaLzsL.js,sha256=suaMDOakSjwP78clQ2rpJt4sTDM-Hmzz1YdouhyDD3s,2787
|
|
32
|
+
chainlit/frontend/dist/assets/Mixcloud-JdadNiQ5.js,sha256=VFrHlibbQs6ZMJhT1mLzzVFLxSMkvegN1_hMUVuXYYc,2635
|
|
33
|
+
chainlit/frontend/dist/assets/Mux-CBN7RO2u.js,sha256=Y8jN3L4jJECEI9XqioUZFtg_0FoIIcVo20j_-udRMVc,5357
|
|
34
|
+
chainlit/frontend/dist/assets/Preview-CxAFvvjV.js,sha256=RPQ2LHkP_FvGnkwIV3u641GUdQpus2W4AoJmJDE5usg,3008
|
|
35
|
+
chainlit/frontend/dist/assets/SoundCloud-JlgmASWm.js,sha256=kGn9CjnT0S7Vv6KgPlpIo9V2LvosUn_KWwDyN9YyQmU,2920
|
|
36
|
+
chainlit/frontend/dist/assets/Streamable-CUWgr6Zw.js,sha256=Qkio_3tXYQnFAXuH-BPvKsqCqDh_aSS45StRxbJy1Lo,2932
|
|
37
|
+
chainlit/frontend/dist/assets/Twitch-BiN1HEDM.js,sha256=7XyX65ZCfo22sUOA59HiRzgNZg5581FVY3E9du8nIC8,3080
|
|
38
|
+
chainlit/frontend/dist/assets/Vidyard-qhPmrhDm.js,sha256=vf0qn1I-QRHnsAt9Ux1frmGd8XMAez1D6Hw50c9IZ2I,2854
|
|
39
|
+
chainlit/frontend/dist/assets/Vimeo-CrZVSCaT.js,sha256=j_Yw1BxQPUecotDuAjwNpi-waSi8jFKFsJCNEF3FIcg,3624
|
|
40
|
+
chainlit/frontend/dist/assets/Wistia-C891KrBP.js,sha256=gOtYlRihzsfkROcRwTu6_dZjYGpzO9-nd_pJxRPBGFo,3511
|
|
41
|
+
chainlit/frontend/dist/assets/YouTube-DKjw5Hbn.js,sha256=qPyskJefUeYsLZMkSGBUMCdblMXZx1LpxWn1PAglNqY,4445
|
|
42
|
+
chainlit/frontend/dist/assets/index-CwmincdQ.css,sha256=qvl0qUmR5u0JcmJAfkzaZpN-0ZKdQjzqCSE9cnrQpZQ,2559
|
|
43
|
+
chainlit/frontend/dist/assets/index-DLRdQOIx.js,sha256=Fn6yegFbplbGuSjdfDk98prNX8sGHhGcUq8nXiSDdWs,2752072
|
|
44
|
+
chainlit/frontend/dist/assets/logo_dark-IkGJ_IwC.svg,sha256=Kjz3QMh-oh-ag4YatjU0YCPqGF7F8nHh8VUQoJIs01E,8887
|
|
45
|
+
chainlit/frontend/dist/assets/logo_light-Bb_IPh6r.svg,sha256=sHjnvEq1rfqh3bcexJNYUY7WEDdTQZq3aKZYpi4w4ck,8889
|
|
46
|
+
chainlit/frontend/dist/assets/react-plotly-Dpmqg5Sy.js,sha256=dv9y3rJWJt8KVB4ZRCE6wUmdZ5Ek4cb_-wEBwSGep0g,3762918
|
|
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=EDEeSA6F7ImtpvW2ncwwf5fIA9p23X-q56NQ6Un6Bgo,972
|
|
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=e-HupFy6HFPCAavBfD3XGBgwHU1n0JrGHO7QjeBp0ts,24297
|
|
63
|
+
chainlit/openai/__init__.py,sha256=CJp-3lr4NS3X-aZ0H3OvKcL5wFf-cJZffIK0Bwl9jxA,1690
|
|
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=NA_GdRqdEJ1scS1Rhcm3geh02ec7xWOSzchmrqLi1Vg,30598
|
|
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=CNrkIshIFm-S4MBq6XQaA3wj72w8pSJ4ND2ZuUS2-KE,12761
|
|
71
|
+
chainlit/step.py,sha256=skY9zpxqrl-Czkp7zKVlxRGvKq9xAwT3nfLarD_Q7z0,14271
|
|
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=J46wpkc01XLnytWNLSziillMvfmwXsc-mIUeYDIy59M,7741
|
|
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=494SAbZ2m46KVcpWmxdBtaPVIG1gvEt-1l3rxYlrMbU,5173
|
|
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.1.dist-info/METADATA,sha256=6rdyLKbvKt386FUV3R9QA6skSlDRY8y8ES6Bdba_95w,6803
|
|
94
|
+
chainlit-1.3.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
95
|
+
chainlit-1.3.1.dist-info/entry_points.txt,sha256=FrkqdjrFl8juSnvBndniyX7XuKojmUwO4ghRh-CFMQc,45
|
|
96
|
+
chainlit-1.3.1.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as P,r as v,u as D,a as O}from"./index-f5df2072.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(e||!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 x="https://api.dmcdn.net/all.js",N="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)(x,N,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-f5df2072.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(e||!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};
|