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.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
refactor: remove Voice dialog and associated domain handling
Muhammad Hamza Khana1f059730667
diff --git a/packages/app/src/react/features/agent-settings/dialogs/ChatBot.tsx b/packages/app/src/react/features/agent-settings/dialogs/ChatBot.tsxindex d28a34ed..1a3e21d4 100644--- a/packages/app/src/react/features/agent-settings/dialogs/ChatBot.tsx+++ b/packages/app/src/react/features/agent-settings/dialogs/ChatBot.tsx@@ -26,7 +26,6 @@ import { EMBODIMENT_TYPE } from '@react/shared/enums';import { Agent } from '@react/shared/types/agent-data.types';import { extractError } from '@react/shared/utils/errors';import { cn, validateDomains, validateURL } from '@react/shared/utils/utils';-import { Tooltip, TooltipContent, TooltipTrigger } from '@src/react/shared/components/ui/tooltip';import { ChatbotEmbodimentData } from '@src/react/shared/types/api-results.types';import { errorToast, successToast, warningToast } from '@src/shared/components/toast';import { Observability } from '@src/shared/observability';@@ -412,85 +411,6 @@ const ChatBotDialog = ({className="text-red-500 text-sm"/></div>- {/* ALLOWED DOMAINS START */}- <div>- <label- htmlFor="allowedDomains"- className="text-[#1E1E1E] mb-1 text-base font-normal flex items-center"- >- Allowed Domains{' '}- <Tooltip>- <TooltipTrigger asChild>- <Info className="w-5 h-5 ml-1" />- </TooltipTrigger>- <TooltipContent className="max-w-[240px] text-center text-wrap">- <div>- Restrict chatbot to specific domains.- <br /> Use commas to separate multiple domains (e.g.,- example.com, mysite.org).- </div>- </TooltipContent>- </Tooltip>- </label>-- <Field- type="text"- id="allowedDomains"- className={`bg-white- border- text-gray-900- rounded- block- w-full- outline-none- focus:outline-none- focus:ring-0- focus:ring-offset-0- focus:ring-shadow-none- text-sm- font-normal- placeholder:text-sm- placeholder:font-normal- mb-4- border-gray-300 border-b-gray-500 focus:border-b-2 focus:border-b-blue-500 focus-visible:border-b-2 focus-visible:border-b-blue-500 ${- domainError- ? 'border-red-500 text-red-900 placeholder-red-700 focus:border-red-500 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500'- : ''- }`}- name="allowedDomains"- placeholder="Enter comma separated values for domains"- value={- Array.isArray(props.values?.allowedDomains)- ? props.values.allowedDomains.join(',')- : props.values?.allowedDomains || ''- }- onChange={(e) => {- if (domainError) {- setDomainError(false);- }- const newValue = e.target.value- ? e.target.value.split(',')- : [];- props.setFieldValue('allowedDomains', newValue);- }}- />-- {domainError && (- <p className="mb-2 text-sm text-red-600 dark:text-red-500">- <span className="font-medium">- One or more domains are invalid. Make sure there is no- trailing comma.- </span>- </p>- )}-- <ErrorMessage- name="allowedDomains"- component="div"- className="text-red-500 text-sm mb-2"- />- </div>- {/* ALLOWED DOMAINS END */}<div className="mb-4"><labeldiff --git a/packages/app/src/react/features/agent-settings/dialogs/FormPreview.tsx b/packages/app/src/react/features/agent-settings/dialogs/FormPreview.tsxindex dd256da0..a80da1df 100644--- a/packages/app/src/react/features/agent-settings/dialogs/FormPreview.tsx+++ b/packages/app/src/react/features/agent-settings/dialogs/FormPreview.tsx@@ -201,84 +201,6 @@ const FormPreviewDialog = ({/></div>- {/* ALLOWED DOMAINS START */}- <div>- <label- htmlFor="allowedDomains"- className="text-[#1E1E1E] mb-1 text-base font-normal flex items-center"- >- Allowed Domains{' '}- <Tooltip>- <TooltipTrigger asChild>- <Info className="w-5 h-5 ml-1 cursor-pointer" />- </TooltipTrigger>- <TooltipContent className="max-w-[240px] text-center text-wrap">- <div>- Restrict form preview to specific domains.- <br /> Use commas to separate multiple domains (e.g.,- example.com, mysite.org).- </div>- </TooltipContent>- </Tooltip>- </label>-- <Field- type="text"- id="allowedDomains"- className={`bg-white- border- text-gray-900- rounded- block- w-full- outline-none- focus:outline-none- focus:ring-0- focus:ring-offset-0- focus:ring-shadow-none- text-sm- font-normal- placeholder:text-sm- placeholder:font-normal- mb-4- border-gray-300 border-b-gray-500 focus:border-b-2 focus:border-b-blue-500 focus-visible:border-b-2 focus-visible:border-b-blue-500 ${- domainError- ? 'border-red-500 text-red-900 placeholder-red-700 focus:border-red-500 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500'- : ''- }`}- name="allowedDomains"- placeholder="Enter comma separated values for domains"- value={- Array.isArray(props.values?.allowedDomains)- ? props.values.allowedDomains.join(',')- : props.values?.allowedDomains || ''- }- onChange={(e) => {- if (domainError) {- setDomainError(false);- }- const newValue = e.target.value ? e.target.value.split(',') : [];- props.setFieldValue('allowedDomains', newValue);- }}- />-- {domainError && (- <p className="mb-2 text-sm text-red-600 dark:text-red-500">- <span className="font-medium">- One or more domains are invalid. Make sure there is no trailing- comma.- </span>- </p>- )}-- <ErrorMessage- name="allowedDomains"- component="div"- className="text-red-500 text-sm mb-2"- />- </div>- {/* ALLOWED DOMAINS END */}-{/* OUTPUT PREVIEW START */}<div className="flex items-center justify-between"><labeldiff --git a/packages/app/src/react/features/agent-settings/dialogs/Voice.tsx b/packages/app/src/react/features/agent-settings/dialogs/Voice.tsxdeleted file mode 100644index 53d4a8c2..00000000--- a/packages/app/src/react/features/agent-settings/dialogs/Voice.tsx+++ /dev/null@@ -1,305 +0,0 @@-import { Dialog, Transition } from '@headlessui/react';-import { mapVoiceEmbodimentProperties } from '@react/features/agent-settings/utils';-import { Button } from '@react/shared/components/ui/newDesign/button';-import { Spinner } from '@react/shared/components/ui/spinner';-import { Tooltip, TooltipContent, TooltipTrigger } from '@react/shared/components/ui/tooltip';-import { EMBODIMENT_TYPE } from '@react/shared/enums';-import { TVoiceProperties } from '@react/shared/types/embodiment.types';-import { extractError } from '@react/shared/utils/errors';-import { validateDomains, validateURL } from '@react/shared/utils/utils';-import { CloseIcon } from '@src/react/shared/components/svgs';-import { Agent } from '@src/react/shared/types/agent-data.types';-import { VoiceEmbodimentData } from '@src/react/shared/types/api-results.types';-import { errorToast, successToast, warningToast } from '@src/shared/components/toast';-import { useQueryClient } from '@tanstack/react-query';-import { ErrorMessage, Field, Form, Formik, FormikProps } from 'formik';-import { Info } from 'lucide-react';-import { Fragment, useEffect, useState } from 'react';-import { saveEmbodiment } from '../clients';--interface IVoiceDialogProps {- isOpen: boolean;- closeModal: () => void;- currentData: { id: string; properties: TVoiceProperties };- activeAgent: Agent;- agentId: string;-}--const VoiceDialog = ({- isOpen,- closeModal,- currentData,- activeAgent,- agentId,-}: IVoiceDialogProps) => {- const [activeData, setActiveData] = useState(null);- const [isSubmitting, setIsSubmitting] = useState(false);- const [domainError, setDomainError] = useState(false);- const queryClient = useQueryClient();-- // Default values to prevent uncontrolled to controlled input warning- const defaultFormValues = {- name: '',- allowedDomains: [],- };-- useEffect(() => {- const properties = currentData?.properties;- const _activeData = mapVoiceEmbodimentProperties(properties, activeAgent);-- setActiveData(_activeData);- }, [currentData, activeAgent]);-- const submitForm = async (data) => {- if (isSubmitting) {- return; // If submission is already in progress, do nothing- }-- if (data.allowedDomains?.filter((domain) => domain)?.length > 0) {- const hasInvalidDomains = !validateDomains(data.allowedDomains);-- if (hasInvalidDomains) {- setDomainError(true);- return;- }- }-- if (data.icon && !validateURL(data.icon)) {- warningToast('The URL entered for icon does not appear to be valid.');- }-- try {- setIsSubmitting(true); // Set the flag to true to indicate that submission is in progress- const dataToSend = {- type: EMBODIMENT_TYPE.ALEXA,- properties: {- ...data,- allowedDomains: data?.allowedDomains- ?.filter((domain) => domain && domain.trim() !== '')- ?.map((item) => item.trim()),- },- };-- try {- await saveEmbodiment(- currentData ? 'PUT' : 'POST',- currentData- ? { ...dataToSend, embodimentId: currentData?.id }- : { ...dataToSend, aiAgentId: agentId },- );- // Invalidate the agentEmbodiments query to ensure fresh data- queryClient.invalidateQueries({ queryKey: ['agentEmbodiments', agentId] });- // Also invalidate the embodiments query used in deploy modal- queryClient.invalidateQueries({ queryKey: ['embodiments', agentId] });- // Invalidate the agent_embodiments query used in OverviewWidgetsContainer- queryClient.invalidateQueries({ queryKey: ['agent_embodiments', agentId] });- // Invalidate the availableEmbodiments query- queryClient.invalidateQueries({ queryKey: ['availableEmbodiments', agentId] });-- successToast('Embodiment saved');- closeModal();- } catch (error) {- errorToast(extractError(error) || 'Embodiment not saved. Please try again.');- }-- setIsSubmitting(false); // Reset the flag after submission is complete- } catch (error) {- console.error('Error:', error);- }- };-- return (- <Transition appear show={isOpen} as={Fragment}>- <Dialog as="div" className="relative z-50" onClose={closeModal}>- <Transition.Child- as={Fragment}- enter="ease-out duration-300"- enterFrom="opacity-0"- enterTo="opacity-100"- leave="ease-in duration-200"- leaveFrom="opacity-100"- leaveTo="opacity-0"- >- <div className="fixed inset-0 bg-black bg-opacity-25" />- </Transition.Child>-- <div className="fixed inset-0 overflow-y-auto">- <div className="flex min-h-full items-center justify-center p-4 text-center">- <Transition.Child- as={Fragment}- enter="ease-out duration-300"- enterFrom="opacity-0 scale-95"- enterTo="opacity-100 scale-100"- leave="ease-in duration-200"- leaveFrom="opacity-100 scale-100"- leaveTo="opacity-0 scale-95"- >- <div className="w-[80vw] max-w-[600px]">- <Dialog.Panel className="w-full relative transform overflow-hidden rounded-xl bg-white p-6 text-left align-middle shadow-xl transition-all">- <Dialog.Title className="text-xl font-semibold leading-6 text-[#1E1E1E] mb-4 flex justify-between items-center">- <span>Voice Configuration</span>- <div- className="cursor-pointer w-8 h-8 bg-transparent rounded-lg hover:text-gray-900 hover:bg-gray-100 p-2 -mr-2 -mt-2"- onClick={() => closeModal()}- >- <CloseIcon width={16} height={16} />- </div>- </Dialog.Title>- <Formik- initialValues={activeData || defaultFormValues}- enableReinitialize={true}- // validate={(values) => validateForm(values)}- onSubmit={(values) => {- submitForm(values);- }}- >- {(props: FormikProps<VoiceEmbodimentData>) => {- return (- <Form>- <div className="mt-5 space-y-4">- <div>- <label- htmlFor="name"- className="block text-[#1E1E1E] mb-1 text-base font-normal"- >- Name- </label>- <Field- type="text"- className="bg-white- border- text-gray-900- rounded- block- w-full- outline-none- focus:outline-none- focus:ring-0- focus:ring-offset-0- focus:ring-shadow-none- text-sm- font-normal- placeholder:text-sm- placeholder:font-normal- mb-4- border-gray-300 border-b-gray-500 focus:border-b-2 focus:border-b-blue-500 focus-visible:border-b-2 focus-visible:border-b-blue-500"- name="name"- id="name"- onChange={props.handleChange}- onBlur={props.handleBlur}- value={props.values?.name}- placeholder="Enter voice name"- disabled={true}- />- <ErrorMessage- name="name"- component="div"- className="text-red-500 text-sm"- />- </div>-- {/* ALLOWED DOMAINS START */}- <div>- <label- htmlFor="allowedDomains"- className="text-[#1E1E1E] mb-1 text-base font-normal flex items-center"- >- Allowed Domains{' '}- <Tooltip>- <TooltipTrigger asChild>- <Info className="w-5 h-5 ml-1 cursor-pointer" />- </TooltipTrigger>- <TooltipContent className="max-w-[240px] text-center text-wrap">- <div>- Restrict voice to specific domains.- <br /> Use commas to separate multiple domains (e.g.,- example.com, mysite.org).- </div>- </TooltipContent>- </Tooltip>- </label>-- <Field- type="text"- id="allowedDomains"- className={`bg-white- border- text-gray-900- rounded- block- w-full- outline-none- focus:outline-none- focus:ring-0- focus:ring-offset-0- focus:ring-shadow-none- text-sm- font-normal- placeholder:text-sm- placeholder:font-normal- mb-4- border-gray-300 border-b-gray-500 focus:border-b-2 focus:border-b-blue-500 focus-visible:border-b-2 focus-visible:border-b-blue-500 ${- domainError- ? 'border-red-500 text-red-900 placeholder-red-700 focus:border-red-500 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500'- : ''- }`}- name="allowedDomains"- placeholder="Enter comma separated values for domains"- value={- Array.isArray(props.values?.allowedDomains)- ? props.values.allowedDomains.join(',')- : props.values?.allowedDomains || ''- }- onChange={(e) => {- if (domainError) {- setDomainError(false);- }- const newValue = e.target.value ? e.target.value.split(',') : [];- props.setFieldValue('allowedDomains', newValue);- }}- />-- {domainError && (- <p className="mb-2 text-sm text-red-600 dark:text-red-500">- <span className="font-medium">- One or more domains are invalid. Make sure there is no trailing- comma.- </span>- </p>- )}-- <ErrorMessage- name="allowedDomains"- component="div"- className="text-red-500 text-sm mb-2"- />- </div>- {/* ALLOWED DOMAINS END */}- </div>-- <div className="flex justify-end w-full mt-4">- <Button- handleClick={() => submitForm(props.values)}- label="Save"- addIcon={isSubmitting}- Icon={<Spinner classes="w-4 h-4 mr-2" />}- disabled={isSubmitting}- type="submit"- className="px-8 rounded-sm"- />- </div>- </Form>- );- }}- </Formik>- </Dialog.Panel>- </div>- </Transition.Child>- </div>- </div>- </Dialog>- </Transition>- );-};--export default VoiceDialog;diff --git a/packages/app/src/react/features/agent-settings/utils/index.ts b/packages/app/src/react/features/agent-settings/utils/index.tsindex cf097872..dbb38c39 100644--- a/packages/app/src/react/features/agent-settings/utils/index.ts+++ b/packages/app/src/react/features/agent-settings/utils/index.ts@@ -4,8 +4,7 @@ import { Input } from '@react/shared/types/agent-data.types';import {TChatBotProperties,TFormPreviewProperties,- TGptEmbodimentProperties,- TVoiceProperties,+ TGptEmbodimentProperties} from '@react/shared/types/embodiment.types';import * as Yup from 'yup';@@ -136,13 +135,6 @@ export const mapFormPreviewEmbodimentProperties = (};};-export const mapVoiceEmbodimentProperties = (properties: TVoiceProperties, activeAgent) => {- return {- name: properties?.name || activeAgent?.name || '',- allowedDomains: properties?.allowedDomains || [],- };-};-export const mapGptEmbodimentProperties = (properties: TGptEmbodimentProperties, activeAgent) => {return {humanName: properties?.humanName || activeAgent?.name || '',diff --git a/packages/app/src/react/features/embodiments/embodiment-configs.tsx b/packages/app/src/react/features/embodiments/embodiment-configs.tsxindex 46c29de3..800d5eb6 100644--- a/packages/app/src/react/features/embodiments/embodiment-configs.tsx+++ b/packages/app/src/react/features/embodiments/embodiment-configs.tsx@@ -10,7 +10,6 @@ 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 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';@@ -179,26 +178,6 @@ export const getFormPreviewDialog = ();};-export const getVoiceDialog = (- isOpen: boolean,- closeModal: () => void,- agent,- agentId,- currentData,-) => {- // Always render the component for preloading, HeadlessUI Transition handles visibility- // This ensures the component is initialized and ready when the user opens it- return (- <VoiceDialog- isOpen={isOpen}- closeModal={closeModal}- activeAgent={agent}- agentId={agentId}- currentData={currentData}- />- );-};-export const getCodeSnippetModal = (embodimentType:| EMBODIMENT_TYPE.FORMdiff --git a/packages/app/src/react/features/embodiments/embodiment-helper.ts b/packages/app/src/react/features/embodiments/embodiment-helper.tsindex d7125e56..8b93d921 100644--- a/packages/app/src/react/features/embodiments/embodiment-helper.ts+++ b/packages/app/src/react/features/embodiments/embodiment-helper.ts@@ -12,8 +12,7 @@ import {getEmbodimentDescription,getEmbodimentIcon,getEmbodimentTitle,- getFormPreviewDialog,- getVoiceDialog,+ getFormPreviewDialog} from './embodiment-configs';type AgentSetting = {@@ -149,18 +148,6 @@ export function structureAgentSetting();}- if (key === EMBODIMENT_TYPE.ALEXA) {- result.dialogComponent = getVoiceDialog(- modalHandlers.activeModal === key, // Pass visibility state- modalHandlers.closeModal,- modalHandlers.agent,- agentData.agentId,- modalHandlers.embodimentsData?.find(- (e) => e.aiAgentId === agentData.agentId && e.type === EMBODIMENT_TYPE.ALEXA,- ),- );- }-// Add code snippet modal for chat bot (preload when it should be visible)// Note: iframe-based components are conditionally rendered to allow reload as requestedif (@@ -219,6 +206,7 @@ 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 LLMembodimentType.toLowerCase() !== EMBODIMENT_TYPE.LLM.toLocaleLowerCase());diff --git a/packages/app/src/react/shared/types/api-results.types.ts b/packages/app/src/react/shared/types/api-results.types.tsindex 1db40e7a..90a9040e 100644--- a/packages/app/src/react/shared/types/api-results.types.ts+++ b/packages/app/src/react/shared/types/api-results.types.ts@@ -85,11 +85,6 @@ export interface FormPreviewEmbodimentData {outputPreview: boolean;}-export interface VoiceEmbodimentData {- name: string;- allowedDomains: string[];-}-export interface ChatbotEmbodimentData {name: string;introMessage: string;diff --git a/packages/app/src/react/shared/types/embodiment.types.ts b/packages/app/src/react/shared/types/embodiment.types.tsindex 1bfae874..fd09aaf1 100644--- a/packages/app/src/react/shared/types/embodiment.types.ts+++ b/packages/app/src/react/shared/types/embodiment.types.ts@@ -42,11 +42,6 @@ export type TFormPreviewProperties = {outputPreview: boolean;};-export type TVoiceProperties = {- name: string;- allowedDomains: string[];-};-export type TGptEmbodimentProperties = {humanName: string;modelName: string;