Skip to content

Commit

Permalink
Disable Mendable model (#2449) (#2455)
Browse files Browse the repository at this point in the history
* chore: disable mendable model

* chore: comment out import lines

(cherry picked from commit 6a831e9)

Co-authored-by: caroldelwing <[email protected]>
  • Loading branch information
1 parent 95e4ea4 commit 1d35804
Showing 1 changed file with 44 additions and 44 deletions.
88 changes: 44 additions & 44 deletions src/components/MendableAIWidget/MendableAIWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
import { useEffect } from "react";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import useBaseUrl from "@docusaurus/useBaseUrl";
// import { useEffect } from "react";
// import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
// import useBaseUrl from "@docusaurus/useBaseUrl";

export const MENDABLE_SCRIPT_URL = "https://unpkg.com/@mendable/[email protected]/dist/umd/mendable-bundle.min.js";
// export const MENDABLE_SCRIPT_URL = "https://unpkg.com/@mendable/[email protected]/dist/umd/mendable-bundle.min.js";

export default function MendableAIWidget() {
const {
siteConfig: { customFields },
} = useDocusaurusContext();

const logoUrl = useBaseUrl("/spectrocloud-logo.png");
const botUrl = useBaseUrl("/spectrocloud-logo-black.svg");

useEffect(() => {
const script = document.createElement("script");
script.src = MENDABLE_SCRIPT_URL;
script.defer = true;

setTimeout(() => {
document.body.appendChild(script);
}, 500);

script.onload = () => {
if (window.Mendable) {
window.Mendable.initialize({
anon_key: customFields?.mendableKey,
type: "floatingButton",
dialogPlaceholder: "What is Palette?",
welcomeMessage: "Ask me anything about Palette",
cmdShortcutKey: "l",
icon: logoUrl,
botIcon: botUrl,
isPinnable: true,
floatingButtonStyle: {
color: "#FFFFFF",
backgroundColor: "#3E4FB5",
},
style: { accentColor: "#3E4FB5" },
});
}
};

return () => {
document.body.removeChild(script);
};
}, []);
// const {
// siteConfig: { customFields },
// } = useDocusaurusContext();

// const logoUrl = useBaseUrl("/spectrocloud-logo.png");
// const botUrl = useBaseUrl("/spectrocloud-logo-black.svg");

// useEffect(() => {
// const script = document.createElement("script");
// script.src = MENDABLE_SCRIPT_URL;
// script.defer = true;

// setTimeout(() => {
// document.body.appendChild(script);
// }, 500);

// script.onload = () => {
// if (window.Mendable) {
// window.Mendable.initialize({
// anon_key: customFields?.mendableKey,
// type: "floatingButton",
// dialogPlaceholder: "What is Palette?",
// welcomeMessage: "Ask me anything about Palette",
// cmdShortcutKey: "l",
// icon: logoUrl,
// botIcon: botUrl,
// isPinnable: true,
// floatingButtonStyle: {
// color: "#FFFFFF",
// backgroundColor: "#3E4FB5",
// },
// style: { accentColor: "#3E4FB5" },
// });
// }
// };

// return () => {
// document.body.removeChild(script);
// };
// }, []);

return null;
}

0 comments on commit 1d35804

Please sign in to comment.