Feat: Add knowledge compilation workflows (#16515)

## Summary
- Add knowledge compilation template APIs, services, and builtin
template seed data
- Add advanced knowledge compile structure/artifact/RAPTOR workflow
support
- Update parsing, dataset/document APIs, and supporting services for
compilation workflows
This commit is contained in:
Kevin Hu
2026-07-02 23:22:07 +08:00
committed by GitHub
parent 7d64a78f83
commit 62f94cd59b
57 changed files with 14587 additions and 3094 deletions

View File

@@ -21,15 +21,15 @@ from common.constants import PipelineTaskType
class UserTenantRole(StrEnum):
OWNER = 'owner'
ADMIN = 'admin'
NORMAL = 'normal'
INVITE = 'invite'
OWNER = "owner"
ADMIN = "admin"
NORMAL = "normal"
INVITE = "invite"
class TenantPermission(StrEnum):
ME = 'me'
TEAM = 'team'
ME = "me"
TEAM = "team"
class SerializedType(IntEnum):
@@ -38,14 +38,15 @@ class SerializedType(IntEnum):
class FileType(StrEnum):
PDF = 'pdf'
DOC = 'doc'
VISUAL = 'visual'
AURAL = 'aural'
VIRTUAL = 'virtual'
FOLDER = 'folder'
PDF = "pdf"
DOC = "doc"
VISUAL = "visual"
AURAL = "aural"
VIRTUAL = "virtual"
FOLDER = "folder"
OTHER = "other"
VALID_FILE_TYPES = {FileType.PDF, FileType.DOC, FileType.VISUAL, FileType.AURAL, FileType.VIRTUAL, FileType.FOLDER, FileType.OTHER}
@@ -61,11 +62,31 @@ class CanvasCategory(StrEnum):
DataFlow = "dataflow_canvas"
VALID_PIPELINE_TASK_TYPES = {PipelineTaskType.PARSE, PipelineTaskType.DOWNLOAD, PipelineTaskType.RAPTOR, PipelineTaskType.GRAPH_RAG, PipelineTaskType.MINDMAP}
VALID_PIPELINE_TASK_TYPES = {
PipelineTaskType.PARSE,
PipelineTaskType.DOWNLOAD,
PipelineTaskType.RAPTOR,
PipelineTaskType.GRAPH_RAG,
PipelineTaskType.MINDMAP,
PipelineTaskType.ARTIFACT,
PipelineTaskType.SKILL,
}
PIPELINE_SPECIAL_PROGRESS_FREEZE_TASK_TYPES = {PipelineTaskType.RAPTOR.lower(), PipelineTaskType.GRAPH_RAG.lower(), PipelineTaskType.MINDMAP.lower()}
# KB-level fan-out task types: their Task row uses GRAPH_RAPTOR_FAKE_DOC_ID as a
# sentinel doc_id, and ``task_executor.collect_task`` substitutes the first real
# doc_id from ``msg["doc_ids"]`` before re-running ``TaskService.get_task`` so
# the join through Document → Knowledgebase → Tenant resolves and tenant_id /
# kb_id / language are hydrated onto the task dict. Add new fan-out task types
# here or TaskContext will raise "Task must contain 'tenant_id'".
PIPELINE_SPECIAL_PROGRESS_FREEZE_TASK_TYPES = {
PipelineTaskType.RAPTOR.lower(),
PipelineTaskType.GRAPH_RAG.lower(),
PipelineTaskType.MINDMAP.lower(),
PipelineTaskType.ARTIFACT.lower(),
PipelineTaskType.SKILL.lower(),
}
KNOWLEDGEBASE_FOLDER_NAME=".knowledgebase"
SKILLS_FOLDER_NAME="skills"
KNOWLEDGEBASE_FOLDER_NAME = ".knowledgebase"
SKILLS_FOLDER_NAME = "skills"