diff --git a/core/action/custom.go b/core/action/custom.go index 3397bff..5eaef04 100644 --- a/core/action/custom.go +++ b/core/action/custom.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/mudler/LocalAgent/core/types" + "github.com/mudler/LocalAgent/pkg/config" "github.com/mudler/LocalAgent/pkg/xlog" "github.com/sashabaranov/go-openai/jsonschema" "github.com/traefik/yaegi/interp" @@ -129,3 +130,34 @@ func (a *CustomAction) Definition() types.ActionDefinition { Required: requiredFields(), } } + +func CustomConfigMeta() []config.Field { + return []config.Field{ + { + Name: "name", + Label: "Action Name", + Type: config.FieldTypeText, + Required: true, + HelpText: "Name of the custom action", + }, + { + Name: "description", + Label: "Description", + Type: config.FieldTypeTextarea, + HelpText: "Description of the custom action", + }, + { + Name: "code", + Label: "Code", + Type: config.FieldTypeTextarea, + Required: true, + HelpText: "Go code for the custom action", + }, + { + Name: "unsafe", + Label: "Unsafe", + Type: config.FieldTypeCheckbox, + HelpText: "Allow unsafe code execution", + }, + } +} diff --git a/services/actions.go b/services/actions.go index ad94e3a..5590911 100644 --- a/services/actions.go +++ b/services/actions.go @@ -217,7 +217,7 @@ func ActionsConfigMeta() []config.FieldGroup { { Name: "custom", Label: "Custom", - Fields: []config.Field{}, + Fields: action.CustomConfigMeta(), }, { Name: "scraper",