feat: Step 3 - Bot API 路由 (v0.9.2)

- 创建 bots.py 路由文件
- 实现 9 个 REST API 端点:
  - GET /api/bots - 获取列表
  - POST /api/bots - 创建
  - GET /api/bots/:id - 详情
  - PUT /api/bots/:id - 更新
  - DELETE /api/bots/:id - 删除
  - POST /api/bots/:id/bind - 绑定 Agent
  - POST /api/bots/:id/unbind - 解绑 Agent
  - GET /api/bots/:id/status - 状态
  - POST /api/bots/:id/heartbeat - 心跳
  - POST /api/bots/:id/token - 重新生成 Token
  - GET /api/bots/:id/stats - 统计
- 实现 JWT 权限检查
- 实现 X-Bot-Token 认证
- 注册蓝图到应用
- 更新版本号到 0.9.2
This commit is contained in:
2026-03-15 10:28:57 +08:00
parent 1ba9f78bd8
commit 608e53ed2f
2 changed files with 365 additions and 1 deletions

View File

@@ -39,7 +39,7 @@ def create_app(config_name='default'):
def index():
return {
'service': '智队中枢',
'version': '0.6.1',
'version': '0.9.2',
'status': 'running',
'endpoints': {
'health': '/health',
@@ -93,6 +93,7 @@ def _register_blueprints(app):
from app.routes.gateways import gateways_bp
from app.routes.messages import messages_bp
from app.routes.stats import stats_bp
from app.routes.bots import bots_bp # Step 3: Bot API
from app.web.routes import web_bp
from app.web.api import web_api_bp
@@ -102,6 +103,7 @@ def _register_blueprints(app):
app.register_blueprint(gateways_bp, url_prefix='/api/gateways')
app.register_blueprint(messages_bp, url_prefix='/api/messages')
app.register_blueprint(stats_bp, url_prefix='/api/stats')
app.register_blueprint(bots_bp, url_prefix='/api/bots') # Step 3: Bot API
app.register_blueprint(web_bp, url_prefix='/web')
app.register_blueprint(web_api_bp)