Skip to content

Architecture

anyeduke11 edited this page Aug 30, 2026 · 1 revision

Architecture

本页为 Wiki 镜像摘录。权威全文在仓库docs/ARCHITECTURE.md(数字由 scripts/generate_meta.py AST 反推维护,CI 强约束)。 同步日期:2026-08-30 (v0.7.0)。

系统总览

面向 AI + 安全从业者 的单机本地工作站。五个子系统共享同一个 FastAPI 进程与 SQLite 数据库:

# 子系统 说明 入口
01 SecNews 热点聚合 14 采集器 · 11+ 质量门禁 · 趋势/搜索/导出 /
02 Knowledge LLM-Wiki llm-wiki-2.0/ md 真源 · kl_pipeline 五阶段 · FTS5 /knowledge
03 CodeGarden 项目生命周期 + 服务网格 + 资源中枢 + 联动引擎 /codegarden
04 Security Graph MITRE ATT&CK · NVD CVE · 等保/关基/数安法 /knowledge/process
05 SecNews 统一工作台 6 tab: Feed / Pipeline / Knowledge / Analyze / Analytics / Settings /secnews
06 CRM 业绩座舱 客户/商机/状态机/KPI 聚合 /crm

分层

┌──────────────────────────────────────────────┐
│  Browser (React SPA, :8898) — /secnews 统一工作台 │
└───────────────┬──────────────────────────────┘
                │ HTTP / JSON / SSE
┌───────────────▼──────────────────────────────┐
│  FastAPI 单进程 (uvicorn, :8000)              │
│  collectors/ → quality/ → scheduler/ (47 jobs)│
│  api/ (65 router) · services/ (96) · repo/   │
└───────────────┬──────────────────────────────┘
                │
   ┌────────────┼──────────────┐
   ▼            ▼              ▼
 SQLite      llm-wiki-2.0/   WebDAV 同步
 (WAL)       (md 真源 + FTS)  (zip + Fernet)

核心设计决策

  • wiki-firstllm-wiki-2.0/ md 文件是唯一真相源,SQLite 仅做投影索引
  • 单出口:所有 LLM 调用经 backend/services/ai_hub/
  • 软分层 + Feature Gates:core 永不消失,扩展域按 feature_gates.toml 条件注册
  • 无外部服务:无 Redis/PostgreSQL/Celery/Docker(单用户假设)
  • MCP Server:19 工具 (11 读 + 8 写) 经 stdio/SSE 暴露给外部 AI Agent
  • 同步:WebDAV + zip + Fernet,3-way merge

架构数字(v0.7.0)

维度 数值
Routers 65
Services 96
Jobs 47
Collectors 14
SQL migrations 77
后端测试 3025
前端测试 309

完整架构文档见仓库 docs/ARCHITECTURE.md

Clone this wiki locally