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:
1 parent
9365c1e9db
commit
732974d152
14 files changed
+121
-474
No files matched your search
@@ -19,7 +19,7 @@ type LLMConfig struct {
|
||||
}
|
||||
|
||||
// TableName 表名 // Logan.Li
|
||||
func (LLMConfig) TableName() string { return "sys_llm_configs" }
|
||||
func (LLMConfig) TableName() string { return "ai_llm_configs" }
|
||||
|
||||
// SaveLLMConfigRequest 保存 LLM 配置请求 // Logan.Li
|
||||
type SaveLLMConfigRequest struct {
|
||||
@@ -41,7 +41,8 @@ type ChatMessage struct {
|
||||
|
||||
// ChatRequest AI 对话请求 // Logan.Li
|
||||
type ChatRequest struct {
|
||||
Messages []ChatMessage `json:"messages" binding:"required,min=1,dive"`
|
||||
Messages []ChatMessage `json:"messages" binding:"required,min=1,dive"`
|
||||
SessionID string `json:"session_id"` // 前端生成,用于隔离多轮对话
|
||||
}
|
||||
|
||||
// ChatResponse AI 对话响应 // Logan.Li
|
||||
@@ -51,14 +52,15 @@ type ChatResponse struct {
|
||||
TokensUsed int `json:"tokens_used"`
|
||||
}
|
||||
|
||||
// ChatHistory 对话历史记录(按用户隔离) // Logan.Li
|
||||
// ChatHistory 对话历史记录(按用户隔离,session_id 区分多轮对话) // Logan.Li
|
||||
// 仅持久化成功完成的对话(用户消息 + 助手回复成对写入),错误气泡为瞬时 UI 不入库
|
||||
type ChatHistory struct {
|
||||
ID uint `gorm:"primarykey" json:"id"`
|
||||
UserID uint `gorm:"index;not null" json:"user_id"` // 所属用户(JWT 中间件注入)
|
||||
Role string `gorm:"size:16;not null" json:"role"` // user / assistant
|
||||
Content string `gorm:"type:text;not null" json:"content"` // 消息内容
|
||||
Model string `gorm:"size:100" json:"model"` // 生成回复所用模型(仅 assistant 行有意义)
|
||||
UserID uint `gorm:"index;not null" json:"user_id"` // 所属用户(JWT 中间件注入)
|
||||
SessionID string `gorm:"size:64;index;not null;default:''" json:"session_id"` // 对话会话 ID(前端 UUID)
|
||||
Role string `gorm:"size:16;not null" json:"role"` // user / assistant
|
||||
Content string `gorm:"type:text;not null" json:"content"` // 消息内容
|
||||
Model string `gorm:"size:100" json:"model"` // 生成回复所用模型(仅 assistant 行有意义)
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user