refactor: unify kubernetes_ table prefix, merge CI/CD models, LLM session support

- Rename container_clusters → kubernetes_clusters, container_topology_layouts → kubernetes_topology_layouts
- LLM: add session_id to chat history for multi-turn conversation support
- CI/CD: add pipeline_id, deploy_type, artifact_url, k8s_cluster_id to AppRelease
- Cleanup: remove deprecated playbook handler, simplify automation models
- Database: optimize auto-migrate model list
- Frontend: AIOps assistant improvements, api.ts updates
This commit is contained in:
attacker committed 2026-06-19 15:01:54 +00:00
1 parent 9365c1e9db
commit 732974d152
14 files changed
+121 -474

No files matched your search

+14 -4
View File
@@ -90,9 +90,14 @@ func (h *LLMHandler) Chat(c *gin.Context) {
// 取最后一条用户消息(前端已附加当前提问)
lastUser := req.Messages[len(req.Messages)-1]
now := time.Now()
// session_id:前端传入或后端生成(兼容旧版客户端) // Logan.Li
sid := req.SessionID
if sid == "" {
sid = fmt.Sprintf("sess-%d", now.UnixMilli())
}
h.db.Create(&[]models.ChatHistory{
{UserID: uid, Role: "user", Content: lastUser.Content, CreatedAt: now},
{UserID: uid, Role: "assistant", Content: replyContent, Model: cfg.Model, CreatedAt: now.Add(time.Millisecond)},
{UserID: uid, SessionID: sid, Role: "user", Content: lastUser.Content, CreatedAt: now},
{UserID: uid, SessionID: sid, Role: "assistant", Content: replyContent, Model: cfg.Model, CreatedAt: now.Add(time.Millisecond)},
})
}
@@ -251,9 +256,14 @@ func (h *LLMHandler) ChatStream(c *gin.Context) {
if uid != 0 {
lastUser := req.Messages[len(req.Messages)-1]
now := time.Now()
// session_id:前端传入或后端生成(兼容旧版客户端) // Logan.Li
sid := req.SessionID
if sid == "" {
sid = fmt.Sprintf("sess-%d", now.UnixMilli())
}
h.db.Create(&[]models.ChatHistory{
{UserID: uid, Role: "user", Content: lastUser.Content, CreatedAt: now},
{UserID: uid, Role: "assistant", Content: fullContent, Model: cfg.Model, CreatedAt: now.Add(time.Millisecond)},
{UserID: uid, SessionID: sid, Role: "user", Content: lastUser.Content, CreatedAt: now},
{UserID: uid, SessionID: sid, Role: "assistant", Content: fullContent, Model: cfg.Model, CreatedAt: now.Add(time.Millisecond)},
})
}
// 发送结束标志