Skip to content

Commit a7988f1

Browse files
committed
Rename append_message_context() -> message_stream_context()
1 parent 3c0ca35 commit a7988f1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

shiny/ui/_chat.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ async def append_message(
591591
)
592592

593593
@asynccontextmanager
594-
async def append_message_context(self):
594+
async def message_stream_context(self):
595595
"""
596596
Message stream context manager.
597597
@@ -629,9 +629,9 @@ async def append_message_context(self):
629629
630630
@reactive.effect
631631
async def _():
632-
async with chat.append_message_context() as msg:
632+
async with chat.message_stream_context() as msg:
633633
await msg.append("Starting stream...\n\nProgress:")
634-
async with chat.append_message_context() as progress:
634+
async with chat.message_stream_context() as progress:
635635
for x in [0, 50, 100]:
636636
await progress.append(f" {x}%")
637637
await asyncio.sleep(1)
@@ -643,7 +643,7 @@ async def _():
643643
Note
644644
----
645645
A useful pattern for displaying tool calls in a chatbot is for the tool to
646-
display using `.append_message_context()` while the the response generation is
646+
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
649649
`.restore()` the stream back to it's initial state when ready to display the
@@ -1492,7 +1492,7 @@ def chat_ui(
14921492

14931493
class MessageStream:
14941494
"""
1495-
An object to yield from a `.append_message_context()` context manager.
1495+
An object to yield from a `.message_stream_context()` context manager.
14961496
"""
14971497

14981498
def __init__(self, chat: Chat, stream_id: str):

0 commit comments

Comments
 (0)