Skip to content

Commit

Permalink
docs: add Ask AI button with Gurubase widget (#2042)
Browse files Browse the repository at this point in the history
* docs: add Ask AI button with Gurubase widget

* docs: generate API References

* chore: ignore Gurubase token
  • Loading branch information
Lancetnik authored Jan 16, 2025
1 parent 76ac388 commit 9782183
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/docs/javascripts/gurubase-widget.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
document.addEventListener("DOMContentLoaded", () => {
const guruScript = document.createElement("script");
guruScript.src = "https://widget.gurubase.io/widget.latest.min.js";
guruScript.defer = true;
guruScript.id = "guru-widget-id";

const widgetSettings = {
// This token is binded to `faststream.airt.ai` domain,
// so its publication is not a problem
"data-widget-id": "TSM1_f2Ese6iwdKflPk7_ItbjXoRBi5CxL_BEYM2s_4", // pragma: allowlist secrets
"data-text": "Ask AI",
"data-margins": JSON.stringify({ bottom: "20px", right: "20px" }),
"data-light-mode": "false",
"data-bg-color": "#003257",
"data-icon-url": "https://faststream.airt.ai/latest/assets/img/logo.svg",
};

Object.entries(widgetSettings).forEach(([key, value]) => {
guruScript.setAttribute(key, value);
});

document.body.appendChild(guruScript);
});
1 change: 1 addition & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ extra_css:

extra_javascript:
- javascripts/extra.js
- javascripts/gurubase-widget.js

plugins:
- search:
Expand Down

0 comments on commit 9782183

Please sign in to comment.