Skip to content

Properly send custom message in a synchronous manner #1888

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 4 commits into from
Mar 6, 2025

Conversation

cpsievert
Copy link
Collaborator

@cpsievert cpsievert commented Mar 5, 2025

Closes #1887

@cpsievert cpsievert requested a review from schloerke March 5, 2025 19:28
"obj": obj,
}

self._session._send_message_sync({"custom": {"shinyChatMessage": msg}})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is def an improvement over .run_coro_sync(), but I'm wondering if we should make .update_user_input() async and escape the possible internal dangers of ._send_message_sync().

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, we pretty intentionally wanted to try avoiding async since it’s so useful to provide a default value at the top-level.

That said, if it becomes a problem, we could probably add value to .ui() to help with that issue.

@cpsievert cpsievert merged commit 6abcb16 into main Mar 6, 2025
41 checks passed
@cpsievert cpsievert deleted the fix/chat-update-user-message branch March 6, 2025 15:00
schloerke added a commit that referenced this pull request Mar 10, 2025
* main:
  fix(textarea-autoresize): add a bit of padding when setting textarea height (#1891)
  Properly send custom message in a synchronous manner (#1888)
  fix(page-main-container): Fillable container with min-height/width only when parent layout is fillable (#1885)
  Add `.latest_stream` to `ui.MarkdownStream()` and deprecate `.get_latest_stream_result()` (#1884)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Chat.update_user_input() errors in shinylive
2 participants