Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Langgenius Dify AppModeEnum

From Leeroopedia


Knowledge Sources
Domains LLM Application Architecture TypeScript Enums
Last Updated 2026-02-08 00:00 GMT

Overview

Concrete tool for defining the set of valid application interaction modes provided by the Dify platform.

Description

The AppModeEnum is a TypeScript enum that enumerates all supported application types in the Dify frontend. It serves as the single source of truth for mode values used throughout the UI -- from the creation dialog to routing, configuration panels, and API calls. Each enum member maps to a string literal that is sent to the backend when creating or querying applications.

The enum defines five members:

  • COMPLETION -- Single-shot text generation (completion)
  • WORKFLOW -- DAG-based automation pipeline (workflow)
  • CHAT -- Simple conversational chatbot (chat)
  • ADVANCED_CHAT -- Chatflow with workflow orchestration (advanced-chat)
  • AGENT_CHAT -- Autonomous agent with tool-calling capabilities (agent-chat)

A companion constant AppModes provides a readonly tuple of all enum values for iteration and validation purposes.

This is a UI-only selection; choosing a mode does not trigger an API call. The selected value is passed to the createApp service function when the user confirms application creation.

Usage

Use AppModeEnum when:

  • Rendering the application type selector in the creation dialog
  • Conditionally rendering UI panels based on the current app mode
  • Passing the mode parameter to the createApp or importDSL API calls
  • Filtering or grouping applications by type in list views

Code Reference

Source Location

  • Repository: Dify
  • File: web/types/app.ts (Lines 63-69)

Signature

export enum AppModeEnum {
  COMPLETION = 'completion',
  WORKFLOW = 'workflow',
  CHAT = 'chat',
  ADVANCED_CHAT = 'advanced-chat',
  AGENT_CHAT = 'agent-chat',
}

export const AppModes = [
  AppModeEnum.COMPLETION,
  AppModeEnum.WORKFLOW,
  AppModeEnum.CHAT,
  AppModeEnum.ADVANCED_CHAT,
  AppModeEnum.AGENT_CHAT,
] as const

Import

import { AppModeEnum } from '@/types/app'

I/O Contract

Inputs

Name Type Required Description
N/A N/A N/A This is an enum definition; it does not accept inputs. Values are selected by the developer at call sites.

Outputs

Name Type Description
COMPLETION 'completion' Single-shot text generation mode
WORKFLOW 'workflow' DAG-based automation pipeline mode
CHAT 'chat' Simple conversational chatbot mode
ADVANCED_CHAT 'advanced-chat' Chatflow with workflow orchestration mode
AGENT_CHAT 'agent-chat' Autonomous agent with tool-calling mode

Usage Examples

import { AppModeEnum } from '@/types/app'
import { createApp } from '@/service/apps'

// Creating a new chat application
const newApp = await createApp({
  name: 'My Chatbot',
  mode: AppModeEnum.CHAT,
  description: 'A simple customer support assistant',
})

// Conditional rendering based on mode
if (appDetail.mode === AppModeEnum.AGENT_CHAT) {
  // Show tool configuration panel
}

// Iterating over all modes
import { AppModes } from '@/types/app'
AppModes.forEach((mode) => {
  console.log(mode) // 'completion', 'workflow', 'chat', 'advanced-chat', 'agent-chat'
})

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment