mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
chore: add widget
This commit is contained in:
@@ -1,41 +1,15 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, createElement } from "react";
|
||||
import { getBehaveAs, BehaveAs } from "@/lib/utils";
|
||||
|
||||
export default function ElevenLabsWidget() {
|
||||
const behaveAs = getBehaveAs();
|
||||
|
||||
useEffect(() => {
|
||||
if (behaveAs !== BehaveAs.CLOUD) return;
|
||||
|
||||
// Check if script is already loaded
|
||||
const existingScript = document.querySelector(
|
||||
'script[src="https://unpkg.com/@elevenlabs/convai-widget-embed"]',
|
||||
);
|
||||
|
||||
if (existingScript) return;
|
||||
|
||||
const script = document.createElement("script");
|
||||
script.src = "https://unpkg.com/@elevenlabs/convai-widget-embed";
|
||||
script.async = true;
|
||||
script.type = "text/javascript";
|
||||
|
||||
document.head.appendChild(script);
|
||||
|
||||
return () => {
|
||||
const scriptToRemove = document.querySelector(
|
||||
'script[src="https://unpkg.com/@elevenlabs/convai-widget-embed"]',
|
||||
);
|
||||
if (scriptToRemove) {
|
||||
scriptToRemove.remove();
|
||||
}
|
||||
};
|
||||
}, [behaveAs]);
|
||||
|
||||
if (behaveAs !== BehaveAs.CLOUD) return null;
|
||||
|
||||
return createElement("elevenlabs-convai", {
|
||||
"agent-id": "agent_01k0catqvjef0sk50r03cj49ek",
|
||||
});
|
||||
return (
|
||||
<>
|
||||
{/* @ts-expect-error - this is a custom element */}
|
||||
<elevenlabs-convai agent-id="agent_01k0catqvjef0sk50r03cj49ek"></elevenlabs-convai>
|
||||
<script
|
||||
src="https://unpkg.com/@elevenlabs/convai-widget-embed"
|
||||
async
|
||||
type="text/javascript"
|
||||
></script>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ const TallyPopupSimple = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="fixed bottom-1 right-24 z-20 hidden select-none items-center gap-4 p-3 transition-all duration-300 ease-in-out md:flex">
|
||||
<div className="fixed bottom-1 left-6 z-20 hidden select-none items-center gap-4 p-3 transition-all duration-300 ease-in-out md:flex">
|
||||
{show_tutorial && (
|
||||
<Button
|
||||
variant="default"
|
||||
|
||||
Reference in New Issue
Block a user