feat(ui): Add custom action config meta data

This commit is contained in:
Richard Palethorpe
2025-04-01 15:38:17 +01:00
parent a5ba49ec93
commit 5023bc77f4
2 changed files with 33 additions and 1 deletions

View File

@@ -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",
},
}
}

View File

@@ -217,7 +217,7 @@ func ActionsConfigMeta() []config.FieldGroup {
{
Name: "custom",
Label: "Custom",
Fields: []config.Field{},
Fields: action.CustomConfigMeta(),
},
{
Name: "scraper",