Metadata-Version: 2.4
Name: news-radar-ai
Version: 1.0.0
Summary: AI 资讯雷达：消费 newsbox 采集层 + DeepSeek 评分，产出 Obsidian Markdown AI 日报
Author: path
License: MIT
Keywords: ai,deepseek,news,newsbox,obsidian,rss
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet
Classifier: Topic :: Text Processing :: Markup :: Markdown
Requires-Python: >=3.11
Requires-Dist: httpx>=0.28.1
Requires-Dist: loguru>=0.7
Requires-Dist: newsbox>=1.0.3
Requires-Dist: pydantic>=2.7
Requires-Dist: python-dotenv>=1.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: ruamel-yaml>=0.18
Requires-Dist: typer>=0.12
Description-Content-Type: text/markdown

# news-radar-ai

> 本地运行的个人 AI 资讯编辑部：消费 [newsbox](https://pypi.org/project/newsbox/) 采集的原始内容，
> 经 DeepSeek 初筛 + 多维评分，产出一份 Obsidian Markdown AI 日报。

`news-radar-ai` 是「加工层」——它不直接抓数据，而是从上游 newsbox 采集层读取原始资讯，
用大模型逐条初筛去噪、打分、写摘要、打标，再把候选交给你（或你的 AI 助手）聚类、精选、
写成日报。

## 架构

```
newsbox（采集层，独立包）  →  news-radar-ai（本包，加工层）  →  Obsidian Markdown 日报
   RSS / X / Reddit /            初筛 · 评分 · 摘要 · 打标
   官方一手 / 通用网页            （DeepSeek 批量处理）
```

- **上游**：[newsbox](https://pypi.org/project/newsbox/) —— 负责全部采集，安装本包时会作为依赖自动拉取。
- **外部模型**：[DeepSeek](https://platform.deepseek.com) —— 逐条评分用，需要一个 API key。

## 安装

```bash
uv tool install news-radar-ai      # 推荐；或 pipx install news-radar-ai
```

会自动一并安装上游 newsbox 及其采集依赖。

## 初始化

```bash
# 1. 生成配置文件 ~/.news-radar-ai/config.yaml
news-radar-ai config init

# 2. 填入 DeepSeek API key（到 https://platform.deepseek.com 创建）
echo 'DEEPSEEK_API_KEY=sk-你的key' >> ~/.news-radar-ai/.env

# 3. 设置日报输出目录（Obsidian vault 或任意可写目录）
news-radar-ai config set report.obsidian_vault_path '/path/to/your/vault/'

# 4. 初始化数据库
news-radar-ai db init

# 5. 环境自检
news-radar-ai preflight
```

`preflight` 会检查 5 项：newsbox 是否装好、DeepSeek key、输出目录、本地数据库、上游 raw.db。

## 准备上游数据

本包只加工，不采集。先让 newsbox 抓到数据：

```bash
newsbox config init
newsbox sources seed       # 载入预置的数十个 AI 信源（多为标准 RSS，开箱即用）
newsbox fetch --since=7d   # 采集最近 7 天
```

> 预置信源以 RSS/Atom 为主，无需额外凭证即可抓取；少数信源（如本地 RSSHub 源、X/Twitter）
> 需要 Docker 或访问凭证，属可选增强。详见 newsbox 文档。

## 使用

### 命令行流水线

```bash
news-radar-ai pull --since 2026-01-01T00:00:00          # 从 newsbox 拉数据入库
news-radar-ai filter-score                              # DeepSeek 批量初筛 + 评分
news-radar-ai report-candidates --window-start 2026-01-01T00:00:00 --json   # 取候选
```

`report-candidates` 输出打过分的候选 JSON，你可据此聚类、精选、写日报。

### 配合 AI 助手（推荐）

本包设计为配合 AI 编程助手（如 Claude Code）的编排工作流使用：助手按
「拉数据 → 评分 → 取候选 → 写 Markdown」全程跑完，你只需一句「生成过去 24h 的 AI 资讯报告」。

## 配置速查

```bash
news-radar-ai config show                                  # 查看当前配置（密钥已脱敏）
news-radar-ai config set scoring.featured_threshold 75      # 精选门槛
news-radar-ai config set llm.model deepseek-v4-flash        # 切换 DeepSeek 模型
```

数据与配置都在 `~/.news-radar-ai/`（`config.yaml` / `.env` / `ai.db`）。

## 依赖

Python ≥ 3.11；运行时依赖 newsbox ≥ 1.0.3、typer、pydantic、httpx、loguru 等（自动安装）。

## License

MIT
