chainlit 1.0.502__py3-none-any.whl → 1.0.504__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.

@@ -22,7 +22,7 @@
22
22
  <script>
23
23
  const global = globalThis;
24
24
  </script>
25
- <script type="module" crossorigin src="/assets/index-e306c2e5.js"></script>
25
+ <script type="module" crossorigin src="/assets/index-a8e1b559.js"></script>
26
26
  <link rel="stylesheet" href="/assets/index-d088547c.css">
27
27
  </head>
28
28
  <body>
chainlit/server.py CHANGED
@@ -597,7 +597,6 @@ async def get_user_threads(
597
597
  current_user: Annotated[Union[User, PersistedUser], Depends(get_current_user)],
598
598
  ):
599
599
  """Get the threads page by page."""
600
- # Only show the current user threads
601
600
 
602
601
  data_layer = get_data_layer()
603
602
 
@@ -605,9 +604,12 @@ async def get_user_threads(
605
604
  raise HTTPException(status_code=400, detail="Data persistence is not enabled")
606
605
 
607
606
  if not isinstance(current_user, PersistedUser):
608
- raise HTTPException(status_code=400, detail="User not persisted")
609
-
610
- payload.filter.userId = current_user.id
607
+ persisted_user = await data_layer.get_user(identifier=current_user.identifier)
608
+ if not persisted_user:
609
+ raise HTTPException(status_code=404, detail="User not found")
610
+ payload.filter.userId = persisted_user.id
611
+ else:
612
+ payload.filter.userId = current_user.id
611
613
 
612
614
  res = await data_layer.list_threads(payload.pagination, payload.filter)
613
615
  return JSONResponse(content=res.to_dict())
chainlit/types.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from enum import Enum
2
- from typing import TYPE_CHECKING, Dict, List, Literal, Optional, TypedDict, Union
2
+ from typing import TYPE_CHECKING, Dict, List, Literal, Optional, TypedDict, Union, Generic, TypeVar, Protocol, Any
3
3
 
4
4
  if TYPE_CHECKING:
5
5
  from chainlit.element import ElementDict
@@ -37,6 +37,58 @@ class ThreadFilter(BaseModel):
37
37
  userId: Optional[str] = None
38
38
  search: Optional[str] = None
39
39
 
40
+ @dataclass
41
+ class PageInfo:
42
+ hasNextPage: bool
43
+ startCursor: Optional[str]
44
+ endCursor: Optional[str]
45
+
46
+ def to_dict(self):
47
+ return {
48
+ "hasNextPage": self.hasNextPage,
49
+ "startCursor": self.startCursor,
50
+ "endCursor": self.endCursor,
51
+ }
52
+
53
+ @classmethod
54
+ def from_dict(cls, page_info_dict: Dict) -> "PageInfo":
55
+ hasNextPage = page_info_dict.get("hasNextPage", False)
56
+ startCursor = page_info_dict.get("startCursor", None)
57
+ endCursor = page_info_dict.get("endCursor", None)
58
+ return cls(
59
+ hasNextPage=hasNextPage, startCursor=startCursor, endCursor=endCursor
60
+ )
61
+
62
+ T = TypeVar("T", covariant=True)
63
+
64
+ class HasFromDict(Protocol[T]):
65
+ @classmethod
66
+ def from_dict(cls, obj_dict: Any) -> T:
67
+ raise NotImplementedError()
68
+
69
+ @dataclass
70
+ class PaginatedResponse(Generic[T]):
71
+ pageInfo: PageInfo
72
+ data: List[T]
73
+
74
+ def to_dict(self):
75
+ return {
76
+ "pageInfo": self.pageInfo.to_dict(),
77
+ "data": [
78
+ (d.to_dict() if hasattr(d, "to_dict") and callable(d.to_dict) else d)
79
+ for d in self.data
80
+ ],
81
+ }
82
+
83
+ @classmethod
84
+ def from_dict(
85
+ cls, paginated_response_dict: Dict, the_class: HasFromDict[T]
86
+ ) -> "PaginatedResponse[T]":
87
+ pageInfo = PageInfo.from_dict(paginated_response_dict.get("pageInfo", {}))
88
+
89
+ data = [the_class.from_dict(d) for d in paginated_response_dict.get("data", [])]
90
+
91
+ return cls(pageInfo=pageInfo, data=data)
40
92
 
41
93
  @dataclass
42
94
  class FileSpec(DataClassJsonMixin):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chainlit
3
- Version: 1.0.502
3
+ Version: 1.0.504
4
4
  Summary: Build Conversational AI.
5
5
  Home-page: https://github.com/Chainlit/chainlit
6
6
  License: Apache-2.0 license
@@ -22,7 +22,7 @@ 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.500)
25
+ Requires-Dist: literalai (==0.0.504)
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)
@@ -4,24 +4,26 @@ chainlit/action.py,sha256=k-GsblVHI4DnDWFyF-RZgq3KfdfAFICFh2OBeU4w8N8,1410
4
4
  chainlit/auth.py,sha256=lLHePwmwKzX0LiWqpTAtKTdSecrDLqCMSY9Yw4c-TD8,2681
