| | |
| | | import type { TransferMethod } from '@/types/app' |
| | | import type { ErrorHandleTypeEnum } from '@/app/components/workflow/nodes/_base/components/error-handle/types' |
| | | |
| | | export type AgentLogItem = { |
| | | node_execution_id: string, |
| | | id: string, |
| | | node_id: string, |
| | | parent_id?: string, |
| | | label: string, |
| | | data: object, // debug data |
| | | error?: string, |
| | | status: string, |
| | | metadata?: { |
| | | elapsed_time?: number |
| | | provider?: string |
| | | icon?: string |
| | | }, |
| | | } |
| | | |
| | | export type AgentLogItemWithChildren = AgentLogItem & { |
| | | hasCircle?: boolean |
| | | children: AgentLogItemWithChildren[] |
| | | } |
| | | |
| | | export type NodeTracing = { |
| | | id: string |
| | | index: number |
| | | predecessor_node_id: string |
| | | node_id: string |
| | | iteration_id?: string |
| | | loop_id?: string |
| | | node_type: BlockEnum |
| | | title: string |
| | | inputs: any |
| | |
| | | currency: string |
| | | iteration_id?: string |
| | | iteration_index?: number |
| | | loop_id?: string |
| | | loop_index?: number |
| | | parallel_id?: string |
| | | parallel_start_node_id?: string |
| | | parent_parallel_id?: string |
| | | parent_parallel_start_node_id?: string |
| | | parallel_mode_run_id?: string |
| | | iteration_duration_map?: IterationDurationMap |
| | | loop_duration_map?: LoopDurationMap |
| | | error_strategy?: ErrorHandleTypeEnum |
| | | agent_log?: AgentLogItem[] |
| | | tool_info?: { |
| | | agent_strategy?: string |
| | | icon?: string |
| | | } |
| | | loop_variable_map?: Record<string, any> |
| | | } |
| | | metadata: { |
| | | iterator_length: number |
| | | iterator_index: number |
| | | loop_length: number |
| | | loop_index: number |
| | | } |
| | | created_at: number |
| | | created_by: { |
| | |
| | | email: string |
| | | } |
| | | iterDurationMap?: IterationDurationMap |
| | | loopDurationMap?: LoopDurationMap |
| | | finished_at: number |
| | | extras?: any |
| | | expand?: boolean // for UI |
| | | details?: NodeTracing[][] // iteration or loop detail |
| | | details?: NodeTracing[][] // iteration detail |
| | | retryDetail?: NodeTracing[] // retry detail |
| | | retry_index?: number |
| | | parallelDetail?: { // parallel detail. if is in parallel, this field will be set |
| | | isParallelStartNode?: boolean |
| | | parallelTitle?: string |
| | | branchTitle?: string |
| | | children?: NodeTracing[] |
| | | } |
| | | parallel_id?: string |
| | | parallel_start_node_id?: string |
| | | parent_parallel_id?: string |
| | | parent_parallel_start_node_id?: string |
| | | agentLog?: AgentLogItemWithChildren[] // agent log |
| | | retry_index?: number |
| | | } |
| | | |
| | | export type FetchWorkflowDraftResponse = { |
| | |
| | | } |
| | | hash: string |
| | | updated_at: number |
| | | updated_by: { |
| | | id: string |
| | | name: string |
| | | email: string |
| | | }, |
| | | tool_published: boolean |
| | | environment_variables?: EnvironmentVariable[] |
| | | conversation_variables?: ConversationVariable[] |
| | | version: string |
| | | marked_name: string |
| | | marked_comment: string |
| | | } |
| | | |
| | | export type VersionHistory = FetchWorkflowDraftResponse |
| | | |
| | | export type FetchWorkflowDraftPageParams = { |
| | | appId: string |
| | | initialPage: number |
| | | limit: number |
| | | userId?: string |
| | | namedOnly?: boolean |
| | | } |
| | | |
| | | export type FetchWorkflowDraftPageResponse = { |
| | | items: VersionHistory[] |
| | |
| | | task_id: string |
| | | workflow_run_id: string |
| | | event: string |
| | | data: NodeTracing |
| | | data: { |
| | | id: string |
| | | node_id: string |
| | | iteration_id?: string |
| | | parallel_run_id?: string |
| | | node_type: string |
| | | index: number |
| | | predecessor_node_id?: string |
| | | inputs: any |
| | | created_at: number |
| | | extras?: any |
| | | } |
| | | } |
| | | |
| | | export type FileResponse = { |
| | |
| | | transfer_method: TransferMethod |
| | | type: string |
| | | url: string |
| | | upload_file_id: string |
| | | } |
| | | |
| | | export type NodeFinishedResponse = { |
| | | task_id: string |
| | | workflow_run_id: string |
| | | event: string |
| | | data: NodeTracing |
| | | data: { |
| | | id: string |
| | | node_id: string |
| | | iteration_id?: string |
| | | node_type: string |
| | | index: number |
| | | predecessor_node_id?: string |
| | | inputs: any |
| | | process_data: any |
| | | outputs: any |
| | | status: string |
| | | error: string |
| | | elapsed_time: number |
| | | execution_metadata: { |
| | | total_tokens: number |
| | | total_price: number |
| | | currency: string |
| | | parallel_id?: string |
| | | parallel_start_node_id?: string |
| | | iteration_index?: number |
| | | iteration_id?: string |
| | | parallel_mode_run_id: string |
| | | error_strategy?: ErrorHandleTypeEnum |
| | | } |
| | | created_at: number |
| | | files?: FileResponse[] |
| | | retry_index?: number |
| | | } |
| | | } |
| | | |
| | | export type IterationStartedResponse = { |
| | | task_id: string |
| | | workflow_run_id: string |
| | | event: string |
| | | data: NodeTracing |
| | | data: { |
| | | id: string |
| | | node_id: string |
| | | metadata: { |
| | | iterator_length: number |
| | | iteration_id: string |
| | | iteration_index: number |
| | | } |
| | | created_at: number |
| | | extras?: any |
| | | } |
| | | } |
| | | |
| | | export type IterationNextResponse = { |
| | | task_id: string |
| | | workflow_run_id: string |
| | | event: string |
| | | data: NodeTracing |
| | | data: { |
| | | id: string |
| | | node_id: string |
| | | index: number |
| | | output: any |
| | | extras?: any |
| | | created_at: number |
| | | parallel_mode_run_id: string |
| | | execution_metadata: { |
| | | parallel_id?: string |
| | | iteration_index: number |
| | | parallel_mode_run_id?: string |
| | | } |
| | | duration?: number |
| | | } |
| | | } |
| | | |
| | | export type IterationFinishedResponse = { |
| | | task_id: string |
| | | workflow_run_id: string |
| | | event: string |
| | | data: NodeTracing |
| | | } |
| | | |
| | | export type LoopStartedResponse = { |
| | | task_id: string |
| | | workflow_run_id: string |
| | | event: string |
| | | data: NodeTracing |
| | | } |
| | | |
| | | export type LoopNextResponse = { |
| | | task_id: string |
| | | workflow_run_id: string |
| | | event: string |
| | | data: NodeTracing |
| | | } |
| | | |
| | | export type LoopFinishedResponse = { |
| | | task_id: string |
| | | workflow_run_id: string |
| | | event: string |
| | | data: NodeTracing |
| | | data: { |
| | | id: string |
| | | node_id: string |
| | | outputs: any |
| | | extras?: any |
| | | status: string |
| | | created_at: number |
| | | error: string |
| | | execution_metadata: { |
| | | parallel_id?: string |
| | | } |
| | | } |
| | | } |
| | | |
| | | export type ParallelBranchStartedResponse = { |
| | | task_id: string |
| | | workflow_run_id: string |
| | | event: string |
| | | data: NodeTracing |
| | | data: { |
| | | parallel_id: string |
| | | parallel_start_node_id: string |
| | | parent_parallel_id: string |
| | | parent_parallel_start_node_id: string |
| | | iteration_id?: string |
| | | created_at: number |
| | | } |
| | | } |
| | | |
| | | export type ParallelBranchFinishedResponse = { |
| | | task_id: string |
| | | workflow_run_id: string |
| | | event: string |
| | | data: NodeTracing |
| | | data: { |
| | | parallel_id: string |
| | | parallel_start_node_id: string |
| | | parent_parallel_id: string |
| | | parent_parallel_start_node_id: string |
| | | iteration_id?: string |
| | | status: string |
| | | created_at: number |
| | | error: string |
| | | } |
| | | } |
| | | |
| | | export type TextChunkResponse = { |
| | |
| | | data: { |
| | | text: string |
| | | } |
| | | } |
| | | |
| | | export type AgentLogResponse = { |
| | | task_id: string |
| | | event: string |
| | | data: AgentLogItemWithChildren |
| | | } |
| | | |
| | | export type WorkflowRunHistory = { |
| | |
| | | } |
| | | |
| | | export type IterationDurationMap = Record<string, number> |
| | | export type LoopDurationMap = Record<string, number> |
| | | export type LoopVariableMap = Record<string, any> |
| | | |
| | | export type WorkflowConfigResponse = { |
| | | parallel_depth_limit: number |
| | | } |
| | | |
| | | export type PublishWorkflowParams = { |
| | | title: string |
| | | releaseNotes: string |
| | | } |
| | | |
| | | export type UpdateWorkflowParams = { |
| | | workflowId: string |
| | | title: string |
| | | releaseNotes: string |
| | | } |