- 配置: ProxyConfig.LogRaw (OT_PROXY_LOG_RAW, 默认 false) - 存储: usage_logs 新增 raw_request/raw_response 文本列 (AutoMigrate) - 网关: NewGateway 接收 logRaw 参数 - handlers: 三个协议入口按 开关+管理员 条件记录原始请求体 - passthrough: 非流式 copyAndCapture 捕获响应, 流式 streamCopy 累积全部原始 SSE 行, finishUsage 统一写入 - admin API: AdminUsage 返回 raw_request/raw_response (仅管理员) - 前端: 用量页新增查看入口, 弹窗 tab 切换请求/响应 - gitignore: 修正 server/web/ 忽略规则(尾随空格导致未生效)
51 lines
1.7 KiB
Bash
51 lines
1.7 KiB
Bash
# openteam 服务配置示例 —— 复制为 .env 后修改
|
||
# 所有项均可用环境变量 OT_<KEY> 覆盖(点号转下划线,如 db.driver → OT_DB_DRIVER)
|
||
|
||
# 运行环境 development | production
|
||
OT_ENV=development
|
||
OT_PORT=8080
|
||
|
||
# 数据库(开发默认 SQLite;生产切 postgres)
|
||
OT_DB_DRIVER=sqlite
|
||
OT_DB_DSN=data/openteam.db
|
||
# OT_DB_DRIVER=postgres
|
||
# OT_DB_DSN=host=localhost user=openteam password=openteam dbname=openteam port=5432 sslmode=disable
|
||
|
||
# JWT(生产必须更换为随机长字符串)
|
||
OT_JWT_SECRET=change-me-to-a-long-random-string
|
||
OT_JWT_ACCESS_TTL=2h
|
||
OT_JWT_REFRESH_TTL=168h
|
||
OT_JWT_COOKIE_SECURE=false
|
||
|
||
# 注册策略:open(开放)| invite(邀请码)
|
||
OT_AUTH_REGISTRATION_MODE=open
|
||
|
||
# 渠道密钥加密主密钥(生产必须设置,32 字节以上)
|
||
OT_MASTER_KEY=change-me-master-key
|
||
|
||
# 默认上游渠道(首次启动自动创建 OpenAI 渠道)
|
||
OT_PROXY_UPSTREAM_KEY=
|
||
OT_PROXY_UPSTREAM_BASE_URL=https://api.openai.com
|
||
OT_PROXY_DEFAULT_MODEL=gpt-4o-mini
|
||
OT_PROXY_TIMEOUT=120s
|
||
|
||
# 渠道健康检查
|
||
OT_PROXY_HEALTH_INTERVAL=60s
|
||
OT_PROXY_HEALTH_FAIL_THRESHOLD=2
|
||
|
||
# 调试:记录管理员的原始请求与响应到请求明细(默认关闭;流式记录全部事件)
|
||
OT_PROXY_LOG_RAW=false
|
||
|
||
# 限流(内存计数,Redis 后置):用户级每秒请求数上限(0=不限制)
|
||
OT_RATELIMIT_USER_RPS=20
|
||
|
||
# Passkey(WebAuthn):RPID 为域名,RPOrigin 为前端来源(需 HTTPS 或 localhost)
|
||
OT_WEBAUTHN_RP_ID=localhost
|
||
OT_WEBAUTHN_RP_ORIGIN=http://localhost:5173
|
||
OT_WEBAUTHN_RP_NAME=openteam
|
||
|
||
# 初始管理员(仅首次创建生效)
|
||
OT_ADMIN_USERNAME=admin
|
||
OT_ADMIN_EMAIL=admin@localhost
|
||
OT_ADMIN_PASSWORD=admin123
|