5
5
  chainlit/cache.py,sha256=Bv3dT4eHhE6Fq3c6Do0ZTpiyoXgXYewdxTgpYghEd9g,1361
6
6
  chainlit/chat_settings.py,sha256=2ByenmwS8O6jQjDVJjhhbLrBPGA5aY2F7R3VvQQxXPk,877
7
- chainlit/cli/__init__.py,sha256=xlvuod2i42fmC-6Ge3EomOi-CFpE77rxoBoI-tWm4uI,4949
7
+ chainlit/cli/__init__.py,sha256=JEB3Z3VWpzPgcfdSOQ6Z-L7dHdl7A1y47KUZP8H08GQ,4951
8
8
  chainlit/cli/utils.py,sha256=mE2d9oOk-B2b9ZvDV1zENoDWxjfMriGP7bVwEFduZP4,717
9
9
  chainlit/config.py,sha256=5vGp8rPIMZhO58cd1mNn2O5lZF2lcBbpq5rGDMIUJVk,15066
10
10
  chainlit/context.py,sha256=CecWdRuRCTr4jfXlOiU3Mh41j3B-p40c1jC7mhToVzk,2476
11
11
  chainlit/copilot/dist/assets/logo_dark-2a3cf740.svg,sha256=Kjz3QMh-oh-ag4YatjU0YCPqGF7F8nHh8VUQoJIs01E,8887
12
12
  chainlit/copilot/dist/assets/logo_light-b078e7bc.svg,sha256=sHjnvEq1rfqh3bcexJNYUY7WEDdTQZq3aKZYpi4w4ck,8889
13
- chainlit/copilot/dist/index.js,sha256=5fpVkoFSGS8HybSjPvjWJBLSjGKCN1uFuMtufy78ZfQ,7015695
14
- chainlit/data/__init__.py,sha256=BpLeWSEMOsMN9JuyKxc4LSzXviNt68RDBayu_c7ccV4,15588
13
+ chainlit/copilot/dist/index.js,sha256=ZkEgE6Z-mMBc9l8IsEABMXgt_h15bVXQfMxhEEhzkNQ,7015707
14
+ chainlit/data/__init__.py,sha256=3cdMN72dtwToLPdK-QDtDUrzKTSdIOoVI9G3HC8kBbA,16323
15
15
  chainlit/data/acl.py,sha256=hx7Othkx12EitonyZD4iFIRVHwxBmBY2TKdwjPuZMSo,461
16
+ chainlit/data/sql_alchemy.py,sha256=G9o4s1gWkR9lg_YMek7LZr53ZxMSs6048hqz0xbfKe4,24600
17
+ chainlit/data/storage_clients.py,sha256=D9KY1XKDjZh2uuh01ECxeoEtjw-JlrCR-WCuOuePVQI,3007
16
18
  chainlit/element.py,sha256=K5-yxiO2E0ZMRARKcXCNPnxsDKeLcBsXiZ5L-CGNp0A,10162
17
- chainlit/emitter.py,sha256=QOB4HNCOwL5x1EVBwuKceiGDtcml8Nr9TsvpSFCntoU,12178
19
+ chainlit/emitter.py,sha256=r-NhVReraC_rJHdIo6I8nN44gwFO9KLb4rFiMsKRpv4,12369
20
+ chainlit/frontend/dist/assets/index-a8e1b559.js,sha256=8D7TQaMsKRQrmhY2nNlZqwk5v5GsrlhKqjm4fiXnIv8,3072953
18
21
  chainlit/frontend/dist/assets/index-d088547c.css,sha256=0IhUfCm_IY1kjvlTR2edW1qKXAFDya3LZ6mnZnP6ovk,6605
19
- chainlit/frontend/dist/assets/index-e306c2e5.js,sha256=xr7IyXFh4_dNdnVp9tJxtyLXysHW_1DVpyK8BD0JDXM,3072941
20
22
  chainlit/frontend/dist/assets/logo_dark-2a3cf740.svg,sha256=Kjz3QMh-oh-ag4YatjU0YCPqGF7F8nHh8VUQoJIs01E,8887
21
23
  chainlit/frontend/dist/assets/logo_light-b078e7bc.svg,sha256=sHjnvEq1rfqh3bcexJNYUY7WEDdTQZq3aKZYpi4w4ck,8889
22
- chainlit/frontend/dist/assets/react-plotly-cc656f1c.js,sha256=8qygrxBoKy-nEkZ6r1iYUVgDPsc5F9FIHR03uQSe35E,3763471
24
+ chainlit/frontend/dist/assets/react-plotly-b225b63c.js,sha256=qYpUtbvyoNA4YnnVH1ax6uS8Ec7396xfhVu3McGrjhw,3763471
23
25
  chainlit/frontend/dist/favicon.svg,sha256=0Cy8x28obT5eWW3nxZRhsEvu6_zMqrqbg0y6hT3D0Q0,6455
24
- chainlit/frontend/dist/index.html,sha256=xvVRWHyL7YkrPGKt7-UO8Qzso0AHsR1rCfA3rXKNPeU,1005
26
+ chainlit/frontend/dist/index.html,sha256=hugS0ZXAPcpHQohmEAPgZqaYTgnCAeGtOg0oZuNLkJ4,1005
25
27
  chainlit/haystack/__init__.py,sha256=uZ77YiPy-qleSTi3dQCDO9HE6S6F6GpJWmh7jO4cxXA,217
26
28
  chainlit/haystack/callbacks.py,sha256=tItLc6OmskPeDEJH2Qjtg7KgAgIy1TuYQYHTZm9cr3U,5209
27
29
  chainlit/hello.py,sha256=LwENQWo5s5r8nNDn4iKSV77vX60Ky5r_qGjQhyi7qlY,416
@@ -47,7 +49,7 @@ chainlit/playground/providers/openai.py,sha256=9aDSgXVW3sW-gaybBBWMIE8cJPyk9ZuGv
47
49
  chainlit/playground/providers/vertexai.py,sha256=zKy501f-MHnLrvuRzN50FqgB3xoHzfQFTVbw83Nsj20,5084
48
50
  chainlit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
51
  chainlit/secret.py,sha256=cQvIFGTQ7r2heC8EOGdgifSZZYqslh-qQxhUhKhD8vU,295
50
- chainlit/server.py,sha256=5HY4W6-iUYriEfgndYMcilTHTow1YsdrDewiGD0dWcY,23716
52
+ chainlit/server.py,sha256=uhSAB3DdBmtuNnov2dFevdY_x_Pxa0148K16ut0uLEM,23856
51
53
  chainlit/session.py,sha256=AP9xhIM0HuvlOrPgcWR6sg161rSmZZ-iDPvJF0f6pZg,8844
52
54
  chainlit/socket.py,sha256=xcLxqZls_nrUrFHseF_AaYghtwmOCoTv7l6QPr5mwoY,9995
53
55
  chainlit/step.py,sha256=JdXVqG73d9kNtHJjLhmfo1mqkCYtgqfF3jm08uGaCMs,13102
@@ -55,12 +57,12 @@ chainlit/sync.py,sha256=G1n-7-3WgXsN8y1bJkEyws_YwmHZIyDZoZUwhprigag,1235
55
57
  chainlit/telemetry.py,sha256=Rk4dnZv0OnGOgV4kD-VHdhgl4i7i3ypqhSE_R-LZceM,3060
56
58
  chainlit/translations/en-US.json,sha256=uUuS4hlNoYSlDp0DZGTAlPZxwLfsP4Jiu4ckrfr-fI0,7835
57
59
  chainlit/translations.py,sha256=WG_r7HzxBYns-zk9tVvoGdoofv71okTZx8k1RlcoTIg,2034
58
- chainlit/types.py,sha256=0DVObo9zKnT4hG9Diqp0rwBf0RFtu22TJCNoViOY3hE,3375
60
+ chainlit/types.py,sha256=RUIaNKtiDvASVpQgFx2_wl7laXButOfgcG7srFupp4E,4947
59
61
  chainlit/user.py,sha256=Cw4uGz0ffivWFszv8W__EHwkvTHQ3Lj9hqpRCPxFujo,619
60
62
  chainlit/user_session.py,sha256=nyPx8vSICP8BhpPcW5h9vbHVf9ixj39SrkvJBUI_6zs,1368
61
63
  chainlit/utils.py,sha256=3HzhfZ4XJhBIe9sJ_3Lxv3lMH4mFXsi6nLBGqm8Gtdw,2571
62
64
  chainlit/version.py,sha256=iosXhlXclBwBqlADFKEilxAC2wWKbtuBKi87AmPi7s8,196
63
- chainlit-1.0.502.dist-info/METADATA,sha256=x_a6epCKzziT_oxQYdiVcH4Gcv4jBN4gxIlqjo_KK5k,5560
64
- chainlit-1.0.502.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
65
- chainlit-1.0.502.dist-info/entry_points.txt,sha256=FrkqdjrFl8juSnvBndniyX7XuKojmUwO4ghRh-CFMQc,45
66
- chainlit-1.0.502.dist-info/RECORD,,
65
+ chainlit-1.0.504.dist-info/METADATA,sha256=PPf8-poC_J2J-YHYAhY47gHnWqMpuJ5Ef0IRvtCvico,5560
66
+ chainlit-1.0.504.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
67
+ chainlit-1.0.504.dist-info/entry_points.txt,sha256=FrkqdjrFl8juSnvBndniyX7XuKojmUwO4ghRh-CFMQc,45
68
+ chainlit-1.0.504.dist-info/RECORD,,