chore(ui): Move some field definitions server side

This commit is contained in:
Richard Palethorpe
2025-03-26 15:56:14 +00:00
parent 7fb99ecf21
commit 319caf8e91
62 changed files with 1534 additions and 1574 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/mudler/LocalAgent/core/action"
"github.com/mudler/LocalAgent/core/state"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/mudler/LocalAgent/pkg/xlog"
"github.com/mudler/LocalAgent/services/actions"
@@ -30,7 +31,7 @@ const (
ActionWikipedia = "wikipedia"
ActionBrowse = "browse"
ActionTwitterPost = "twitter-post"
ActionSendMail = "send_mail"
ActionSendMail = "send-mail"
ActionGenerateImage = "generate_image"
ActionCounter = "counter"
ActionCallAgents = "call_agents"
@@ -138,3 +139,108 @@ func Action(name string, config map[string]string, pool *state.AgentPool) (types
return a, nil
}
func ActionsConfigMeta() []config.FieldGroup {
return []config.FieldGroup{
{
Name: "search",
Label: "Search",
Fields: actions.SearchConfigMeta(),
},
{
Name: "generate_image",
Label: "Generate Image",
Fields: actions.GenImageConfigMeta(),
},
{
Name: "github-issue-labeler",
Label: "GitHub Issue Labeler",
Fields: actions.GithubIssueLabelerConfigMeta(),
},
{
Name: "github-issue-opener",
Label: "GitHub Issue Opener",
Fields: actions.GithubIssueOpenerConfigMeta(),
},
{
Name: "github-issue-closer",
Label: "GitHub Issue Closer",
Fields: actions.GithubIssueCloserConfigMeta(),
},
{
Name: "github-issue-commenter",
Label: "GitHub Issue Commenter",
Fields: actions.GithubIssueCommenterConfigMeta(),
},
{
Name: "github-issue-reader",
Label: "GitHub Issue Reader",
Fields: actions.GithubIssueReaderConfigMeta(),
},
{
Name: "github-issue-searcher",
Label: "GitHub Issue Search",
Fields: actions.GithubIssueSearchConfigMeta(),
},
{
Name: "github-repository-get-content",
Label: "GitHub Repository Get Content",
Fields: actions.GithubRepositoryGetContentConfigMeta(),
},
{
Name: "github-repository-create-or-update-content",
Label: "GitHub Repository Create/Update Content",
Fields: actions.GithubRepositoryCreateOrUpdateContentConfigMeta(),
},
{
Name: "github-readme",
Label: "GitHub Repository README",
Fields: actions.GithubRepositoryREADMEConfigMeta(),
},
{
Name: "twitter-post",
Label: "Twitter Post",
Fields: actions.TwitterPostConfigMeta(),
},
{
Name: "send-mail",
Label: "Send Mail",
Fields: actions.SendMailConfigMeta(),
},
{
Name: "shell-command",
Label: "Shell Command",
Fields: actions.ShellConfigMeta(),
},
{
Name: "custom",
Label: "Custom",
Fields: []config.Field{},
},
{
Name: "scraper",
Label: "Scraper",
Fields: []config.Field{},
},
{
Name: "wikipedia",
Label: "Wikipedia",
Fields: []config.Field{},
},
{
Name: "browse",
Label: "Browse",
Fields: []config.Field{},
},
{
Name: "counter",
Label: "Counter",
Fields: []config.Field{},
},
{
Name: "call_agents",
Label: "Call Agents",
Fields: []config.Field{},
},
}
}

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/sashabaranov/go-openai"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -96,3 +97,32 @@ func (a *GenImageAction) Definition() types.ActionDefinition {
func (a *GenImageAction) Plannable() bool {
return true
}
// GenImageConfigMeta returns the metadata for GenImage action configuration fields
func GenImageConfigMeta() []config.Field {
return []config.Field{
{
Name: "apiKey",
Label: "API Key",
Type: config.FieldTypeText,
Required: true,
HelpText: "OpenAI API key for image generation",
},
{
Name: "apiURL",
Label: "API URL",
Type: config.FieldTypeText,
Required: true,
DefaultValue: "https://api.openai.com/v1",
HelpText: "OpenAI API URL",
},
{
Name: "model",
Label: "Model",
Type: config.FieldTypeText,
Required: true,
DefaultValue: "dall-e-3",
HelpText: "Image generation model to use (e.g., dall-e-3)",
},
}
}

View File

@@ -6,6 +6,7 @@ import (
"github.com/google/go-github/v69/github"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -118,3 +119,36 @@ func (g *GithubIssuesCloser) Definition() types.ActionDefinition {
func (a *GithubIssuesCloser) Plannable() bool {
return true
}
// GithubIssueCloserConfigMeta returns the metadata for GitHub Issue Closer action configuration fields
func GithubIssueCloserConfigMeta() []config.Field {
return []config.Field{
{
Name: "token",
Label: "GitHub Token",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub API token with repository access",
},
{
Name: "repository",
Label: "Repository",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository name",
},
{
Name: "owner",
Label: "Owner",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository owner",
},
{
Name: "customActionName",
Label: "Custom Action Name",
Type: config.FieldTypeText,
HelpText: "Custom name for this action",
},
}
}

View File

@@ -6,6 +6,7 @@ import (
"github.com/google/go-github/v69/github"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -105,3 +106,36 @@ func (g *GithubIssuesCommenter) Definition() types.ActionDefinition {
func (a *GithubIssuesCommenter) Plannable() bool {
return true
}
// GithubIssueCommenterConfigMeta returns the metadata for GitHub Issue Commenter action configuration fields
func GithubIssueCommenterConfigMeta() []config.Field {
return []config.Field{
{
Name: "token",
Label: "GitHub Token",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub API token with repository access",
},
{
Name: "repository",
Label: "Repository",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository name",
},
{
Name: "owner",
Label: "Owner",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository owner",
},
{
Name: "customActionName",
Label: "Custom Action Name",
Type: config.FieldTypeText,
HelpText: "Custom name for this action",
},
}
}

View File

@@ -7,6 +7,7 @@ import (
"github.com/google/go-github/v69/github"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/mudler/LocalAgent/pkg/xlog"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -120,3 +121,43 @@ func (g *GithubIssuesLabeler) Definition() types.ActionDefinition {
func (a *GithubIssuesLabeler) Plannable() bool {
return true
}
// GithubIssueLabelerConfigMeta returns the metadata for GitHub Issue Labeler action configuration fields
func GithubIssueLabelerConfigMeta() []config.Field {
return []config.Field{
{
Name: "token",
Label: "GitHub Token",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub API token with repository access",
},
{
Name: "repository",
Label: "Repository",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository name",
},
{
Name: "owner",
Label: "Owner",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository owner",
},
{
Name: "availableLabels",
Label: "Available Labels",
Type: config.FieldTypeText,
HelpText: "Comma-separated list of available labels",
DefaultValue: "bug,enhancement",
},
{
Name: "customActionName",
Label: "Custom Action Name",
Type: config.FieldTypeText,
HelpText: "Custom name for this action",
},
}
}

View File

@@ -6,6 +6,7 @@ import (
"github.com/google/go-github/v69/github"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -111,3 +112,36 @@ func (g *GithubIssuesOpener) Definition() types.ActionDefinition {
func (a *GithubIssuesOpener) Plannable() bool {
return true
}
// GithubIssueOpenerConfigMeta returns the metadata for GitHub Issue Opener action configuration fields
func GithubIssueOpenerConfigMeta() []config.Field {
return []config.Field{
{
Name: "token",
Label: "GitHub Token",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub API token with repository access",
},
{
Name: "repository",
Label: "Repository",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository name",
},
{
Name: "owner",
Label: "Owner",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository owner",
},
{
Name: "customActionName",
Label: "Custom Action Name",
Type: config.FieldTypeText,
HelpText: "Custom name for this action",
},
}
}

View File

@@ -6,6 +6,7 @@ import (
"github.com/google/go-github/v69/github"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -99,3 +100,36 @@ func (g *GithubIssuesReader) Definition() types.ActionDefinition {
func (a *GithubIssuesReader) Plannable() bool {
return true
}
// GithubIssueReaderConfigMeta returns the metadata for GitHub Issue Reader action configuration fields
func GithubIssueReaderConfigMeta() []config.Field {
return []config.Field{
{
Name: "token",
Label: "GitHub Token",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub API token with repository access",
},
{
Name: "repository",
Label: "Repository",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository name",
},
{
Name: "owner",
Label: "Owner",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository owner",
},
{
Name: "customActionName",
Label: "Custom Action Name",
Type: config.FieldTypeText,
HelpText: "Custom name for this action",
},
}
}

View File

@@ -6,6 +6,7 @@ import (
"github.com/google/go-github/v69/github"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/mudler/LocalAgent/pkg/xlog"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -108,3 +109,36 @@ func (g *GithubIssueSearch) Definition() types.ActionDefinition {
func (a *GithubIssueSearch) Plannable() bool {
return true
}
// GithubIssueSearchConfigMeta returns the metadata for GitHub Issue Search action configuration fields
func GithubIssueSearchConfigMeta() []config.Field {
return []config.Field{
{
Name: "token",
Label: "GitHub Token",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub API token with repository access",
},
{
Name: "repository",
Label: "Repository",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository name",
},
{
Name: "owner",
Label: "Owner",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository owner",
},
{
Name: "customActionName",
Label: "Custom Action Name",
Type: config.FieldTypeText,
HelpText: "Custom name for this action",
},
}
}

View File

@@ -6,6 +6,7 @@ import (
"github.com/google/go-github/v69/github"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -144,3 +145,36 @@ func (g *GithubRepositoryCreateOrUpdateContent) Definition() types.ActionDefinit
func (a *GithubRepositoryCreateOrUpdateContent) Plannable() bool {
return true
}
// GithubRepositoryCreateOrUpdateContentConfigMeta returns the metadata for GitHub Repository Create/Update Content action configuration fields
func GithubRepositoryCreateOrUpdateContentConfigMeta() []config.Field {
return []config.Field{
{
Name: "token",
Label: "GitHub Token",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub API token with repository access",
},
{
Name: "repository",
Label: "Repository",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository name",
},
{
Name: "owner",
Label: "Owner",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository owner",
},
{
Name: "customActionName",
Label: "Custom Action Name",
Type: config.FieldTypeText,
HelpText: "Custom name for this action",
},
}
}

View File

@@ -6,6 +6,7 @@ import (
"github.com/google/go-github/v69/github"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -109,3 +110,36 @@ func (g *GithubRepositoryGetContent) Definition() types.ActionDefinition {
func (a *GithubRepositoryGetContent) Plannable() bool {
return true
}
// GithubRepositoryGetContentConfigMeta returns the metadata for GitHub Repository Get Content action configuration fields
func GithubRepositoryGetContentConfigMeta() []config.Field {
return []config.Field{
{
Name: "token",
Label: "GitHub Token",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub API token with repository access",
},
{
Name: "repository",
Label: "Repository",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository name",
},
{
Name: "owner",
Label: "Owner",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub repository owner",
},
{
Name: "customActionName",
Label: "Custom Action Name",
Type: config.FieldTypeText,
HelpText: "Custom name for this action",
},
}
}

View File

@@ -6,6 +6,7 @@ import (
"github.com/google/go-github/v69/github"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -75,3 +76,22 @@ func (g *GithubRepositoryREADME) Definition() types.ActionDefinition {
func (a *GithubRepositoryREADME) Plannable() bool {
return true
}
// GithubRepositoryREADMEConfigMeta returns the metadata for GitHub Repository README action configuration fields
func GithubRepositoryREADMEConfigMeta() []config.Field {
return []config.Field{
{
Name: "token",
Label: "GitHub Token",
Type: config.FieldTypeText,
Required: true,
HelpText: "GitHub API token with repository access",
},
{
Name: "customActionName",
Label: "Custom Action Name",
Type: config.FieldTypeText,
HelpText: "Custom name for this action",
},
}
}

View File

@@ -7,6 +7,7 @@ import (
"strings"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/sashabaranov/go-openai/jsonschema"
"github.com/tmc/langchaingo/tools/duckduckgo"
"mvdan.cc/xurls/v2"
@@ -89,3 +90,19 @@ func (a *SearchAction) Definition() types.ActionDefinition {
func (a *SearchAction) Plannable() bool {
return true
}
// SearchConfigMeta returns the metadata for Search action configuration fields
func SearchConfigMeta() []config.Field {
return []config.Field{
{
Name: "results",
Label: "Number of Results",
Type: config.FieldTypeNumber,
DefaultValue: 1,
Min: 1,
Max: 10,
Step: 1,
HelpText: "Number of search results to return",
},
}
}

View File

@@ -6,6 +6,7 @@ import (
"net/smtp"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -80,3 +81,45 @@ func (a *SendMailAction) Definition() types.ActionDefinition {
func (a *SendMailAction) Plannable() bool {
return true
}
// SendMailConfigMeta returns the metadata for SendMail action configuration fields
func SendMailConfigMeta() []config.Field {
return []config.Field{
{
Name: "smtpHost",
Label: "SMTP Host",
Type: config.FieldTypeText,
Required: true,
HelpText: "SMTP server host (e.g., smtp.gmail.com)",
},
{
Name: "smtpPort",
Label: "SMTP Port",
Type: config.FieldTypeText,
Required: true,
DefaultValue: "587",
HelpText: "SMTP server port (e.g., 587)",
},
{
Name: "username",
Label: "SMTP Username",
Type: config.FieldTypeText,
Required: true,
HelpText: "SMTP username/email address",
},
{
Name: "password",
Label: "SMTP Password",
Type: config.FieldTypeText,
Required: true,
HelpText: "SMTP password or app password",
},
{
Name: "email",
Label: "From Email",
Type: config.FieldTypeText,
Required: true,
HelpText: "Sender email address",
},
}
}

View File

@@ -6,6 +6,7 @@ import (
"log"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/sashabaranov/go-openai/jsonschema"
"golang.org/x/crypto/ssh"
)
@@ -96,6 +97,43 @@ func (a *ShellAction) Definition() types.ActionDefinition {
}
}
// ShellConfigMeta returns the metadata for Shell action configuration fields
func ShellConfigMeta() []config.Field {
return []config.Field{
{
Name: "privateKey",
Label: "Private Key",
Type: config.FieldTypeTextarea,
Required: true,
HelpText: "SSH private key for connecting to remote servers",
},
{
Name: "user",
Label: "Default User",
Type: config.FieldTypeText,
HelpText: "Default SSH user for connecting to remote servers",
},
{
Name: "host",
Label: "Default Host",
Type: config.FieldTypeText,
HelpText: "Default host for SSH connections (e.g., hostname:port)",
},
{
Name: "customName",
Label: "Custom Action Name",
Type: config.FieldTypeText,
HelpText: "Custom name for this action",
},
{
Name: "customDescription",
Label: "Custom Description",
Type: config.FieldTypeTextarea,
HelpText: "Custom description for this action",
},
}
}
func sshCommand(privateKey, command, user, host string) (string, error) {
// Create signer from private key string
key, err := ssh.ParsePrivateKey([]byte(privateKey))

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/mudler/LocalAgent/services/connectors/twitter"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -62,3 +63,22 @@ func (a *PostTweetAction) Definition() types.ActionDefinition {
func (a *PostTweetAction) Plannable() bool {
return true
}
// TwitterPostConfigMeta returns the metadata for Twitter Post action configuration fields
func TwitterPostConfigMeta() []config.Field {
return []config.Field{
{
Name: "token",
Label: "Twitter API Token",
Type: config.FieldTypeText,
Required: true,
HelpText: "Twitter API token for posting tweets",
},
{
Name: "noCharacterLimit",
Label: "No Character Limit",
Type: config.FieldTypeCheckbox,
HelpText: "If checked, tweets longer than the character limit will be split into multiple tweets",
},
}
}

View File

@@ -3,6 +3,7 @@ package services
import (
"encoding/json"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/mudler/LocalAgent/pkg/xlog"
"github.com/mudler/LocalAgent/services/connectors"
@@ -69,3 +70,43 @@ func Connectors(a *state.AgentConfig) []state.Connector {
}
return conns
}
func ConnectorsConfigMeta() []config.FieldGroup {
return []config.FieldGroup{
{
Name: "discord",
Label: "Discord",
Fields: connectors.DiscordConfigMeta(),
},
{
Name: "slack",
Label: "Slack",
Fields: connectors.SlackConfigMeta(),
},
{
Name: "telegram",
Label: "Telegram",
Fields: connectors.TelegramConfigMeta(),
},
{
Name: "github-issues",
Label: "GitHub Issues",
Fields: connectors.GithubIssueConfigMeta(),
},
{
Name: "github-prs",
Label: "GitHub PRs",
Fields: connectors.GithubPRConfigMeta(),
},
{
Name: "irc",
Label: "IRC",
Fields: connectors.IRCConfigMeta(),
},
{
Name: "twitter",
Label: "Twitter",
Fields: connectors.TwitterConfigMeta(),
},
}
}

View File

@@ -6,6 +6,7 @@ import (
"github.com/bwmarrin/discordgo"
"github.com/mudler/LocalAgent/core/agent"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/mudler/LocalAgent/pkg/xlog"
"github.com/sashabaranov/go-openai"
)
@@ -34,6 +35,28 @@ func NewDiscord(config map[string]string) *Discord {
}
}
func DiscordConfigMeta() []config.Field {
return []config.Field{
{
Name: "token",
Label: "Discord Token",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "defaultChannel",
Label: "Default Channel",
Type: config.FieldTypeText,
},
{
Name: "lastMessageDuration",
Label: "Last Message Duration",
Type: config.FieldTypeText,
DefaultValue: "5m",
},
}
}
func (d *Discord) AgentResultCallback() func(state types.ActionState) {
return func(state types.ActionState) {
// Send the result to the bot

View File

@@ -8,6 +8,7 @@ import (
"github.com/google/go-github/v69/github"
"github.com/mudler/LocalAgent/core/agent"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/mudler/LocalAgent/pkg/xlog"
"github.com/sashabaranov/go-openai"
@@ -195,3 +196,39 @@ func (g *GithubIssues) issuesService() {
}
}
}
// GithubIssueConfigMeta returns the metadata for GitHub Issues connector configuration fields
func GithubIssueConfigMeta() []config.Field {
return []config.Field{
{
Name: "token",
Label: "GitHub Token",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "repository",
Label: "Repository",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "owner",
Label: "Owner",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "replyIfNoReplies",
Label: "Reply If No Replies",
Type: config.FieldTypeCheckbox,
},
{
Name: "pollInterval",
Label: "Poll Interval",
Type: config.FieldTypeText,
DefaultValue: "10m",
HelpText: "How often to check for new issues (e.g., 10m, 1h)",
},
}
}

View File

@@ -8,6 +8,7 @@ import (
"github.com/google/go-github/v69/github"
"github.com/mudler/LocalAgent/core/agent"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/mudler/LocalAgent/pkg/xlog"
"github.com/sashabaranov/go-openai"
@@ -195,3 +196,39 @@ func (g *GithubPRs) prService() {
}
}
}
// GithubPRConfigMeta returns the metadata for GitHub PR connector configuration fields
func GithubPRConfigMeta() []config.Field {
return []config.Field{
{
Name: "token",
Label: "GitHub Token",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "repository",
Label: "Repository",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "owner",
Label: "Owner",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "replyIfNoReplies",
Label: "Reply If No Replies",
Type: config.FieldTypeCheckbox,
},
{
Name: "pollInterval",
Label: "Poll Interval",
Type: config.FieldTypeText,
DefaultValue: "10m",
HelpText: "How often to check for new PRs (e.g., 10m, 1h)",
},
}
}

View File

@@ -7,6 +7,7 @@ import (
"github.com/mudler/LocalAgent/core/agent"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/mudler/LocalAgent/pkg/xlog"
"github.com/mudler/LocalAgent/services/actions"
"github.com/sashabaranov/go-openai"
@@ -207,3 +208,44 @@ func (i *IRC) Start(a *agent.Agent) {
// Start the IRC client in a goroutine
go i.conn.Loop()
}
// IRCConfigMeta returns the metadata for IRC connector configuration fields
func IRCConfigMeta() []config.Field {
return []config.Field{
{
Name: "server",
Label: "IRC Server",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "port",
Label: "Port",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "nickname",
Label: "Nickname",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "channel",
Label: "Channel",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "alwaysReply",
Label: "Always Reply",
Type: config.FieldTypeCheckbox,
},
{
Name: "lastMessageDuration",
Label: "Last Message Duration",
Type: config.FieldTypeText,
DefaultValue: "5m",
},
}
}

View File

@@ -10,6 +10,7 @@ import (
"sync"
"time"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/mudler/LocalAgent/pkg/xlog"
"github.com/mudler/LocalAgent/pkg/xstrings"
"github.com/mudler/LocalAgent/services/actions"
@@ -784,3 +785,37 @@ func (t *Slack) Start(a *agent.Agent) {
client.RunContext(a.Context())
}
// SlackConfigMeta returns the metadata for Slack connector configuration fields
func SlackConfigMeta() []config.Field {
return []config.Field{
{
Name: "appToken",
Label: "App Token",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "botToken",
Label: "Bot Token",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "channelID",
Label: "Channel ID",
Type: config.FieldTypeText,
},
{
Name: "alwaysReply",
Label: "Always Reply",
Type: config.FieldTypeCheckbox,
},
{
Name: "lastMessageDuration",
Label: "Last Message Duration",
Type: config.FieldTypeText,
DefaultValue: "5m",
},
}
}

View File

@@ -14,6 +14,7 @@ import (
"github.com/go-telegram/bot/models"
"github.com/mudler/LocalAgent/core/agent"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/mudler/LocalAgent/pkg/xlog"
"github.com/mudler/LocalAgent/pkg/xstrings"
"github.com/mudler/LocalAgent/services/actions"
@@ -203,3 +204,27 @@ func NewTelegramConnector(config map[string]string) (*Telegram, error) {
conversationTracker: NewConversationTracker[int64](duration),
}, nil
}
// TelegramConfigMeta returns the metadata for Telegram connector configuration fields
func TelegramConfigMeta() []config.Field {
return []config.Field{
{
Name: "token",
Label: "Telegram Token",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "admins",
Label: "Admins",
Type: config.FieldTypeText,
HelpText: "Comma-separated list of Telegram usernames that are allowed to interact with the bot",
},
{
Name: "lastMessageDuration",
Label: "Last Message Duration",
Type: config.FieldTypeText,
DefaultValue: "5m",
},
}
}

View File

@@ -8,6 +8,7 @@ import (
"github.com/mudler/LocalAgent/core/agent"
"github.com/mudler/LocalAgent/core/types"
"github.com/mudler/LocalAgent/pkg/config"
"github.com/mudler/LocalAgent/pkg/xlog"
"github.com/mudler/LocalAgent/services/connectors/twitter"
"github.com/sashabaranov/go-openai"
@@ -134,3 +135,26 @@ func (t *Twitter) run(a *agent.Agent) error {
return nil
}
// TwitterConfigMeta returns the metadata for Twitter connector configuration fields
func TwitterConfigMeta() []config.Field {
return []config.Field{
{
Name: "token",
Label: "Twitter API Token",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "botUsername",
Label: "Bot Username",
Type: config.FieldTypeText,
Required: true,
},
{
Name: "noCharacterLimit",
Label: "No Character Limit",
Type: config.FieldTypeCheckbox,
},
}
}