# ============================================================ # 🎯 RedNote Insight — Environment Configuration # ============================================================ # Setup: # 1. Copy this file: cp .env.example .env # 2. Fill in your API key below # 3. Get a free key at: https://siliconflow.cn (supports DeepSeek) # # All fields are compatible with any OpenAI-format API provider: # - SiliconFlow (硅基流动): https://api.siliconflow.cn/v1 # - Alibaba Bailian (阿里云百炼): https://dashscope.aliyuncs.com/compatible-mode/v1 # - DeepSeek Official: https://api.deepseek.com/v1 # - OpenAI: https://api.openai.com/v1 # ============================================================ # ===== LLM Configuration ===== OPENAI_BASE_URL=https://api.siliconflow.cn/v1 OPENAI_API_KEY=your_api_key_here # Optional: use a dedicated provider for report generation. Confirm the # current model ids through DeepSeek's official `/models` endpoint. LLM_BASE_URL=https://api.deepseek.com LLM_API_KEY=your_deepseek_api_key_here LLM_MODEL=deepseek-v4-flash # ===== Embedding Model ===== # For semantic search (Chinese-optimized) EMBEDDING_MODEL=BAAI/bge-m3 # ===== Reranker Model ===== # Cross-Encoder for relevance scoring RERANKER_MODEL=BAAI/bge-reranker-v2-m3 # ===== Hybrid Retrieval Tuning ===== # RRF fusion constant (Cormack et al. 2009 paper recommends 60) RRF_K=60 # Number of candidates from BM25 keyword search BM25_K=25 # Number of candidates from vector search VECTOR_K=25 # Final documents returned after RRF fusion FINAL_K=10 # Re-ranker relevance threshold (docs below this score are discarded) RERANKER_THRESHOLD=0.1 # ===== PostgreSQL(Docker Compose 内自动配置)===== # 本地开发(非 Docker):用自己的 PG 实例 # DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/rednote_insight # # Docker Compose 部署:自动通过 docker-compose.yml 注入 # DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/rednote_insight # ===== Redis(Docker Compose 内自动配置)===== # 本地开发(非 Docker): # REDIS_URL=redis://localhost:6379/0 # # Docker Compose 部署:自动通过 docker-compose.yml 注入 # REDIS_URL=redis://redis:6379/0 # ===== LangFuse 可观测性(可选)===== # 注册 https://cloud.langfuse.com 获取 # LANGFUSE_PUBLIC_KEY=pk-... # LANGFUSE_SECRET_KEY=sk-... # LANGFUSE_HOST=https://cloud.langfuse.com # ===== 限流配置(可选)===== # RATE_LIMIT_ENABLED=true # RATE_LIMIT_INSIGHT=10/minute # RATE_LIMIT_QA=20/minute # RATE_LIMIT_CRAWL=5/minute # ===== 小红书 Cookie(Streamlit Cloud 部署用)===== # 在本地运行: uv run python scripts/export_cookies.py # 复制输出的 JSON 粘贴到 Streamlit Cloud Secrets → XHS_COOKIES # 注意: 本地 .env 中不需要此项,仅用于 Streamlit Cloud