Quickstart
cp .env.example .env.local
yarn
yarn dev
Deploy code
<script>
function loadScript(url, callback) {
let script = document.createElement('script')
script.type = 'text/javascript'
script.src = url
script.onload = callback
document.head.appendChild(script)
let link = document.createElement('link')
link.rel = 'stylesheet'
link.href = 'https://cdn.jsdelivr.net/npm/@revium/gpt-widget@0.x.x/dist/style.css'
document.head.appendChild(link)
}
// Function to initialize the widget after the script is loaded
function initializeWidget() {
if (typeof ReviumGptWidget !== 'undefined' && typeof ReviumGptWidget.init === 'function') {
ReviumGptWidget.init({
source: 'xxxxxxxx',
apikey: 'xxxxxxxx',
intro:
'Im an AI chatbot built by the Revium team and trained on data you can find on this site, ask me anything about the website or future privacy laws!',
textMode: 'light',
primaryColor: '#000000',
secondaryColor: '#000000',
elementId: 'revium-gpt-widget',
})
} else {
console.error('ReviumGptWidget is not defined or does not have an init() function.')
}
}
// Load the external script
loadScript('https://cdn.jsdelivr.net/npm/@revium/gpt-widget@0.x.x/dist/revium-gpt-widget.js', initializeWidget)
</script>
Minified
function loadScript(t,e){let i=document.createElement("script");i.type="text/javascript",i.src=t,i.onload=e,document.head.appendChild(i);let n=document.createElement("link");n.rel="stylesheet",n.href="https://cdn.jsdelivr.net/npm/@revium/gpt-widget@0.x.x/dist/style.css",document.head.appendChild(n)}function initializeWidget(){"undefined"!=typeof ReviumGptWidget&&"function"==typeof ReviumGptWidget.init?ReviumGptWidget.init({source:"xxxxxxxx",apikey:"xxxxxxxx",intro:"Im an AI chatbot built by the Revium team and trained on data you can find on this site, ask me anything about the website or future privacy laws!",textMode:"light",primaryColor:"#000000",secondaryColor:"#000000"}):console.error("ReviumGptWidget is not defined or does not have an init() function.")}loadScript("https://cdn.jsdelivr.net/npm/@revium/gpt-widget@0.x.x/dist/revium-gpt-widget.js",initializeWidget);