chainlit 0.1.102__py3-none-any.whl → 0.1.103__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 +15 -0
- chainlit/frontend/dist/assets/{index-70c66596.js → index-2dad8c58.js} +136 -136
- chainlit/frontend/dist/index.html +1 -1
- chainlit/sdk.py +34 -3
- {chainlit-0.1.102.dist-info → chainlit-0.1.103.dist-info}/METADATA +1 -1
- {chainlit-0.1.102.dist-info → chainlit-0.1.103.dist-info}/RECORD +8 -8
- {chainlit-0.1.102.dist-info → chainlit-0.1.103.dist-info}/WHEEL +0 -0
- {chainlit-0.1.102.dist-info → chainlit-0.1.103.dist-info}/entry_points.txt +0 -0
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<script>
|
|
15
15
|
const global = globalThis;
|
|
16
16
|
</script>
|
|
17
|
-
<script type="module" crossorigin src="/assets/index-
|
|
17
|
+
<script type="module" crossorigin src="/assets/index-2dad8c58.js"></script>
|
|
18
18
|
<link rel="stylesheet" href="/assets/index-bdffdaa0.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
chainlit/sdk.py
CHANGED
|
@@ -46,7 +46,24 @@ class Chainlit:
|
|
|
46
46
|
"""Get the 'client' property from the session."""
|
|
47
47
|
return self._get_session_property("client")
|
|
48
48
|
|
|
49
|
-
def
|
|
49
|
+
def send_remote_element(
|
|
50
|
+
self,
|
|
51
|
+
url: str,
|
|
52
|
+
name: str,
|
|
53
|
+
type: ElementType,
|
|
54
|
+
display: ElementDisplay,
|
|
55
|
+
):
|
|
56
|
+
"""Send an element to the UI."""
|
|
57
|
+
element = {
|
|
58
|
+
"name": name,
|
|
59
|
+
"url": url,
|
|
60
|
+
"type": type,
|
|
61
|
+
"display": display,
|
|
62
|
+
}
|
|
63
|
+
if self.emit and element:
|
|
64
|
+
self.emit("element", element)
|
|
65
|
+
|
|
66
|
+
def send_local_element(
|
|
50
67
|
self,
|
|
51
68
|
ext: str,
|
|
52
69
|
content: bytes,
|
|
@@ -81,7 +98,15 @@ class Chainlit:
|
|
|
81
98
|
_, ext = os.path.splitext(path)
|
|
82
99
|
type = "image"
|
|
83
100
|
image_data = f.read()
|
|
84
|
-
self.
|
|
101
|
+
self.send_local_element(ext, image_data, name, type, display)
|
|
102
|
+
|
|
103
|
+
def send_image(self, url: str, name: str, display: ElementDisplay = "side"):
|
|
104
|
+
"""Send an image to the UI."""
|
|
105
|
+
if not self.emit:
|
|
106
|
+
return
|
|
107
|
+
|
|
108
|
+
type = "image"
|
|
109
|
+
self.send_remote_element(url, name, type, display)
|
|
85
110
|
|
|
86
111
|
def send_text(self, text: str, name: str, display: ElementDisplay = "side"):
|
|
87
112
|
"""Send a text element to the UI."""
|
|
@@ -90,7 +115,7 @@ class Chainlit:
|
|
|
90
115
|
|
|
91
116
|
type = "text"
|
|
92
117
|
ext = ".txt"
|
|
93
|
-
self.
|
|
118
|
+
self.send_local_element(ext, bytes(text, "utf-8"), name, type, display)
|
|
94
119
|
|
|
95
120
|
def send_action(self, name: str, trigger: str, description=""):
|
|
96
121
|
"""Send an action to the UI."""
|
|
@@ -152,6 +177,11 @@ class Chainlit:
|
|
|
152
177
|
if self.emit:
|
|
153
178
|
self.emit("ask_timeout", {})
|
|
154
179
|
|
|
180
|
+
def clear_ask(self):
|
|
181
|
+
"""Clear the prompt from the UI."""
|
|
182
|
+
if self.emit:
|
|
183
|
+
self.emit("clear_ask", {})
|
|
184
|
+
|
|
155
185
|
def send_ask_user(
|
|
156
186
|
self, author: str, content: str, spec: AskSpec, raise_on_timeout=False
|
|
157
187
|
):
|
|
@@ -189,6 +219,7 @@ class Chainlit:
|
|
|
189
219
|
# TODO: upload file to S3
|
|
190
220
|
pass
|
|
191
221
|
|
|
222
|
+
self.clear_ask()
|
|
192
223
|
return res
|
|
193
224
|
except TimeoutError as e:
|
|
194
225
|
self.send_ask_timeout(author)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
chainlit/__init__.py,sha256=
|
|
1
|
+
chainlit/__init__.py,sha256=eGsejuwLFxmjRXWeTps9qKIM_xEBcu6zOqlCYuR7SwI,14345
|
|
2
2
|
chainlit/__main__.py,sha256=7Vg3w3T3qDuz4KDu5lQhLH6lQ3cYdume7gHH7Z1V97U,87
|
|
3
3
|
chainlit/cli/__init__.py,sha256=hOUGpafUkOTbAi4QRNHoebWhLJNk9B7Sr-ERYTXhh5s,3527
|
|
4
4
|
chainlit/cli/auth.py,sha256=G437UK4BvLA4wWPz_KPDwN6_6dnchMtHWr4tqu5XN-M,4093
|
|
@@ -6,12 +6,12 @@ chainlit/cli/deploy.py,sha256=dOqgmnVI4xsorwd0g6GgQAIB92oBgli-02HKqs1GWTQ,2594
|
|
|
6
6
|
chainlit/cli/utils.py,sha256=Pn6ANnw9GgdUduiMphnb8RiGUPRbzDafkCHM2rOPBj4,716
|
|
7
7
|
chainlit/client.py,sha256=QqJo2kpTQFmKGThhz0LSv_7PPF5sb0Cf1A7qzdRxdvM,5150
|
|
8
8
|
chainlit/config.py,sha256=vt6eudSRgaLXxPM_kN4McuGe18nvKu_K7SVIa7eKVp0,6385
|
|
9
|
-
chainlit/frontend/dist/assets/index-
|
|
9
|
+
chainlit/frontend/dist/assets/index-2dad8c58.js,sha256=ivDEL0mDGoP-xcbGEo52_6XE4pBXFy9BvXIa9O1ofLU,2070511
|
|
10
10
|
chainlit/frontend/dist/assets/index-bdffdaa0.css,sha256=vf_aoJGXu6-Km_p1XCjmgjXrcE8IEIRRggIkiIyY-qo,4317
|
|
11
11
|
chainlit/frontend/dist/assets/logo_dark-bc7401f6.svg,sha256=vHQB9g-n5OqOmuH3Fduuc7ZMg0EmMsGyO9cEnYwLbHg,8889
|
|
12
12
|
chainlit/frontend/dist/assets/logo_light-f19fc2ea.svg,sha256=8Z_C6t-0V9QL9ldmLjaLfp2REcGDuaTeNynj6-6muNI,8891
|
|
13
13
|
chainlit/frontend/dist/favicon.svg,sha256=0Cy8x28obT5eWW3nxZRhsEvu6_zMqrqbg0y6hT3D0Q0,6455
|
|
14
|
-
chainlit/frontend/dist/index.html,sha256=
|
|
14
|
+
chainlit/frontend/dist/index.html,sha256=mwKCq_f23WAEWnxTpsvgnnarH2GO22mzML2vhKuTuhI,772
|
|
15
15
|
chainlit/hello.py,sha256=dQ7TmXpSQ6mB8Uu3PqAK7eWi_bCgcdexS9EckTdXgLQ,344
|
|
16
16
|
chainlit/lc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
chainlit/lc/chainlit_handler.py,sha256=4621t82ObvYAyprtoC1s_ywz97M_vWgqAkUrcfKhsLU,8077
|
|
@@ -21,7 +21,7 @@ chainlit/lc/old_monkey.py,sha256=-rT9I_OqRrYtiU8XL3J2dAvamUPNkqdv2skAOzcn5Do,412
|
|
|
21
21
|
chainlit/lc/utils.py,sha256=WYbtzLn0yQORwRGuP0ylQGllRcsRzIVwfxQTMbEf4n4,1117
|
|
22
22
|
chainlit/logger.py,sha256=G6-k0WYt7Ghp0QPOZrKlQNAy41X8L7KJyKiHiumxAYw,398
|
|
23
23
|
chainlit/markdown.py,sha256=CCE5FTqQTKJA0bkMo8nuk8hqkaWSF38VXnjAM69GlTw,1618
|
|
24
|
-
chainlit/sdk.py,sha256=
|
|
24
|
+
chainlit/sdk.py,sha256=kH1FTma_OcZ95T1rAqpuFa5AWKlq1Vr6FSvpumgYZws,9047
|
|
25
25
|
chainlit/server.py,sha256=6dNTrP3Ii2GQ0E1uvgVuGQ7WJJJ-DXoySBOsb2PWCdg,9948
|
|
26
26
|
chainlit/session.py,sha256=Guu2NvUYd7o37tTWCC19rDls0JtoK2xAKdbKt9EOKWs,813
|
|
27
27
|
chainlit/telemetry.py,sha256=G7lLwevIKSyV511JEnse9B_Zy5qYA695R9MdIHEcBkw,2017
|
|
@@ -29,7 +29,7 @@ chainlit/types.py,sha256=aH49wJ-BUh_6rg4BdeesuJurBFeAz0n5mDUmrzPl3NE,1044
|
|
|
29
29
|
chainlit/user_session.py,sha256=ODTLoJowXmRwczQBRwCWpBxRhwC7jZ7z0hEQAXY0ZDQ,1145
|
|
30
30
|
chainlit/version.py,sha256=iosXhlXclBwBqlADFKEilxAC2wWKbtuBKi87AmPi7s8,196
|
|
31
31
|
chainlit/watch.py,sha256=9kllA562yvdTceTO7V9xh1WDSXJzccERrAlCQ-8voQE,1551
|
|
32
|
-
chainlit-0.1.
|
|
33
|
-
chainlit-0.1.
|
|
34
|
-
chainlit-0.1.
|
|
35
|
-
chainlit-0.1.
|
|
32
|
+
chainlit-0.1.103.dist-info/METADATA,sha256=oatVbWoCPBlezAyP-Ec7RMMu8CQM50b2rXns5IzGu2c,3779
|
|
33
|
+
chainlit-0.1.103.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
|
|
34
|
+
chainlit-0.1.103.dist-info/entry_points.txt,sha256=FrkqdjrFl8juSnvBndniyX7XuKojmUwO4ghRh-CFMQc,45
|
|
35
|
+
chainlit-0.1.103.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|