Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

feat: add Voice embodiment support across various components

Muhammad Hamza Khan3b32f61fc248
diff --git a/packages/app/src/builder-ui/Agent.class.ts b/packages/app/src/builder-ui/Agent.class.ts
index cb2206aa..7449487f 100644
--- a/packages/app/src/builder-ui/Agent.class.ts
+++ b/packages/app/src/builder-ui/Agent.class.ts
@@ -498,6 +498,7 @@ export class Agent extends EventEmitter {
[EMBODIMENT_TYPE.API.toUpperCase()]: 'true',
[EMBODIMENT_TYPE.MCP]: 'true',
[EMBODIMENT_TYPE.ALEXA]: 'true',
+ [EMBODIMENT_TYPE.VOICE]: 'true',
[EMBODIMENT_TYPE.FORM]: 'true',
};
const currentSettings = await getAgentSettings(agentId);
diff --git a/packages/app/src/react/features/agent-settings/components/Security/AllowedDomainsWidget.tsx b/packages/app/src/react/features/agent-settings/components/Security/AllowedDomainsWidget.tsx
index f3e2c12b..0d6d8b80 100644
--- a/packages/app/src/react/features/agent-settings/components/Security/AllowedDomainsWidget.tsx
+++ b/packages/app/src/react/features/agent-settings/components/Security/AllowedDomainsWidget.tsx
@@ -25,6 +25,7 @@ const DOMAIN_SUPPORTED_EMBODIMENTS = [
EMBODIMENT_TYPE.CHAT_BOT,
EMBODIMENT_TYPE.FORM,
EMBODIMENT_TYPE.ALEXA,
+ EMBODIMENT_TYPE.VOICE,
] as const;
/**
diff --git a/packages/app/src/react/features/agents/components/modals/deploy-agent-modal.tsx b/packages/app/src/react/features/agents/components/modals/deploy-agent-modal.tsx
index 0f479af6..58af0358 100644
--- a/packages/app/src/react/features/agents/components/modals/deploy-agent-modal.tsx
+++ b/packages/app/src/react/features/agents/components/modals/deploy-agent-modal.tsx
@@ -17,8 +17,10 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@react/shared/componen
import { useAppState } from '@react/shared/contexts/AppStateContext';
import { OnboardingTaskType } from '@react/shared/types/onboard.types';
import { UserSettingsKey } from '@src/backend/types/user-data';
+import AlexaEmbodimentModal from '@src/react/features/embodiments/alexa-embodiment-modal';
import FormEmbodimentModal from '@src/react/features/embodiments/form-embodiment-modal';
import LovableEmbodimentModal from '@src/react/features/embodiments/lovable-embodiment-modal';
+import VoiceEmbodimentModal from '@src/react/features/embodiments/voice-embodiment-modal';
import { Tooltip, TooltipContent, TooltipTrigger } from '@src/react/shared/components/ui/tooltip';
import { errorToast, successToast } from '@src/shared/components/toast';
import { SMYTHOS_DOCS_URL } from '@src/shared/constants/general';
@@ -33,7 +35,6 @@ import { CloseIcon } from '../../../../shared/components/svgs';
import Modal from '../../../../shared/components/ui/modals/Modal';
import { EMBODIMENT_TYPE } from '../../../../shared/enums';
import { Embodiment } from '../../../../shared/types/api-results.types';
-import VoiceEmbodimentModal from '../../../embodiments/alexa-embodiment-modal';
import ApiEmbodimentModal from '../../../embodiments/api-embodiment-modal';
import ChatbotEmbodimentModal from '../../../embodiments/chatbot-embodiment-modal';
import { globalModalManager } from '../../../embodiments/embodiment-settings';
@@ -82,7 +83,7 @@ function DeployAgentModal({ userInfo, deploymentSidebarCtx }) {
const [hasDeployment, setHasDeployment] = useState(false);
const [isCollapsed, setIsCollapsed] = useState(false);
- type PanelType = 'none' | 'gpt' | 'alexa' | 'chatbot' | 'api' | 'mcp' | 'lovable' | 'form';
+ type PanelType = 'none' | EMBODIMENT_TYPE.ALEXA | EMBODIMENT_TYPE.VOICE | EMBODIMENT_TYPE.CHAT_GPT | EMBODIMENT_TYPE.CHAT_BOT | EMBODIMENT_TYPE.API | EMBODIMENT_TYPE.MCP | EMBODIMENT_TYPE.LOVABLE | EMBODIMENT_TYPE.FORM;
const [openPanel, setOpenPanel] = useState<PanelType>('none');
const [dialogModal, setDialogModal] = useState<{
open: boolean;
@@ -152,13 +153,13 @@ function DeployAgentModal({ userInfo, deploymentSidebarCtx }) {
// Transform the embodiment data to match ChatbotEmbodimentModal props
const chatbotEmbodimentData = chatbotEmbodiment
? {
- properties: {
- introMessage: chatbotEmbodiment.properties?.introMessage || '',
- isFullScreen: chatbotEmbodiment.properties?.isFullScreen || false,
- allowFileAttachments: chatbotEmbodiment.properties?.allowFileAttachments || false,
- enableMetaMessages: chatbotEmbodiment.properties?.enableMetaMessages || false,
- },
- }
+ properties: {
+ introMessage: chatbotEmbodiment.properties?.introMessage || '',
+ isFullScreen: chatbotEmbodiment.properties?.isFullScreen || false,
+ allowFileAttachments: chatbotEmbodiment.properties?.allowFileAttachments || false,
+ enableMetaMessages: chatbotEmbodiment.properties?.enableMetaMessages || false,
+ },
+ }
: undefined;
// Get domain for chatbot/voice/form integration
@@ -440,11 +441,14 @@ function DeployAgentModal({ userInfo, deploymentSidebarCtx }) {
return (
<>
- {openPanel === 'alexa' && (
- <VoiceEmbodimentModal domain={agentDomain} onClose={handleClosePanel} />
+ {openPanel === EMBODIMENT_TYPE.ALEXA && (
+ <AlexaEmbodimentModal onClose={handleClosePanel} />
+ )}
+ {openPanel === EMBODIMENT_TYPE.VOICE && (
+ <VoiceEmbodimentModal onClose={handleClosePanel} />
)}
- {openPanel === 'gpt' && <GptEmbodimentModal onClose={handleClosePanel} />}
- {openPanel === 'chatbot' && (
+ {openPanel === EMBODIMENT_TYPE.CHAT_GPT && <GptEmbodimentModal onClose={handleClosePanel} />}
+ {openPanel === EMBODIMENT_TYPE.CHAT_BOT && (
<ChatbotEmbodimentModal
onClose={handleClosePanel}
domain={agentDomain}
@@ -452,16 +456,16 @@ function DeployAgentModal({ userInfo, deploymentSidebarCtx }) {
isLoading={isLoadingEmbodiments}
/>
)}
- {openPanel === 'form' && (
+ {openPanel === EMBODIMENT_TYPE.FORM && (
<FormEmbodimentModal
onClose={handleClosePanel}
domain={agentDomain}
isLoading={isLoadingEmbodiments}
/>
)}
- {openPanel === 'api' && <ApiEmbodimentModal onClose={handleClosePanel} />}
- {openPanel === 'mcp' && <McpEmbodimentModal onClose={handleClosePanel} />}
- {openPanel === 'lovable' && <LovableEmbodimentModal onClose={handleClosePanel} />}
+ {openPanel === EMBODIMENT_TYPE.API && <ApiEmbodimentModal onClose={handleClosePanel} />}
+ {openPanel === EMBODIMENT_TYPE.MCP && <McpEmbodimentModal onClose={handleClosePanel} />}
+ {openPanel === EMBODIMENT_TYPE.LOVABLE && <LovableEmbodimentModal onClose={handleClosePanel} />}
{dialogModal && dialogModal.open && (
<Modal
isOpen={dialogModal.open}
@@ -803,15 +807,16 @@ function DeployAgentModal({ userInfo, deploymentSidebarCtx }) {
onClose={toggleDeployModal}
onReopenDeployModal={() => setIsVisible(true)}
onOpenLlmModal={handleOpenLlmModal}
- onOpenCustomGptModal={() => handleOpenPanel('gpt')}
+ onOpenCustomGptModal={() => handleOpenPanel(EMBODIMENT_TYPE.CHAT_GPT)}
onOpenDialogModal={handleOpenDialogModal}
onOpenCodeSnippetModal={handleOpenCodeSnippetModal}
- onOpenAlexaPanel={() => handleOpenPanel('alexa')}
- onOpenChatbotPanel={() => handleOpenPanel('chatbot')}
- onOpenFormPanel={() => handleOpenPanel('form')}
- onOpenApiPanel={() => handleOpenPanel('api')}
- onOpenMcpPanel={() => handleOpenPanel('mcp')}
- onOpenLovablePanel={() => handleOpenPanel('lovable')}
+ onOpenAlexaPanel={() => handleOpenPanel(EMBODIMENT_TYPE.ALEXA)}
+ onOpenVoicePanel={() => handleOpenPanel(EMBODIMENT_TYPE.VOICE)}
+ onOpenChatbotPanel={() => handleOpenPanel(EMBODIMENT_TYPE.CHAT_BOT)}
+ onOpenFormPanel={() => handleOpenPanel(EMBODIMENT_TYPE.FORM)}
+ onOpenApiPanel={() => handleOpenPanel(EMBODIMENT_TYPE.API)}
+ onOpenMcpPanel={() => handleOpenPanel(EMBODIMENT_TYPE.MCP)}
+ onOpenLovablePanel={() => handleOpenPanel(EMBODIMENT_TYPE.LOVABLE)}
isVisible={isCollapsed && !isAnyOverlayOpen}
/>
</div>
diff --git a/packages/app/src/react/features/embodiments/alexa-embodiment-modal-wrapper.tsx b/packages/app/src/react/features/embodiments/alexa-embodiment-modal-wrapper.tsx
index a3277081..905f8b94 100644
--- a/packages/app/src/react/features/embodiments/alexa-embodiment-modal-wrapper.tsx
+++ b/packages/app/src/react/features/embodiments/alexa-embodiment-modal-wrapper.tsx
@@ -1,13 +1,11 @@
import { useEffect, useState } from 'react';
import { useAgentSettingsCtx } from '../agent-settings/contexts/agent-settings.context';
-import VoiceEmbodimentModal from './alexa-embodiment-modal';
+import AlexaEmbodimentModal from './alexa-embodiment-modal';
const AlexaEmbodimentModalWrapper = ({
onClose,
- domain,
}: {
onClose: () => void;
- domain: string;
}) => {
const { workspace, agentId, serverStatusData } = useAgentSettingsCtx();
@@ -33,7 +31,7 @@ const AlexaEmbodimentModalWrapper = ({
}
}, [workspace, agentId, serverStatusData]);
- return <VoiceEmbodimentModal onClose={onClose} domain={domain} agentDomains={agentDomains} />;
+ return <AlexaEmbodimentModal onClose={onClose} agentDomains={agentDomains} />;
};
export default AlexaEmbodimentModalWrapper;
diff --git a/packages/app/src/react/features/embodiments/alexa-embodiment-modal.tsx b/packages/app/src/react/features/embodiments/alexa-embodiment-modal.tsx
index 0544828c..4ff55ce9 100644
--- a/packages/app/src/react/features/embodiments/alexa-embodiment-modal.tsx
+++ b/packages/app/src/react/features/embodiments/alexa-embodiment-modal.tsx
@@ -1,24 +1,19 @@
import { builderStore } from '@src/shared/state_stores/builder/store';
-import { ArrowRightIcon } from 'lucide-react';
import React, { useState } from 'react';
import { CheckIcon, CopyIcon } from '../../shared/components/svgs';
import { Input } from '../../shared/components/ui/input';
import ModalHeaderEmbodiment from './modal-header-embodiment';
/**
- * Props for the VoiceEmbodimentModal component.
+ * Props for the AlexaEmbodimentModal component.
*/
-interface VoiceEmbodimentModalProps {
+interface AlexaEmbodimentModalProps {
/**
* Callback to close the modal (also used for back button).
*/
onClose: () => void;
/**
- * Domain for the Voice integration.
- */
- domain: string;
- /**
- * Agent domains for the Voice integration.
+ * Agent domains for the Alexa integration.
*/
agentDomains?: {
dev: string;
@@ -28,19 +23,16 @@ interface VoiceEmbodimentModalProps {
}
/**
- * Voice Integration Modal for showing step-by-step instructions and Dev/Prod URLs.
- * Matches the design and UX of Custom GPT Modal.
+ * Alexa Integration Modal for showing step-by-step instructions and Dev/Prod URLs.
*
- * @param {VoiceEmbodimentModalProps} props - The component props.
+ * @param {AlexaEmbodimentModalProps} props - The component props.
* @returns {JSX.Element} The rendered modal.
*/
-const VoiceEmbodimentModal: React.FC<VoiceEmbodimentModalProps> = ({
+const AlexaEmbodimentModal: React.FC<AlexaEmbodimentModalProps> = ({
onClose,
- domain = 'your-domain.com',
agentDomains,
}) => {
const [copied, setCopied] = useState({
- voice: false,
alexaDev: false,
alexaProd: false,
});
@@ -56,13 +48,11 @@ const VoiceEmbodimentModal: React.FC<VoiceEmbodimentModalProps> = ({
const devUrl = devDomain && scheme ? `${scheme}://${devDomain}/alexa` : '';
const prodUrl = prodDomain && scheme ? `${scheme}://${prodDomain}/alexa` : '';
- const voicePreviewUrl = prodDomain && scheme ? `${scheme}://${prodDomain}/emb/voice` : '';
-
/**
* Copies the given text to clipboard.
* @param {string} text - The text to copy.
*/
- const handleCopy = (text: string, type: 'voice' | 'alexaDev' | 'alexaProd'): void => {
+ const handleCopy = (text: string, type: 'alexaDev' | 'alexaProd'): void => {
setCopied({ ...copied, [type]: true });
void navigator.clipboard.writeText(text);
setTimeout(() => {
@@ -70,100 +60,15 @@ const VoiceEmbodimentModal: React.FC<VoiceEmbodimentModalProps> = ({
}, 2000);
};
- /**
- * Ensures domain has proper protocol prefix.
- * @param {string} domain - The domain to format.
- * @returns {string} The formatted domain with protocol.
- */
- const getFullDomain = (domain: string): string => {
- // Check if the domain already includes http:// or https://
- if (!/^https?:\/\//i.test(domain)) {
- // Assume HTTPS by default
- return `https://${domain}`;
- }
- return domain;
- };
-
- const codeSnippet = `<script src="${getFullDomain(domain)}/static/embodiment/voice/voice-embodiment-minified.js">
- </script>
- <script>
- VoiceEmbodiment.init({
- domain: '${domain}?type=widget',
- });
- </script>`;
-
return (
<div className="fixed inset-0 bg-black/25 flex items-center justify-center z-50">
<div className="relative bg-white rounded-2xl shadow-lg w-full p-6 flex flex-col overflow-auto max-h-[90vh] max-w-[480px]">
{/* Header with back and close buttons */}
<ModalHeaderEmbodiment
- title="Voice and Alexa Integration"
+ title="Alexa Integration"
onBack={onClose}
onClose={onClose}
/>
-
- {codeSnippet && (
- <>
- <div className="flex items-center justify-between mt-4">
- <label className="block text-base font-semibold text-gray-700">
- Voice Integration
- </label>
- <a
- href={voicePreviewUrl}
- target="_blank"
- rel="noopener noreferrer"
- className="inline-flex items-center gap-1 text-[13px] text-[#707070]"
- >
- Preview <ArrowRightIcon className="w-4 h-4" />
- </a>
- </div>
- <div className="bg-amber-50 border border-amber-200 rounded-md p-3 my-2 mb-4">
- <p className="text-amber-800 text-xs">
- <strong>Note:</strong> To use voice embodiment, you need to provide personal OpenAI
- API key via{' '}
- <a href="/vault" target="_blank" rel="noopener noreferrer" className="underline">
- Vault
- </a>
- .
- </p>
- </div>
- <label htmlFor="code-snippet" className="text-sm text-gray-900">
- Code Snippet
- </label>
- <p className="text-sm text-gray-700 my-2">
- To integrate voice embodiment, copy and paste this snippet into your website before
- the closing <code>&lt;/body&gt;</code> tag.
- </p>
- <div className="relative flex items-center mt-1 group w-full">
- <textarea
- id="code-snippet"
- readOnly
- className="w-full h-40 p-3 text-sm text-[#707070] bg-white rounded-lg border border-gray-200 font-mono resize-none focus:outline-none focus:border-b-2 focus:border-b-blue-500 transition-colors"
- value={codeSnippet}
- />
- <button
- type="button"
- aria-label="Copy Voice Integration"
- onClick={() => handleCopy(codeSnippet, 'voice')}
- className={`absolute right-2 top-2 opacity-0 group-hover:opacity-100 transition-opacity bg-white p-1 ${copied.voice ? 'opacity-100' : ''}`}
- tabIndex={-1}
- >
- {copied.voice ? <CheckIcon fill="#222" /> : <CopyIcon color="#222" />}
- </button>
- </div>
- </>
- )}
-
- <hr className="my-4" />
- <label className="block text-base font-semibold text-gray-700 mb-2">
- Alexa Integration
- </label>
- {/* Description */}
- <p className="text-sm text-gray-700 mb-4">
- Publish your agent as an Alexa Skill. You can publish your skill to the Alexa Skill Store
- or use it in your own Alexa devices.
- </p>
-
{/* Dev URL */}
{devUrl && (
<>
@@ -220,4 +125,4 @@ const VoiceEmbodimentModal: React.FC<VoiceEmbodimentModalProps> = ({
);
};
-export default VoiceEmbodimentModal;
+export default AlexaEmbodimentModal;
diff --git a/packages/app/src/react/features/embodiments/embodiment-configs.tsx b/packages/app/src/react/features/embodiments/embodiment-configs.tsx
index 800d5eb6..aaf4782b 100644
--- a/packages/app/src/react/features/embodiments/embodiment-configs.tsx
+++ b/packages/app/src/react/features/embodiments/embodiment-configs.tsx
@@ -1,6 +1,7 @@
import { createPortal } from 'react-dom';
import { FaCommentDots, FaDiscord, FaGear, FaIdCard, FaRobot } from 'react-icons/fa6';
import {
+ AlexaIcon,
ChatGptIcon,
LovableIcon,
MCPIcon,
@@ -10,15 +11,17 @@ import { EMBODIMENT_TYPE } from '../../shared/enums';
import ChatBotDialog from '../agent-settings/dialogs/ChatBot';
import ChatGptDialog from '../agent-settings/dialogs/ChatGpt';
import FormPreviewDialog from '../agent-settings/dialogs/FormPreview';
-import VoiceEmbodimentModalWrapper from './alexa-embodiment-modal-wrapper';
+import AlexaEmbodimentModalWrapper from './alexa-embodiment-modal-wrapper';
import ChatbotEmbodimentModal from './chatbot-embodiment-modal';
import FormEmbodimentModal from './form-embodiment-modal';
import GptEmbodimentModal from './gpt-embodiment-modal';
+import VoiceEmbodimentModalWrapper from './voice-embodiment-modal-wrapper';
export const AlwaysAvailableEmbodiments = [
'API',
EMBODIMENT_TYPE.MCP,
EMBODIMENT_TYPE.ALEXA,
+ EMBODIMENT_TYPE.VOICE,
// TODO: Uncomment this when Ingrid provides the updated prompt for integration
// EMBODIMENT_TYPE.LOVABLE,
];
@@ -40,6 +43,8 @@ export const getEmbodimentIcon = (embodimentType: string, classes = ''): JSX.Ele
case EMBODIMENT_TYPE.LLM:
return <FaRobot className={classes} style={{ marginTop: '-3px' }} />;
case EMBODIMENT_TYPE.ALEXA:
+ return <AlexaIcon className={classes} />;
+ case EMBODIMENT_TYPE.VOICE:
return <VoiceEmbodimentIcon className={classes} />;
case EMBODIMENT_TYPE.LOVABLE:
return <LovableIcon className={classes} />;
@@ -57,6 +62,8 @@ export const getEmbodimentTitle = (embodimentType: string): string => {
case EMBODIMENT_TYPE.FORM:
return 'Form Preview';
case EMBODIMENT_TYPE.ALEXA:
+ return 'Alexa';
+ case EMBODIMENT_TYPE.VOICE:
return 'Voice';
default:
return embodimentType;
@@ -74,13 +81,15 @@ export const getEmbodimentDescription = (embodimentType: string): string => {
case EMBODIMENT_TYPE.MCP:
return 'Enable MCP Client to communicate with your agent.';
case EMBODIMENT_TYPE.ALEXA:
- return 'Enable Voice and Alexa to communicate with your agent.';
+ return 'Enable Alexa Skill to communicate with your agent.';
case EMBODIMENT_TYPE.LLM:
return 'Use your agent as an OpenAI-compatible API endpoint for seamless integration with existing LLM workflows.';
case EMBODIMENT_TYPE.FORM:
return 'Preview your agent as a form for seamless integration with existing workflows.';
case EMBODIMENT_TYPE.LOVABLE:
return 'Get step-by-step instructions to connect this agent or workflow to Lovable.';
+ case EMBODIMENT_TYPE.VOICE:
+ return 'Enable Voice to communicate with your agent for natural, real-time conversations.';
default:
return '';
}
@@ -104,6 +113,8 @@ export const getEmbodimentDataAttribute = (embodimentType: string): string => {
return 'form-embodiment-card';
case EMBODIMENT_TYPE.LOVABLE:
return 'lovable-embodiment-card';
+ case EMBODIMENT_TYPE.VOICE:
+ return 'voice-embodiment-card';
default:
return '';
}
@@ -183,6 +194,7 @@ export const getCodeSnippetModal = (
| EMBODIMENT_TYPE.FORM
| EMBODIMENT_TYPE.CHAT_BOT
| EMBODIMENT_TYPE.CHAT_GPT
+ | EMBODIMENT_TYPE.VOICE
| EMBODIMENT_TYPE.ALEXA,
isOpen: boolean,
closeModal: () => void,
@@ -225,10 +237,17 @@ export const getCodeSnippetModal = (
);
}
- if (embodimentType === EMBODIMENT_TYPE.ALEXA) {
+ if (embodimentType === EMBODIMENT_TYPE.VOICE) {
return createPortal(
<VoiceEmbodimentModalWrapper onClose={closeModal} domain={agent?.domain?.[0]?.name} />,
document.body,
);
}
+
+ if (embodimentType === EMBODIMENT_TYPE.ALEXA) {
+ return createPortal(
+ <AlexaEmbodimentModalWrapper onClose={closeModal} />,
+ document.body,
+ );
+ }
};
diff --git a/packages/app/src/react/features/embodiments/embodiment-helper.ts b/packages/app/src/react/features/embodiments/embodiment-helper.ts
index 8b93d921..e566ca15 100644
--- a/packages/app/src/react/features/embodiments/embodiment-helper.ts
+++ b/packages/app/src/react/features/embodiments/embodiment-helper.ts
@@ -154,6 +154,7 @@ export function structureAgentSetting(
(key === EMBODIMENT_TYPE.CHAT_BOT ||
key === EMBODIMENT_TYPE.FORM ||
key === EMBODIMENT_TYPE.CHAT_GPT ||
+ key === EMBODIMENT_TYPE.VOICE ||
key === EMBODIMENT_TYPE.ALEXA) &&
shouldCodeSnippetVisible(key, {
canUseEmbodiments: agentData.canUseEmbodiments,
@@ -188,6 +189,7 @@ const shouldCodeSnippetVisible = (
(embodimentType === EMBODIMENT_TYPE.CHAT_BOT ||
embodimentType === EMBODIMENT_TYPE.FORM ||
embodimentType === EMBODIMENT_TYPE.CHAT_GPT ||
+ embodimentType === EMBODIMENT_TYPE.VOICE ||
embodimentType === EMBODIMENT_TYPE.ALEXA) &&
agentData?.agentDeployed &&
agentData.canUseEmbodiments
@@ -206,6 +208,7 @@ const shouldConfigurationVisible = (
!agentData.isReadOnlyAccess &&
embodimentType.toLowerCase() !== EMBODIMENT_TYPE.API.toLocaleLowerCase() &&
embodimentType.toLowerCase() !== EMBODIMENT_TYPE.MCP.toLocaleLowerCase() &&
+ embodimentType.toLowerCase() !== EMBODIMENT_TYPE.VOICE.toLocaleLowerCase() &&
embodimentType.toLowerCase() !== EMBODIMENT_TYPE.ALEXA.toLocaleLowerCase() &&
// NOTE: TEMPORARY DISABLE CONFIGURATION FOR AGENT LLM
embodimentType.toLowerCase() !== EMBODIMENT_TYPE.LLM.toLocaleLowerCase()
diff --git a/packages/app/src/react/features/embodiments/post-deployment-modal.tsx b/packages/app/src/react/features/embodiments/post-deployment-modal.tsx
index 5a317a23..d7b5ff9f 100644
--- a/packages/app/src/react/features/embodiments/post-deployment-modal.tsx
+++ b/packages/app/src/react/features/embodiments/post-deployment-modal.tsx
@@ -65,6 +65,10 @@ interface Props {
* Called when the user requests to open the Voice panel.
*/
onOpenAlexaPanel: () => void;
+ /**
+ * Called when the user requests to open the Voice panel.
+ */
+ onOpenVoicePanel: () => void;
/**
* Called when the user requests to open the Chatbot panel.
*/
@@ -99,6 +103,7 @@ function PostDeploymentModal({
onOpenLlmModal,
onOpenCustomGptModal,
onOpenAlexaPanel,
+ onOpenVoicePanel,
onOpenChatbotPanel,
onOpenFormPanel,
onOpenApiPanel,
@@ -397,27 +402,14 @@ function PostDeploymentModal({
);
}
// Alexa
- else if (key === EMBODIMENT_TYPE.ALEXA) {
- if (setting.openModal) {
- buttons.push(
- <button
- key={'configuration-' + EMBODIMENT_TYPE.ALEXA}
- className="flex items-center px-2 py-1 h-8 text-xl text-blue-600 hover:bg-smythos-blue-500 hover:text-white rounded"
- onClick={() => setting.openModal()}
- type="button"
- aria-label="Configuration"
- >
- <FaSliders />
- </button>,
- );
- }
+ else if (key === EMBODIMENT_TYPE.ALEXA || key === EMBODIMENT_TYPE.VOICE) {
buttons.push(
<Button
- key={'get-endpoints-' + EMBODIMENT_TYPE.ALEXA}
+ key={'get-endpoints-' + key}
label="Get Endpoints"
variant="tertiary"
className="px-3 py-1 h-8 text-xs"
- handleClick={onOpenAlexaPanel}
+ handleClick={key === EMBODIMENT_TYPE.ALEXA ? onOpenAlexaPanel : onOpenVoicePanel}
aria-label="Get Endpoints"
type="button"
/>,
@@ -449,9 +441,8 @@ function PostDeploymentModal({
return (
<div
- className={`relative bg-white rounded-2xl shadow-lg w-full p-6 flex flex-col gap-4 max-h-[90vh] max-w-[480px] ${
- !isVisible ? 'hidden' : ''
- }`}
+ className={`relative bg-white rounded-2xl shadow-lg w-full p-6 flex flex-col gap-4 max-h-[90vh] max-w-[480px] ${!isVisible ? 'hidden' : ''
+ }`}
style={{
boxShadow: '0 4px 32px 0 rgba(0,0,0,0.10)',
borderRadius: '20px',
@@ -480,9 +471,8 @@ function PostDeploymentModal({
<div
key={setting.key}
data-qa={getEmbodimentLocator(setting.key)}
- className={`flex items-center justify-between bg-white rounded-lg px-2 py-2 ${
- !isSettingEnabled ? 'opacity-80' : ''
- }`}
+ className={`flex items-center justify-between bg-white rounded-lg px-2 py-2 ${!isSettingEnabled ? 'opacity-80' : ''
+ }`}
>
<div className="flex items-center gap-3">
{/* Icon */}
diff --git a/packages/app/src/react/features/embodiments/voice-embodiment-modal-wrapper.tsx b/packages/app/src/react/features/embodiments/voice-embodiment-modal-wrapper.tsx
new file mode 100644
index 00000000..1acb2dc2
--- /dev/null
+++ b/packages/app/src/react/features/embodiments/voice-embodiment-modal-wrapper.tsx
@@ -0,0 +1,39 @@
+import { useEffect, useState } from 'react';
+import { useAgentSettingsCtx } from '../agent-settings/contexts/agent-settings.context';
+import VoiceEmbodimentModal from './voice-embodiment-modal';
+
+const VoiceEmbodimentModalWrapper = ({
+ onClose,
+ domain,
+}: {
+ onClose: () => void;
+ domain: string;
+}) => {
+ const { workspace, agentId, serverStatusData } = useAgentSettingsCtx();
+
+ const [agentDomains, setAgentDomains] = useState({
+ dev: null,
+ prod: null,
+ scheme: 'https',
+ });
+
+ useEffect(() => {
+ // Fallback to workspace and server data
+ if (agentId && (serverStatusData || workspace)) {
+ const devDomain = `${agentId}.${serverStatusData.agent_domain}`;
+ const prodDomain =
+ workspace?.agent?.domain || `${agentId}.${serverStatusData.prod_agent_domain}`;
+ const scheme = serverStatusData.agent_domain?.includes(':') ? 'http' : 'https';
+
+ setAgentDomains({
+ dev: devDomain,
+ prod: prodDomain,
+ scheme: scheme,
+ });
+ }
+ }, [workspace, agentId, serverStatusData]);
+
+ return <VoiceEmbodimentModal onClose={onClose} agentDomains={agentDomains} />;
+};
+
+export default VoiceEmbodimentModalWrapper;
diff --git a/packages/app/src/react/features/embodiments/voice-embodiment-modal.tsx b/packages/app/src/react/features/embodiments/voice-embodiment-modal.tsx
new file mode 100644
index 00000000..113088fa
--- /dev/null
+++ b/packages/app/src/react/features/embodiments/voice-embodiment-modal.tsx
@@ -0,0 +1,150 @@
+import { builderStore } from '@src/shared/state_stores/builder/store';
+import { ArrowRightIcon } from 'lucide-react';
+import React, { useState } from 'react';
+import { CheckIcon, CopyIcon } from '../../shared/components/svgs';
+import ModalHeaderEmbodiment from './modal-header-embodiment';
+
+/**
+ * Props for the VoiceEmbodimentModal component.
+ */
+interface VoiceEmbodimentModalProps {
+ /**
+ * Callback to close the modal (also used for back button).
+ */
+ onClose: () => void;
+ /**
+ * Agent domains for the Voice integration.
+ */
+ agentDomains?: {
+ dev: string;
+ prod: string;
+ scheme: string;
+ };
+}
+
+/**
+ * Voice Integration Modal for showing step-by-step instructions and Dev/Prod URLs.
+ * Matches the design and UX of Custom GPT Modal.
+ *
+ * @param {VoiceEmbodimentModalProps} props - The component props.
+ * @returns {JSX.Element} The rendered modal.
+ */
+const VoiceEmbodimentModal: React.FC<VoiceEmbodimentModalProps> = ({
+ onClose,
+ agentDomains,
+}) => {
+ const [copied, setCopied] = useState({
+ voice: false,
+ });
+
+ // Get agent domains and scheme from builderStore
+ const {
+ dev: devDomain,
+ prod: prodDomain,
+ scheme,
+ } = agentDomains || builderStore.getState().agentDomains;
+
+ const voiceDevUrl = devDomain && scheme ? `${scheme}://${devDomain}` : '';
+ const voiceProdUrl = prodDomain && scheme ? `${scheme}://${prodDomain}` : '';
+
+ /**
+ * Copies the given text to clipboard.
+ * @param {string} text - The text to copy.
+ */
+ const handleCopy = (text: string, type: 'voice'): void => {
+ setCopied({ ...copied, [type]: true });
+ void navigator.clipboard.writeText(text);
+ setTimeout(() => {
+ setCopied({ ...copied, [type]: false });
+ }, 2000);
+ };
+
+ /**
+ * Ensures domain has proper protocol prefix.
+ * @param {string} domain - The domain to format.
+ * @returns {string} The formatted domain with protocol.
+ */
+ const getFullDomain = (domain: string): string => {
+ // Check if the domain already includes http:// or https://
+ if (!/^https?:\/\//i.test(domain)) {
+ // Assume HTTPS by default
+ return `https://${domain}`;
+ }
+ return domain;
+ };
+
+ const codeSnippet = `<script src="${getFullDomain(voiceProdUrl || voiceDevUrl)}/static/embodiment/voice/voice-embodiment-minified.js">
+ </script>
+ <script>
+ VoiceEmbodiment.init({
+ domain: '${voiceProdUrl || voiceDevUrl}?type=widget',
+ });
+ </script>`;
+
+ return (
+ <div className="fixed inset-0 bg-black/25 flex items-center justify-center z-50">
+ <div className="relative bg-white rounded-2xl shadow-lg w-full p-6 flex flex-col overflow-auto max-h-[90vh] max-w-[480px]">
+ {/* Header with back and close buttons */}
+ <ModalHeaderEmbodiment
+ title="Voice Integration"
+ onBack={onClose}
+ onClose={onClose}
+ />
+
+ {codeSnippet && (
+ <>
+ <div className="flex items-center justify-between mt-4">
+ <label className="block text-base font-semibold text-gray-700">
+ Voice Integration
+ </label>
+ <a
+ href={`${voiceProdUrl || voiceDevUrl}/emb/voice`}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="inline-flex items-center gap-1 text-[13px] text-[#707070]"
+ >
+ Preview <ArrowRightIcon className="w-4 h-4" />
+ </a>
+ </div>
+ <div className="bg-amber-50 border border-amber-200 rounded-md p-3 my-2 mb-4">
+ <p className="text-amber-800 text-xs">
+ <strong>Note:</strong> To use voice embodiment, you need to provide personal OpenAI
+ API key via{' '}
+ <a href="/vault" target="_blank" rel="noopener noreferrer" className="underline">
+ Vault
+ </a>
+ .
+ </p>
+ </div>
+ <label htmlFor="code-snippet" className="text-sm text-gray-900">
+ Code Snippet
+ </label>
+ <p className="text-sm text-gray-700 my-2">
+ To integrate voice embodiment, copy and paste this snippet into your website before
+ the closing <code>&lt;/body&gt;</code> tag.
+ </p>
+ <div className="relative flex items-center mt-1 group w-full">
+ <textarea
+ id="code-snippet"
+ readOnly
+ className="w-full h-72 p-3 text-sm text-[#707070] bg-white rounded-lg border border-gray-200 font-mono resize-none focus:outline-none focus:border-b-2 focus:border-b-blue-500 transition-colors"
+ value={codeSnippet}
+ />
+ <button
+ type="button"
+ aria-label="Copy Voice Integration"
+ onClick={() => handleCopy(codeSnippet, 'voice')}
+ className={`absolute right-2 top-2 opacity-0 group-hover:opacity-100 transition-opacity bg-white p-1 ${copied.voice ? 'opacity-100' : ''}`}
+ tabIndex={-1}
+ >
+ {copied.voice ? <CheckIcon fill="#222" /> : <CopyIcon color="#222" />}
+ </button>
+ </div>
+ </>
+ )}
+ </div>
+ </div>
+ );
+};
+
+export default VoiceEmbodimentModal;
diff --git a/packages/app/src/react/shared/enums/index.ts b/packages/app/src/react/shared/enums/index.ts
index 86d2cf1b..170be2e9 100644
--- a/packages/app/src/react/shared/enums/index.ts
+++ b/packages/app/src/react/shared/enums/index.ts
@@ -25,6 +25,7 @@ export enum EMBODIMENT_TYPE {
LLM = 'llm', // Add this line
ALEXA = 'alexa',
LOVABLE = 'lovable',
+ VOICE = 'voice',
}
export enum DEFAULT_CHAT_COLORS {