From 907b7886f0797e63fbd8fe864cb3fa0568683363 Mon Sep 17 00:00:00 2001 From: Mateusz Szostok Date: Fri, 1 Mar 2024 01:33:29 +0100 Subject: [PATCH 1/2] Rename ai-face to ai, update help message --- .goreleaser.plugin.yaml | 10 +++++----- cmd/executor/{ai-face => ai}/config_schema.json | 2 +- cmd/executor/{ai-face => ai}/main.go | 14 ++++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) rename cmd/executor/{ai-face => ai}/config_schema.json (95%) rename cmd/executor/{ai-face => ai}/main.go (84%) diff --git a/.goreleaser.plugin.yaml b/.goreleaser.plugin.yaml index e4241be4..e6bfc193 100644 --- a/.goreleaser.plugin.yaml +++ b/.goreleaser.plugin.yaml @@ -5,9 +5,9 @@ before: - go mod download builds: - - id: ai-face - main: cmd/executor/ai-face/main.go - binary: executor_ai-face_{{ .Os }}_{{ .Arch }} + - id: ai + main: cmd/executor/ai/main.go + binary: executor_ai_{{ .Os }}_{{ .Arch }} no_unique_dist_dir: true env: @@ -188,8 +188,8 @@ builds: archives: - - builds: [ai-face] - id: ai-face + - builds: [ai] + id: ai files: - none* name_template: "{{ .Binary }}" diff --git a/cmd/executor/ai-face/config_schema.json b/cmd/executor/ai/config_schema.json similarity index 95% rename from cmd/executor/ai-face/config_schema.json rename to cmd/executor/ai/config_schema.json index 9ce7c26d..401a37b9 100644 --- a/cmd/executor/ai-face/config_schema.json +++ b/cmd/executor/ai/config_schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "AI Face", + "title": "AI", "description": "Proxies incoming prompts into AI engine a.k.a brain that responds with analysis.", "type": "object", "properties": { diff --git a/cmd/executor/ai-face/main.go b/cmd/executor/ai/main.go similarity index 84% rename from cmd/executor/ai-face/main.go rename to cmd/executor/ai/main.go index f651d6f1..c1f702c7 100644 --- a/cmd/executor/ai-face/main.go +++ b/cmd/executor/ai/main.go @@ -12,7 +12,6 @@ import ( "github.com/hashicorp/go-plugin" - "github.com/kubeshop/botkube-cloud-plugins/internal/auth" aibrain "github.com/kubeshop/botkube-cloud-plugins/internal/source/ai-brain" "github.com/kubeshop/botkube/pkg/api" "github.com/kubeshop/botkube/pkg/api/executor" @@ -31,7 +30,7 @@ var ( ) const ( - pluginName = "ai-face" + pluginName = "ai" description = "Proxies incoming prompts into AI engine a.k.a brain that responds with analysis." maxRespBodySize = 5 * 1024 * 1024 // 5 MB ) @@ -116,10 +115,13 @@ func (*AIFace) Help(context.Context) (api.Message, error) { Sections: []api.Section{ { Base: api.Base{ - Header: "Botkube: An AI-powered plugin for diagnosing your Kubernetes clusters in natural language.", + Description: "🤖 I am an AI powered Kubernetes assistant, ask me anything. Like you would ask your favorite Kubernetes expert. I have a set of tools to investigate the cluster(s) connected to this channel, and happy to learn new ones. Few examples:\n" + + "`{{BotName}} ai are there any failing pods in the namespace kube-system?`\n" + + "`{{BotName}} ai how can I change the number of replicas?`\n" + + "`{{BotName}} ai get me the logs for a pod called \"x\"?`", }, Buttons: []api.Button{ - btnBuilder.ForCommandWithDescCmd("Ask a question", "ai are there any failing pods in my cluster?"), + btnBuilder.ForURL("Give feedback", "https://feedback.botkube.io", api.ButtonStylePrimary), }, }, }, @@ -129,9 +131,9 @@ func (*AIFace) Help(context.Context) (api.Message, error) { func main() { executor.Serve(map[string]plugin.Plugin{ pluginName: &executor.Plugin{ - Executor: auth.NewProtectedExecutor(&AIFace{ + Executor: &AIFace{ httpClient: httpx.NewHTTPClient(), - }), + }, }, }) } From 872b5d56b57d87e6c384530213e216571aa80d4d Mon Sep 17 00:00:00 2001 From: Mateusz Szostok Date: Fri, 1 Mar 2024 10:25:09 +0100 Subject: [PATCH 2/2] Revert protection --- cmd/executor/ai/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/executor/ai/main.go b/cmd/executor/ai/main.go index c1f702c7..a235c836 100644 --- a/cmd/executor/ai/main.go +++ b/cmd/executor/ai/main.go @@ -11,7 +11,7 @@ import ( "strings" "github.com/hashicorp/go-plugin" - + "github.com/kubeshop/botkube-cloud-plugins/internal/auth" aibrain "github.com/kubeshop/botkube-cloud-plugins/internal/source/ai-brain" "github.com/kubeshop/botkube/pkg/api" "github.com/kubeshop/botkube/pkg/api/executor" @@ -131,9 +131,9 @@ func (*AIFace) Help(context.Context) (api.Message, error) { func main() { executor.Serve(map[string]plugin.Plugin{ pluginName: &executor.Plugin{ - Executor: &AIFace{ + Executor: auth.NewProtectedExecutor(&AIFace{ httpClient: httpx.NewHTTPClient(), - }, + }), }, }) }