Files
llm-intelligence/scripts/run_real_pipeline.sh
2026-05-13 14:42:45 +08:00

39 lines
976 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT_DIR"
if [[ -f ".env.local" ]]; then
# shellcheck disable=SC1091
source ".env.local"
fi
if [[ -f ".env" ]]; then
# shellcheck disable=SC1091
source ".env"
fi
if [[ -z "${DATABASE_URL:-}" ]]; then
echo "DATABASE_URL 未设置" >&2
exit 1
fi
if [[ -z "${OPENROUTER_API_KEY:-}" ]]; then
echo "OPENROUTER_API_KEY 未设置,无法执行真实采集" >&2
exit 1
fi
"$ROOT_DIR/scripts/apply_migration.sh"
go run "./scripts/fetch_openrouter.go" \
-api-key "$OPENROUTER_API_KEY" \
-db "$DATABASE_URL" \
-out "$ROOT_DIR/models.json"
go run "./scripts/generate_daily_report.go" \
-json "$ROOT_DIR/models.json" \
-out "$ROOT_DIR/reports/daily"
psql "$DATABASE_URL" -Atqc \
"select 'models', count(*) from models union all select 'model_prices', count(*) from model_prices union all select 'report_runs', count(*) from report_runs order by 1;"