- 支持 Windows Agent 构建、安装脚本和统一上报协议 - 增强 RDP 剪贴板、虚拟盘和文件传输能力 - 新增 AIOps 上下文工具、告警 RCA trace 落库和回放接口 - 重构 docs 模块文档并补充终端、堡垒机、监控、AI Agent 设计
47 lines
1.4 KiB
Go
47 lines
1.4 KiB
Go
package controller
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"ezops/model"
|
|
"ezops/pkg/aiopscontext"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// AIOpsContextHandler 提供 AI 上下文包接口,供智能助手、告警分析、预测分析和后续 MCP 复用。 // Logan.Li
|
|
type AIOpsContextHandler struct {
|
|
service *aiopscontext.Service
|
|
}
|
|
|
|
// NewAIOpsContextHandler 创建 AI 上下文处理器。 // Logan.Li
|
|
func NewAIOpsContextHandler(db *gorm.DB) *AIOpsContextHandler {
|
|
return &AIOpsContextHandler{service: aiopscontext.NewService(db)}
|
|
}
|
|
|
|
// Summary GET /api/v1/aiops/context/summary // Logan.Li
|
|
func (h *AIOpsContextHandler) Summary(c *gin.Context) {
|
|
data, err := h.service.Summary(c.Request.Context())
|
|
if err != nil {
|
|
c.JSON(http.StatusOK, model.Response{Code: 500, Message: err.Error()})
|
|
return
|
|
}
|
|
c.JSON(http.StatusOK, model.Response{Code: 200, Data: data})
|
|
}
|
|
|
|
// BuildPack POST /api/v1/aiops/context/pack // Logan.Li
|
|
func (h *AIOpsContextHandler) BuildPack(c *gin.Context) {
|
|
var req aiopscontext.ContextPackRequest
|
|
if err := c.ShouldBindJSON(&req); err != nil {
|
|
c.JSON(http.StatusBadRequest, model.Response{Code: 400, Message: "请求参数错误: " + err.Error()})
|
|
return
|
|
}
|
|
data, err := h.service.BuildPack(c.Request.Context(), req)
|
|
if err != nil {
|
|
c.JSON(http.StatusOK, model.Response{Code: 500, Message: err.Error()})
|
|
return
|
|
}
|
|
c.JSON(http.StatusOK, model.Response{Code: 200, Data: data})
|
|
}
|