# 环境变量配置 - 已有数据库服务
# AI+合规智能中枢

# ===== 应用配置 =====
APP_NAME=AI+合规智能中枢
APP_VERSION=0.1.0
DEBUG=false

# ===== Milvus向量数据库配置（已有）=====
MILVUS_HOST=6.86.80.8
MILVUS_PORT=19530
MILVUS_COLLECTION=regulations_dense_1024_v2
MILVUS_DB_NAME=default
MILVUS_INDEX_TYPE=IVF_FLAT
MILVUS_NLIST=128
MILVUS_NPROBE=16

# ===== MinIO对象存储配置（已有）=====
MINIO_ENDPOINT=6.86.80.8:9000
MINIO_ACCESS_KEY=minioadmin
MINIO_SECRET_KEY=minioadmin
MINIO_BUCKET=compliance-docs
MINIO_SECURE=false

# ===== Redis配置（已有）=====
REDIS_HOST=6.86.80.8
REDIS_PORT=6379
REDIS_PASSWORD=redis@123
REDIS_DB=0

# ===== PostgreSQL配置（已有）=====
POSTGRES_HOST=6.86.80.8
POSTGRES_PORT=5432
POSTGRES_USER=postgresql
POSTGRES_PASSWORD=postgresql123456
POSTGRES_DB=compliance_db

# ===== 嵌入模型配置 =====
EMBEDDING_MODEL=text-embedding-v3
EMBEDDING_DIM=1024
EMBEDDING_API_KEY=sk-fVr9KmDZNC4pGDBQj0EUWz9bDmFzNxjYC9EzZpe2bVDsxtz8
EMBEDDING_BASE_URL=http://6.86.80.4:30080/v1
EMBEDDING_TIMEOUT_SECONDS=120

# ===== 文档处理配置 =====
CHUNK_SIZE=512
CHUNK_OVERLAP=50
MAX_FILE_SIZE_MB=100
PARSER_BACKEND=aliyun
CHUNK_BACKEND=aliyun
# 文档元数据存储后端：启用 postgres 以激活合规分析历史记录（Direction B）及 Finding Chat 持久化（Direction C）
DOCUMENT_REPOSITORY_BACKEND=postgres
# Set to true only when a Celery worker is actually running (./dev.sh start worker).
# Default false: processing runs in FastAPI's threadpool — no external worker needed.
USE_CELERY_WORKER=false

# ===== 法规感知爬取配置 =====
PERCEPTION_CRAWL_TIMEOUT_SECONDS=120
PERCEPTION_MAX_EVENTS_PER_SOURCE=100
PERCEPTION_DIFF_SIMILARITY_THRESHOLD=0.85

# ===== API配置 =====
API_HOST=0.0.0.0
API_PORT=8000

# ===== LLM配置 =====
# LLM提供商选择: qwen / deepseek / qwen_vl
LLM_PROVIDER=deepseek
LLM_MODEL=deepseek-v4-flash
LLM_MAX_TOKENS=4096
LLM_TEMPERATURE=0.7

# ===== Qwen API配置（阿里云DashScope）=====
# 获取API Key: https://dashscope.console.aliyun.com/
QWEN_API_KEY=sk-fVr9KmDZNC4pGDBQj0EUWz9bDmFzNxjYC9EzZpe2bVDsxtz8
QWEN_BASE_URL=http://6.86.80.4:30080/v1
QWEN_MODEL=qwen3.6-plus
QWEN_VL_MODEL=qwen3-vl-plus

# ===== DeepSeek API配置 =====
# 获取API Key: https://platform.deepseek.com/
DEEPSEEK_API_KEY=sk-fVr9KmDZNC4pGDBQj0EUWz9bDmFzNxjYC9EzZpe2bVDsxtz8
DEEPSEEK_BASE_URL=http://6.86.80.4:30080/v1
DEEPSEEK_MODEL=deepseek-v4-flash

# ===== RAG配置 =====
RAG_TOP_K=10
RAG_MAX_CONTEXT_TOKENS=4000
RAG_SUMMARY_MAX_TOKENS=1024
RAG_SKILLS_MAX_TOKENS=2048

# ===== 阿里云文档解析 =====
ALIBABA_ACCESS_KEY_ID=LTAI5t9ZjvwSU9bKuMyiExrE
ALIBABA_ACCESS_KEY_SECRET=hNvY6XocmEO6inYlrmiBwBcx5OfidL
ALIBABA_ENDPOINT=docmind-api.cn-hangzhou.aliyuncs.com
ALIYUN_PARSE_POLL_INTERVAL_SECONDS=5
ALIYUN_PARSE_TIMEOUT_SECONDS=900
ALIYUN_PARSE_LAYOUT_STEP_SIZE=50
ALIYUN_LLM_ENHANCEMENT=true
ALIYUN_ENHANCEMENT_MODE=VLM
DOCUMENT_PARSE_ARTIFACT_PREFIX=artifacts
PARSER_FAILURE_MODE=fail

# ===== Reranker 配置 =====
RERANKER_ENABLED=false
RERANKER_BASE_URL=http://6.86.80.4:30080/v1
RERANKER_MODEL=BAAI/bge-reranker-v2-m3
RERANKER_API_KEY=sk-fVr9KmDZNC4pGDBQj0EUWz9bDmFzNxjYC9EzZpe2bVDsxtz8
RERANKER_TOP_K=5

# ===== 会话持久化 =====
SESSION_BACKEND=redis

# ===== 认证配置 =====
# 生产环境请修改为强随机密钥: python -c "import secrets; print(secrets.token_hex(32))"
AUTH_SECRET_KEY=ai-compliance-hub-jwt-secret-2026-tsystems
AUTH_ALGORITHM=HS256
AUTH_TOKEN_EXPIRE_MINUTES=480
AUTH_ENABLED=true

# ===== CORS =====
CORS_ALLOW_ORIGINS=http://localhost:5173

# ===== HyDE ???? =====
HYDE_ENABLED=true
HYDE_MAX_TOKENS=200
HYDE_LLM_PROVIDER=qwen
HYDE_LLM_MODEL=qwen3.5-flash

