You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pipeline.ts 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. import type { Edge, EnvironmentVariable, Node, SupportUploadFileTypes } from '@/app/components/workflow/types'
  2. import type { DSLImportMode, DSLImportStatus } from './app'
  3. import type { ChunkingMode, DatasetPermission, DocumentIndexingStatus, FileIndexingEstimateResponse, IconInfo } from './datasets'
  4. import type { Dependency } from '@/app/components/plugins/types'
  5. import type { AppIconSelection } from '@/app/components/base/app-icon-picker'
  6. import type { Viewport } from 'reactflow'
  7. import type { TransferMethod } from '@/types/app'
  8. export enum DatasourceType {
  9. localFile = 'local_file',
  10. onlineDocument = 'online_document',
  11. websiteCrawl = 'website_crawl',
  12. }
  13. export type PipelineTemplateListParams = {
  14. type: 'built-in' | 'customized'
  15. }
  16. export type PipelineTemplate = {
  17. id: string
  18. name: string
  19. icon_info: IconInfo
  20. description: string
  21. position: number
  22. doc_form: ChunkingMode
  23. }
  24. export type PipelineTemplateListResponse = {
  25. pipelines: PipelineTemplate[]
  26. }
  27. export type PipelineTemplateByIdResponse = {
  28. name: string
  29. icon_info: IconInfo
  30. description: string
  31. author: string // todo: TBD
  32. structure: string // todo: TBD
  33. graph: {
  34. nodes: Node[]
  35. edges: Edge[]
  36. viewport: Viewport
  37. }
  38. export_data: string
  39. }
  40. export type CreateFormData = {
  41. name: string
  42. appIcon: AppIconSelection
  43. description: string
  44. permission: DatasetPermission
  45. selectedMemberIDs: string[]
  46. }
  47. export type UpdateTemplateInfoRequest = {
  48. template_id: string
  49. name: string
  50. icon_info: IconInfo
  51. description: string
  52. }
  53. export type UpdateTemplateInfoResponse = {
  54. pipeline_id: string
  55. name: string
  56. icon_info: IconInfo
  57. description: string
  58. position: number
  59. }
  60. export type DeleteTemplateResponse = {
  61. code: number
  62. }
  63. export type ExportTemplateDSLResponse = {
  64. data: string
  65. }
  66. export type ImportPipelineDSLRequest = {
  67. mode: DSLImportMode
  68. yaml_content?: string
  69. yaml_url?: string
  70. pipeline_id?: string
  71. }
  72. export type ImportPipelineDSLResponse = {
  73. id: string
  74. status: DSLImportStatus
  75. pipeline_id: string
  76. dataset_id: string
  77. current_dsl_version: string
  78. imported_dsl_version: string
  79. }
  80. export type ImportPipelineDSLConfirmResponse = {
  81. status: DSLImportStatus
  82. pipeline_id: string
  83. dataset_id: string
  84. current_dsl_version: string
  85. imported_dsl_version: string
  86. error: string
  87. }
  88. export type PipelineCheckDependenciesResponse = {
  89. leaked_dependencies: Dependency[]
  90. }
  91. export enum PipelineInputVarType {
  92. textInput = 'text-input',
  93. paragraph = 'paragraph',
  94. select = 'select',
  95. number = 'number',
  96. singleFile = 'file',
  97. multiFiles = 'file-list',
  98. checkbox = 'checkbox',
  99. }
  100. export type RAGPipelineVariable = {
  101. belong_to_node_id: string // indicates belong to which node or 'shared'
  102. type: PipelineInputVarType
  103. label: string
  104. variable: string
  105. max_length?: number
  106. default_value?: string
  107. placeholder?: string
  108. unit?: string
  109. required: boolean
  110. tooltips?: string
  111. options?: string[]
  112. allowed_file_upload_methods?: TransferMethod[]
  113. allowed_file_types?: SupportUploadFileTypes[]
  114. allowed_file_extensions?: string[]
  115. }
  116. export type InputVar = Omit<RAGPipelineVariable, 'belong_to_node_id'>
  117. export type RAGPipelineVariables = RAGPipelineVariable[]
  118. export type PipelineProcessingParamsRequest = {
  119. pipeline_id: string
  120. node_id: string
  121. }
  122. export type PipelineProcessingParamsResponse = {
  123. variables: RAGPipelineVariables
  124. }
  125. export type PipelinePreProcessingParamsRequest = {
  126. pipeline_id: string
  127. node_id: string
  128. }
  129. export type PipelinePreProcessingParamsResponse = {
  130. variables: RAGPipelineVariables
  131. }
  132. export type PipelineDatasourceNodeRunRequest = {
  133. pipeline_id: string
  134. node_id: string
  135. inputs: Record<string, any>
  136. }
  137. export type PipelineDatasourceNodeRunResponse = Record<string, any>
  138. export type PublishedPipelineInfoResponse = {
  139. id: string
  140. graph: {
  141. nodes: Node[]
  142. edges: Edge[]
  143. viewport: Viewport
  144. }
  145. created_at: number
  146. created_by: {
  147. id: string
  148. name: string
  149. email: string
  150. }
  151. hash: string
  152. updated_at: number
  153. updated_by: {
  154. id: string
  155. name: string
  156. email: string
  157. },
  158. environment_variables?: EnvironmentVariable[]
  159. rag_pipeline_variables?: RAGPipelineVariables
  160. version: string
  161. marked_name: string
  162. marked_comment: string
  163. }
  164. export type PublishedPipelineRunRequest = {
  165. pipeline_id: string
  166. inputs: Record<string, any>
  167. start_node_id: string
  168. datasource_type: DatasourceType
  169. datasource_info_list: Array<Record<string, any>>
  170. is_preview: boolean
  171. }
  172. export type PublishedPipelineRunPreviewResponse = {
  173. task_iod: string
  174. workflow_run_id: string
  175. data: {
  176. id: string
  177. status: string
  178. created_at: number
  179. elapsed_time: number
  180. error: string
  181. finished_at: number
  182. outputs: FileIndexingEstimateResponse
  183. total_steps: number
  184. total_tokens: number
  185. workflow_id: string
  186. }
  187. }
  188. export type PublishedPipelineRunResponse = {
  189. batch: string
  190. dataset: {
  191. chunk_structure: ChunkingMode
  192. description: string
  193. id: string
  194. name: string
  195. }
  196. documents: InitialDocumentDetail[]
  197. }
  198. export type InitialDocumentDetail = {
  199. data_source_info: Record<string, any>
  200. data_source_type: DatasourceType
  201. enable: boolean
  202. error: string
  203. id: string
  204. indexing_status: DocumentIndexingStatus
  205. name: string
  206. position: number
  207. }