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 (
"github.com/google/go-github/v69/github"
"github.com/mudler/LocalAgent/core/agent"
"github.com/mudler/LocalAgent/pkg/metaform"
"github.com/mudler/LocalAgent/pkg/xlog"
"github.com/sashabaranov/go-openai"
@@ -63,6 +64,51 @@ func (g *GithubIssues) AgentReasoningCallback() func(state agent.ActionCurrentSt
}
}
func (g *GithubIssues) ConfigForm() metaform.Form {
return metaform.Form{
Fields: []metaform.Field{
{
Kind: metaform.FieldString,
Name: "token",
Label: "GitHub Token",
Required: true,
Placeholder: "Your GitHub personal access token",
},
{
Kind: metaform.FieldString,
Name: "owner",
Label: "Repository Owner",
Required: true,
Placeholder: "username or organization",
},
{
Kind: metaform.FieldString,
Name: "repository",
Label: "Repository Name",
Required: true,
Placeholder: "repo-name",
},
{
Kind: metaform.FieldOptions,
Name: "replyIfNoReplies",
Label: "Reply Behavior",
Required: true,
Options: []metaform.Option{
{Value: "true", Label: "Reply only to issues with no comments"},
{Value: "false", Label: "Reply to all issues"},
},
},
{
Kind: metaform.FieldString,
Name: "pollInterval",
Label: "Poll Interval",
Required: false,
Placeholder: "10m",
},
},
}
}
func (g *GithubIssues) Start(a *agent.Agent) {
// Start the connector
g.agent = a