Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/dist/chat/chat.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/dist/chat/chat.js.map

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions js/dist/markdown-stream/markdown-stream.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions js/dist/markdown-stream/markdown-stream.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions js/src/chat/chat-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ class ShinyToolCard extends LitElement {
this.requestUpdate()
}

firstUpdated() {
this.dispatchEvent(new CustomEvent("shiny-chat-maybe-scroll-to-bottom"))
}

/**
* Formats the title for display in the card header. Uses the `titleTemplate`,
* replacing `{title}` with the actual title or name of the tool.
Expand Down
16 changes: 16 additions & 0 deletions js/src/markdown-stream/markdown-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ class MarkdownElement extends LightElement {
return html`${contentToHTML(this.content, this.content_type)}`
}

connectedCallback(): void {
super.connectedCallback()
this.addEventListener(
"shiny-chat-maybe-scroll-to-bottom",
this.#onMaybeScrollToBottom,
)
}

disconnectedCallback(): void {
super.disconnectedCallback()
this.#cleanup()
Expand Down Expand Up @@ -376,6 +384,10 @@ class MarkdownElement extends LightElement {
return null
}

#onMaybeScrollToBottom = (): void => {
this.#maybeScrollToBottom()
}

#maybeScrollToBottom(): void {
const el = this.#scrollableElement
if (!el || this.#isUserScrolled) return
Expand All @@ -390,6 +402,10 @@ class MarkdownElement extends LightElement {
this.#scrollableElement?.removeEventListener("scroll", this.#onScroll)
this.#scrollableElement = null
this.#isUserScrolled = false
this.removeEventListener(
"shiny-chat-maybe-scroll-to-bottom",
this.#onMaybeScrollToBottom,
)
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg-py/src/shinychat/www/GIT_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ec8feb87cb2a78c497d8ee66edd6f1e50faf1d48
ec204acc3563226e4bcba3d48fc5b19418a9a360
2 changes: 1 addition & 1 deletion pkg-py/src/shinychat/www/chat/chat.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pkg-py/src/shinychat/www/chat/chat.js.map

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions pkg-py/src/shinychat/www/markdown-stream/markdown-stream.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg-r/inst/lib/shiny/GIT_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ec8feb87cb2a78c497d8ee66edd6f1e50faf1d48
ec204acc3563226e4bcba3d48fc5b19418a9a360
2 changes: 1 addition & 1 deletion pkg-r/inst/lib/shiny/chat/chat.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pkg-r/inst/lib/shiny/chat/chat.js.map

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions pkg-r/inst/lib/shiny/markdown-stream/markdown-stream.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pkg-r/inst/lib/shiny/markdown-stream/markdown-stream.js.map

Large diffs are not rendered by default.