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 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. import type { Edge, EnvironmentVariable, Node, SupportUploadFileTypes } from '@/app/components/workflow/types'
  2. import type { DSLImportMode, DSLImportStatus } from './app'
  3. import type { ChunkingMode, DatasetPermission, 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-input',
  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 PipelineDatasourceNodeRunRequest = {
  126. pipeline_id: string
  127. node_id: string
  128. inputs: Record<string, any>
  129. }
  130. export type PipelineDatasourceNodeRunResponse = Record<string, any>
  131. export type PublishedPipelineInfoResponse = {
  132. id: string
  133. graph: {
  134. nodes: Node[]
  135. edges: Edge[]
  136. viewport: Viewport
  137. }
  138. created_at: number
  139. created_by: {
  140. id: string
  141. name: string
  142. email: string
  143. }
  144. hash: string
  145. updated_at: number
  146. updated_by: {
  147. id: string
  148. name: string
  149. email: string
  150. },
  151. environment_variables?: EnvironmentVariable[]
  152. rag_pipeline_variables?: RAGPipelineVariables
  153. version: string
  154. marked_name: string
  155. marked_comment: string
  156. }
  157. export type PublishedPipelineRunRequest = {
  158. pipeline_id: string
  159. inputs: Record<string, any>
  160. start_node_id: string
  161. datasource_type: DatasourceType
  162. datasource_info_list: Array<Record<string, any>>
  163. is_preview?: boolean
  164. }