-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |