feat(ai): 助手浮窗聚焦日志查询页,携带当前查询结果对话
- 浮球只在 /logs 渲染(产品定位:辅助分析正在查看的查询结果,其它页面不打扰) - /logs 查询成功后写入 AI 上下文:LogQL、时间范围、结果条数、error 行数、 最新 20 条样本(去 CRI 包装);对话请求自动携带 - 后端 /ai/chat 接收 context:截断 6000 字 + RedactTextOnly 统一脱敏后并入 system (ECHO 假模型实测注入完整);空态文案改为查询导向
This commit is contained in:
1 parent
2efbed882a
commit
c216bdfdd4
8 files changed
+59
-6
No files matched your search
@@ -161,6 +161,7 @@ func (ctrl *AIController) Chat(c *gin.Context) {
|
||||
History []services.ChatMessage `json:"history" binding:"required,min=1,max=40"`
|
||||
Page string `json:"page"`
|
||||
RangeMinutes int `json:"rangeMinutes"`
|
||||
Context string `json:"context"`
|
||||
}
|
||||
if !utils.BindAndValidate(c, &req) {
|
||||
return
|
||||
@@ -174,7 +175,7 @@ func (ctrl *AIController) Chat(c *gin.Context) {
|
||||
if rangeMinutes <= 0 || rangeMinutes > 120 {
|
||||
rangeMinutes = 15
|
||||
}
|
||||
reply, err := services.RunAIChat(c.Request.Context(), cfg, src, c.GetUint("userId"), c.GetString("role") == "admin", req.History, req.Page, rangeMinutes)
|
||||
reply, err := services.RunAIChat(c.Request.Context(), cfg, src, c.GetUint("userId"), c.GetString("role") == "admin", req.History, req.Page, rangeMinutes, req.Context)
|
||||
if err != nil {
|
||||
utils.Error(c, 400, err.Error())
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user