71 lines
3.1 KiB
Bash
71 lines
3.1 KiB
Bash
#!/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 "${INTRADAY_DISCOVERY_SEARCH_PROVIDER:-}" ]]; then
|
|
echo "INTRADAY_DISCOVERY_SEARCH_PROVIDER 未设置" >&2
|
|
exit 1
|
|
fi
|
|
if [[ -z "${INTRADAY_DISCOVERY_LLM_PROVIDER:-}" ]]; then
|
|
echo "INTRADAY_DISCOVERY_LLM_PROVIDER 未设置" >&2
|
|
exit 1
|
|
fi
|
|
|
|
REPORT_DATE="${REPORT_DATE:-$(date +%F)}"
|
|
DRY_RUN="false"
|
|
if [[ "${1:-}" == "--dry-run" ]]; then
|
|
DRY_RUN="true"
|
|
fi
|
|
|
|
discovery_args=(--date "$REPORT_DATE")
|
|
verification_args=(--date "$REPORT_DATE")
|
|
materialize_args=(--date "$REPORT_DATE")
|
|
if [[ "$DRY_RUN" == "true" ]]; then
|
|
discovery_args+=(--dry-run)
|
|
verification_args+=(--dry-run)
|
|
materialize_args+=(--dry-run)
|
|
fi
|
|
|
|
deepseek_guard_args=()
|
|
if [[ "$DRY_RUN" == "true" ]]; then
|
|
deepseek_guard_args+=(--allow-bootstrap=false)
|
|
fi
|
|
|
|
if ! go run -tags llm_script ./scripts/discover_intraday_news_candidates.go ./scripts/intraday_discovery_provider.go ./scripts/intraday_discovery_common.go "${discovery_args[@]}"; then
|
|
exit 1
|
|
fi
|
|
if ! go run -tags llm_script ./scripts/verify_intraday_news_candidates.go ./scripts/intraday_discovery_common.go "${verification_args[@]}"; then
|
|
exit 1
|
|
fi
|
|
if ! go run -tags llm_script ./scripts/deepseek_news_signature_guard.go ./scripts/deepseek_news_signature_guard_lib.go ./scripts/deepseek_news_snapshot_lib.go ./scripts/subscription_import_common.go ./scripts/official_import_signature_audit_lib.go ./scripts/pricing_markdown_snapshot_lib.go ./scripts/signature_guard_common.go "${deepseek_guard_args[@]}"; then
|
|
if [[ "$DRY_RUN" != "true" ]]; then
|
|
exit 1
|
|
fi
|
|
fi
|
|
if ! go run -tags llm_script ./scripts/deepseek_pricing_signature_guard.go ./scripts/deepseek_pricing_signature_guard_lib.go ./scripts/deepseek_pricing_snapshot_lib.go ./scripts/subscription_import_common.go ./scripts/official_import_signature_audit_lib.go ./scripts/pricing_markdown_snapshot_lib.go ./scripts/signature_guard_common.go --source-key deepseek_pricing_signature --snapshot-base deepseek-pricing --url https://platform.deepseek.com/pricing "${deepseek_guard_args[@]}"; then
|
|
if [[ "$DRY_RUN" != "true" ]]; then
|
|
exit 1
|
|
fi
|
|
fi
|
|
if ! go run -tags llm_script ./scripts/deepseek_pricing_signature_guard.go ./scripts/deepseek_pricing_signature_guard_lib.go ./scripts/deepseek_pricing_snapshot_lib.go ./scripts/subscription_import_common.go ./scripts/official_import_signature_audit_lib.go ./scripts/pricing_markdown_snapshot_lib.go ./scripts/signature_guard_common.go --source-key deepseek_api_pricing_signature --snapshot-base deepseek-api-pricing --url https://platform.deepseek.com/docs/api-pricing "${deepseek_guard_args[@]}"; then
|
|
if [[ "$DRY_RUN" != "true" ]]; then
|
|
exit 1
|
|
fi
|
|
fi
|
|
REPORT_TRIGGER_SOURCE="intraday_discovery" go run -tags llm_script ./scripts/materialize_daily_signals.go ./scripts/official_import_signature_audit_query_lib.go "${materialize_args[@]}"
|