Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# 必填
# 必填: 两个 provider 二选一(默认 DeepSeek)
# 方案 A: DeepSeek(默认)
DEEPSEEK_API_KEY=sk-xxxxxxxxxxxxxxxx
# 可选: 自定义 API 地址(中转用)
# DEEPSEEK_BASE_URL=https://api.deepseek.com

# 方案 B: OrcaRouter(OpenAI 兼容 AI 网关,设置后自动接管全部 LLM 调用)
# ORCAROUTER_API_KEY=sk-orca-xxxxxxxxxxxxxxxx
# ORCAROUTER_BASE_URL=https://api.orcarouter.ai/v1
# ORCAROUTER_MODEL=orcarouter/auto

# 可选: 飞书机器人(国内首选)
FEISHU_WEBHOOK_URL=https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxxx
FEISHU_SECRET=xxxxxxxxxxxxxxxx
Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
## 密钥

- DeepSeek `DEEPSEEK_API_KEY`(命名 AIuse):本地在项目根 `.env`(gitignored),GitHub 侧在 repo secret;两处已同步更新。密钥值不放本文件。
- OrcaRouter `ORCAROUTER_API_KEY`(可选):设置后自动接管全部 LLM 调用(base `https://api.orcarouter.ai/v1`,默认模型 `orcarouter/auto`),与 DeepSeek 二选一;GitHub 侧同样走 repo secret。
- 飞书 `FEISHU_WEBHOOK_URL` / `FEISHU_SECRET`:仅在 GitHub repo secret。
- `XHS_COOKIE`(小红书):仅本地 `.env`,微调发布脚本用。

Expand Down
21 changes: 17 additions & 4 deletions src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,23 @@ def env_str(key: str, default: str = "") -> str:
# China has no DST, fixed offset avoids the tzdata dependency on Windows
BEIJING_TZ = timezone(timedelta(hours=8), name="Asia/Shanghai")

# --- LLM ---
LLM_API_KEY = env_str("DEEPSEEK_API_KEY")
LLM_BASE_URL = env_str("DEEPSEEK_BASE_URL", "https://api.deepseek.com")
LLM_MODEL = env_str("LLM_MODEL", "deepseek-chat")
# --- LLM provider ---
# Two named providers share the same OpenAI-compatible wiring. DeepSeek is the
# default; setting ORCAROUTER_API_KEY opts the whole pipeline into OrcaRouter
# (an OpenAI-compatible AI gateway) without touching process.py, which only
# reads the resolved LLM_* values below.
ORCAROUTER_API_KEY = env_str("ORCAROUTER_API_KEY")
ORCAROUTER_BASE_URL = env_str("ORCAROUTER_BASE_URL", "https://api.orcarouter.ai/v1")
ORCAROUTER_MODEL = env_str("ORCAROUTER_MODEL", "orcarouter/auto")

if ORCAROUTER_API_KEY:
LLM_API_KEY = ORCAROUTER_API_KEY
LLM_BASE_URL = ORCAROUTER_BASE_URL
LLM_MODEL = ORCAROUTER_MODEL
else:
LLM_API_KEY = env_str("DEEPSEEK_API_KEY")
LLM_BASE_URL = env_str("DEEPSEEK_BASE_URL", "https://api.deepseek.com")
LLM_MODEL = env_str("LLM_MODEL", "deepseek-chat")

# --- Content Sources ---
SOURCES = {
Expand Down
4 changes: 3 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
python src/main.py --publish-only # only publish (needs digest.md + social_posts.json)

Environment variables required:
DEEPSEEK_API_KEY - DeepSeek API key
DEEPSEEK_API_KEY - DeepSeek API key (default provider)
ORCAROUTER_API_KEY - OrcaRouter API key; when set, it takes over all
LLM calls instead of DeepSeek (OpenAI-compatible gateway)
DEEPSEEK_BASE_URL - (optional) custom endpoint
FEISHU_WEBHOOK_URL - (optional) Feishu bot webhook
FEISHU_SECRET - (optional) Feishu bot sign secret
Expand Down