From 51644997e480bb361886c07534e7fac2d740e01b Mon Sep 17 00:00:00 2001 From: starmen1265 Date: Fri, 13 Mar 2026 23:28:30 +0800 Subject: [PATCH] feat(04-03): add AnalyzeInput and AnalyzeOutput schemas - AnalyzeInput extends StepInput with metadata_file, content_file, content_type, output_file - AnalyzeOutput extends StepOutput with analysis_file, summary, main_topics, key_insights, tags, stats - Supports both video and article content types Co-Authored-By: Claude Opus 4.6 --- kb_pipeline/schemas.py | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/kb_pipeline/schemas.py b/kb_pipeline/schemas.py index 6260edd..e05aa7b 100644 --- a/kb_pipeline/schemas.py +++ b/kb_pipeline/schemas.py @@ -310,3 +310,46 @@ class DownloadOutput(StepOutput): title: str = Field(..., description="Content title") author: str = Field(..., description="Content author") duration: Optional[int] = Field(None, description="Duration for video content in seconds") + + +# ============================================================================= +# Analyze Schemas (Phase 04) +# ============================================================================= + + +class AnalyzeInput(StepInput): + """Analyze 步骤输入 + + 继承 StepInput 的基础字段,添加分析特定字段。 + + Attributes: + metadata_file: 元数据 JSON 文件路径 + content_file: 内容文件路径(字幕 JSON 或文章内容) + content_type: 内容类型(video 或 article) + output_file: 输出分析 Markdown 文件路径 + """ + metadata_file: str = Field(..., min_length=1, description="Path to metadata JSON file") + content_file: str = Field(..., min_length=1, description="Path to content file (subtitle JSON or article content)") + content_type: str = Field(..., min_length=1, description="Content type (video or article)") + output_file: str = Field(..., min_length=1, description="Path to output analysis Markdown file") + + +class AnalyzeOutput(StepOutput): + """Analyze 步骤输出 + + 继承 StepOutput 的基础字段,添加分析特定字段。 + + Attributes: + analysis_file: 生成的分析报告文件路径 + summary: 内容摘要 + main_topics: 提取的主要主题列表 + key_insights: 关键见解列表 + tags: 推荐标签列表 + stats: 分析统计信息字典 + """ + analysis_file: str = Field(..., description="Path to generated analysis report") + summary: str = Field(default="", description="Content summary") + main_topics: List[str] = Field(default_factory=list, description="Main topics extracted") + key_insights: List[str] = Field(default_factory=list, description="Key insights") + tags: List[str] = Field(default_factory=list, description="Recommended tags") + stats: Dict[str, Any] = Field(default_factory=dict, description="Statistics about analysis")