PCSchmidt/SITREP
GitHub: PCSchmidt/SITREP
SITREP 是一个利用多模型 LLM 自动聚合开源情报、以军事情报格式生成每日地缘政治简报的移动平台。
Stars: 1 | Forks: 0
# SITREP
**AI 驱动的情报简报平台**
SITREP 将军用级别的地缘政治情报简报发送至移动设备。它抓取开源防务、经济和智库出版物(ISW、Defense One、War on the Rocks、Reuters、Bloomberg、The Economist、CFR 等),使用多模型 LLM pipeline 对它们进行综合,并以专业的 BLUF (Bottom Line Up Front) 格式呈现每日威胁评估——这种结构与军事情报产品使用的结构相同。
[](https://opensource.org/licenses/MIT)


## 🎯 项目概述
**构建类型**:生产环境 / GA (App Store + Play Store 部署)
**时间线**:3 个月(总计约 136-152 小时)
**当前状态**:Backend v0.21 已上线 — 高管 PDF 重新设计 + 复合 Global 简报;正在准备提交至 Google Play Store
**下一阶段**:v1.0 生产环境上线(首选 Play Store,然后是 App Store)
**生产环境 URL**:
**作品集**:[pcschmidt.github.io](https://pcschmidt.github.io)
### 近期成果 (v0.18–v0.21)
✅ **高管 PDF 重新设计**:编辑排版(PT Serif + Lato,海军蓝/细线分隔),双栏封面(目录 + 执行摘要),带超链接的分章节来源 — 已在生产环境中验证
✅ **复合 Global 简报**:“ALL” 视图现在完整拼接所有四个地区(≈4 个地区,19 个章节,120 篇文章),而不是单薄的浓缩摘要
✅ **来源扩展**:13 个 scraper,约 540 篇文章/运行 — 恢复了经济/智库 feeds(Reuters、Bloomberg、World Bank、Brookings、Carnegie 通过 Google News 代理;CSIS 原生)以及 Guardian API + 美国/英国政府来源
✅ **GDELT 修复**:更正为 FIPS 国家代码 + OR 关键字查询(之前返回 0)
✅ **每日自动化**:内部 APScheduler 每天 06:00 UTC 运行完整 pipeline
✅ **可靠性**:每个 scraper 的超时机制、模型级联空内容回退、确定性的源 URL 超链接、移动端 PDF 缓存修复
### 什么是 SITREP?
SITREP 是一个移动情报简报平台,复制并增强了 "The LOWDOWN" — 一种 AI 生成的 OSINT 时事通讯格式。它实现了从数十家顶尖开源出版物中自动收集、综合和呈现防务与地缘政治情报。
**问题所在**:要跟上全球防务动态,需要监控 40 多个不同的来源,从智库(ISW、CSIS、IISS)到行业出版物(Defense One、Breaking Defense)再到主流新闻。这既耗时又令人不堪重负。
**解决方案**:SITREP 利用 AI 每日自动抓取、综合和总结这些来源,呈现一份按地区(中东、印太地区、欧洲/非洲、西半球)组织的、专业军事 BLUF 格式的单一连贯情报简报。
**关于本项目**:作为作品集展示,演示了全栈移动端开发、AI/LLM 集成、网页抓取、后端架构以及部署至公共 App Store 的生产环境实践。
## ✨ 核心功能 (v1.0)
### 情报简报
- ✅ **每日自动生成** - 内部 APScheduler 每天 06:00 UTC 运行完整 pipeline
- ✅ **BLUF 格式** - Bottom Line Up Front 军事情报结构
- ✅ **4 个地理区域** + 复合 **Global**(完整包含所有地区)
- ✅ **引用来源** - 论点通过可点击的超链接指向原始出版物
- ✅ **13 个 scraper 每次运行约 540 篇文章** - ISW、Defense One、War on the Rocks、The War Zone、Al Jazeera、Foreign Policy、CFR、19 个 RSS feeds(Reuters、Bloomberg、FT、Economist、BBC、Guardian、World Bank、Brookings、Carnegie、CSIS、The Diplomat、Middle East Eye 等)、Guardian API 以及美国/英国政府来源
- ✅ **AI 生成内容免责声明** - 高度关注合规性以获得 App Store 批准
### PDF 功能
- ✅ **PDF 自动生成** - 在每周 pipeline 期间生成专业的 15-20 页报告
- ✅ **应用内 PDF 查看器** - 支持双指缩放的全屏查看
- ✅ **PDF 分享** - iOS/Android 分享面板(电子邮件、信息、AirDrop)
- ✅ **PDF 保存/打开** - 保存至 Files 应用或在外部应用中打开(Adobe、Apple Books)
### 移动端体验
- ✅ **深色军事美学** - 针对 AMOLED 优化的 UI(接近纯黑 + 琥珀色点缀)
- ✅ **区域筛选** - 在地理区域之间进行标签页导航
- ✅ **离线阅读** - 简报在本地缓存以供离线访问
- ✅ **流畅的 UX** - 加载状态、乐观更新、错误边界
### 基础设施与成本优化
- ✅ **成本上限:$20/月**(目标:通常为 $5-10/月)
- ✅ **单一缓存简报** - 每周向所有用户提供一份简报(无按用户生成)
- ✅ **多模型 LLM 级联** - DeepSeek V4 Flash(约 $0.001/简报) → DeepSeek V3.2 → Kimi K2.5
- ✅ **Playwright 抓取** - 开源新闻抓取(CloakBrowser 为付费墙的可选项)
- ✅ **全面的分析与监控** - Mixpanel(用户行为)+ Sentry(崩溃追踪)
## 🚀 快速开始
### 前置条件
- **Node.js** 18+ 和 npm
- **Python** 3.11+
- **Git**
- **Expo CLI** (`npm install -g expo-cli`)
- **iOS Simulator** (Mac) 或 **Android Emulator**
- **Supabase** 账号(免费版)
### 安装
```
# Clone the repository
git clone https://github.com/PCSchmidt/SITREP.git
cd SITREP
# 安装移动端依赖
cd mobile
npm install
# 安装 backend 依赖
cd ../api
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
# 配置环境
cp .env.example .env
# 使用你的 Supabase 和 Open Router 凭据编辑 .env
```
### 本地运行
**移动应用:**
```
cd mobile
npm start
# 然后选择你的平台:
# - 按 'i' 启动 iOS Simulator
# - 按 'a' 启动 Android Emulator
# - 使用 Expo Go app 扫描 QR code
```
**Backend API:**
```
cd api
source venv/bin/activate # Windows: venv\Scripts\activate
uvicorn main:app --reload --port 8000
# API 可在 http://localhost:8000 访问
# 文档位于 http://localhost:8000/docs
```
## 📁 项目结构
```
SITREP/
├── mobile/ # React Native + Expo mobile app
│ ├── App.tsx # Main app entry point
│ ├── app.json # Expo configuration
│ ├── assets/ # Images, fonts, icons
│ └── package.json # Mobile dependencies
│
├── api/ # FastAPI backend
│ ├── main.py # FastAPI app and routes
│ ├── requirements.txt # Python dependencies
│ ├── .env.example # Environment template
│ └── venv/ # Python virtual environment (gitignored)
│
├── docs/ # Documentation
│
├── .claude/ # Blueprint v11 framework
│ ├── skills/ # Development workflow skills
│ ├── hooks/ # Pre/post tool execution hooks
│ └── agents/ # Specialized subagents
│
├── CONTRACT.md # Project scope and identity
├── SPEC.md # Technical specification
├── VERSION_ROADMAP.md # 16-gate development roadmap
├── DESIGN_SYSTEM.md # UI/UX design specifications
├── DECISIONS.md # Architecture decision records
└── README.md # This file
```
## 🛠️ 技术栈
### 移动端
- **框架**:React Native + Expo SDK 56
- **语言**:TypeScript (strict mode)
- **导航**:Expo Router (基于文件的路由)
- **样式**:NativeWind (适用于 React Native 的 Tailwind CSS)
- **状态管理**:
- TanStack Query v5 (服务端状态、缓存、离线优先)
- Zustand (客户端状态)
- **PDF 查看**:react-native-pdf
- **分析**:Mixpanel SDK
- **监控**:Sentry React Native SDK
### 后端
- **框架**:FastAPI (Python 3.11+)
- **数据库**:Supabase (PostgreSQL + 用于 PDF 的 Blob Storage)
- **抓取**:Playwright (CloakBrowser 为付费墙来源的可选项)
- **PDF 生成**:ReportLab (程序化 PDF 生成)
- **LLM 集成**:通过 Open Router 的多模型
- 主要:DeepSeek V4 Flash (约 $0.001/简报)
- 回退 1:DeepSeek V3.2 (约 $0.003/简报)
- 回退 2:Kimi K2.5 (约 $0.009/简报)
- **HTTP**:httpx (异步), aiohttp (并发抓取)
- **测试**:pytest, pytest-asyncio, pytest-cov
### DevOps 与基础设施
- **后端托管**:Railway (Hobby 套餐, $5/月)
- **移动端部署**:App Store (iOS) + Play Store (Android)
- **数据库**:Supabase 免费版 (500MB 数据库, 1GB 存储)
- **分析**:Mixpanel 免费版 (每月 10 万事件)
- **监控**:Sentry 免费版 (每月 5000 错误)
- **自动化**:内部 APScheduler (每日简报生成)
- **CI/CD**:GitHub Actions (计划在 v0.13+ 实现)
## 📋 开发路线图
**当前阶段**:v0.10 生产环境部署 ✅
采用 **Blueprint v11** 方法论,进行 16 阶段的分阶段开发:
| 版本 | 阶段 | 描述 | 小时数 | 状态 |
| ------- | -------------------------- | ----------------------------------------------------- | ---------------- | ------------ |
| v0.0 | Foundation | 项目脚手架、依赖项、文档 | 4h (实际 4h) | ✅ COMPLETE |
| v0.1 | Mobile Foundation | 应用配置、设计系统、组件库、界面 | 8h (实际 3h) | ✅ COMPLETE |
| v0.2 | Scraping Pipeline | Playwright 抓取,ISW 运行中(16 篇文章) | 8h (实际 4h) | ✅ COMPLETE |
| v0.2 | LLM Synthesis | 通过 Open Router 使用 DeepSeek V4 Flash,生成 BLUF | 12h (实际 3h) | ✅ COMPLETE |
| v0.3 | PDF Generation Backend | ReportLab PDF 生成,3 页输出 | 8h (实际 2h) | ✅ COMPLETE |
| v0.4 | Mobile Scaffold | (已跳过 - 在 v0.1 中完成) | - | ⏭️ SKIPPED |
| v0.5 | UI Design System | (已跳过 - 在 v0.1 中完成) | - | ⏭️ SKIPPED |
| v0.6 | Backend API | FastAPI endpoint,基于文件的缓存 | 8h (实际 4h) | ✅ COMPLETE |
| v0.7 | Mobile-Backend Integration | TanStack Query,API client,垂直区域标签页 | 6h (实际 8h) | ✅ COMPLETE |
| v0.8 | PDF Mobile Integration | react-native-pdf,自定义构建,分享/保存正常运行 | 6h (实际 6h) | ✅ COMPLETE |
| v0.9 | Regional Filtering | 多区域简报,过滤逻辑,导航 | 6h (实际 6h) | ✅ COMPLETE |
| v0.10 | Production Deployment | Railway 部署,移动应用功能完备 | 10h (实际 16h) | ✅ COMPLETE |
| v0.11 | Analytics Integration | Mixpanel 事件,Sentry 崩溃追踪 | 6h | 📅 Next |
| v0.12 | Legal & Disclaimers | 隐私政策、服务条款、AI 内容警告 | 4h | 📅 Planned |
| v0.13 | App Store Prep | 图标、截图、元数据、构建签名 | 6h | 📅 Planned |
| v0.14 | Beta Testing | TestFlight,内部测试,修复 Bug | 8-16h | 📅 Planned |
| v1.0 | Production Live | App Store + Play Store 部署,上线 | 6-12h | 📅 Planned |
**预计总计**:3 个月内 114-124 小时
**实际总计 (v0.0-v0.10)**:56 小时
**剩余**:58-68 小时
**目标上线时间**:2026-08-21
有关详细的阶段描述和小时分解,请参见 [VERSION_ROADMAP.md](VERSION_ROADMAP.md)。
## 🏗️ 技术架构
### 系统概述
```
┌─────────────────────────────────────────────────────────────┐
│ Mobile App (React Native) │
│ ┌─────────────┐ ┌──────────────┐ ┌──────────────────┐ │
│ │ Region │ │ Briefing │ │ PDF Viewer │ │
│ │ Tabs │ │ Cards │ │ (Full Screen) │ │
│ └─────────────┘ └──────────────┘ └──────────────────┘ │
│ │ │ │ │
│ └─────────────────┴────────────────────┘ │
│ │ │
│ TanStack Query │
│ (Caching Layer) │
└─────────────────────────┬───────────────────────────────────┘
│ REST API
↓
┌─────────────────────────────────────────────────────────────┐
│ FastAPI Backend (Railway) │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ GET /briefing/latest → {regions, pdf_url, metadata} │ │
│ │ GET /briefing/latest/pdf → PDF binary │ │
│ │ POST /scrape (internal cron trigger) │ │
│ │ POST /synthesize (internal cron trigger) │ │
│ └──────────────────────────────────────────────────────┘ │
│ │ │
│ ↓ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Supabase (PostgreSQL + Storage) │ │
│ │ • briefings table (JSON, metadata, timestamp) │ │
│ │ • Blob storage for generated PDFs │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────┬───────────────────────────────────┘
│ Internal APScheduler
│ (Sunday 06:00 UTC)
↓
┌─────────────────────────────────────────────────────────────┐
│ Weekly Scraping Pipeline │
│ 1. Playwright scrapes OSINT sources (ISW, Defense One...) │
│ 2. Extract articles → JSON storage │
│ 3. Multi-model LLM synthesis (DeepSeek V4 → V3.2 → Kimi) │
│ 4. Generate BLUF per region │
│ 5. ReportLab generates PDF │
│ 6. Cache briefing + PDF in Supabase │
└─────────────────────────────────────────────────────────────┘
```
### 每周 Pipeline 流程
```
Sunday 06:00 UTC
│
↓
┌───────────────────────────────────────────────┐
│ Internal APScheduler triggers POST /scrape │
└────────────────┬──────────────────────────────┘
│
↓
┌───────────────────────────────────────────────┐
│ Playwright Scraping (async, parallel) │
│ • ISW: Russia/Ukraine analysis │
│ • Defense One: Pentagon insider news │
│ • IISS: Strategic assessments │
│ • Breaking Defense: Tech/procurement │
│ • CSIS, Reuters, Al Jazeera (40+ total) │
└────────────────┬──────────────────────────────┘
│
↓ Raw articles JSON
┌───────────────────────────────────────────────┐
│ Multi-Model LLM Synthesis │
│ Primary: DeepSeek V4 Flash (~$0.001/briefing)│
│ Fallback: DeepSeek V3.2 → Kimi K2.5 │
│ │
│ Prompt: "Synthesize into 4 regional BLUF │
│ briefings (Middle East, Indo-Pacific, │
│ Europe/Africa, Western Hemisphere)" │
└────────────────┬──────────────────────────────┘
│
↓ Structured BLUF JSON
┌───────────────────────────────────────────────┐
│ ReportLab PDF Generation │
│ • Programmatic layout with Python API │
│ • 3-5 pages per region, military aesthetic │
│ • Source citations, disclaimers │
└────────────────┬──────────────────────────────┘
│
↓ PDF binary
┌───────────────────────────────────────────────┐
│ Supabase Storage │
│ • briefings table: JSON + metadata │
│ • Blob storage: PDF file │
│ • Single cached briefing for all users │
└───────────────────────────────────────────────┘
```
### 数据模型
**Supabase `briefings` 表:**
```
CREATE TABLE briefings (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
created_at TIMESTAMP DEFAULT NOW(),
week_start DATE NOT NULL,
regions JSONB NOT NULL, -- {middle_east: {...}, indo_pacific: {...}, ...}
pdf_url TEXT, -- Blob storage URL
source_count INTEGER, -- Number of articles scraped
model_used TEXT -- "DeepSeek V4 Flash" | "DeepSeek V3.2" | "Kimi K2.5"
);
```
**移动端缓存 (TanStack Query):**
```
{
queryKey: ['briefing', 'latest'],
data: {
id: string,
created_at: string,
week_start: string,
regions: {
middle_east: {
bluf: string,
sections: Array<{title: string, content: string, sources: string[]}>
},
// ... other regions
},
pdf_url: string,
source_count: number
},
staleTime: 1000 * 60 * 60 * 24 * 7 // 1 week
}
```
## 💰 成本明细与优化
**运营上限**:$20/月
**典型月度成本**:$5-10
**一次性构建成本**:<$50 LLM 使用费
### 每月运营成本
| 服务 | 套餐 | 每月成本 | 备注 |
| ------------------------------- | ------------- | ------------------------------------------------------------------ ------------------------------------------ |
| Railway | Hobby | $5 | 后端托管,自动调度 |
| Supabase | Free | $0 | 500MB 数据库,1GB 存储,2GB 带宽 |
| Open Router (DeepSeek V4 Flash) | Pay-as-you-go | $0-1 | 约 $0.001/简报,每月 4 份简报 = $0.004 | |
| Open Router (回退) | Pay-as-you-go | $0 | 仅在 V4 失败时使用 DeepSeek V3.2/Kimi(罕见) |
| Mixpanel | Free | $0 | 每月 10 万事件 |
| Sentry | Free | $0 | 每月 5000 错误 |
| **总计** | | **$5-6** | **最坏情况:如果频繁使用回退则为 $10** | |
### 成本优化策略
1. **单一缓存简报**:每周生成一份简报,提供给所有用户(无按用户生成)
2. **超低成本 LLM**:使用 DeepSeek V4 Flash,约 $0.001/简报(每月 4 份简报 = $0.004/月,相比 GPT-4o Mini 减少 99%)
3. **级联回退**:仅在 V4 Flash 失败时才支付 DeepSeek V3.2/Kimi 的费用(罕见,每月增加 $0-1)
4. **Supabase 免费版**:500MB 数据库 + 1GB blob 存储足以容纳每年 52 份简报及 PDF
5. **v1.0 无用户认证**:推迟至 v1.1 以降低复杂性和后端负载
6. **Railway 免费试用**:首月 $5 的免费额度降低了实际成本
## 🔒 安全与合规
### App Store 批准策略
- **显著的 AI 免责声明** - 贯穿整个 UI 及关于界面
- **来源引用** - 所有论点均链接至原始出版物
- **无医疗/法律建议** - 仅限地缘政治分析
- **隐私政策** - v1.0 不收集用户数据(无认证)
- **服务条款** - 标准使用条款
### 数据隐私
- **v1.0**:无用户认证 → 不收集个人数据
- **分析**:仅限匿名设备 ID (Mixpanel)
- **崩溃报告**:仅限堆栈跟踪,无 PII (Sentry)
- **Supabase**:单一缓存简报,无用户特定数据
### 抓取道德
- **Playwright 抓取**:礼貌抓取开源新闻(每个来源 1 次请求/秒)
- **CloakBrowser**:用于付费墙来源的可选项,在当前实施中未使用
- **robots.txt**:在存在的情况下予以遵守
- **来源署名**:所有抓取的内容均在简报中妥善引用
## 🧪 测试策略
- **单元测试**:后端使用 pytest (v0.1+)
- **集成测试**:API endpoint 使用 FastAPI 测试客户端 (v0.6+)
- **E2E 测试**:抓取 pipeline 使用 Playwright (v0.1+)
- **移动端测试**:Jest + React Native Testing Library (v0.7+)
- **TestFlight Beta**:生产环境前的内部测试 (v0.14)
## 📄 许可证
MIT 许可证 - 有关详细信息,请参见 [LICENSE](LICENSE)
## 👤 作者
**Chris Schmidt**
- 作品集:[pcschmidt.github.io](https://pcschmidt.github.io)
- 电子邮件:p.christopher.schmidt@gmail.com
- GitHub:[@PCSchmidt](https://github.com/PCSchmidt)
## 📱 移动端开发设置 (v0.10)
### 在物理设备上运行 (Samsung S25+)
开发构建已安装,可以通过 USB 启动:
```
# 1. 通过 USB 连接手机并启用 debugging
# 2. 设置 ADB 反向端口转发
"C:/Users/pchri/AppData/Local/Android/Sdk/platform-tools/adb.exe" devices
"C:/Users/pchri/AppData/Local/Android/Sdk/platform-tools/adb.exe" reverse tcp:8081 tcp:8081
# 3. 启动 Metro bundler
cd mobile
npx expo start
# 4. 在手机上:打开 SITREP app,输入 exp://localhost:8081
```
**注意**:开发构建包含所有原生模块(react-native-pdf、react-native-blob-util),并通过移动数据连接到 Railway 生产环境后端。
标签:AV绕过, FastAPI, React Native, 人工智能, 地缘政治, 情报分析, 特征检测, 用户模式Hook绕过, 网络诊断, 逆向工具