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.8KB

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