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 Log Models

From Leeroopedia
Knowledge Sources
Domains Frontend, TypeSystem, Logging, Workflow
Last Updated 2026-02-12 07:00 GMT

Overview

TypeScript type definitions for log-related data structures including completion conversations, chat messages, workflow runs, agent logs, and feedback annotations.

Description

web/models/log.ts defines the complete type system for the Dify logging subsystem in the frontend. It covers:

  • Completion parameters via the CompletionParams const array and CompletionParamsType (temperature, top_p, max_tokens, etc.).
  • Model configuration types (LogModelConfig, ModelConfigDetail) that describe the LLM model, provider, and prompt template used in a conversation.
  • Annotations through LogAnnotation and Annotation types for human-labeled responses.
  • Message content via the comprehensive MessageContent type, which includes query, answer, token counts, feedbacks, vision files, agent thoughts, and workflow run references.
  • Completion conversations with CompletionConversationGeneralDetail and CompletionConversationFullDetailResponse for text generation logs.
  • Chat conversations with ChatConversationGeneralDetail, ChatConversationsResponse, and ChatConversationFullDetailResponse.
  • Workflow execution logs including WorkflowRunTriggeredFrom enum (debugging, app-run, webhook, schedule, plugin), WorkflowRunDetail, WorkflowAppLogDetail, and WorkflowRunDetailResponse with full graph data (nodes, edges, viewport).
  • Agent logs with AgentLogMeta, ToolCall, AgentIteration, and AgentLogDetailResponse.
  • Message feedback types for like/dislike ratings.
  • Workflow pause types (PauseType, PauseDetail, WorkflowPausedDetailsResponse) for human-input and breakpoint pauses.

Usage

Import these types when building log viewer components, conversation detail panels, workflow run inspectors, or agent log displays. They provide the contract between the backend API and frontend rendering.

Code Reference

Source Location

Signature

export const CompletionParams = ['temperature', 'top_p', 'presence_penalty', 'max_token', 'stop', 'frequency_penalty'] as const

export type MessageContent = {
  id: string
  conversation_id: string
  query: string
  inputs: Record<string, any>
  message: { role: string, text: string, files?: VisionFile[] }[]
  message_tokens: number
  answer_tokens: number
  answer: string
  provider_response_latency: number
  created_at: number
  annotation: LogAnnotation
  feedbacks: Array<{ rating: 'like' | 'dislike' | null; content: string | null }>
  workflow_run_id: string
  parent_message_id: string | null
}

export enum WorkflowRunTriggeredFrom {
  DEBUGGING = 'debugging',
  APP_RUN = 'app-run',
  RAG_PIPELINE_RUN = 'rag-pipeline-run',
  WEBHOOK = 'webhook',
  SCHEDULE = 'schedule',
  PLUGIN = 'plugin',
}

export type WorkflowRunDetailResponse = {
  id: string
  version: string
  graph: { nodes: Node[]; edges: Edge[]; viewport?: Viewport }
  status: 'running' | 'succeeded' | 'failed' | 'stopped'
  outputs?: string
  elapsed_time?: number
  total_tokens?: number
  total_steps: number
  // ...
}

export type AgentLogDetailResponse = {
  meta: AgentLogMeta
  iterations: AgentIteration[]
  files: AgentLogFile[]
}

Import

import type {
  MessageContent,
  WorkflowRunDetailResponse,
  ChatConversationsResponse,
  AgentLogDetailResponse,
  WorkflowRunTriggeredFrom,
} from '@/models/log'

I/O Contract

Inputs

Name Type Required Description
N/A N/A N/A Type-only module, no runtime inputs.

Outputs

Name Type Description
CompletionParams const array Tuple of completion parameter names
MessageContent type Full message with query, answer, tokens, feedbacks, and files
CompletionConversationsResponse type Paginated list of completion conversation summaries
ChatConversationsResponse type Paginated list of chat conversation summaries
WorkflowRunTriggeredFrom enum Source that triggered a workflow run
WorkflowRunDetailResponse type Detailed workflow run including graph, status, and outputs
AgentLogDetailResponse type Agent execution details with iterations and tool calls
WorkflowPausedDetailsResponse type Details of paused workflow nodes
MessageRating type Union type for like/dislike/null feedback

Usage Examples

Displaying Workflow Run Status

import type { WorkflowRunDetailResponse } from '@/models/log'

function getStatusBadge(run: WorkflowRunDetailResponse) {
  switch (run.status) {
    case 'succeeded': return 'success'
    case 'failed': return 'error'
    case 'running': return 'processing'
    case 'stopped': return 'warning'
  }
}

Related Pages

Page Connections

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