Skip to content
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

Programmatically open or close the Copilot widget #1638

Closed
francisjervis opened this issue Jan 8, 2025 · 1 comment
Closed

Programmatically open or close the Copilot widget #1638

francisjervis opened this issue Jan 8, 2025 · 1 comment
Labels
enhancement New feature or request needs-triage

Comments

@francisjervis
Copy link

francisjervis commented Jan 8, 2025

Is your feature request related to a problem? Please describe.
Use case is displaying the copilot with eg a user satisfaction survey when the page loads/after a preset delay. This is not currently possible (or at least, is not documented and is not obvious from inspecting the source code).

Describe the solution you'd like
Adding "show_copilot" and "hide_copilot" class methods (or similar) to enable the copilot to be shown/hidden from JS loaded on the page.

Describe alternatives you've considered
1: Sending click events to the relevant elements to simulate user interaction. Hack-y and potentially unstable if changes are made to the copilot code (eg in widget.tsx) which change the id of the relevant elements (these should not be breaking changes).
2: Examining the widget.tsx code for events related to setIsOpen which can be piggybacked off to deliver this functionality (unsuccessfully).

Additional context
Additional functionality such as a "with_first_message" optional param (enabling a conversation to be started programmatically with a "starter" message, eg if a user clicks a button) and/or passing a dictionary of key-value pairs to the server would broaden the use cases for this feature.

@willydouhard
Copy link
Collaborator

Added window.toggleChainlitCopilot in the next release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-triage
Projects
None yet
Development

No branches or pull requests

2 participants