@@ -32,6 +32,7 @@ import { Skeleton } from '@/components/ui/skeleton'
3232import { Textarea } from '@/components/ui/textarea'
3333import { createLogger } from '@/lib/logs/console-logger'
3434import { cn } from '@/lib/utils'
35+ import { getBaseDomain } from '@/lib/urls/utils'
3536import { useNotificationStore } from '@/stores/notifications/store'
3637import { OutputSelect } from '@/app/w/[id]/components/panel/components/chat/components/output-select/output-select'
3738import { OutputConfig } from '@/stores/panel/chat/types'
@@ -54,6 +55,11 @@ type AuthType = 'public' | 'password' | 'email'
5455
5556const isDevelopment = process . env . NODE_ENV === 'development'
5657
58+ const getDomainSuffix = ( ( ) => {
59+ const suffix = isDevelopment ? `.${ getBaseDomain ( ) } ` : '.simstudio.ai'
60+ return ( ) => suffix
61+ } ) ( )
62+
5763// Define Zod schema for API request validation
5864const chatSchema = z . object ( {
5965 workflowId : z . string ( ) . min ( 1 , 'Workflow ID is required' ) ,
@@ -810,11 +816,20 @@ export function ChatDeploy({
810816 }
811817
812818 if ( deployedChatUrl ) {
813- // Extract just the subdomain from the URL
814819 const url = new URL ( deployedChatUrl )
815820 const hostname = url . hostname
816821 const isDevelopmentUrl = hostname . includes ( 'localhost' )
817- const domainSuffix = isDevelopmentUrl ? '.localhost:3000' : '.simstudio.ai'
822+
823+ let domainSuffix
824+ if ( isDevelopmentUrl ) {
825+ const baseDomain = getBaseDomain ( )
826+ const baseHost = baseDomain . split ( ':' ) [ 0 ]
827+ const port = url . port || ( baseDomain . includes ( ':' ) ? baseDomain . split ( ':' ) [ 1 ] : '3000' )
828+ domainSuffix = `.${ baseHost } :${ port } `
829+ } else {
830+ domainSuffix = '.simstudio.ai'
831+ }
832+
818833 const subdomainPart = isDevelopmentUrl
819834 ? hostname . split ( '.' ) [ 0 ]
820835 : hostname . split ( '.simstudio.ai' ) [ 0 ]
@@ -911,7 +926,7 @@ export function ChatDeploy({
911926 disabled = { isDeploying }
912927 />
913928 < div className = "h-10 px-3 flex items-center border border-l-0 rounded-r-md bg-muted text-muted-foreground text-sm font-medium whitespace-nowrap" >
914- { isDevelopment ? '.localhost:3000' : '.simstudio.ai' }
929+ { getDomainSuffix ( ) }
915930 </ div >
916931 { ! isCheckingSubdomain && subdomainAvailable === true && subdomain && (
917932 < div className = "absolute right-14 flex items-center" >
0 commit comments