diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index eec8677..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.dockerignore b/.dockerignore index 983485f..ff67260 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,9 +1,15 @@ node_modules dist .env +.env.* +!.env.example .git .codex outputs reports data/geo data/vehicle-heatmap/source.csv + +# Local machine metadata and runtime logs +.DS_Store +*.log diff --git a/.gitignore b/.gitignore index 7071147..36c51ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,10 @@ node_modules dist .env +.env.* +!.env.example .worktrees + +# Local machine metadata and runtime logs +.DS_Store +*.log diff --git a/docker-compose.yml b/docker-compose.yml index 6f235dc..516ce2f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,8 @@ services: image: harbor.lnh2e.com/lingniu-v1/ln-bi:main-1.0.0 network_mode: host environment: + # Runtime only: set this variable in Portainer Stack environment variables. + DEEPSEEK_API_KEY: "${DEEPSEEK_API_KEY:-}" DB_HOST: "rm-bp179zbv481rnw3e2no.mysql.rds.aliyuncs.com" DB_PORT: "3306" DB_USER: "oneos_db_prod" diff --git a/docs/.DS_Store b/docs/.DS_Store deleted file mode 100644 index 894578a..0000000 Binary files a/docs/.DS_Store and /dev/null differ diff --git a/docs/portainer-deepseek.md b/docs/portainer-deepseek.md new file mode 100644 index 0000000..6227547 --- /dev/null +++ b/docs/portainer-deepseek.md @@ -0,0 +1,38 @@ +# Portainer 部署资产 AI 问数 + +DeepSeek Key 由 Node 服务端在运行时读取,变量名为 `DEEPSEEK_API_KEY`。模型固定为 `deepseek-flash`,接口为 `https://api.deepseek.com/chat/completions`,部署节点需要能够访问该 HTTPS 地址。 + +## Stack 配置 + +仓库的 `docker-compose.yml` 已包含: + +```yaml +services: + ln-bi: + environment: + DEEPSEEK_API_KEY: "${DEEPSEEK_API_KEY:-}" +``` + +1. 等待当前分支的 Woodpecker 构建与镜像推送成功。本次版本 1.1.17 对应镜像 `harbor.lnh2e.com/lingniu-v1/ln-bi:feature-asset-statistics-1.1.17`。 +2. Portainer → Stacks → 现有 `ln-bi` Stack。确认 Compose 的 `image` 使用上述镜像,且保留现有数据库、认证、网络和端口配置。 +3. 在 **Environment variables** 中新增名称 `DEEPSEEK_API_KEY`,值粘贴实际 API Key。Compose 必须包含上面的变量引用,才能将 Stack 变量传入容器。 +4. 点击 **Update the stack** 并重新部署,确保拉取新镜像。Git 管理的 Stack 需要从仓库拉取新版 Compose;Web Editor 管理的 Stack 则直接更新编辑器内容。 +5. 登录应用,在资产管理中打开「AI 问数」,查询“当前库存按区域统计”验证。 + +后续更换 Key 只需更新 Stack 环境变量并重新部署/创建容器,无需重新构建镜像。仅重启旧容器不会刷新其环境变量。未配置 Key 时 AI 问数返回配置提示,其他资产功能可继续使用。 + +## 检查是否注入 + +在 Portainer 中打开正在运行的应用容器 Console,执行: + +```sh +node -e 'console.log(process.env.DEEPSEEK_API_KEY ? "已配置" : "未配置")' +``` + +该命令只检查是否存在,不打印 Key;实际有效性由问数请求验证。Swarm 部署请进入对应任务容器检查。 + +Key 不使用 `VITE_` 前缀,不写入前端代码、Dockerfile、构建参数或 Git。`.env` 与本机日志已排除出 Git 和 Docker 构建上下文。现有应用端口保持 8111,无需为 DeepSeek 新增监听端口。 + +仓库 Compose 采用显式 `environment` 引用,可用于 Docker Standalone 与 Swarm;不依赖仅 Standalone 支持的 `env_file: stack.env`。 + +参考:[Portainer 创建 Stack 与环境变量](https://docs.portainer.io/sts/user/docker/stacks/add)、[更新现有 Stack](https://docs.portainer.io/user/docker/stacks/edit)。 diff --git a/docs/superpowers/.DS_Store b/docs/superpowers/.DS_Store deleted file mode 100644 index 5115dd2..0000000 Binary files a/docs/superpowers/.DS_Store and /dev/null differ