From 51e53948fd6f2a68f1b42595239f1b7430ee1d3c Mon Sep 17 00:00:00 2001 From: Anton Dosta Date: Thu, 8 Aug 2024 17:57:00 -0700 Subject: [PATCH] feat: Cookbook Onboard integration --- main/.vitepress/config.mjs | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/main/.vitepress/config.mjs b/main/.vitepress/config.mjs index f3d13b40a..4f15ed01d 100644 --- a/main/.vitepress/config.mjs +++ b/main/.vitepress/config.mjs @@ -79,6 +79,34 @@ export default defineConfig({ }, 500); `, ], + /* --- Cookbook Onboard integration --- */ + [ + 'script', + {}, + ` + document.addEventListener('DOMContentLoaded', function() { + // Cookbook Onboard (AI Assistant). API key is public so it's fine to just hardcode it here. + var COOKBOOK_API_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2NmExOTE1ZjY4ZWI5Y2IyMDQzY2E5MGMiLCJpYXQiOjE3MjE4NjQ1NDMsImV4cCI6MjAzNzQ0MDU0M30.zPYzKohNZXSvgGeTjeZc8NmE13lwaj5A-cq1p0MMC5E"; + + var element = document.getElementById('__cookbook'); + if (!element) { + element = document.createElement('div'); + element.id = '__cookbook'; + element.dataset.apiKey = COOKBOOK_API_KEY; + document.body.appendChild(element); + } + + var script = document.getElementById('__cookbook-script'); + if (!script) { + script = document.createElement('script'); + script.src = 'https://cdn.jsdelivr.net/npm/@cookbookdev/docsbot/dist/standalone/index.cjs.js'; + script.id = '__cookbook-script'; + script.async = true; + document.body.appendChild(script); + } + }); + `, + ], ], ignoreDeadLinks: [ // ignore all localhost links @@ -651,4 +679,4 @@ export default defineConfig({ }, ], }, -}); \ No newline at end of file +});