From 9c74f51b43437c3bc4517307c5d605f597b55444 Mon Sep 17 00:00:00 2001 From: starmen1265 Date: Mon, 16 Mar 2026 23:17:29 +0800 Subject: [PATCH] feat(05-02): add ArchiveInput and ArchiveOutput schemas - Add ArchiveInput with content_dir, analysis_file, content_type fields - Add ArchiveOutput with archive_file, skipped, platform fields - Update PipelineConfig default steps to include archive step --- kb_pipeline/schemas.py | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/kb_pipeline/schemas.py b/kb_pipeline/schemas.py index 8ab2318..83a3e02 100644 --- a/kb_pipeline/schemas.py +++ b/kb_pipeline/schemas.py @@ -397,15 +397,50 @@ class PipelineConfig(BaseModel): """Pipeline configuration Attributes: - steps: Steps to execute in order (default: parse, download, asr, analyze) + steps: Steps to execute in order (default: parse, download, asr, analyze, archive) output_dir: Base output directory skip_completed: Skip completed steps (default True) max_retries: Max retries per step (default 3) """ steps: List[str] = Field( - default_factory=lambda: ["parse", "download", "asr", "analyze"], + default_factory=lambda: ["parse", "download", "asr", "analyze", "archive"], description="Steps to execute in order" ) output_dir: Optional[Path] = Field(None, description="Base output directory") skip_completed: bool = Field(default=True, description="Skip completed steps") max_retries: int = Field(default=3, description="Max retries per step") + + +# ============================================================================= +# Archive Schemas (Phase 5) +# ============================================================================= + + +class ArchiveInput(StepInput): + """Archive 步骤输入 + + 继承 StepInput 的基础字段,添加归档特定字段。 + + Attributes: + content_dir: 内容目录路径(中间目录) + analysis_file: 分析报告 md 文件路径 + content_type: 内容类型 + """ + content_dir: str = Field(..., min_length=1, description="Content directory path (intermediate)") + analysis_file: str = Field(..., min_length=1, description="Path to analysis Markdown file") + content_type: str = Field(..., min_length=1, description="Content type (video, article, etc.)") + + +class ArchiveOutput(StepOutput): + """Archive 步骤输出 + + 继承 StepOutput 的基础字段,添加归档特定字段。 + + Attributes: + archive_file: 归档后的文件路径 + skipped: 是否跳过(已有相同文件) + platform: 平台名称 + """ + archive_file: str = Field(default="", description="Path to archived file") + skipped: bool = Field(default=False, description="Whether archiving was skipped") + platform: str = Field(default="", description="Platform name")