streamlit-nightly 1.41.2.dev20250130__py2.py3-none-any.whl → 1.41.2.dev20250131__py2.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.
- streamlit/elements/lib/utils.py +16 -0
- streamlit/elements/widgets/chat.py +159 -12
- streamlit/proto/ChatInput_pb2.py +6 -4
- streamlit/proto/ChatInput_pb2.pyi +27 -1
- streamlit/proto/Common_pb2.py +3 -1
- streamlit/proto/Common_pb2.pyi +24 -0
- streamlit/proto/WidgetStates_pb2.py +2 -2
- streamlit/proto/WidgetStates_pb2.pyi +7 -3
- streamlit/runtime/scriptrunner_utils/script_requests.py +2 -0
- streamlit/runtime/state/common.py +1 -0
- streamlit/runtime/state/session_state.py +6 -0
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{FileDownload.esm.BW2GD_iE.js → FileDownload.esm.Cf3bITtP.js} +1 -1
- streamlit/static/static/js/FileDropzone.B8wCqKiM.js +5 -0
- streamlit/static/static/js/{FormClearHelper.DZ1scmYc.js → FormClearHelper.BgwPD1tD.js} +1 -1
- streamlit/static/static/js/{Hooks.DPFxqsrt.js → Hooks.BMaXaj11.js} +1 -1
- streamlit/static/static/js/{InputInstructions.kmEglyPj.js → InputInstructions.qlsk9gvt.js} +1 -1
- streamlit/static/static/js/{ProgressBar.DlpiRykl.js → ProgressBar.Di2oT-20.js} +2 -2
- streamlit/static/static/js/{RenderInPortalIfExists.Io9TPjT5.js → RenderInPortalIfExists.Blpdplqk.js} +1 -1
- streamlit/static/static/js/{Toolbar.CsJK79V5.js → Toolbar.DMhyNpv2.js} +1 -1
- streamlit/static/static/js/{base-input.BUELT8YC.js → base-input.DyTEaESI.js} +4 -4
- streamlit/static/static/js/{createSuper.CborHI-x.js → createSuper.B3rIhdpQ.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.BpRK_Fjy.js → data-grid-overlay-editor.C9Q9Gy4e.js} +1 -1
- streamlit/static/static/js/{downloader.BL7woS2R.js → downloader.BAMiKd1n.js} +1 -1
- streamlit/static/static/js/{es6.BLJirovP.js → es6.D82pr6dy.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.CsDiWEwe.js → iframeResizer.contentWindow.CJwxqR7x.js} +1 -1
- streamlit/static/static/js/{index.CZ_IlLc4.js → index.5JFTbX2J.js} +1 -1
- streamlit/static/static/js/{index.BcDqsbhj.js → index.8Q56Jjmk.js} +1 -1
- streamlit/static/static/js/{index.BnfnxD0E.js → index.B3Wxz7wG.js} +1 -1
- streamlit/static/static/js/{index.DqAa92Lj.js → index.B79cf7gS.js} +1 -1
- streamlit/static/static/js/{index.7ACWibTY.js → index.B7J6suR-.js} +59 -59
- streamlit/static/static/js/index.BBPZ3wsr.js +1 -0
- streamlit/static/static/js/{index.D1dEn4mm.js → index.BKahTKEx.js} +2 -2
- streamlit/static/static/js/{index.DkKHo5zC.js → index.BLCqXxIG.js} +1 -1
- streamlit/static/static/js/{index.C_NO_6ev.js → index.BM_J1KkD.js} +1 -1
- streamlit/static/static/js/{index.CozJANOl.js → index.BZvQkTCS.js} +1 -1
- streamlit/static/static/js/{index.DRX-oomt.js → index.BcAjRRAZ.js} +10 -10
- streamlit/static/static/js/{index.DBlRI9-8.js → index.BdEYCAFh.js} +1 -1
- streamlit/static/static/js/{index.DLNHCVdY.js → index.BdlaxG49.js} +1 -1
- streamlit/static/static/js/{index.DRw2m5d2.js → index.C4kPuKr4.js} +1 -1
- streamlit/static/static/js/{index.CsBE1tR7.js → index.CC5oiyoV.js} +2 -2
- streamlit/static/static/js/{index.DtJw0w2z.js → index.CF4stbIZ.js} +1 -1
- streamlit/static/static/js/{index.CUHtehzq.js → index.CSGfgCnQ.js} +1 -1
- streamlit/static/static/js/{index.BShMn81Q.js → index.CYMgsYSm.js} +1 -1
- streamlit/static/static/js/{index.HWM8Jo0D.js → index.CZjnqbcd.js} +1 -1
- streamlit/static/static/js/{index.8xuJfNGL.js → index.C_4BuzGH.js} +1 -1
- streamlit/static/static/js/{index.DUQzVbMl.js → index.CjFbbEE0.js} +1 -1
- streamlit/static/static/js/index.CjiPq39N.js +1 -0
- streamlit/static/static/js/{index.CuHtZ9Dm.js → index.CjuTYYFG.js} +1 -1
- streamlit/static/static/js/{index.Bkuwp1nX.js → index.CoE1gpPQ.js} +1 -1
- streamlit/static/static/js/{index.CJNFcs5M.js → index.CqGcWpm5.js} +2 -2
- streamlit/static/static/js/{index.BL_l30n0.js → index.CuH7mftz.js} +1 -1
- streamlit/static/static/js/{index.CmIDjHns.js → index.D9yF6cxC.js} +1 -1
- streamlit/static/static/js/{index.CQHr3YZb.js → index.DFJg1zHB.js} +1 -1
- streamlit/static/static/js/{index.GPnu42nG.js → index.DiZyaYeV.js} +3 -3
- streamlit/static/static/js/{index.Yz4zfxAi.js → index.Dm3nmdhh.js} +1 -1
- streamlit/static/static/js/{index.51fCwYSO.js → index.NbimJbgq.js} +5 -5
- streamlit/static/static/js/{index.CFagjgA1.js → index.P5kx9um8.js} +67 -67
- streamlit/static/static/js/{index.k2qCiWKR.js → index.TPHsScPF.js} +1 -1
- streamlit/static/static/js/{index.YT8U9SBb.js → index.Y84nTPW2.js} +1 -1
- streamlit/static/static/js/{index.CoZfJLg6.js → index.rrDohWOh.js} +1 -1
- streamlit/static/static/js/{index.BmCbxpl1.js → index.yp4f0OMe.js} +2 -2
- streamlit/static/static/js/{index.ChEJ9NpI.js → index.zlHOKWDA.js} +1 -1
- streamlit/static/static/js/{input.Cc_gque8.js → input.DRyjjTTH.js} +2 -2
- streamlit/static/static/js/{memory.dOywlvNB.js → memory.C98yjNkk.js} +1 -1
- streamlit/static/static/js/{mergeWith.B3UEYpBK.js → mergeWith.CLihEflw.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.vtZ5cHrO.js → number-overlay-editor.DozQhDJj.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.C28aC5bE.js → possibleConstructorReturn.DJ7-JsJc.js} +1 -1
- streamlit/static/static/js/{sandbox.Bu9R-BjJ.js → sandbox.0Tj4C46D.js} +1 -1
- streamlit/static/static/js/{textarea.BuehYUL9.js → textarea.CUrV8-V3.js} +2 -2
- streamlit/static/static/js/{timepicker.BoUQqla6.js → timepicker.DEu3fwJe.js} +4 -4
- streamlit/static/static/js/{toConsumableArray.1TsnLTQZ.js → toConsumableArray.C71OtXzK.js} +1 -1
- streamlit/static/static/js/{uniqueId.DWzkKvg-.js → uniqueId.CndDhnid.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.S-yUfhr7.js → useBasicWidgetState.DXLMTaiS.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.z9TKe1o4.js → useOnInputChange.CvHbHWmy.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.DNSRZFsQ.js → withFullScreenWrapper.BLLyDFUF.js} +1 -1
- {streamlit_nightly-1.41.2.dev20250130.dist-info → streamlit_nightly-1.41.2.dev20250131.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.41.2.dev20250130.dist-info → streamlit_nightly-1.41.2.dev20250131.dist-info}/RECORD +82 -81
- streamlit/static/static/js/index.BB4dPXdd.js +0 -5
- streamlit/static/static/js/index.BrgcQXer.js +0 -1
- {streamlit_nightly-1.41.2.dev20250130.data → streamlit_nightly-1.41.2.dev20250131.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.41.2.dev20250130.dist-info → streamlit_nightly-1.41.2.dev20250131.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.41.2.dev20250130.dist-info → streamlit_nightly-1.41.2.dev20250131.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.41.2.dev20250130.dist-info → streamlit_nightly-1.41.2.dev20250131.dist-info}/top_level.txt +0 -0
streamlit/elements/lib/utils.py
CHANGED
@@ -30,6 +30,7 @@ from typing_extensions import TypeAlias
|
|
30
30
|
|
31
31
|
from streamlit import config
|
32
32
|
from streamlit.errors import StreamlitDuplicateElementId, StreamlitDuplicateElementKey
|
33
|
+
from streamlit.proto.ChatInput_pb2 import ChatInput
|
33
34
|
from streamlit.proto.LabelVisibilityMessage_pb2 import LabelVisibilityMessage
|
34
35
|
from streamlit.runtime.scriptrunner_utils.script_run_context import (
|
35
36
|
ScriptRunContext,
|
@@ -78,6 +79,21 @@ def get_label_visibility_proto_value(
|
|
78
79
|
raise ValueError(f"Unknown label visibility value: {label_visibility_string}")
|
79
80
|
|
80
81
|
|
82
|
+
def get_chat_input_accept_file_proto_value(
|
83
|
+
accept_file_value: bool | Literal["multiple"],
|
84
|
+
) -> ChatInput.AcceptFile.ValueType:
|
85
|
+
"""Returns one of ChatInput.AcceptFile enum value based on string value."""
|
86
|
+
|
87
|
+
if accept_file_value is False:
|
88
|
+
return ChatInput.AcceptFile.NONE
|
89
|
+
elif accept_file_value is True:
|
90
|
+
return ChatInput.AcceptFile.SINGLE
|
91
|
+
elif accept_file_value == "multiple":
|
92
|
+
return ChatInput.AcceptFile.MULTIPLE
|
93
|
+
|
94
|
+
raise ValueError(f"Unknown accept file value: {accept_file_value}")
|
95
|
+
|
96
|
+
|
81
97
|
@overload
|
82
98
|
def to_key(key: None) -> None: ...
|
83
99
|
|
@@ -16,23 +16,35 @@ from __future__ import annotations
|
|
16
16
|
|
17
17
|
from dataclasses import dataclass
|
18
18
|
from enum import Enum
|
19
|
-
from typing import
|
19
|
+
from typing import (
|
20
|
+
TYPE_CHECKING,
|
21
|
+
Any,
|
22
|
+
Iterator,
|
23
|
+
Literal,
|
24
|
+
MutableMapping,
|
25
|
+
Sequence,
|
26
|
+
cast,
|
27
|
+
overload,
|
28
|
+
)
|
20
29
|
|
21
30
|
from streamlit import runtime
|
22
31
|
from streamlit.delta_generator_singletons import get_dg_singleton_instance
|
32
|
+
from streamlit.elements.lib.file_uploader_utils import normalize_upload_file_type
|
23
33
|
from streamlit.elements.lib.form_utils import is_in_form
|
24
34
|
from streamlit.elements.lib.image_utils import AtomicImage, WidthBehavior, image_to_url
|
25
35
|
from streamlit.elements.lib.policies import check_widget_policies
|
26
36
|
from streamlit.elements.lib.utils import (
|
27
37
|
Key,
|
28
38
|
compute_and_register_element_id,
|
39
|
+
get_chat_input_accept_file_proto_value,
|
29
40
|
save_for_app_testing,
|
30
41
|
to_key,
|
31
42
|
)
|
32
43
|
from streamlit.errors import StreamlitAPIException
|
33
44
|
from streamlit.proto.Block_pb2 import Block as BlockProto
|
34
45
|
from streamlit.proto.ChatInput_pb2 import ChatInput as ChatInputProto
|
35
|
-
from streamlit.proto.Common_pb2 import
|
46
|
+
from streamlit.proto.Common_pb2 import ChatInputValue as ChatInputValueProto
|
47
|
+
from streamlit.proto.Common_pb2 import FileUploaderState as FileUploaderStateProto
|
36
48
|
from streamlit.proto.RootContainer_pb2 import RootContainer
|
37
49
|
from streamlit.runtime.metrics_util import gather_metrics
|
38
50
|
from streamlit.runtime.scriptrunner_utils.script_run_context import get_script_run_ctx
|
@@ -42,12 +54,43 @@ from streamlit.runtime.state import (
|
|
42
54
|
WidgetKwargs,
|
43
55
|
register_widget,
|
44
56
|
)
|
57
|
+
from streamlit.runtime.uploaded_file_manager import UploadedFile
|
45
58
|
from streamlit.string_util import is_emoji, validate_material_icon
|
46
59
|
|
47
60
|
if TYPE_CHECKING:
|
48
61
|
from streamlit.delta_generator import DeltaGenerator
|
49
62
|
|
50
63
|
|
64
|
+
@dataclass
|
65
|
+
class ChatInputValue(MutableMapping[str, Any]):
|
66
|
+
text: str
|
67
|
+
files: list[UploadedFile]
|
68
|
+
|
69
|
+
def __len__(self) -> int:
|
70
|
+
return len(vars(self))
|
71
|
+
|
72
|
+
def __iter__(self) -> Iterator[str]:
|
73
|
+
return iter(vars(self))
|
74
|
+
|
75
|
+
def __getitem__(self, item: str) -> str | list[UploadedFile]:
|
76
|
+
try:
|
77
|
+
return getattr(self, item) # type: ignore[no-any-return]
|
78
|
+
except AttributeError:
|
79
|
+
raise KeyError(f"Invalid key: {item}") from None
|
80
|
+
|
81
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
82
|
+
setattr(self, key, value)
|
83
|
+
|
84
|
+
def __delitem__(self, key: str) -> None:
|
85
|
+
try:
|
86
|
+
delattr(self, key)
|
87
|
+
except AttributeError:
|
88
|
+
raise KeyError(f"Invalid key: {key}") from None
|
89
|
+
|
90
|
+
def to_dict(self) -> dict[str, str | list[UploadedFile]]:
|
91
|
+
return vars(self)
|
92
|
+
|
93
|
+
|
51
94
|
class PresetNames(str, Enum):
|
52
95
|
USER = "user"
|
53
96
|
ASSISTANT = "assistant"
|
@@ -108,18 +151,65 @@ def _process_avatar_input(
|
|
108
151
|
) from ex
|
109
152
|
|
110
153
|
|
154
|
+
def _pop_upload_files(
|
155
|
+
files_value: FileUploaderStateProto | None,
|
156
|
+
) -> list[UploadedFile]:
|
157
|
+
if files_value is None:
|
158
|
+
return []
|
159
|
+
|
160
|
+
ctx = get_script_run_ctx()
|
161
|
+
if ctx is None:
|
162
|
+
return []
|
163
|
+
|
164
|
+
uploaded_file_info = files_value.uploaded_file_info
|
165
|
+
if len(uploaded_file_info) == 0:
|
166
|
+
return []
|
167
|
+
|
168
|
+
file_recs_list = ctx.uploaded_file_mgr.get_files(
|
169
|
+
session_id=ctx.session_id,
|
170
|
+
file_ids=[f.file_id for f in uploaded_file_info],
|
171
|
+
)
|
172
|
+
|
173
|
+
file_recs = {f.file_id: f for f in file_recs_list}
|
174
|
+
|
175
|
+
collected_files: list[UploadedFile] = []
|
176
|
+
|
177
|
+
for f in uploaded_file_info:
|
178
|
+
maybe_file_rec = file_recs.get(f.file_id)
|
179
|
+
if maybe_file_rec is not None:
|
180
|
+
uploaded_file = UploadedFile(maybe_file_rec, f.file_urls)
|
181
|
+
collected_files.append(uploaded_file)
|
182
|
+
|
183
|
+
if hasattr(ctx.uploaded_file_mgr, "remove_file"):
|
184
|
+
ctx.uploaded_file_mgr.remove_file(
|
185
|
+
session_id=ctx.session_id,
|
186
|
+
file_id=f.file_id,
|
187
|
+
)
|
188
|
+
|
189
|
+
return collected_files
|
190
|
+
|
191
|
+
|
111
192
|
@dataclass
|
112
193
|
class ChatInputSerde:
|
194
|
+
accept_files: bool = False
|
195
|
+
|
113
196
|
def deserialize(
|
114
|
-
self,
|
115
|
-
|
197
|
+
self,
|
198
|
+
ui_value: ChatInputValueProto | None,
|
199
|
+
widget_id: str = "",
|
200
|
+
) -> str | ChatInputValue | None:
|
116
201
|
if ui_value is None or not ui_value.HasField("data"):
|
117
202
|
return None
|
203
|
+
if not self.accept_files:
|
204
|
+
return ui_value.data
|
205
|
+
else:
|
206
|
+
return ChatInputValue(
|
207
|
+
text=ui_value.data,
|
208
|
+
files=_pop_upload_files(ui_value.file_uploader_state),
|
209
|
+
)
|
118
210
|
|
119
|
-
|
120
|
-
|
121
|
-
def serialize(self, v: str | None) -> StringTriggerValueProto:
|
122
|
-
return StringTriggerValueProto(data=v)
|
211
|
+
def serialize(self, v: str | None) -> ChatInputValueProto:
|
212
|
+
return ChatInputValueProto(data=v)
|
123
213
|
|
124
214
|
|
125
215
|
class ChatMixin:
|
@@ -237,6 +327,36 @@ class ChatMixin:
|
|
237
327
|
|
238
328
|
return self.dg._block(block_proto=block_proto)
|
239
329
|
|
330
|
+
@overload
|
331
|
+
def chat_input(
|
332
|
+
self,
|
333
|
+
placeholder: str = "Your message",
|
334
|
+
*,
|
335
|
+
key: Key | None = None,
|
336
|
+
max_chars: int | None = None,
|
337
|
+
accept_file: Literal[False] = False,
|
338
|
+
file_type: str | Sequence[str] | None = None,
|
339
|
+
disabled: bool = False,
|
340
|
+
on_submit: WidgetCallback | None = None,
|
341
|
+
args: WidgetArgs | None = None,
|
342
|
+
kwargs: WidgetKwargs | None = None,
|
343
|
+
) -> str | None: ...
|
344
|
+
|
345
|
+
@overload
|
346
|
+
def chat_input(
|
347
|
+
self,
|
348
|
+
placeholder: str = "Your message",
|
349
|
+
*,
|
350
|
+
key: Key | None = None,
|
351
|
+
max_chars: int | None = None,
|
352
|
+
accept_file: Literal[True, "multiple"],
|
353
|
+
file_type: str | Sequence[str] | None = None,
|
354
|
+
disabled: bool = False,
|
355
|
+
on_submit: WidgetCallback | None = None,
|
356
|
+
args: WidgetArgs | None = None,
|
357
|
+
kwargs: WidgetKwargs | None = None,
|
358
|
+
) -> ChatInputValue | None: ...
|
359
|
+
|
240
360
|
@gather_metrics("chat_input")
|
241
361
|
def chat_input(
|
242
362
|
self,
|
@@ -244,11 +364,13 @@ class ChatMixin:
|
|
244
364
|
*,
|
245
365
|
key: Key | None = None,
|
246
366
|
max_chars: int | None = None,
|
367
|
+
accept_file: bool | Literal["multiple"] = False,
|
368
|
+
file_type: str | Sequence[str] | None = None,
|
247
369
|
disabled: bool = False,
|
248
370
|
on_submit: WidgetCallback | None = None,
|
249
371
|
args: WidgetArgs | None = None,
|
250
372
|
kwargs: WidgetKwargs | None = None,
|
251
|
-
) -> str | None:
|
373
|
+
) -> str | ChatInputValue | None:
|
252
374
|
"""Display a chat input widget.
|
253
375
|
|
254
376
|
Parameters
|
@@ -267,9 +389,17 @@ class ChatMixin:
|
|
267
389
|
The maximum number of characters that can be entered. If ``None``
|
268
390
|
(default), there will be no maximum.
|
269
391
|
|
392
|
+
accept_file : bool | str
|
393
|
+
Whether the chat input should accept files. ``True`` to accept a single
|
394
|
+
file, ``"multiple"`` to accept multiple files.
|
395
|
+
|
270
396
|
disabled : bool
|
271
397
|
Whether the chat input should be disabled. Defaults to ``False``.
|
272
398
|
|
399
|
+
file_type : str or list[str] or None
|
400
|
+
Array of allowed extensions. ['png', 'jpg']
|
401
|
+
The default is None, which means all extensions are allowed.
|
402
|
+
|
273
403
|
on_submit : callable
|
274
404
|
An optional callback invoked when the chat input's value is submitted.
|
275
405
|
|
@@ -329,7 +459,13 @@ class ChatMixin:
|
|
329
459
|
writes_allowed=False,
|
330
460
|
)
|
331
461
|
|
462
|
+
if accept_file not in {True, False, "multiple"}:
|
463
|
+
raise StreamlitAPIException(
|
464
|
+
"The `accept_file` parameter must be a boolean or 'multiple'."
|
465
|
+
)
|
466
|
+
|
332
467
|
ctx = get_script_run_ctx()
|
468
|
+
|
333
469
|
element_id = compute_and_register_element_id(
|
334
470
|
"chat_input",
|
335
471
|
user_key=key,
|
@@ -337,8 +473,13 @@ class ChatMixin:
|
|
337
473
|
form_id=None,
|
338
474
|
placeholder=placeholder,
|
339
475
|
max_chars=max_chars,
|
476
|
+
accept_file=accept_file,
|
477
|
+
file_type=file_type,
|
340
478
|
)
|
341
479
|
|
480
|
+
if file_type:
|
481
|
+
file_type = normalize_upload_file_type(file_type)
|
482
|
+
|
342
483
|
# It doesn't make sense to create a chat input inside a form.
|
343
484
|
# We throw an error to warn the user about this.
|
344
485
|
# We omit this check for scripts running outside streamlit, because
|
@@ -371,8 +512,14 @@ class ChatMixin:
|
|
371
512
|
|
372
513
|
chat_input_proto.default = default
|
373
514
|
|
374
|
-
|
375
|
-
|
515
|
+
chat_input_proto.accept_file = get_chat_input_accept_file_proto_value(
|
516
|
+
accept_file
|
517
|
+
)
|
518
|
+
|
519
|
+
chat_input_proto.file_type[:] = file_type if file_type is not None else []
|
520
|
+
|
521
|
+
serde = ChatInputSerde(accept_files=bool(accept_file))
|
522
|
+
widget_state = register_widget( # type: ignore[misc]
|
376
523
|
chat_input_proto.id,
|
377
524
|
on_change_handler=on_submit,
|
378
525
|
args=args,
|
@@ -380,7 +527,7 @@ class ChatMixin:
|
|
380
527
|
deserializer=serde.deserialize,
|
381
528
|
serializer=serde.serialize,
|
382
529
|
ctx=ctx,
|
383
|
-
value_type="
|
530
|
+
value_type="chat_input_value",
|
384
531
|
)
|
385
532
|
|
386
533
|
chat_input_proto.disabled = disabled
|
streamlit/proto/ChatInput_pb2.py
CHANGED
@@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default()
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1fstreamlit/proto/ChatInput.proto\"\
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1fstreamlit/proto/ChatInput.proto\"\xb4\x02\n\tChatInput\x12\n\n\x02id\x18\x01 \x01(\t\x12\x13\n\x0bplaceholder\x18\x02 \x01(\t\x12\x11\n\tmax_chars\x18\x03 \x01(\r\x12\x10\n\x08\x64isabled\x18\x04 \x01(\x08\x12\r\n\x05value\x18\x05 \x01(\t\x12\x11\n\tset_value\x18\x06 \x01(\x08\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x07 \x01(\t\x12%\n\x08position\x18\x08 \x01(\x0e\x32\x13.ChatInput.Position\x12*\n\x0b\x61\x63\x63\x65pt_file\x18\t \x01(\x0e\x32\x15.ChatInput.AcceptFile\x12\x11\n\tfile_type\x18\n \x03(\t\"\x16\n\x08Position\x12\n\n\x06\x42OTTOM\x10\x00\"0\n\nAcceptFile\x12\x08\n\x04NONE\x10\x00\x12\n\n\x06SINGLE\x10\x01\x12\x0c\n\x08MULTIPLE\x10\x02\x42.\n\x1c\x63om.snowflake.apps.streamlitB\x0e\x43hatInputProtob\x06proto3')
|
18
18
|
|
19
19
|
_globals = globals()
|
20
20
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
@@ -23,7 +23,9 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
23
23
|
_globals['DESCRIPTOR']._loaded_options = None
|
24
24
|
_globals['DESCRIPTOR']._serialized_options = b'\n\034com.snowflake.apps.streamlitB\016ChatInputProto'
|
25
25
|
_globals['_CHATINPUT']._serialized_start=36
|
26
|
-
_globals['_CHATINPUT']._serialized_end=
|
27
|
-
_globals['_CHATINPUT_POSITION']._serialized_start=
|
28
|
-
_globals['_CHATINPUT_POSITION']._serialized_end=
|
26
|
+
_globals['_CHATINPUT']._serialized_end=344
|
27
|
+
_globals['_CHATINPUT_POSITION']._serialized_start=272
|
28
|
+
_globals['_CHATINPUT_POSITION']._serialized_end=294
|
29
|
+
_globals['_CHATINPUT_ACCEPTFILE']._serialized_start=296
|
30
|
+
_globals['_CHATINPUT_ACCEPTFILE']._serialized_end=344
|
29
31
|
# @@protoc_insertion_point(module_scope)
|
@@ -18,7 +18,9 @@ limitations under the License.
|
|
18
18
|
"""
|
19
19
|
|
20
20
|
import builtins
|
21
|
+
import collections.abc
|
21
22
|
import google.protobuf.descriptor
|
23
|
+
import google.protobuf.internal.containers
|
22
24
|
import google.protobuf.internal.enum_type_wrapper
|
23
25
|
import google.protobuf.message
|
24
26
|
import sys
|
@@ -48,6 +50,21 @@ class ChatInput(google.protobuf.message.Message):
|
|
48
50
|
|
49
51
|
BOTTOM: ChatInput.Position.ValueType # 0
|
50
52
|
|
53
|
+
class _AcceptFile:
|
54
|
+
ValueType = typing.NewType("ValueType", builtins.int)
|
55
|
+
V: typing_extensions.TypeAlias = ValueType
|
56
|
+
|
57
|
+
class _AcceptFileEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[ChatInput._AcceptFile.ValueType], builtins.type):
|
58
|
+
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
|
59
|
+
NONE: ChatInput._AcceptFile.ValueType # 0
|
60
|
+
SINGLE: ChatInput._AcceptFile.ValueType # 1
|
61
|
+
MULTIPLE: ChatInput._AcceptFile.ValueType # 2
|
62
|
+
|
63
|
+
class AcceptFile(_AcceptFile, metaclass=_AcceptFileEnumTypeWrapper): ...
|
64
|
+
NONE: ChatInput.AcceptFile.ValueType # 0
|
65
|
+
SINGLE: ChatInput.AcceptFile.ValueType # 1
|
66
|
+
MULTIPLE: ChatInput.AcceptFile.ValueType # 2
|
67
|
+
|
51
68
|
ID_FIELD_NUMBER: builtins.int
|
52
69
|
PLACEHOLDER_FIELD_NUMBER: builtins.int
|
53
70
|
MAX_CHARS_FIELD_NUMBER: builtins.int
|
@@ -56,6 +73,8 @@ class ChatInput(google.protobuf.message.Message):
|
|
56
73
|
SET_VALUE_FIELD_NUMBER: builtins.int
|
57
74
|
DEFAULT_FIELD_NUMBER: builtins.int
|
58
75
|
POSITION_FIELD_NUMBER: builtins.int
|
76
|
+
ACCEPT_FILE_FIELD_NUMBER: builtins.int
|
77
|
+
FILE_TYPE_FIELD_NUMBER: builtins.int
|
59
78
|
id: builtins.str
|
60
79
|
placeholder: builtins.str
|
61
80
|
max_chars: builtins.int
|
@@ -64,6 +83,11 @@ class ChatInput(google.protobuf.message.Message):
|
|
64
83
|
set_value: builtins.bool
|
65
84
|
default: builtins.str
|
66
85
|
position: global___ChatInput.Position.ValueType
|
86
|
+
accept_file: global___ChatInput.AcceptFile.ValueType
|
87
|
+
@property
|
88
|
+
def file_type(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
|
89
|
+
"""Supported file types: For example: ["png","jpg","img"]"""
|
90
|
+
|
67
91
|
def __init__(
|
68
92
|
self,
|
69
93
|
*,
|
@@ -75,7 +99,9 @@ class ChatInput(google.protobuf.message.Message):
|
|
75
99
|
set_value: builtins.bool = ...,
|
76
100
|
default: builtins.str = ...,
|
77
101
|
position: global___ChatInput.Position.ValueType = ...,
|
102
|
+
accept_file: global___ChatInput.AcceptFile.ValueType = ...,
|
103
|
+
file_type: collections.abc.Iterable[builtins.str] | None = ...,
|
78
104
|
) -> None: ...
|
79
|
-
def ClearField(self, field_name: typing.Literal["default", b"default", "disabled", b"disabled", "id", b"id", "max_chars", b"max_chars", "placeholder", b"placeholder", "position", b"position", "set_value", b"set_value", "value", b"value"]) -> None: ...
|
105
|
+
def ClearField(self, field_name: typing.Literal["accept_file", b"accept_file", "default", b"default", "disabled", b"disabled", "file_type", b"file_type", "id", b"id", "max_chars", b"max_chars", "placeholder", b"placeholder", "position", b"position", "set_value", b"set_value", "value", b"value"]) -> None: ...
|
80
106
|
|
81
107
|
global___ChatInput = ChatInput
|
streamlit/proto/Common_pb2.py
CHANGED
@@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default()
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cstreamlit/proto/Common.proto\"\x1b\n\x0bStringArray\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\t\"\x1b\n\x0b\x44oubleArray\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x01\"\x1a\n\nInt32Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x05\"\x1a\n\nInt64Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x03\"\x1b\n\x0bSInt64Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x12\"\x1b\n\x0bUInt32Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\r\"0\n\x12StringTriggerValue\x12\x11\n\x04\x64\x61ta\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x07\n\x05_data\"M\n\x0f\x46ileURLsRequest\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12\x12\n\nfile_names\x18\x02 \x03(\t\x12\x12\n\nsession_id\x18\x03 \x01(\t\"C\n\x08\x46ileURLs\x12\x0f\n\x07\x66ile_id\x18\x01 \x01(\t\x12\x12\n\nupload_url\x18\x02 \x01(\t\x12\x12\n\ndelete_url\x18\x03 \x01(\t\"X\n\x10\x46ileURLsResponse\x12\x13\n\x0bresponse_id\x18\x01 \x01(\t\x12\x1c\n\tfile_urls\x18\x02 \x03(\x0b\x32\t.FileURLs\x12\x11\n\terror_msg\x18\x03 \x01(\t\"i\n\x10UploadedFileInfo\x12\n\n\x02id\x18\x01 \x01(\x12\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0c\n\x04size\x18\x03 \x01(\x04\x12\x0f\n\x07\x66ile_id\x18\x04 \x01(\t\x12\x1c\n\tfile_urls\x18\x05 \x01(\x0b\x32\t.FileURLs\"W\n\x11\x46ileUploaderState\x12\x13\n\x0bmax_file_id\x18\x01 \x01(\x12\x12-\n\x12uploaded_file_info\x18\x02 \x03(\x0b\x32\x11.
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cstreamlit/proto/Common.proto\"\x1b\n\x0bStringArray\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\t\"\x1b\n\x0b\x44oubleArray\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x01\"\x1a\n\nInt32Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x05\"\x1a\n\nInt64Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x03\"\x1b\n\x0bSInt64Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x12\"\x1b\n\x0bUInt32Array\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\r\"0\n\x12StringTriggerValue\x12\x11\n\x04\x64\x61ta\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x07\n\x05_data\"M\n\x0f\x46ileURLsRequest\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12\x12\n\nfile_names\x18\x02 \x03(\t\x12\x12\n\nsession_id\x18\x03 \x01(\t\"C\n\x08\x46ileURLs\x12\x0f\n\x07\x66ile_id\x18\x01 \x01(\t\x12\x12\n\nupload_url\x18\x02 \x01(\t\x12\x12\n\ndelete_url\x18\x03 \x01(\t\"X\n\x10\x46ileURLsResponse\x12\x13\n\x0bresponse_id\x18\x01 \x01(\t\x12\x1c\n\tfile_urls\x18\x02 \x03(\x0b\x32\t.FileURLs\x12\x11\n\terror_msg\x18\x03 \x01(\t\"i\n\x10UploadedFileInfo\x12\n\n\x02id\x18\x01 \x01(\x12\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0c\n\x04size\x18\x03 \x01(\x04\x12\x0f\n\x07\x66ile_id\x18\x04 \x01(\t\x12\x1c\n\tfile_urls\x18\x05 \x01(\x0b\x32\t.FileURLs\"W\n\x11\x46ileUploaderState\x12\x13\n\x0bmax_file_id\x18\x01 \x01(\x12\x12-\n\x12uploaded_file_info\x18\x02 \x03(\x0b\x32\x11.UploadedFileInfo\"z\n\x0e\x43hatInputValue\x12\x11\n\x04\x64\x61ta\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x34\n\x13\x66ile_uploader_state\x18\x02 \x01(\x0b\x32\x12.FileUploaderStateH\x01\x88\x01\x01\x42\x07\n\x05_dataB\x16\n\x14_file_uploader_stateB+\n\x1c\x63om.snowflake.apps.streamlitB\x0b\x43ommonProtob\x06proto3')
|
18
18
|
|
19
19
|
_globals = globals()
|
20
20
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
@@ -46,4 +46,6 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
46
46
|
_globals['_UPLOADEDFILEINFO']._serialized_end=597
|
47
47
|
_globals['_FILEUPLOADERSTATE']._serialized_start=599
|
48
48
|
_globals['_FILEUPLOADERSTATE']._serialized_end=686
|
49
|
+
_globals['_CHATINPUTVALUE']._serialized_start=688
|
50
|
+
_globals['_CHATINPUTVALUE']._serialized_end=810
|
49
51
|
# @@protoc_insertion_point(module_scope)
|
streamlit/proto/Common_pb2.pyi
CHANGED
@@ -267,3 +267,27 @@ class FileUploaderState(google.protobuf.message.Message):
|
|
267
267
|
def ClearField(self, field_name: typing.Literal["max_file_id", b"max_file_id", "uploaded_file_info", b"uploaded_file_info"]) -> None: ...
|
268
268
|
|
269
269
|
global___FileUploaderState = FileUploaderState
|
270
|
+
|
271
|
+
@typing.final
|
272
|
+
class ChatInputValue(google.protobuf.message.Message):
|
273
|
+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
274
|
+
|
275
|
+
DATA_FIELD_NUMBER: builtins.int
|
276
|
+
FILE_UPLOADER_STATE_FIELD_NUMBER: builtins.int
|
277
|
+
data: builtins.str
|
278
|
+
@property
|
279
|
+
def file_uploader_state(self) -> global___FileUploaderState: ...
|
280
|
+
def __init__(
|
281
|
+
self,
|
282
|
+
*,
|
283
|
+
data: builtins.str | None = ...,
|
284
|
+
file_uploader_state: global___FileUploaderState | None = ...,
|
285
|
+
) -> None: ...
|
286
|
+
def HasField(self, field_name: typing.Literal["_data", b"_data", "_file_uploader_state", b"_file_uploader_state", "data", b"data", "file_uploader_state", b"file_uploader_state"]) -> builtins.bool: ...
|
287
|
+
def ClearField(self, field_name: typing.Literal["_data", b"_data", "_file_uploader_state", b"_file_uploader_state", "data", b"data", "file_uploader_state", b"file_uploader_state"]) -> None: ...
|
288
|
+
@typing.overload
|
289
|
+
def WhichOneof(self, oneof_group: typing.Literal["_data", b"_data"]) -> typing.Literal["data"] | None: ...
|
290
|
+
@typing.overload
|
291
|
+
def WhichOneof(self, oneof_group: typing.Literal["_file_uploader_state", b"_file_uploader_state"]) -> typing.Literal["file_uploader_state"] | None: ...
|
292
|
+
|
293
|
+
global___ChatInputValue = ChatInputValue
|
@@ -16,7 +16,7 @@ from streamlit.proto import Common_pb2 as streamlit_dot_proto_dot_Common__pb2
|
|
16
16
|
from streamlit.proto import Components_pb2 as streamlit_dot_proto_dot_Components__pb2
|
17
17
|
|
18
18
|
|
19
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\"streamlit/proto/WidgetStates.proto\x1a\x1cstreamlit/proto/Common.proto\x1a streamlit/proto/Components.proto\"-\n\x0cWidgetStates\x12\x1d\n\x07widgets\x18\x01 \x03(\x0b\x32\x0c.WidgetState\"\
|
19
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\"streamlit/proto/WidgetStates.proto\x1a\x1cstreamlit/proto/Common.proto\x1a streamlit/proto/Components.proto\"-\n\x0cWidgetStates\x12\x1d\n\x07widgets\x18\x01 \x03(\x0b\x32\x0c.WidgetState\"\x83\x04\n\x0bWidgetState\x12\n\n\x02id\x18\x01 \x01(\t\x12\x17\n\rtrigger_value\x18\x02 \x01(\x08H\x00\x12\x14\n\nbool_value\x18\x03 \x01(\x08H\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12\x13\n\tint_value\x18\x05 \x01(\x12H\x00\x12\x16\n\x0cstring_value\x18\x06 \x01(\tH\x00\x12*\n\x12\x64ouble_array_value\x18\x07 \x01(\x0b\x32\x0c.DoubleArrayH\x00\x12\'\n\x0fint_array_value\x18\x08 \x01(\x0b\x32\x0c.SInt64ArrayH\x00\x12*\n\x12string_array_value\x18\t \x01(\x0b\x32\x0c.StringArrayH\x00\x12\x14\n\njson_value\x18\n \x01(\tH\x00\x12\"\n\x0b\x61rrow_value\x18\x0b \x01(\x0b\x32\x0b.ArrowTableH\x00\x12\x15\n\x0b\x62ytes_value\x18\x0c \x01(\x0cH\x00\x12\x37\n\x19\x66ile_uploader_state_value\x18\r \x01(\x0b\x32\x12.FileUploaderStateH\x00\x12\x33\n\x14string_trigger_value\x18\x0e \x01(\x0b\x32\x13.StringTriggerValueH\x00\x12+\n\x10\x63hat_input_value\x18\x0f \x01(\x0b\x32\x0f.ChatInputValueH\x00\x42\x07\n\x05valueB1\n\x1c\x63om.snowflake.apps.streamlitB\x11WidgetStatesProtob\x06proto3')
|
20
20
|
|
21
21
|
_globals = globals()
|
22
22
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
@@ -27,5 +27,5 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
27
27
|
_globals['_WIDGETSTATES']._serialized_start=102
|
28
28
|
_globals['_WIDGETSTATES']._serialized_end=147
|
29
29
|
_globals['_WIDGETSTATE']._serialized_start=150
|
30
|
-
_globals['_WIDGETSTATE']._serialized_end=
|
30
|
+
_globals['_WIDGETSTATE']._serialized_end=665
|
31
31
|
# @@protoc_insertion_point(module_scope)
|
@@ -66,6 +66,7 @@ class WidgetState(google.protobuf.message.Message):
|
|
66
66
|
BYTES_VALUE_FIELD_NUMBER: builtins.int
|
67
67
|
FILE_UPLOADER_STATE_VALUE_FIELD_NUMBER: builtins.int
|
68
68
|
STRING_TRIGGER_VALUE_FIELD_NUMBER: builtins.int
|
69
|
+
CHAT_INPUT_VALUE_FIELD_NUMBER: builtins.int
|
69
70
|
id: builtins.str
|
70
71
|
trigger_value: builtins.bool
|
71
72
|
"""trigger_value is for buttons. A button's value needs to
|
@@ -97,6 +98,8 @@ class WidgetState(google.protobuf.message.Message):
|
|
97
98
|
This is used for the chat_input widget.
|
98
99
|
"""
|
99
100
|
|
101
|
+
@property
|
102
|
+
def chat_input_value(self) -> streamlit.proto.Common_pb2.ChatInputValue: ...
|
100
103
|
def __init__(
|
101
104
|
self,
|
102
105
|
*,
|
@@ -114,9 +117,10 @@ class WidgetState(google.protobuf.message.Message):
|
|
114
117
|
bytes_value: builtins.bytes = ...,
|
115
118
|
file_uploader_state_value: streamlit.proto.Common_pb2.FileUploaderState | None = ...,
|
116
119
|
string_trigger_value: streamlit.proto.Common_pb2.StringTriggerValue | None = ...,
|
120
|
+
chat_input_value: streamlit.proto.Common_pb2.ChatInputValue | None = ...,
|
117
121
|
) -> None: ...
|
118
|
-
def HasField(self, field_name: typing.Literal["arrow_value", b"arrow_value", "bool_value", b"bool_value", "bytes_value", b"bytes_value", "double_array_value", b"double_array_value", "double_value", b"double_value", "file_uploader_state_value", b"file_uploader_state_value", "int_array_value", b"int_array_value", "int_value", b"int_value", "json_value", b"json_value", "string_array_value", b"string_array_value", "string_trigger_value", b"string_trigger_value", "string_value", b"string_value", "trigger_value", b"trigger_value", "value", b"value"]) -> builtins.bool: ...
|
119
|
-
def ClearField(self, field_name: typing.Literal["arrow_value", b"arrow_value", "bool_value", b"bool_value", "bytes_value", b"bytes_value", "double_array_value", b"double_array_value", "double_value", b"double_value", "file_uploader_state_value", b"file_uploader_state_value", "id", b"id", "int_array_value", b"int_array_value", "int_value", b"int_value", "json_value", b"json_value", "string_array_value", b"string_array_value", "string_trigger_value", b"string_trigger_value", "string_value", b"string_value", "trigger_value", b"trigger_value", "value", b"value"]) -> None: ...
|
120
|
-
def WhichOneof(self, oneof_group: typing.Literal["value", b"value"]) -> typing.Literal["trigger_value", "bool_value", "double_value", "int_value", "string_value", "double_array_value", "int_array_value", "string_array_value", "json_value", "arrow_value", "bytes_value", "file_uploader_state_value", "string_trigger_value"] | None: ...
|
122
|
+
def HasField(self, field_name: typing.Literal["arrow_value", b"arrow_value", "bool_value", b"bool_value", "bytes_value", b"bytes_value", "chat_input_value", b"chat_input_value", "double_array_value", b"double_array_value", "double_value", b"double_value", "file_uploader_state_value", b"file_uploader_state_value", "int_array_value", b"int_array_value", "int_value", b"int_value", "json_value", b"json_value", "string_array_value", b"string_array_value", "string_trigger_value", b"string_trigger_value", "string_value", b"string_value", "trigger_value", b"trigger_value", "value", b"value"]) -> builtins.bool: ...
|
123
|
+
def ClearField(self, field_name: typing.Literal["arrow_value", b"arrow_value", "bool_value", b"bool_value", "bytes_value", b"bytes_value", "chat_input_value", b"chat_input_value", "double_array_value", b"double_array_value", "double_value", b"double_value", "file_uploader_state_value", b"file_uploader_state_value", "id", b"id", "int_array_value", b"int_array_value", "int_value", b"int_value", "json_value", b"json_value", "string_array_value", b"string_array_value", "string_trigger_value", b"string_trigger_value", "string_value", b"string_value", "trigger_value", b"trigger_value", "value", b"value"]) -> None: ...
|
124
|
+
def WhichOneof(self, oneof_group: typing.Literal["value", b"value"]) -> typing.Literal["trigger_value", "bool_value", "double_value", "int_value", "string_value", "double_array_value", "int_array_value", "string_array_value", "json_value", "arrow_value", "bytes_value", "file_uploader_state_value", "string_trigger_value", "chat_input_value"] | None: ...
|
121
125
|
|
122
126
|
global___WidgetState = WidgetState
|
@@ -20,6 +20,7 @@ from enum import Enum
|
|
20
20
|
from typing import cast
|
21
21
|
|
22
22
|
from streamlit import util
|
23
|
+
from streamlit.proto.Common_pb2 import ChatInputValue as ChatInputValueProto
|
23
24
|
from streamlit.proto.Common_pb2 import StringTriggerValue as StringTriggerValueProto
|
24
25
|
from streamlit.proto.WidgetStates_pb2 import WidgetState, WidgetStates
|
25
26
|
|
@@ -116,6 +117,7 @@ def _coalesce_widget_states(
|
|
116
117
|
trigger_value_types = [
|
117
118
|
("trigger_value", False),
|
118
119
|
("string_trigger_value", StringTriggerValueProto(data=None)),
|
120
|
+
("chat_input_value", ChatInputValueProto(data=None)),
|
119
121
|
]
|
120
122
|
for old_state in old_states.widgets:
|
121
123
|
for trigger_value_type, unset_value in trigger_value_types:
|
@@ -237,6 +237,8 @@ class WStates(MutableMapping[str, Any]):
|
|
237
237
|
widget.file_uploader_state_value.CopyFrom(serialized)
|
238
238
|
elif field == "string_trigger_value":
|
239
239
|
widget.string_trigger_value.CopyFrom(serialized)
|
240
|
+
elif field == "chat_input_value":
|
241
|
+
widget.chat_input_value.CopyFrom(serialized)
|
240
242
|
elif field is not None and serialized is not None:
|
241
243
|
# If the field is None, the widget value was cleared
|
242
244
|
# by the user and therefore is None. But we cannot
|
@@ -605,6 +607,8 @@ class SessionState:
|
|
605
607
|
self._new_widget_state[state_id] = Value(False)
|
606
608
|
elif metadata.value_type == "string_trigger_value":
|
607
609
|
self._new_widget_state[state_id] = Value(None)
|
610
|
+
elif metadata.value_type == "chat_input_value":
|
611
|
+
self._new_widget_state[state_id] = Value(None)
|
608
612
|
|
609
613
|
for state_id in self._old_state:
|
610
614
|
metadata = self._new_widget_state.widget_metadata.get(state_id)
|
@@ -613,6 +617,8 @@ class SessionState:
|
|
613
617
|
self._old_state[state_id] = False
|
614
618
|
elif metadata.value_type == "string_trigger_value":
|
615
619
|
self._old_state[state_id] = None
|
620
|
+
elif metadata.value_type == "chat_input_value":
|
621
|
+
self._old_state[state_id] = None
|
616
622
|
|
617
623
|
def _remove_stale_widgets(self, active_widget_ids: set[str]) -> None:
|
618
624
|
"""Remove widget state for widgets whose ids aren't in `active_widget_ids`."""
|
streamlit/static/index.html
CHANGED
@@ -51,7 +51,7 @@
|
|
51
51
|
<script>
|
52
52
|
window.prerenderReady = false
|
53
53
|
</script>
|
54
|
-
<script type="module" crossorigin src="./static/js/index.
|
54
|
+
<script type="module" crossorigin src="./static/js/index.B7J6suR-.js"></script>
|
55
55
|
<link rel="stylesheet" crossorigin href="./static/css/index.mUTQuMqR.css">
|
56
56
|
</head>
|
57
57
|
<body>
|
@@ -1 +1 @@
|
|
1
|
-
import{r as e,E as n,_ as a}from"./index.
|
1
|
+
import{r as e,E as n,_ as a}from"./index.B7J6suR-.js";var o=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),e.createElement("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}))});o.displayName="Delete";var i=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("rect",{width:24,height:24,fill:"none"}),e.createElement("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4l-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}))});i.displayName="FileDownload";export{o as D,i as F};
|