2025-05-21 16:37:02 +08:00
|
|
|
import type { Edge, EnvironmentVariable, Node, SupportUploadFileTypes } from '@/app/components/workflow/types'
|
2025-05-07 18:09:38 +08:00
|
|
|
import type { DSLImportMode, DSLImportStatus } from './app'
|
2025-06-03 17:42:40 +08:00
|
|
|
import type { ChunkingMode, DatasetPermission, DocumentIndexingStatus, FileIndexingEstimateResponse, IconInfo } from './datasets'
|
2025-05-07 18:09:38 +08:00
|
|
|
import type { Dependency } from '@/app/components/plugins/types'
|
2025-05-14 10:48:54 +08:00
|
|
|
import type { AppIconSelection } from '@/app/components/base/app-icon-picker'
|
2025-05-14 18:20:29 +08:00
|
|
|
import type { Viewport } from 'reactflow'
|
2025-05-19 16:26:13 +08:00
|
|
|
import type { TransferMethod } from '@/types/app'
|
2025-06-17 16:28:50 +08:00
|
|
|
import { BaseFieldType } from '@/app/components/base/form/form-scenarios/base/types'
|
2025-05-07 11:30:13 +08:00
|
|
|
|
2025-05-27 11:01:38 +08:00
|
|
|
export enum DatasourceType {
|
2025-05-27 13:52:43 +08:00
|
|
|
localFile = 'local_file',
|
|
|
|
onlineDocument = 'online_document',
|
|
|
|
websiteCrawl = 'website_crawl',
|
2025-06-26 10:16:37 +08:00
|
|
|
onlineDrive = 'online_drive',
|
2025-05-27 11:01:38 +08:00
|
|
|
}
|
|
|
|
|
2025-05-07 11:30:13 +08:00
|
|
|
export type PipelineTemplateListParams = {
|
|
|
|
type: 'built-in' | 'customized'
|
|
|
|
}
|
|
|
|
|
2025-05-14 10:48:54 +08:00
|
|
|
export type PipelineTemplate = {
|
2025-05-07 11:30:13 +08:00
|
|
|
id: string
|
|
|
|
name: string
|
2025-06-11 11:25:08 +08:00
|
|
|
icon: IconInfo
|
2025-05-07 11:30:13 +08:00
|
|
|
description: string
|
|
|
|
position: number
|
2025-06-11 11:25:08 +08:00
|
|
|
chunk_structure: ChunkingMode
|
2025-05-07 11:30:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export type PipelineTemplateListResponse = {
|
2025-06-11 10:40:32 +08:00
|
|
|
pipeline_templates: PipelineTemplate[]
|
2025-05-07 11:30:13 +08:00
|
|
|
}
|
|
|
|
|
2025-06-11 16:38:42 +08:00
|
|
|
export type PipelineTemplateByIdRequest = {
|
|
|
|
template_id: string
|
|
|
|
type: 'built-in' | 'customized'
|
|
|
|
}
|
|
|
|
|
2025-05-07 11:30:13 +08:00
|
|
|
export type PipelineTemplateByIdResponse = {
|
2025-06-11 11:51:19 +08:00
|
|
|
id: string
|
2025-05-07 11:30:13 +08:00
|
|
|
name: string
|
2025-06-11 16:38:42 +08:00
|
|
|
icon_info: IconInfo
|
2025-05-07 11:30:13 +08:00
|
|
|
description: string
|
2025-06-11 16:38:42 +08:00
|
|
|
chunk_structure: ChunkingMode
|
|
|
|
export_data: string // DSL content
|
|
|
|
graph: {
|
|
|
|
nodes: Node[]
|
|
|
|
edges: Edge[]
|
|
|
|
viewport: Viewport
|
2025-05-14 18:20:29 +08:00
|
|
|
}
|
2025-06-11 16:38:42 +08:00
|
|
|
created_by: string
|
2025-05-07 11:30:13 +08:00
|
|
|
}
|
|
|
|
|
2025-05-14 10:48:54 +08:00
|
|
|
export type CreateFormData = {
|
|
|
|
name: string
|
|
|
|
appIcon: AppIconSelection
|
|
|
|
description: string
|
|
|
|
permission: DatasetPermission
|
|
|
|
selectedMemberIDs: string[]
|
|
|
|
}
|
|
|
|
|
2025-05-16 15:14:50 +08:00
|
|
|
export type UpdateTemplateInfoRequest = {
|
|
|
|
template_id: string
|
2025-05-07 11:30:13 +08:00
|
|
|
name: string
|
2025-06-11 13:39:07 +08:00
|
|
|
icon_info: IconInfo
|
2025-05-07 11:30:13 +08:00
|
|
|
description: string
|
|
|
|
}
|
|
|
|
|
2025-05-16 15:14:50 +08:00
|
|
|
export type UpdateTemplateInfoResponse = {
|
2025-05-07 14:29:01 +08:00
|
|
|
pipeline_id: string
|
|
|
|
name: string
|
2025-06-11 11:25:08 +08:00
|
|
|
icon: IconInfo
|
2025-05-07 14:29:01 +08:00
|
|
|
description: string
|
|
|
|
position: number
|
|
|
|
}
|
|
|
|
|
2025-05-16 15:14:50 +08:00
|
|
|
export type DeleteTemplateResponse = {
|
2025-05-07 14:29:01 +08:00
|
|
|
code: number
|
|
|
|
}
|
|
|
|
|
2025-05-16 15:14:50 +08:00
|
|
|
export type ExportTemplateDSLResponse = {
|
2025-05-07 11:30:13 +08:00
|
|
|
data: string
|
|
|
|
}
|
2025-05-07 18:09:38 +08:00
|
|
|
|
|
|
|
export type ImportPipelineDSLRequest = {
|
|
|
|
mode: DSLImportMode
|
2025-05-14 14:49:01 +08:00
|
|
|
yaml_content?: string
|
|
|
|
yaml_url?: string
|
|
|
|
pipeline_id?: string
|
2025-05-07 18:09:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export type ImportPipelineDSLResponse = {
|
|
|
|
id: string
|
|
|
|
status: DSLImportStatus
|
2025-05-14 14:49:01 +08:00
|
|
|
pipeline_id: string
|
2025-05-14 16:00:17 +08:00
|
|
|
dataset_id: string
|
2025-05-14 14:49:01 +08:00
|
|
|
current_dsl_version: string
|
|
|
|
imported_dsl_version: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export type ImportPipelineDSLConfirmResponse = {
|
|
|
|
status: DSLImportStatus
|
|
|
|
pipeline_id: string
|
2025-05-14 16:00:17 +08:00
|
|
|
dataset_id: string
|
2025-05-14 14:49:01 +08:00
|
|
|
current_dsl_version: string
|
|
|
|
imported_dsl_version: string
|
2025-05-07 18:09:38 +08:00
|
|
|
error: string
|
2025-05-14 14:49:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export type PipelineCheckDependenciesResponse = {
|
2025-05-07 18:09:38 +08:00
|
|
|
leaked_dependencies: Dependency[]
|
|
|
|
}
|
2025-05-08 18:29:49 +08:00
|
|
|
|
2025-05-19 16:26:13 +08:00
|
|
|
export enum PipelineInputVarType {
|
2025-05-23 15:10:20 +08:00
|
|
|
textInput = 'text-input',
|
2025-05-19 16:26:13 +08:00
|
|
|
paragraph = 'paragraph',
|
|
|
|
select = 'select',
|
2025-06-04 16:58:08 +08:00
|
|
|
number = 'number',
|
2025-05-19 16:26:13 +08:00
|
|
|
singleFile = 'file',
|
2025-05-23 15:10:20 +08:00
|
|
|
multiFiles = 'file-list',
|
2025-05-19 16:26:13 +08:00
|
|
|
checkbox = 'checkbox',
|
|
|
|
}
|
|
|
|
|
2025-06-17 16:28:50 +08:00
|
|
|
export const VAR_TYPE_MAP: Record<PipelineInputVarType, BaseFieldType> = {
|
|
|
|
[PipelineInputVarType.textInput]: BaseFieldType.textInput,
|
|
|
|
[PipelineInputVarType.paragraph]: BaseFieldType.paragraph,
|
|
|
|
[PipelineInputVarType.select]: BaseFieldType.select,
|
|
|
|
[PipelineInputVarType.singleFile]: BaseFieldType.file,
|
|
|
|
[PipelineInputVarType.multiFiles]: BaseFieldType.fileList,
|
|
|
|
[PipelineInputVarType.number]: BaseFieldType.numberInput,
|
|
|
|
[PipelineInputVarType.checkbox]: BaseFieldType.checkbox,
|
|
|
|
}
|
|
|
|
|
2025-05-19 16:26:13 +08:00
|
|
|
export type RAGPipelineVariable = {
|
|
|
|
belong_to_node_id: string // indicates belong to which node or 'shared'
|
|
|
|
type: PipelineInputVarType
|
2025-05-08 18:29:49 +08:00
|
|
|
label: string
|
|
|
|
variable: string
|
2025-05-19 16:26:13 +08:00
|
|
|
max_length?: number
|
2025-05-20 11:42:22 +08:00
|
|
|
default_value?: string
|
2025-05-19 16:26:13 +08:00
|
|
|
placeholder?: string
|
|
|
|
unit?: string
|
2025-05-08 18:29:49 +08:00
|
|
|
required: boolean
|
2025-05-19 16:26:13 +08:00
|
|
|
tooltips?: string
|
2025-05-08 18:29:49 +08:00
|
|
|
options?: string[]
|
2025-05-19 16:26:13 +08:00
|
|
|
allowed_file_upload_methods?: TransferMethod[]
|
|
|
|
allowed_file_types?: SupportUploadFileTypes[]
|
|
|
|
allowed_file_extensions?: string[]
|
2025-05-08 18:29:49 +08:00
|
|
|
}
|
|
|
|
|
2025-05-19 16:26:13 +08:00
|
|
|
export type InputVar = Omit<RAGPipelineVariable, 'belong_to_node_id'>
|
2025-05-20 11:42:22 +08:00
|
|
|
export type RAGPipelineVariables = RAGPipelineVariable[]
|
|
|
|
|
|
|
|
export type PipelineProcessingParamsRequest = {
|
|
|
|
pipeline_id: string
|
|
|
|
node_id: string
|
|
|
|
}
|
2025-05-19 16:26:13 +08:00
|
|
|
|
2025-05-08 18:29:49 +08:00
|
|
|
export type PipelineProcessingParamsResponse = {
|
2025-05-20 11:42:22 +08:00
|
|
|
variables: RAGPipelineVariables
|
2025-05-08 18:29:49 +08:00
|
|
|
}
|
2025-05-09 16:35:09 +08:00
|
|
|
|
2025-06-04 18:37:19 +08:00
|
|
|
export type PipelinePreProcessingParamsRequest = {
|
|
|
|
pipeline_id: string
|
|
|
|
node_id: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export type PipelinePreProcessingParamsResponse = {
|
|
|
|
variables: RAGPipelineVariables
|
|
|
|
}
|
|
|
|
|
2025-05-21 16:37:02 +08:00
|
|
|
export type PublishedPipelineInfoResponse = {
|
|
|
|
id: string
|
|
|
|
graph: {
|
|
|
|
nodes: Node[]
|
|
|
|
edges: Edge[]
|
|
|
|
viewport: Viewport
|
|
|
|
}
|
|
|
|
created_at: number
|
|
|
|
created_by: {
|
|
|
|
id: string
|
|
|
|
name: string
|
|
|
|
email: string
|
|
|
|
}
|
|
|
|
hash: string
|
|
|
|
updated_at: number
|
|
|
|
updated_by: {
|
|
|
|
id: string
|
|
|
|
name: string
|
|
|
|
email: string
|
|
|
|
},
|
|
|
|
environment_variables?: EnvironmentVariable[]
|
|
|
|
rag_pipeline_variables?: RAGPipelineVariables
|
|
|
|
version: string
|
|
|
|
marked_name: string
|
|
|
|
marked_comment: string
|
|
|
|
}
|
2025-05-27 11:01:38 +08:00
|
|
|
|
|
|
|
export type PublishedPipelineRunRequest = {
|
|
|
|
pipeline_id: string
|
|
|
|
inputs: Record<string, any>
|
|
|
|
start_node_id: string
|
|
|
|
datasource_type: DatasourceType
|
|
|
|
datasource_info_list: Array<Record<string, any>>
|
2025-06-03 10:14:48 +08:00
|
|
|
is_preview: boolean
|
|
|
|
}
|
|
|
|
|
|
|
|
export type PublishedPipelineRunPreviewResponse = {
|
2025-06-03 17:42:40 +08:00
|
|
|
task_iod: string
|
|
|
|
workflow_run_id: string
|
2025-06-03 10:14:48 +08:00
|
|
|
data: {
|
2025-06-03 17:42:40 +08:00
|
|
|
id: string
|
|
|
|
status: string
|
|
|
|
created_at: number
|
|
|
|
elapsed_time: number
|
|
|
|
error: string
|
|
|
|
finished_at: number
|
2025-06-03 10:14:48 +08:00
|
|
|
outputs: FileIndexingEstimateResponse
|
2025-06-03 17:42:40 +08:00
|
|
|
total_steps: number
|
|
|
|
total_tokens: number
|
|
|
|
workflow_id: string
|
2025-06-03 10:14:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export type PublishedPipelineRunResponse = {
|
2025-06-03 17:42:40 +08:00
|
|
|
batch: string
|
|
|
|
dataset: {
|
|
|
|
chunk_structure: ChunkingMode
|
|
|
|
description: string
|
|
|
|
id: string
|
|
|
|
name: string
|
|
|
|
}
|
|
|
|
documents: InitialDocumentDetail[]
|
|
|
|
}
|
|
|
|
|
|
|
|
export type InitialDocumentDetail = {
|
|
|
|
data_source_info: Record<string, any>
|
|
|
|
data_source_type: DatasourceType
|
|
|
|
enable: boolean
|
|
|
|
error: string
|
|
|
|
id: string
|
|
|
|
indexing_status: DocumentIndexingStatus
|
|
|
|
name: string
|
|
|
|
position: number
|
2025-05-27 11:01:38 +08:00
|
|
|
}
|
2025-06-19 15:57:49 +08:00
|
|
|
|
|
|
|
export type PipelineExecutionLogRequest = {
|
|
|
|
dataset_id: string
|
|
|
|
document_id: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export type PipelineExecutionLogResponse = {
|
|
|
|
datasource_info: Record<string, any>
|
|
|
|
datasource_type: DatasourceType
|
|
|
|
input_data: Record<string, any>
|
|
|
|
datasource_node_id: string
|
|
|
|
}
|
2025-06-25 11:36:56 +08:00
|
|
|
|
|
|
|
export type OnlineDocumentPreviewRequest = {
|
|
|
|
workspaceID: string
|
|
|
|
pageID: string
|
|
|
|
pageType: string
|
|
|
|
pipelineId: string
|
|
|
|
datasourceNodeId: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export type OnlineDocumentPreviewResponse = {
|
|
|
|
content: string
|
|
|
|
}
|
2025-06-30 14:19:14 +08:00
|
|
|
|
|
|
|
export enum OnlineDriveFileType {
|
|
|
|
file = 'file',
|
|
|
|
folder = 'folder',
|
|
|
|
bucket = 'bucket',
|
|
|
|
}
|
|
|
|
|
|
|
|
export type OnlineDriveFile = {
|
|
|
|
key: string
|
|
|
|
size?: number
|
|
|
|
type: OnlineDriveFileType
|
|
|
|
}
|