Documentation
¶
Index ¶
- Variables
- type AIModelConfigController
- func (m *AIModelConfigController) Delete(c *response.Context)
- func (m *AIModelConfigController) List(c *response.Context)
- func (m *AIModelConfigController) QuickSave(c *response.Context)
- func (m *AIModelConfigController) Save(c *response.Context)
- func (m *AIModelConfigController) TestConnection(c *response.Context)
- type AIRunConfigController
- type AdminAIPromptController
- func (s *AdminAIPromptController) AIPromptDelete(c *response.Context)
- func (s *AdminAIPromptController) AIPromptList(c *response.Context)
- func (s *AdminAIPromptController) AIPromptLoad(c *response.Context)
- func (s *AdminAIPromptController) AIPromptOptionList(c *response.Context)
- func (s *AdminAIPromptController) AIPromptQuickSave(c *response.Context)
- func (s *AdminAIPromptController) AIPromptSave(c *response.Context)
- func (s *AdminAIPromptController) AIPromptToggle(c *response.Context)
- func (s *AdminAIPromptController) AIPromptTypes(c *response.Context)
- type Controller
- func (cc *Controller) AnyQuestion(c *response.Context)
- func (cc *Controller) AnySelection(c *response.Context)
- func (cc *Controller) Cron(c *response.Context)
- func (cc *Controller) Describe(c *response.Context)
- func (cc *Controller) Event(c *response.Context)
- func (cc *Controller) Example(c *response.Context)
- func (cc *Controller) FieldExample(c *response.Context)
- func (cc *Controller) GPTShell(c *response.Context)
- func (cc *Controller) History(c *response.Context)
- func (cc *Controller) K8sGPTResource(c *response.Context)
- func (cc *Controller) Log(c *response.Context)
- func (cc *Controller) Reset(c *response.Context)
- func (cc *Controller) Resource(c *response.Context)
- type ResourceData
Constants ¶
This section is empty.
Variables ¶
var WebsocketMessageType = map[int]string{ websocket.BinaryMessage: "binary", websocket.TextMessage: "text", websocket.CloseMessage: "close", websocket.PingMessage: "ping", websocket.PongMessage: "pong", }
Functions ¶
This section is empty.
Types ¶
type AIModelConfigController ¶
type AIModelConfigController struct {
}
func (*AIModelConfigController) Delete ¶
func (m *AIModelConfigController) Delete(c *response.Context)
@Summary 删除AI模型配置 @Security BearerAuth @Param ids path string true "模型ID,多个用逗号分隔" @Success 200 {object} string @Router /admin/plugins/ai/model/delete/{ids} [post]
func (*AIModelConfigController) List ¶
func (m *AIModelConfigController) List(c *response.Context)
@Summary 获取AI模型配置列表 @Security BearerAuth @Success 200 {object} string @Router /admin/plugins/ai/model/list [get]
func (*AIModelConfigController) QuickSave ¶
func (m *AIModelConfigController) QuickSave(c *response.Context)
@Summary 快速保存AI模型思考状态 @Security BearerAuth @Param id path int true "模型ID" @Param status path string true "状态,例如:true、false" @Success 200 {object} string @Router /admin/plugins/ai/model/id/{id}/think/{status} [post]
func (*AIModelConfigController) Save ¶
func (m *AIModelConfigController) Save(c *response.Context)
@Summary 创建或更新AI模型配置 @Security BearerAuth @Success 200 {object} string @Router /admin/plugins/ai/model/save [post]
func (*AIModelConfigController) TestConnection ¶
func (m *AIModelConfigController) TestConnection(c *response.Context)
@Summary 测试AI模型连接 @Security BearerAuth @Param id path int true "模型ID" @Success 200 {object} string @Router /admin/plugins/ai/model/test/id/{id} [post]
type AIRunConfigController ¶
type AIRunConfigController struct{}
func (*AIRunConfigController) GetRunConfig ¶
func (c *AIRunConfigController) GetRunConfig(ctx *response.Context)
@Summary 获取AI运行配置 @Security BearerAuth @Success 200 {object} models.AIRunConfig @Router /admin/plugins/ai/run_config [get]
func (*AIRunConfigController) UpdateRunConfig ¶
func (c *AIRunConfigController) UpdateRunConfig(ctx *response.Context)
@Summary 更新AI运行配置 @Security BearerAuth @Param config body models.AIRunConfig true "AI运行配置" @Success 200 {object} string @Router /admin/plugins/ai/run_config [post]
type AdminAIPromptController ¶
type AdminAIPromptController struct {
}
AdminAIPromptController AI提示词管理控制器 提供AI提示词的增删改查功能
func (*AdminAIPromptController) AIPromptDelete ¶
func (s *AdminAIPromptController) AIPromptDelete(c *response.Context)
@Summary 删除AI提示词 @Security BearerAuth @Param ids path string true "提示词ID,多个用逗号分隔" @Success 200 {object} string @Router /admin/ai_prompt/delete/{ids} [post]
func (*AdminAIPromptController) AIPromptList ¶
func (s *AdminAIPromptController) AIPromptList(c *response.Context)
@Summary 获取AI提示词列表 @Security BearerAuth @Success 200 {object} string @Router /admin/ai_prompt/list [get]
func (*AdminAIPromptController) AIPromptLoad ¶
func (s *AdminAIPromptController) AIPromptLoad(c *response.Context)
@Summary 加载内置AI提示词 @Security BearerAuth @Success 200 {object} string @Router /admin/ai_prompt/load [post]
func (*AdminAIPromptController) AIPromptOptionList ¶
func (s *AdminAIPromptController) AIPromptOptionList(c *response.Context)
@Summary 获取AI提示词选项列表 @Security BearerAuth @Success 200 {object} string @Router /admin/ai_prompt/option_list [get]
func (*AdminAIPromptController) AIPromptQuickSave ¶
func (s *AdminAIPromptController) AIPromptQuickSave(c *response.Context)
@Summary 快捷保存AI提示词启用状态 @Security BearerAuth @Param id path string true "提示词ID" @Param enabled path string true "启用状态,true或false" @Success 200 {object} string @Router /admin/ai_prompt/id/{id}/enabled/{enabled} [post]
func (*AdminAIPromptController) AIPromptSave ¶
func (s *AdminAIPromptController) AIPromptSave(c *response.Context)
@Summary 保存AI提示词 @Security BearerAuth @Success 200 {object} string @Router /admin/ai_prompt/save [post]
func (*AdminAIPromptController) AIPromptToggle ¶
func (s *AdminAIPromptController) AIPromptToggle(c *response.Context)
@Summary 启用/禁用AI提示词 @Security BearerAuth @Param id path string true "提示词ID" @Success 200 {object} string @Router /admin/ai_prompt/toggle/{id} [post]
func (*AdminAIPromptController) AIPromptTypes ¶
func (s *AdminAIPromptController) AIPromptTypes(c *response.Context)
@Summary 获取AI提示词类型列表 @Security BearerAuth @Success 200 {object} string @Router /admin/ai_prompt/types [get]
type Controller ¶
type Controller struct {
}
func (*Controller) AnyQuestion ¶
func (cc *Controller) AnyQuestion(c *response.Context)
@Summary 回答K8s相关问题 @Security BearerAuth @Param group query string false "资源组" @Param version query string false "资源版本" @Param kind query string false "资源类型" @Param question query string false "问题内容" @Success 200 {object} string @Router /mgm/plugins/ai/chat/any_question [get]
func (*Controller) AnySelection ¶
func (cc *Controller) AnySelection(c *response.Context)
@Summary 解释选择内容 @Security BearerAuth @Param question query string false "要解释的内容" @Success 200 {object} string @Router /mgm/plugins/ai/chat/any_selection [get]
func (*Controller) Cron ¶
func (cc *Controller) Cron(c *response.Context)
@Summary 分析Cron表达式 @Security BearerAuth @Param cron query string false "Cron表达式" @Success 200 {object} string @Router /mgm/plugins/ai/chat/cron [get]
func (*Controller) Describe ¶
func (cc *Controller) Describe(c *response.Context)
@Summary 分析K8s资源描述 @Security BearerAuth @Param group query string false "资源组" @Param version query string false "资源版本" @Param kind query string false "资源类型" @Param name query string false "资源名称" @Param namespace query string false "命名空间" @Success 200 {object} string @Router /mgm/plugins/ai/chat/describe [get]
func (*Controller) Event ¶
func (cc *Controller) Event(c *response.Context)
@Summary 分析K8s事件 @Security BearerAuth @Param note query string false "事件备注" @Param source query string false "事件来源" @Param reason query string false "事件原因" @Param type query string false "事件类型" @Param regardingKind query string false "相关资源类型" @Success 200 {object} string @Router /mgm/plugins/ai/chat/event [get]
func (*Controller) Example ¶
func (cc *Controller) Example(c *response.Context)
@Summary 获取K8s资源使用示例 @Security BearerAuth @Param group query string false "资源组" @Param version query string false "资源版本" @Param kind query string false "资源类型" @Success 200 {object} string @Router /mgm/plugins/ai/chat/example [get]
func (*Controller) FieldExample ¶
func (cc *Controller) FieldExample(c *response.Context)
@Summary 获取K8s资源字段示例 @Security BearerAuth @Param group query string false "资源组" @Param version query string false "资源版本" @Param kind query string false "资源类型" @Param field query string false "字段名称" @Success 200 {object} string @Router /mgm/plugins/ai/chat/example/field [get]
func (*Controller) GPTShell ¶
func (cc *Controller) GPTShell(c *response.Context)
@Summary 通过WebSocket提供GPT交互式对话终端 @Security BearerAuth @Param cluster query string false "集群名称" @Param namespace query string false "命名空间" @Param name query string false "资源名称" @Param resource query string false "资源类型" @Param content query string false "对话内容" @Success 101 {string} string "Switching Protocols" @Router /mgm/plugins/ai/chat/gptshell [get] GPTShell 通过 WebSocket 提供与 ChatGPT 及工具集成的交互式对话终端。
该函数升级 HTTP 连接为 WebSocket,维持心跳检测,实现双向消息流转: - 前端发送消息后,调用 ChatGPT 并动态集成可用工具,支持流式响应和工具调用结果返回; - 后端将 AI 回复和工具执行结果实时推送给前端; - 自动处理连接异常、心跳超时和资源释放。
若 AI 服务未启用或参数绑定失败,将返回相应错误信息。
func (*Controller) History ¶
func (cc *Controller) History(c *response.Context)
@Summary 获取聊天历史记录 @Security BearerAuth @Success 200 {object} string @Router /mgm/plugins/ai/ws_chatgpt/history [get]
func (*Controller) K8sGPTResource ¶
func (cc *Controller) K8sGPTResource(c *response.Context)
@Summary K8s错误信息分析 @Security BearerAuth @Param data query string false "错误内容" @Param name query string false "资源名称" @Param kind query string false "资源类型" @Param field query string false "相关字段" @Success 200 {object} string @Router /mgm/plugins/ai/chat/k8s_gpt/resource [get]
func (*Controller) Log ¶
func (cc *Controller) Log(c *response.Context)
@Summary 分析日志 @Security BearerAuth @Param data query string false "日志内容" @Success 200 {object} string @Router /mgm/plugins/ai/chat/log [get]
func (*Controller) Reset ¶
func (cc *Controller) Reset(c *response.Context)
@Summary 重置聊天历史记录 @Security BearerAuth @Success 200 {object} string @Router /mgm/plugins/ai/ws_chatgpt/reset [post]
func (*Controller) Resource ¶
func (cc *Controller) Resource(c *response.Context)
@Summary 获取K8s资源使用指南 @Security BearerAuth @Param group query string false "资源组" @Param version query string false "资源版本" @Param kind query string false "资源类型" @Success 200 {object} string @Router /mgm/plugins/ai/chat/resource [get]
type ResourceData ¶
type ResourceData struct {
// 资源版本
Version string `form:"version"`
// 资源类型
Kind string `form:"kind"`
// 资源组
Group string `form:"group"`
// 资源描述
Describe string `form:"describe"`
// 定时任务
Cron string `form:"cron"`
// 日志
Data string `form:"data"`
Field string `form:"field"`
Name string `form:"name"`
Namespace string `form:"namespace"`
// 事件
Note string `form:"note"`
Source string `form:"source"`
Reason string `form:"reason"`
ReportingController string `form:"reportingController"`
Type string `form:"type"`
RegardingKind string `form:"regardingKind"`
// AnyQuestion 任意提问
Question string `form:"question"`
}