Skip to content

Conversation

addisonschultz
Copy link
Collaborator

@addisonschultz addisonschultz commented Aug 18, 2025

Hi @likawind

This PR adds extra functionality to the RunLLM integration to tap into GitBook native UI.

What we’ve added to GitBook

We’ve introduced a new feature to allow AI integrations to use the native GitBook UI/search, instead of defaulting to the GitBook assistant. This will allow GitBook users to choose what type of AI experience they want. Previously, this was not possible, meaning many GitBook sites using AI integrations would have 2 experiences - the GitBook Assistant and a floating button/AI, such as RunLLM.

UI/Video

479316504-d09e8d21-7d13-4289-8404-fac5d04297d3.mov

Note: This video shows the GitBook Assistant still enabled, causing there to be 2 buttons for AI chat in the UI (next to the search bar). Ideally, users would disable the GitBook Assistant after adding this integration, meaning only one AI button would appear.

What this PR does

This PR adds the newly created API from the integration platform to allow AI integrations to tap into the GitBook UI. It also introduces an extra configuration native_ai_experience to allow users to select the AI experience they want (Native using GitBook UI, or Non-native (continue using the floating button in the lower corner).

The call for registerCustomAssistant has a few properties that can be changed.

Required props:
label: The name of the AI assistant
icon: An icon to display in the UI to represent the assistant. Must be an icon from https://fontawesome.com/. Custom icons are not supported at this time.
open: Function called when the UI button (next to the search bar) is pressed or question is asked. Meant to open the RunLLM modal, in this instance. Contains an argument query which contains a question when asked from the search UI.

Image for reference:
image

Optional prop:
ui?: Optional property whether to display the UI for this integration. This should be used if a user does not want to show the button in the UI (next to the search bar), but would like to continue to use the floating button in the lower right (injected from RunLLM). The reason we introduced this flag, is because we still want integrations to register through this new API, allowing users to tap into the search/ask workflow to ask questions and still fire the RunLLM modal. (See image above)

What still needs to be done/discussed

  1. In the event the user wants to use the Native experience (Using the GitBook button to fire the RunLLM modal), we want to disable/hide the floating button from RunLLM. Is there a reliable query selector we can use to set it’s visibility to none?
  2. The open function is not finished yet, as I need to discuss with you on what method could be used to open the RunLLM modal. Is there a function or call exposed by the script that is available for this integration to call?

Copy link

changeset-bot bot commented Aug 18, 2025

🦋 Changeset detected

Latest commit: c4eac48

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@gitbook/integration-runllm-widget Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Aug 18, 2025

Open in StackBlitz

bun add https://pkg.pr.new/GitbookIO/integrations/@gitbook/api@947

commit: c4eac48

@addisonschultz addisonschultz marked this pull request as ready for review August 19, 2025 03:53
Copy link
Contributor

@likawind likawind left a comment

Choose a reason for hiding this comment

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

Exciting to see this @addisonschultz , thank you for getting us integrated with gitbook more smoothly

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.

3 participants