stock-data-api / .env.example
fromozuzhouzzz
fix: 引入全局源调用池,防止 HF Pro tier worker pool 饱和
3a08f21
Raw
History Blame Contribute Delete
1.32 kB
APP_NAME=A Share Stock Data API
API_PREFIX=/api/v1
# Optional. If set, every /api/v1 request must include X-API-Key or Bearer token.
STOCK_DATA_API_KEY=
# Hugging Face Spaces file storage is not persistent on free CPU Spaces.
# Use an external MySQL-compatible database for durable cache.
DATABASE_URL=mysql+pymysql://user:password@host:3306/stock_cache?charset=utf8mb4
DATABASE_SSL=false
CACHE_ENABLED=true
CACHE_TABLE_NAME=api_cache
CACHE_SCHEMA_VERSION=v1
SOURCE_TIMEOUT_SECONDS=15
SUPPRESS_SOURCE_OUTPUT=true
DISABLE_PROXY_FOR_AKSHARE=true
CORS_ORIGINS=*
# 源调用池配置 - 防止 HF Space worker pool 饱和
# MAX_CONCURRENT_SOURCES: 最大并发源调用数
# - HF Free tier: 建议设为 2(限制 1-2 个 worker)
# - HF Pro tier: 建议设为 10(支持更多并发)
# SOURCE_POOL_WORKERS: 线程池大小
# - 默认 4,如果上游响应慢,可以适当增加
MAX_CONCURRENT_SOURCES=2
SOURCE_POOL_WORKERS=4
# Search engine backend (OpenAI-compatible chat/completions endpoint).
# Without SEARCH_API_KEY the /search endpoints return 503 service unavailable.
SEARCH_API_BASE_URL=https://jiuuij.de5.net/
SEARCH_API_KEY=
SEARCH_API_MODEL=grok-4.20-multi-agent-xhigh
# SEARCH_API_TIMEOUT_SECONDS=180
# SEARCH_API_MAX_ATTEMPTS=8
# SEARCH_API_MAX_TOKENS=4096
# SEARCH_CACHE_TTL_SECONDS=3600