Skip to content

docs: add assistant sidebar with MongoDB Knowledge integration - #16311

Merged
vkarpov15 merged 8 commits into
masterfrom
vkarpov15/gh-16283
Jun 17, 2026
Merged

docs: add assistant sidebar with MongoDB Knowledge integration#16311
vkarpov15 merged 8 commits into
masterfrom
vkarpov15/gh-16283

Conversation

@vkarpov15

Copy link
Copy Markdown
Collaborator

Fix #16283

Summary

Added a "Ask a Question" floating panel and assistant sidebar on the docs that connects to the MongoDB Knowledge API, which is the API that powers the MongoDB docs' assistant functionality as well.

Floating assistant input:

image

Assistant panel:

image

Heavily inspired by Mintlify - similar UI can be found on the Numeral API docs and Oso API docs.

The MongoDB Knowledge API currently doesn't support CORS, so I had to add a relay endpoint here: mongoosejs/backend@2a1e3d0

Examples

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a docs assistant experience that lets users ask Mongoose questions through a floating input and sidebar powered by the MongoDB Knowledge API.

Changes:

  • Adds assistant panel/floating form markup and loads the assistant scripts.
  • Adds client-side assistant behavior for streaming responses, rendering markdown, sources, resizing, and keyboard shortcut support.
  • Adds assistant styling and removes a few explanatory comments from one tutorial example.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
docs/layout.pug Adds assistant UI markup and script includes.
docs/js/ask-ai.js Implements assistant interactions and Knowledge API streaming response handling.
docs/css/mongoose9.css Adds assistant layout, panel, message, and responsive styles.
docs/tutorials/findoneandupdate.md Removes comments from an existing tutorial code block.

Comment thread docs/js/ask-ai.js Outdated
Comment thread docs/css/mongoose9.css
Comment thread docs/css/mongoose9.css
Comment thread docs/js/ask-ai.js Outdated
Comment thread docs/layout.pug

@hasezoey hasezoey left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Mostly looks good, though there are some styling issues.

Due to how the website works, conversations are not persisted across page changes (ex. navigating from Quick Start to Middleware).

I also just noticed that eslint does not get run for documentation only files, which are normally linted and so issues dont surface here (like the Strings must use singlequote quotes error in this PR).

Extra image Image

PS: is this mongodb model intended to be used outside of their website?

Comment thread docs/js/ask-ai.js

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This file is served, but due to its amount of functions, it would likely be good to have some JSDoc.

Comment thread docs/js/ask-ai.js Outdated
Comment thread docs/layout.pug Outdated
@nlarew

nlarew commented Jun 3, 2026

Copy link
Copy Markdown

The MongoDB Knowledge API currently doesn't support CORS

@vkarpov15 I justed DMed you on Slack to resolve this - should be an easy fix

Comment thread docs/layout.pug Outdated

@AbdelrahmanHafez AbdelrahmanHafez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One minor comment, otherwise LGTM

vkarpov15 and others added 2 commits June 14, 2026 15:10
@vkarpov15

Copy link
Copy Markdown
Collaborator Author

"Due to how the website works, conversations are not persisted across page changes (ex. navigating from Quick Start to Middleware)." <-- that is intentional IMO given how the Mongoose docs are currently structured. Mintlify docs also wipe the current conversation on page reload. Although because Mintlify docs are single page apps, navigating between pages does retain the current conversation unless you explicitly refresh or open a new tab. @AbdelrahmanHafez @hasezoey WDYT, retain current conversation between page reloads? If we do that, we need to also have a button to start a new thread.

@hasezoey

Copy link
Copy Markdown
Collaborator

WDYT, retain current conversation between page reloads? If we do that, we need to also have a button to start a new thread.

I think the current way is fine for now, just pointed out the current (expected) behavior.

@RaschidJFR RaschidJFR left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Left some comments, most of them aesthetic. The important one is the one about CORS/ALLOWED_ORIGINS.

Comment thread docs/js/ask-ai.js Outdated
Comment thread docs/js/ask-ai.js
Comment thread docs/js/ask-ai.js
Comment thread docs/css/mongoose9.css
@vkarpov15 vkarpov15 added this to the 9.7.1 milestone Jun 17, 2026
@vkarpov15
vkarpov15 merged commit 1f75b81 into master Jun 17, 2026
29 checks passed
@alexbevi

Copy link
Copy Markdown
Contributor
image

love it :)

@hasezoey
hasezoey deleted the vkarpov15/gh-16283 branch June 18, 2026 09:30
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.

Docs: integrate MongoDB RAG chatbot

7 participants