Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

598 B
Raw Blame
import type { AppDetailWithSite } from '@dify/contracts/api/console/apps/types.gen'

export function getAppSiteURL({ mode, site }: AppDetailWithSite): string {
  if (!site?.app_base_url || !site.access_token)
    throw new Error('App detail does not include a Web App URL.')

  const webAppMode = (() => {
    if (mode === 'completion' || mode === 'workflow') return mode
    if (mode === 'advanced-chat' || mode === 'agent-chat' || mode === 'chat') return 'chat'
    throw new Error(`Unsupported Web App mode: ${mode}`)
  })()

  return `${site.app_base_url}/${webAppMode}/${site.access_token}`
}