feat(ui): Add custom action config meta data
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/mudler/LocalAgent/core/types"
|
"github.com/mudler/LocalAgent/core/types"
|
||||||
|
"github.com/mudler/LocalAgent/pkg/config"
|
||||||
"github.com/mudler/LocalAgent/pkg/xlog"
|
"github.com/mudler/LocalAgent/pkg/xlog"
|
||||||
"github.com/sashabaranov/go-openai/jsonschema"
|
"github.com/sashabaranov/go-openai/jsonschema"
|
||||||
"github.com/traefik/yaegi/interp"
|
"github.com/traefik/yaegi/interp"
|
||||||
@@ -129,3 +130,34 @@ func (a *CustomAction) Definition() types.ActionDefinition {
|
|||||||
Required: requiredFields(),
|
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",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ func ActionsConfigMeta() []config.FieldGroup {
|
|||||||
{
|
{
|
||||||
Name: "custom",
|
Name: "custom",
|
||||||
Label: "Custom",
|
Label: "Custom",
|
||||||
Fields: []config.Field{},
|
Fields: action.CustomConfigMeta(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "scraper",
|
Name: "scraper",
|
||||||
|
|||||||
Reference in New Issue
Block a user