Skip to content

Commit 773e4f1

Browse files
committed
Rename .restore() -> .clear()
1 parent 7ac2ba1 commit 773e4f1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

shiny/ui/_chat.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ async def message_stream_context(self):
602602
* Compared to `.append_message_stream()` this method is more flexible but
603603
isn't non-blocking by default (i.e., it doesn't launch an extended task).
604604
2. Be nested within itself
605-
* Nesting is primarily useful for making checkpoints to `.restore()` back
605+
* Nesting is primarily useful for making checkpoints to `.clear()` back
606606
to (see the example below).
607607
3. Be used from within a `.append_message_stream()`
608608
* Useful for inserting additional content from another context into the
@@ -612,7 +612,7 @@ async def message_stream_context(self):
612612
------
613613
:
614614
A `MessageStream` class instance, which has a method for `.append()`ing
615-
message content chunks to as well as way to `.restore()` the stream back to
615+
message content chunks to as well as way to `.clear()` the stream back to
616616
it's initial state. Note that `.append()` supports the same message content
617617
types as `.append_message()`.
618618
@@ -635,8 +635,8 @@ async def _():
635635
for x in [0, 50, 100]:
636636
await progress.append(f" {x}%")
637637
await asyncio.sleep(1)
638-
await progress.restore()
639-
await msg.restore()
638+
await progress.clear()
639+
await msg.clear()
640640
await msg.append("Completed stream")
641641
```
642642
@@ -646,7 +646,7 @@ async def _():
646646
display using `.message_stream_context()` while the the response generation is
647647
happening through `.append_message_stream()`. This allows the tool to display
648648
things like progress updates (or other "ephemeral" content) and optionally
649-
`.restore()` the stream back to it's initial state when ready to display the
649+
`.clear()` the stream back to it's initial state when ready to display the
650650
"final" content.
651651
"""
652652
# Checkpoint the current stream state so operation="replace" can return to it
@@ -1499,9 +1499,9 @@ def __init__(self, chat: Chat, stream_id: str):
14991499
self._chat = chat
15001500
self._stream_id = stream_id
15011501

1502-
async def restore(self):
1502+
async def clear(self):
15031503
"""
1504-
Restore the stream back to its initial state.
1504+
Set the stream back to its original state.
15051505
"""
15061506
await self._chat._append_message_chunk(
15071507
"",

0 commit comments

Comments
 (0)