Team Ai
Apppublic

Underground-Digital/Workflow-Engine

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
workflow.ts326 linesDownload Raw Back to types
1import type { Viewport } from 'reactflow'2import type {3  BlockEnum,4  ConversationVariable,5  Edge,6  EnvironmentVariable,7  Node,8} from '@/app/components/workflow/types'9import type { TransferMethod } from '@/types/app'10 11export type NodeTracing = {12  id: string13  index: number14  predecessor_node_id: string15  node_id: string16  node_type: BlockEnum17  title: string18  inputs: any19  process_data: any20  outputs?: any21  status: string22  parallel_run_id?: string23  error?: string24  elapsed_time: number25  execution_metadata: {26    total_tokens: number27    total_price: number28    currency: string29    iteration_id?: string30    iteration_index?: number31    parallel_id?: string32    parallel_start_node_id?: string33    parent_parallel_id?: string34    parent_parallel_start_node_id?: string35    parallel_mode_run_id?: string36  }37  metadata: {38    iterator_length: number39    iterator_index: number40  }41  created_at: number42  created_by: {43    id: string44    name: string45    email: string46  }47  finished_at: number48  extras?: any49  expand?: boolean // for UI50  details?: NodeTracing[][] // iteration detail51  parallel_id?: string52  parallel_start_node_id?: string53  parent_parallel_id?: string54  parent_parallel_start_node_id?: string55}56 57export type FetchWorkflowDraftResponse = {58  id: string59  graph: {60    nodes: Node[]61    edges: Edge[]62    viewport?: Viewport63  }64  features?: any65  created_at: number66  created_by: {67    id: string68    name: string69    email: string70  }71  hash: string72  updated_at: number73  tool_published: boolean74  environment_variables?: EnvironmentVariable[]75  conversation_variables?: ConversationVariable[]76}77 78export type NodeTracingListResponse = {79  data: NodeTracing[]80}81 82export type WorkflowStartedResponse = {83  task_id: string84  workflow_run_id: string85  event: string86  data: {87    id: string88    workflow_id: string89    sequence_number: number90    created_at: number91  }92}93 94export type WorkflowFinishedResponse = {95  task_id: string96  workflow_run_id: string97  event: string98  data: {99    id: string100    workflow_id: string101    status: string102    outputs: any103    error: string104    elapsed_time: number105    total_tokens: number106    total_steps: number107    created_at: number108    created_by: {109      id: string110      name: string111      email: string112    }113    finished_at: number114    files?: FileResponse[]115  }116}117 118export type NodeStartedResponse = {119  task_id: string120  workflow_run_id: string121  event: string122  data: {123    id: string124    node_id: string125    iteration_id?: string126    parallel_run_id?: string127    node_type: string128    index: number129    predecessor_node_id?: string130    inputs: any131    created_at: number132    extras?: any133  }134}135 136export type FileResponse = {137  related_id: string138  extension: string139  filename: string140  size: number141  mime_type: string142  transfer_method: TransferMethod143  type: string144  url: string145}146 147export type NodeFinishedResponse = {148  task_id: string149  workflow_run_id: string150  event: string151  data: {152    id: string153    node_id: string154    iteration_id?: string155    node_type: string156    index: number157    predecessor_node_id?: string158    inputs: any159    process_data: any160    outputs: any161    status: string162    error: string163    elapsed_time: number164    execution_metadata: {165      total_tokens: number166      total_price: number167      currency: string168      parallel_id?: string169      parallel_start_node_id?: string170      iteration_index?: number171      iteration_id?: string172      parallel_mode_run_id: string173    }174    created_at: number175    files?: FileResponse[]176  }177}178 179export type IterationStartedResponse = {180  task_id: string181  workflow_run_id: string182  event: string183  data: {184    id: string185    node_id: string186    metadata: {187      iterator_length: number188      iteration_id: string189      iteration_index: number190    }191    created_at: number192    extras?: any193  }194}195 196export type IterationNextResponse = {197  task_id: string198  workflow_run_id: string199  event: string200  data: {201    id: string202    node_id: string203    index: number204    output: any205    extras?: any206    created_at: number207    parallel_mode_run_id: string208    execution_metadata: {209      parallel_id?: string210    }211  }212}213 214export type IterationFinishedResponse = {215  task_id: string216  workflow_run_id: string217  event: string218  data: {219    id: string220    node_id: string221    outputs: any222    extras?: any223    status: string224    created_at: number225    error: string226    execution_metadata: {227      parallel_id?: string228    }229  }230}231 232export type ParallelBranchStartedResponse = {233  task_id: string234  workflow_run_id: string235  event: string236  data: {237    parallel_id: string238    parallel_start_node_id: string239    parent_parallel_id: string240    parent_parallel_start_node_id: string241    iteration_id?: string242    created_at: number243  }244}245 246export type ParallelBranchFinishedResponse = {247  task_id: string248  workflow_run_id: string249  event: string250  data: {251    parallel_id: string252    parallel_start_node_id: string253    parent_parallel_id: string254    parent_parallel_start_node_id: string255    iteration_id?: string256    status: string257    created_at: number258    error: string259  }260}261 262export type TextChunkResponse = {263  task_id: string264  workflow_run_id: string265  event: string266  data: {267    text: string268  }269}270 271export type TextReplaceResponse = {272  task_id: string273  workflow_run_id: string274  event: string275  data: {276    text: string277  }278}279 280export type WorkflowRunHistory = {281  id: string282  sequence_number: number283  version: string284  conversation_id?: string285  message_id?: string286  graph: {287    nodes: Node[]288    edges: Edge[]289    viewport?: Viewport290  }291  inputs: Record<string, string>292  status: string293  outputs: Record<string, any>294  error?: string295  elapsed_time: number296  total_tokens: number297  total_steps: number298  created_at: number299  finished_at: number300  created_by_account: {301    id: string302    name: string303    email: string304  }305}306export type WorkflowRunHistoryResponse = {307  data: WorkflowRunHistory[]308}309 310export type ChatRunHistoryResponse = {311  data: WorkflowRunHistory[]312}313 314export type NodesDefaultConfigsResponse = {315  type: string316  config: any317}[]318 319export type ConversationVariableResponse = {320  data: (ConversationVariable & { updated_at: number; created_at: number })[]321  has_more: boolean322  limit: number323  total: number324  page: number325}326