feat(report): improve daily intelligence UX and price tracking

This commit is contained in:
phamnazage-jpg
2026-05-27 17:23:08 +08:00
parent f274621013
commit f5b373caf4
29 changed files with 4257 additions and 801 deletions

View File

@@ -48,9 +48,12 @@ psql llm_intelligence < db/migrations/001_phase1_core_tables.sql
```bash
export DATABASE_URL="host=/var/run/postgresql dbname=llm_intelligence sslmode=disable"
export OPENROUTER_API_KEY="your-api-key"
export API_AUTH_TOKEN="replace-with-long-random-token"
# 或者export API_BASIC_AUTH_USER="review" && export API_BASIC_AUTH_PASS="replace-with-password"
export FEISHU_WEBHOOK="your-webhook-url" # 可选
```
### 4. 启动后端
```bash
go run cmd/server/main.go
@@ -69,10 +72,14 @@ crontab -e
# 正式日报调度
0 8 * * * cd /path/to/llm-intelligence && bash scripts/run_daily.sh >> /tmp/llm_hub_cron.log 2>&1
# 日内价格追踪(推荐每 4 小时一次)
0 */4 * * * cd /path/to/llm-intelligence && bash scripts/run_intraday_price_watch.sh >> /tmp/llm_hub_intraday.log 2>&1
# 真实采集 + 写库 + 报告生成的手动复跑入口
cd /path/to/llm-intelligence && bash scripts/run_real_pipeline.sh
```
---
## Docker 部署
@@ -93,17 +100,26 @@ docker-compose up -d
|------|------|------|
| DATABASE_URL | ✅ | PostgreSQL 连接串 |
| OPENROUTER_API_KEY | ✅ | OpenRouter API Key |
| API_AUTH_TOKEN | 条件必填 | 对外访问 `/api/*` 的 Bearer token |
| API_BASIC_AUTH_USER / API_BASIC_AUTH_PASS | 条件必填 | 对外访问 `/api/*` 的 Basic Auth 凭证 |
| API_RATE_LIMIT_PER_WINDOW | ❌ | `/api/*` 每窗口允许的请求数,默认 `60` |
| API_RATE_LIMIT_WINDOW_SEC | ❌ | `/api/*` 限流窗口秒数,默认 `60` |
| FEISHU_WEBHOOK | ❌ | 飞书告警 Webhook |
| REPORT_DATE | ❌ | 手工指定日内追踪/日报日期 |
| PORT | ❌ | API Server 监听端口,默认 8080 |
---
## 验证安装
```bash
# 数据库连接
# 健康检查(仅本机 / 私网)
curl http://localhost:8080/health
# API 鉴权
curl -H "Authorization: Bearer $API_AUTH_TOKEN" http://localhost:8080/api/v1/models
# 采集器测试
go run scripts/fetch_openrouter.go -strict-real