Files
Nexus/docs/changelog/2026-06-08-install-agent-auto-api-key.md
T
Nexus Agent 08a0157c95 feat: 调度表单重构、登录门控、批量任务与页面缓存对齐
调度页执行周期可视化/单次执行/分类选机/推送源对齐;登录 IP 门控与无缝导航;
服务器批量后台任务、执行记录、凭据合并、各页激活刷新与错误提示修复。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-08 11:17:21 +08:00

1.0 KiB

2026-06-08 — 安装 Agent 时自动生成 API Key

摘要

批量/单台安装 Agent 时,若服务器尚未设置 agent_api_key(常见于 Excel 导入),自动按 nxs-* 格式生成并写入数据库,不再要求先去详情页手动生成。

动机

用户批量安装「机器人」等 Excel 导入服务器时报错:未设置 Agent API Key,请先在服务器详情生成。新建/CSV 导入会自动生成密钥,Excel 导入路径遗漏,安装流程不应阻断。

涉及文件

  • server/application/server_batch_common.pyensure_agent_api_key()
  • server/application/services/server_batch_service.py — 批量安装调用
  • server/api/servers.py — 单台 POST /{id}/install-agent 对齐
  • tests/test_ensure_agent_api_key.py

迁移 / 重启

  • 无 DB 迁移
  • 需重启 API

验证

pytest tests/test_ensure_agent_api_key.py -q
bash scripts/local_verify.sh
# 对无 agent_api_key 的服务器批量安装 → 应直接 SSH 安装,不再报 Key 未设置