- backend/.env.example: AI 网关地址 129.146.203.203 → 129.146.26.249; MariaDB 注释段更新为生产实际(garmin 专用账号 @ 127.0.0.1:3306,socket 已不用) - README: 生产数据层/数据库说明改为 Oracle 新机本地 MariaDB 10.3 - docs/REQUIREMENTS: 部署目标 NAS → Oracle 新机;公网方式 frp 隧道 → gunicorn 直绑 8123 - docs/ARCHITECTURE: 部署架构改为真实生产栈(Flask+gunicorn+MariaDB+SPA)
64 lines
2.6 KiB
Plaintext
64 lines
2.6 KiB
Plaintext
# --- Server ---
|
|
# BACKEND_PORT takes precedence over PORT. Prefer it: many tools inject PORT
|
|
# for the frontend, and Flask would otherwise take the React dev server's port.
|
|
BACKEND_PORT=5000
|
|
|
|
# --- Database: sqlite (default) or mariadb ---
|
|
DB_TYPE=sqlite
|
|
# SQLite file (used when DB_TYPE=sqlite)
|
|
DATABASE_PATH=./data/health.db
|
|
|
|
# MariaDB (used when DB_TYPE=mariadb) — production DB on the Oracle server
|
|
# (129.146.26.249, local MariaDB 10.3). Dedicated account over TCP 127.0.0.1;
|
|
# MARIADB_SOCKET is only needed if TCP auth is disabled for the app user.
|
|
# MARIADB_HOST=127.0.0.1
|
|
# MARIADB_PORT=3306
|
|
# MARIADB_USER=garmin
|
|
# MARIADB_PASSWORD=your_production_mariadb_password
|
|
# MARIADB_DATABASE=garmin_health_lab
|
|
|
|
# --- Auth ---
|
|
# CHANGE THIS in production! Used to sign JWTs (7-day expiry by default).
|
|
JWT_SECRET=dev_secret_change_me
|
|
JWT_EXPIRY_DAYS=7
|
|
|
|
# --- CORS (comma-separated allowed front-end origins) ---
|
|
# localhost stays in the production list on purpose: CORS is not an auth
|
|
# boundary — every data route requires a valid JWT — so allowing a developer's
|
|
# dev server costs nothing and saves toggling this on every session.
|
|
CORS_ORIGIN=http://localhost:3000,http://localhost:5173
|
|
|
|
# --- AI models (text-only, large context) ---
|
|
# Put REAL keys in backend/.env — that file is gitignored. Never commit keys.
|
|
# Any model whose credentials are absent is skipped automatically.
|
|
|
|
# Self-hosted AI gateway (model id "gateway"). OpenAI-compatible; it fans out
|
|
# over nvidia/gemini/ollama itself and rotates several Gemini keys, so it
|
|
# absorbs single-vendor quota limits. Reached directly, bypassing any local
|
|
# HTTP proxy. NOTE: its NVIDIA upstream is a large reasoning model — replies
|
|
# can take 2-3 minutes, so set AI_TIMEOUT_SECONDS accordingly.
|
|
AI_GATEWAY_BASE_URL=http://129.146.26.249:5100/v1
|
|
AI_GATEWAY_TOKEN=
|
|
AI_GATEWAY_MODEL=ai-gateway-auto
|
|
|
|
# Google AI Studio -> "gemini-flash". Free-tier quota is small; 429s are common.
|
|
GEMINI_API_KEY=
|
|
|
|
# NVIDIA NIM -> "llama-70b", "nemotron-49b", "mistral-large".
|
|
# Model ids come from that account's live GET /v1/models — do not guess them.
|
|
NVIDIA_API_KEY=
|
|
# NVIDIA_BASE_URL=https://integrate.api.nvidia.com/v1
|
|
|
|
# Preference order. The first configured model answers; if it fails or times
|
|
# out, the next is tried. Read per request, so changes need no restart.
|
|
AI_MODEL_CHAIN=gateway,gemini-flash,llama-70b
|
|
|
|
# Max days of history sent (CSV-encoded). Trimmed further per model so the
|
|
# payload always fits that model's own context window.
|
|
AI_DAY_BUDGET=365
|
|
|
|
AI_TIMEOUT_SECONDS=180
|
|
# Output cap. Reasoning models spend part of it thinking before they answer;
|
|
# entries that need more declare their own budget in services/ai.py.
|
|
AI_MAX_TOKENS=1024
|