docs: add assistant sidebar with MongoDB Knowledge integration - #16311
Conversation
There was a problem hiding this comment.
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. |
hasezoey
left a comment
There was a problem hiding this comment.
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).
PS: is this mongodb model intended to be used outside of their website?
There was a problem hiding this comment.
This file is served, but due to its amount of functions, it would likely be good to have some JSDoc.
@vkarpov15 I justed DMed you on Slack to resolve this - should be an easy fix |
AbdelrahmanHafez
left a comment
There was a problem hiding this comment.
One minor comment, otherwise LGTM
Co-authored-by: Hafez <a.hafez852@gmail.com>
|
"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. |
I think the current way is fine for now, just pointed out the current (expected) behavior. |
RaschidJFR
left a comment
There was a problem hiding this comment.
Left some comments, most of them aesthetic. The important one is the one about CORS/ALLOWED_ORIGINS.


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:
Assistant panel:
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