-
Couldn't load subscription status.
- Fork 114
Add ui.MarkdownStream
#1782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add ui.MarkdownStream
#1782
Changes from 4 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
3acbd4c
First pass at ui.MarkdownStream
cpsievert 0d0fba6
Add streaming context
cpsievert 584284f
Merge branch 'main' into markdown-stream-component
cpsievert 9fbfb2e
Make examples more readable:
cpsievert ba86904
Address review feedback
cpsievert 7cf0366
Merge branch 'main' into markdown-stream-component
cpsievert 68233de
Remove .update() method
cpsievert 93cce86
Show error message in shiny console if message can't be handled
cpsievert b304ee2
Implement new and improved auto-scroll logic
cpsievert 34be9ba
Try to fix make-format
cpsievert 19255a1
Remove file committed by mistake
cpsievert 7b475dc
Handle google genai update to import
cpsievert c899dfb
Fix autoreload typing issue
cpsievert e129b2e
Avoid chat having to import markdown-stream assets
cpsievert 99b58b3
plotly now requires anywidget
cpsievert 40382f7
Merge branch 'main' into markdown-stream-component
cpsievert 326b730
Slightly more complete examples
cpsievert 65499d1
Cleanup error messages; ReturnTypes aren't needed
cpsievert 4fb775d
Merge branch 'main' into markdown-stream-component
cpsievert 20cf773
Cleanup docstrings
cpsievert 5ab4f59
Let it be known that output_markdown_stream() is intentionally not in…
cpsievert f030b93
3.9 typing support
cpsievert a682747
Be slightly less agressive about updating scrollable element. Remove …
cpsievert 2eb2698
Add a basic test
cpsievert a7d5d5e
Remove controller since their isn't much of anything worth providing.…
cpsievert c7d6e05
Re-build map file
cpsievert 7caa2e4
Surface errors in a similar fashion to Chat()
cpsievert 0afcb87
Make error messages a bit more informative in terms of who is causing…
cpsievert 1d17a35
Update playwright test to include error notification
cpsievert 3b4a5a4
Add height/width params; rename to markdown_stream_ui()
cpsievert cf36d18
Make stream() async so is non-blocking
cpsievert 7c82077
Update playwright test
cpsievert cd0cf0e
Fix import
cpsievert 570335c
Committed file by mistake
cpsievert 7c0a536
Refactor MarkdownStream logic
cpsievert 9d459ce
Allow for auto-scrolling to be disabled
cpsievert 3413029
Tweak example code
cpsievert 833edfc
Have .stream() return the ExtendedTask; Add a .clear() method
cpsievert 5089b99
Have the stream task return the accumulated string result
cpsievert 6b1e24d
More aggressively update scrollable element. Add test for obtaining s…
cpsievert 37257ec
Missed a couple renamings
cpsievert d091ebd
Take a pass at addressing documentation feedback
cpsievert add7b2f
Address JS feedback
cpsievert 0360e2c
Fix tests
cpsievert 96d6db0
Take another pass at polishing docstrings
cpsievert a99b3a5
Go back to output_markdown_stream()
cpsievert 2496cc0
Update API reference
cpsievert 95f271a
Remove the .ui() entirely from shiny.ui.MarkdownStream
cpsievert 187817b
Fix add_example usage
cpsievert 3ff0537
Update changelog
cpsievert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| @use "highlight_styles" as highlight_styles; | ||
|
|
||
| /* Code highlighting (for both light and dark mode) */ | ||
| @include highlight_styles.atom_one_light; | ||
| [data-bs-theme="dark"] { | ||
| @include highlight_styles.atom_one_dark; | ||
| } | ||
|
|
||
| /* | ||
| Styling for the code-copy button (inspired by Quarto's code-copy feature) | ||
| */ | ||
| pre:has(.code-copy-button) { | ||
| position: relative; | ||
| } | ||
|
|
||
| .code-copy-button { | ||
| position: absolute; | ||
| top: 0; | ||
| right: 0; | ||
| border: 0; | ||
| margin-top: 5px; | ||
| margin-right: 5px; | ||
| background-color: transparent; | ||
|
|
||
| > .bi { | ||
| display: flex; | ||
| gap: 0.25em; | ||
|
|
||
| &::after { | ||
| content: ""; | ||
| display: block; | ||
| height: 1rem; | ||
| width: 1rem; | ||
| mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/><path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/></svg>'); | ||
| background-color: var(--bs-body-color, #222); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| .code-copy-button-checked { | ||
| > .bi::before { | ||
| content: "Copied!"; | ||
| font-size: 0.75em; | ||
| vertical-align: 0.25em; | ||
| } | ||
|
|
||
| > .bi::after { | ||
| mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/></svg>'); | ||
| background-color: var(--bs-success, #198754); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not something to handle in this PR, but we should anticipate highlighting styles being something that people will want to configure.