Skip to content

drasstry/ai-brief

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Brief

中文 | English

中文

AI Brief 是一个命令行优先的每日情报机器人。它默认优先通过 Serper 搜索 API 按关键词采集资讯;如果用户没有配置搜索 API token,系统会自动使用预置的权威 RSS 源兜底。采集后,AI Brief 会根据用户自定义主题过滤内容,使用可配置的大模型生成摘要,并把每日早报推送到 Telegram。

这个项目适合个人或小团队使用:通过 CLI 和本地配置文件完成设置,不需要网页后台。

功能特性

  • 按主题关键词过滤资讯。
  • 默认优先使用 Serper 新闻搜索采集。
  • 未配置搜索 API token 时,自动使用 RSS fallback。
  • 预置多个官方/权威 RSS 源,包括 OpenAI、Google AI、Google DeepMind、Meta、Hugging Face、Microsoft Research 和 NVIDIA。
  • 使用 SQLite 保存历史记录、去重和已推送链接。
  • 支持 Telegram Bot API 推送。
  • 支持前台运行的每日定时任务。
  • 支持多种模型:
    • 豆包、OpenAI、DeepSeek、通义千问、Kimi、智谱,以及其他 OpenAI-compatible API。
    • Anthropic Claude。
    • Google Gemini。

快速开始

python -m venv .venv
source .venv/bin/activate
pip install -e .
ai-brief init

ai-brief init 会创建本地运行文件:

  • config.yaml
  • .env
  • data/ai_brief.sqlite

这些文件不会被提交到 Git。公开模板是 config.example.yaml.env.example

配置主题

ai-brief topic list
ai-brief topic add "OpenAI"
ai-brief topic add "AI Agent"
ai-brief topic remove "OpenAI"

配置搜索采集

搜索采集默认开启,但需要你提供自己的 Serper API key。编辑 .env

SERPER_API_KEY=your_api_key

默认配置如下:

sources:
  search:
    enabled: true
    provider: serper
    api_key_env: SERPER_API_KEY
    num_results_per_topic: 10
    fallback_to_rss: true

如果没有配置 SERPER_API_KEY,系统会自动使用 RSS fallback。

RSS Fallback 和高级信息源

项目已经预置了一批官方/权威 RSS 源。你可以查看或继续添加:

ai-brief source list
ai-brief source add-rss "https://example.com/feed.xml" --name "Example"
ai-brief source disable "Example"

配置模型

默认模型服务是 doubao,通过 OpenAI-compatible 适配器调用。你需要配置 provider、模型名、base URL 和 API key 环境变量:

ai-brief model set doubao \
  --model "YOUR_MODEL_NAME" \
  --base-url "YOUR_OPENAI_COMPATIBLE_BASE_URL" \
  --api-key-env DOUBAO_API_KEY

然后在 .env 中设置密钥:

DOUBAO_API_KEY=your_api_key

查看支持的 provider:

ai-brief model list

OpenAI-compatible providers:

  • doubao
  • openai
  • deepseek
  • qwen
  • kimi
  • zhipu
  • openai-compatible

原生适配器:

  • anthropic
  • gemini

配置 Telegram

  1. 在 Telegram 中通过 @BotFather 创建一个机器人。
  2. 把机器人 token 写入 .env
TELEGRAM_BOT_TOKEN=your_bot_token
  1. 配置你的 chat ID:
ai-brief telegram setup --chat-id "YOUR_CHAT_ID"
ai-brief telegram test

运行

只预览,不发送:

ai-brief preview

不调用大模型,只用源摘要预览:

ai-brief preview --no-ai

生成并推送到 Telegram:

ai-brief run

启动前台定时任务:

ai-brief schedule start

定时任务会读取 config.yaml 中的 app.send_timeapp.timezone

项目结构

ai_brief/
  collectors/       RSS 和搜索采集器
  llm/              大模型 provider 适配器
  pipeline/         过滤、去重、格式化和运行编排
  prompts/          prompt 模板
  cli.py            命令行入口
  config.py         配置加载和初始化
  db.py             SQLite 存储
  scheduler.py      每日定时任务
  telegram.py       Telegram 推送
docs/
  ARCHITECTURE.md

开发

python -m compileall ai_brief
ai-brief --help
ai-brief preview --no-ai

GitHub Actions 会执行一个基础冒烟测试:安装项目、编译源码、检查 CLI 入口。

注意事项

  • 不要提交 .env,它包含密钥。
  • config.yaml 是本地运行配置,已被忽略。
  • data/ 存放本地 SQLite 数据库,已被忽略。
  • 当前项目仍是 MVP,定时任务以前台进程运行。生产环境建议用 systemd、Docker、进程管理器或托管 worker 来运行。

