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.

Add AlexaEmbodimentModalWrapper and update VoiceEmbodimentModal to support agent domains

Muhammad Hamza Khan2521fc38d4ce
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
new file mode 100644
index 00000000..a3277081
--- /dev/null
+++ b/packages/app/src/react/features/embodiments/alexa-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 './alexa-embodiment-modal';
+
+const AlexaEmbodimentModalWrapper = ({
+ 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} domain={domain} 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 e6eb6291..2d750e73 100644
--- a/packages/app/src/react/features/embodiments/alexa-embodiment-modal.tsx
+++ b/packages/app/src/react/features/embodiments/alexa-embodiment-modal.tsx
@@ -17,6 +17,14 @@ interface VoiceEmbodimentModalProps {
* Domain for the Voice integration.
*/
domain: string;
+ /**
+ * Agent domains for the Voice integration.
+ */
+ agentDomains?: {
+ dev: string;
+ prod: string;
+ scheme: string;
+ };
}
/**
@@ -29,6 +37,7 @@ interface VoiceEmbodimentModalProps {
const VoiceEmbodimentModal: React.FC<VoiceEmbodimentModalProps> = ({
onClose,
domain = 'your-domain.com',
+ agentDomains,
}) => {
const [copied, setCopied] = useState({
voice: false,
@@ -37,7 +46,11 @@ const VoiceEmbodimentModal: React.FC<VoiceEmbodimentModalProps> = ({
});
// Get agent domains and scheme from builderStore
- const { dev: devDomain, prod: prodDomain, scheme } = builderStore.getState().agentDomains;
+ const {
+ dev: devDomain,
+ prod: prodDomain,
+ scheme,
+ } = agentDomains || builderStore.getState().agentDomains;
// Calculate Dev and Prod URLs (same pattern as agent-settings)
const devUrl = devDomain && scheme ? `${scheme}://${devDomain}/alexa` : '';
diff --git a/packages/app/src/react/features/embodiments/embodiment-configs.tsx b/packages/app/src/react/features/embodiments/embodiment-configs.tsx
index 9083f2f8..46c29de3 100644
--- a/packages/app/src/react/features/embodiments/embodiment-configs.tsx
+++ b/packages/app/src/react/features/embodiments/embodiment-configs.tsx
@@ -11,6 +11,7 @@ import ChatBotDialog from '../agent-settings/dialogs/ChatBot';
import ChatGptDialog from '../agent-settings/dialogs/ChatGpt';
import FormPreviewDialog from '../agent-settings/dialogs/FormPreview';
import VoiceDialog from '../agent-settings/dialogs/Voice';
+import VoiceEmbodimentModalWrapper from './alexa-embodiment-modal-wrapper';
import ChatbotEmbodimentModal from './chatbot-embodiment-modal';
import FormEmbodimentModal from './form-embodiment-modal';
import GptEmbodimentModal from './gpt-embodiment-modal';
@@ -199,7 +200,11 @@ export const getVoiceDialog = (
};
export const getCodeSnippetModal = (
- embodimentType: EMBODIMENT_TYPE.FORM | EMBODIMENT_TYPE.CHAT_BOT | EMBODIMENT_TYPE.CHAT_GPT,
+ embodimentType:
+ | EMBODIMENT_TYPE.FORM
+ | EMBODIMENT_TYPE.CHAT_BOT
+ | EMBODIMENT_TYPE.CHAT_GPT
+ | EMBODIMENT_TYPE.ALEXA,
isOpen: boolean,
closeModal: () => void,
agent,
@@ -240,4 +245,11 @@ export const getCodeSnippetModal = (
document.body,
);
}
+
+ if (embodimentType === EMBODIMENT_TYPE.ALEXA) {
+ return createPortal(
+ <VoiceEmbodimentModalWrapper onClose={closeModal} domain={agent?.domain?.[0]?.name} />,
+ 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 2cc4c055..a0482fa9 100644
--- a/packages/app/src/react/features/embodiments/embodiment-helper.ts
+++ b/packages/app/src/react/features/embodiments/embodiment-helper.ts
@@ -174,7 +174,8 @@ export function structureAgentSetting(
if (
(key === EMBODIMENT_TYPE.CHAT_BOT ||
key === EMBODIMENT_TYPE.FORM ||
- key === EMBODIMENT_TYPE.CHAT_GPT) &&
+ key === EMBODIMENT_TYPE.CHAT_GPT ||
+ key === EMBODIMENT_TYPE.ALEXA) &&
shouldCodeSnippetVisible(key, {
canUseEmbodiments: agentData.canUseEmbodiments,
isReadOnlyAccess: agentData.isReadOnlyAccess,
@@ -207,7 +208,8 @@ const shouldCodeSnippetVisible = (
return (
(embodimentType === EMBODIMENT_TYPE.CHAT_BOT ||
embodimentType === EMBODIMENT_TYPE.FORM ||
- embodimentType === EMBODIMENT_TYPE.CHAT_GPT) &&
+ embodimentType === EMBODIMENT_TYPE.CHAT_GPT ||
+ embodimentType === EMBODIMENT_TYPE.ALEXA) &&
agentData?.agentDeployed &&
agentData.canUseEmbodiments
);
@@ -225,7 +227,6 @@ const shouldConfigurationVisible = (
!agentData.isReadOnlyAccess &&
embodimentType.toLowerCase() !== EMBODIMENT_TYPE.API.toLocaleLowerCase() &&
embodimentType.toLowerCase() !== EMBODIMENT_TYPE.MCP.toLocaleLowerCase() &&
- embodimentType.toLowerCase() !== EMBODIMENT_TYPE.ALEXA.toLocaleLowerCase() &&
// NOTE: TEMPORARY DISABLE CONFIGURATION FOR AGENT LLM
embodimentType.toLowerCase() !== EMBODIMENT_TYPE.LLM.toLocaleLowerCase()
);