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.

2.4 KB
Raw Blame
// This file is auto-generated by @hey-api/openapi-ts

import { oc } from '@orpc/contract'
import * as z from 'zod'
import {
  zCompletionRequestError,
  zModelCurrentlyNotSupportError,
  zProviderNotInitializeError,
  zProviderQuotaExceededError,
} from './zod.gen.ts'
import {
  zPostWorkflowGenerateBody,
  zPostWorkflowGenerateResponse,
  zPostWorkflowGenerateStreamBody,
  zPostWorkflowGenerateStreamResponse,
  zPostWorkflowGenerateSuggestionsBody,
  zPostWorkflowGenerateSuggestionsResponse,
} from './zod.gen.ts'

/**
 * Stream a Dify workflow graph (plan then result) via SSE
 */
export const post = oc
  .route({
    description: 'Stream a Dify workflow graph (plan then result) via SSE',
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postWorkflowGenerateStream',
    path: '/workflow-generate/stream',
    tags: ['console'],
  })
  .input(z.object({ body: zPostWorkflowGenerateStreamBody }))
  .output(zPostWorkflowGenerateStreamResponse)

export const stream = {
  post,
}

/**
 * Suggest example workflow-generator instructions for the tenant
 */
export const post2 = oc
  .route({
    description: 'Suggest example workflow-generator instructions for the tenant',
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postWorkflowGenerateSuggestions',
    path: '/workflow-generate/suggestions',
    tags: ['console'],
  })
  .input(z.object({ body: zPostWorkflowGenerateSuggestionsBody }))
  .output(zPostWorkflowGenerateSuggestionsResponse)

export const suggestions = {
  post: post2,
}

/**
 * Generate a Dify workflow graph from natural language
 */
export const post3 = oc
  .route({
    description: 'Generate a Dify workflow graph from natural language',
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postWorkflowGenerate',
    path: '/workflow-generate',
    tags: ['console'],
  })
  .input(z.object({ body: zPostWorkflowGenerateBody }))
  .output(zPostWorkflowGenerateResponse)
  .errors({
    completion_request_error: { status: 400, data: zCompletionRequestError },
    model_currently_not_support: { status: 400, data: zModelCurrentlyNotSupportError },
    provider_not_initialize: { status: 400, data: zProviderNotInitializeError },
    provider_quota_exceeded: { status: 400, data: zProviderQuotaExceededError },
  })

export const workflowGenerate = {
  post: post3,
  stream,
  suggestions,
}

export const contract = {
  workflowGenerate,
}