Files
microfish/.env.example
Kunthawat Greethong 8b84378fe1 feat: SaaS foundation for CrowdSight
Elevate MiroFish/CrowdSight from single-container dev to a SaaS foundation:

- Local memory backend (Zep-compatible): memory services/models, local graph
  builder + updater, AgentActivity seam, import-boundary isolation; Zep stays
  default, local is opt-in behind MEMORY_BACKEND. Semantic parity not yet proven.
- Durable product persistence: projects/simulations/reports schema (migration
  0007) + tenant/owner-scoped ProductRepository + dual-write + scoped_project
  read-first + ArtifactStore abstraction; durable JobQueue + worker.py.
- SaaS hardening: durable RateLimiter (wired to login), UsageService (LLM
  accounting), redacted AuditService, idempotency, CORS allowlist, safe API
  errors, single-use PasswordResetService + endpoints (covers invite-pending).
- Exactly 3 roles (super_admin/admin/user) with tenant authz policy.
- Admin UI: GET/POST/PATCH /api/admin/users + GET/PUT /api/admin/settings
  (super-admin only, encrypted/masked); AdminView.vue + SettingsView.vue with
  admin/super-admin route guards, th/en i18n.
- Production deploy topology: multi-stage Dockerfile (frontend build + gunicorn
  wsgi + nginx SPA-proxy + supervisord worker), backend/wsgi.py, gunicorn dep.

Backend 197 passed; frontend 10 tests + build green. ruff unavailable (gap).
No commit of credentials; secrets handled via env/.env.example.
Deferred: Zep semantic A/B parity, object storage cutover, mobile QA, EasyPanel
container build of deploy topology.
2026-08-31 13:05:21 +07:00

122 lines
4.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ================================================================
# CrowdSight environment configuration
# ================================================================
# Copy this file to .env and fill in deployment secrets:
# cp .env.example .env
#
# Security (generate a unique value for every deployment)
SECRET_KEY=replace_with_a_long_random_secret
SESSION_COOKIE_SECURE=true
CORS_ALLOWED_ORIGINS=https://your-frontend.example.com
#
# LLM 配置支持两种方式:
# 方式1推荐设置 LLM_PROVIDER只需提供 API Key
# 方式2灵活手动指定 LLM_BASE_URL 和 LLM_MODEL_NAME
# ================================================================
# ================================================================
# 方式1使用提供商预设推荐
# ================================================================
# 取消注释你要使用的提供商,然后填入对应的 API Key。
# 设置 LLM_PROVIDER 后LLM_BASE_URL 和 LLM_MODEL_NAME 会自动填充默认值。
#
# 可用的提供商:
# - openai : OpenAI GPT 系列
# - deepseek : DeepSeek (深度求索)
# - xiaomi_mimo : Xiaomi MiMo (小米 MiMo)
# - alibaba_dashscope : 阿里百炼 (通义千问)
# - minimax : MiniMax (海螺 AI)
# --- DeepSeek ---
# API Key 获取: https://platform.deepseek.com
# LLM_PROVIDER=deepseek
# LLM_API_KEY=sk-your-deepseek-key-here
# --- Xiaomi MiMo ---
# API Key 获取: https://platform.xiaomimimo.com
# LLM_PROVIDER=xiaomi_mimo
# LLM_API_KEY=your-mimo-api-key-here
# --- OpenAI ---
# API Key 获取: https://platform.openai.com/api-keys
# LLM_PROVIDER=openai
# LLM_API_KEY=sk-your-openai-key-here
# --- 阿里百炼 (通义千问) ---
# API Key 获取: https://bailian.console.aliyun.com/
# 注意消耗较大可先进行小于40轮的模拟尝试
# LLM_PROVIDER=alibaba_dashscope
# LLM_API_KEY=sk-your-dashscope-key-here
# --- MiniMax (海螺 AI) ---
# API Key 获取: https://platform.minimaxi.com/
# LLM_PROVIDER=minimax
# LLM_API_KEY=your-minimax-key-here
# ================================================================
# 方式2手动指定配置兼容原有方式
# ================================================================
# 如果不使用 LLM_PROVIDER需要手动指定以下三个变量。
# 适用于任何兼容 OpenAI SDK 格式的 LLM API。
LLM_API_KEY=your_api_key_here
LLM_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
LLM_MODEL_NAME=qwen-plus
# Memory backend migration switch:
# zep = legacy Zep runtime (current default)
# local = local SQLAlchemy memory repository (requires imported memory graphs)
MEMORY_BACKEND=zep
# Legacy Zep credential; remove only after all consumers are cut over.
ZEP_API_KEY=your_zep_api_key_here
# ================================================================
# Frontend URL 配置
# ================================================================
# 前后端分离部署时(如 opinion.moreminimore.com + opinion-api.moreminimore.com
# 设置此变量让前端直接请求后端 API 地址。
# 同源部署或本地开发时无需设置。
VITE_API_BASE_URL=https://opinion-api.moreminimore.com
# ================================================================
# 加速 LLM 配置(可选)
# ================================================================
# 注意如果不使用加速配置env文件中就不要出现下面的配置项
# LLM_BOOST_API_KEY=your_api_key_here
# LLM_BOOST_BASE_URL=your_base_url_here
# LLM_BOOST_MODEL_NAME=your_model_name_here
# ================================================================
# 提供商配置示例(完整示例,取消注释即可使用)
# ================================================================
# ---- DeepSeek 完整示例 ----
# LLM_PROVIDER=deepseek
# LLM_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# # 以下可省略(使用默认值):
# # LLM_BASE_URL=https://api.deepseek.com/v1
# # LLM_MODEL_NAME=deepseek-chat
# ---- Xiaomi MiMo 完整示例 ----
# LLM_PROVIDER=xiaomi_mimo
# LLM_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# # 以下可省略(使用默认值):
# # LLM_BASE_URL=https://api.xiaomimimo.com/v1
# # LLM_MODEL_NAME=mimo-v2.5-pro
# ---- 阿里百炼 完整示例 ----
# LLM_PROVIDER=alibaba_dashscope
# LLM_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# # 以下可省略(使用默认值):
# # LLM_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
# # LLM_MODEL_NAME=qwen-plus