Generate connector form based on meta-data (#62)

* Ignore volumes and exe

* Export form meta-data

* use dynamic metaform for connectors

* fix populating form
This commit is contained in:
Richard Palethorpe
2025-03-20 15:00:37 +00:00
committed by GitHub
parent 43a46ad1fb
commit d7cfa7f0b2
15 changed files with 630 additions and 78 deletions

View File

@@ -7,6 +7,7 @@ import (
"os/signal"
"github.com/mudler/LocalAgent/core/agent"
"github.com/mudler/LocalAgent/pkg/metaform"
"github.com/mudler/LocalAgent/pkg/xlog"
"github.com/mudler/LocalAgent/services/connectors/twitter"
"github.com/sashabaranov/go-openai"
@@ -32,6 +33,37 @@ func (t *Twitter) AgentReasoningCallback() func(state agent.ActionCurrentState)
}
}
func (t *Twitter) ConfigForm() metaform.Form {
return metaform.Form{
Fields: []metaform.Field{
{
Kind: metaform.FieldString,
Name: "token",
Label: "Token",
Required: true,
Placeholder: "elmo-...",
},
{
Kind: metaform.FieldString,
Name: "botUsername",
Label: "Bot Username",
Required: true,
Placeholder: "Chocolate Pineapple",
},
{
Kind: metaform.FieldOptions,
Name: "noCharacterLimit",
Label: "No Character Limit",
Required: false,
Options: []metaform.Option{
{Value: "false", Label: ""},
{Value: "true", Label: ""},
},
},
},
}
}
func NewTwitterConnector(config map[string]string) (*Twitter, error) {
return &Twitter{
token: config["token"],