# state.py # ============================================================ # 类型:数据模型定义(乙负责,PPT 展示用) # 功能:定义整个系统的核心数据结构 # 用途:PPT 中展示架构设计能力;代码中不需要 import,仅作为参考 # ============================================================ from dataclasses import dataclass, field from typing import Optional # ---- 第一层:研究方向 ---- @dataclass class MethodFamily: """方法族""" family_name: str # 如 "Embedding-based Anomaly Detection" description: str # 一句话核心特点 representative_work: str # 代表论文,如 "PaDiM (2021)" search_queries: list[str] # GitHub 搜索词 @dataclass class DirectionAnalysis: """研究方向解析结果(Agent 1 的输出)""" subfield: str # 子领域名 subfield_trend: str # 当前趋势 method_families: list[MethodFamily] broad_queries: list[str] # 宽泛搜索词 # ---- 第二层:候选仓库 ---- @dataclass class CandidateRepo: """候选仓库(甲的 Workflow 输出)""" full_name: str # "openvinotoolkit/anomalib" html_url: str description: str stars: int language: str updated_at: str topics: list[str] match_keyword: str # 命中哪个搜索词 method_family: str # 归类到哪个方法族(可为空) readme: Optional[str] = None dependencies: dict[str, str] = field(default_factory=dict) # ---- 第三层:评估结果 ---- @dataclass class EvalResult: """单个仓库的评估结果(Agent 2 的输出)""" reproducibility_score: int # 可复现性总分 (0-80) benchmark_fitness_score: int # 对比实验适配度总分 (0-20) overall_score: int # 综合总分 (0-100) verdict: str # reproducible / partially / not_reproducible env_score: int # 0-15 doc_score: int # 0-20 code_score: int # 0-20 community_score: int # 0-10 dep_score: int # 0-15 benchmark_score: int # 0-20 reasoning: str # 分析文本 risks: list[str] # 风险列表 benchmark_readiness: str # ready / partial / not_ready suggested_use: str # 建议用途 # ---- 顶层:完整研报 ---- @dataclass class ResearchReport: """完整研究方向全景研报(run.py 的最终输出)""" paper_info: dict direction: DirectionAnalysis repos: list[tuple[CandidateRepo, EvalResult]]