许可证

MIT

English

AI Brief is a CLI-first daily intelligence bot. It uses the Serper Search API first to collect topic-based updates; if the user has not configured a search API token, it automatically falls back to a curated set of authoritative RSS feeds. After collection, it filters updates by user-defined topics, summarizes them with a configurable LLM, and sends the daily brief to Telegram.

It is designed for personal or small-team workflows where configuration happens through the command line and local files, without a web dashboard.

Features

  • Topic-based news filtering.
  • Serper news search as the default collection path.
  • Automatic RSS fallback when no search API token is configured.
  • Curated official/authoritative RSS defaults, including OpenAI, Google AI, Google DeepMind, Meta, Hugging Face, Microsoft Research, and NVIDIA.
  • SQLite history for dedupe and sent-item tracking.
  • Telegram Bot API delivery.
  • Foreground daily scheduler.
  • Multi-model LLM adapters:
    • Doubao, OpenAI, DeepSeek, Qwen, Kimi, Zhipu, and other OpenAI-compatible APIs.
    • Anthropic Claude.
    • Google Gemini.

Quick Start

python -m venv .venv
source .venv/bin/activate
pip install -e .
ai-brief init

ai-brief init creates local runtime files:

  • config.yaml
  • .env
  • data/ai_brief.sqlite

These files are ignored by Git. Public templates live in config.example.yaml and .env.example.

Configure Topics

ai-brief topic list
ai-brief topic add "OpenAI"
ai-brief topic add "AI Agent"
ai-brief topic remove "OpenAI"

Configure Search Collection

Search collection is enabled by default, but you need to provide your own Serper API key. Add it to .env:

SERPER_API_KEY=your_api_key

The default config looks like this:

sources:
  search:
    enabled: true
    provider: serper
    api_key_env: SERPER_API_KEY
    num_results_per_topic: 10
    fallback_to_rss: true

If SERPER_API_KEY is missing, AI Brief automatically uses RSS fallback.

RSS Fallback and Advanced Sources

The project includes a curated set of official/authoritative RSS feeds. You can list or extend them:

ai-brief source list
ai-brief source add-rss "https://example.com/feed.xml" --name "Example"
ai-brief source disable "Example"

Configure a Model

The default provider is doubao, using the OpenAI-compatible adapter. Configure the provider, model name, base URL, and environment variable:

ai-brief model set doubao \
  --model "YOUR_MODEL_NAME" \
  --base-url "YOUR_OPENAI_COMPATIBLE_BASE_URL" \
  --api-key-env DOUBAO_API_KEY

Then set the key in .env:

DOUBAO_API_KEY=your_api_key

Supported provider names:

ai-brief model list

OpenAI-compatible providers:

  • doubao
  • openai
  • deepseek
  • qwen
  • kimi
  • zhipu
  • openai-compatible

Native adapters:

  • anthropic
  • gemini

Configure Telegram

  1. Create a bot with Telegram @BotFather.
  2. Put the bot token in .env:
TELEGRAM_BOT_TOKEN=your_bot_token
  1. Configure your chat ID:
ai-brief telegram setup --chat-id "YOUR_CHAT_ID"
ai-brief telegram test

Run

Preview without sending:

ai-brief preview

Preview without calling an LLM:

ai-brief preview --no-ai

Generate and send to Telegram:

ai-brief run

Start the foreground scheduler:

ai-brief schedule start

The scheduler uses app.send_time and app.timezone from config.yaml.

Repository Layout

ai_brief/
  collectors/       RSS and search collectors
  llm/              LLM provider adapters
  pipeline/         filtering, dedupe, formatting, and run orchestration
  prompts/          prompt templates
  cli.py            command-line interface
  config.py         config loading and initialization
  db.py             SQLite storage
  scheduler.py      daily scheduler
  telegram.py       Telegram delivery
docs/
  ARCHITECTURE.md

Development

python -m compileall ai_brief
ai-brief --help
ai-brief preview --no-ai

The GitHub Actions workflow runs a smoke test that installs the package, compiles the source, and checks the CLI entry point.

Notes

  • Never commit .env; it contains secrets.
  • config.yaml is local runtime configuration and is ignored.
  • data/ contains the local SQLite database and is ignored.
  • This project is an MVP and the scheduler currently runs in the foreground. For production use, run it under systemd, Docker, a process manager, or a hosted worker.

License

MIT

About

每日生成行业新闻摘要,并将其自动推送到 Telegram。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages