reordering

This commit is contained in:
Ettore Di Giacinto
2025-02-25 22:18:08 +01:00
parent d73fd545b2
commit 296734ba3b
46 changed files with 84 additions and 85 deletions

View File

@@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/mudler/local-agent-framework/xlog" "github.com/mudler/local-agent-framework/pkg/xlog"
"github.com/sashabaranov/go-openai/jsonschema" "github.com/sashabaranov/go-openai/jsonschema"
"github.com/traefik/yaegi/interp" "github.com/traefik/yaegi/interp"
"github.com/traefik/yaegi/stdlib" "github.com/traefik/yaegi/stdlib"

View File

@@ -3,7 +3,7 @@ package action_test
import ( import (
"context" "context"
. "github.com/mudler/local-agent-framework/action" . "github.com/mudler/local-agent-framework/core/action"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"

View File

@@ -4,8 +4,8 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/core/action"
"github.com/mudler/local-agent-framework/xlog" "github.com/mudler/local-agent-framework/pkg/xlog"
"github.com/sashabaranov/go-openai" "github.com/sashabaranov/go-openai"
) )

View File

@@ -8,10 +8,10 @@ import (
"sync" "sync"
"time" "time"
"github.com/mudler/local-agent-framework/xlog" "github.com/mudler/local-agent-framework/pkg/xlog"
"github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/core/action"
"github.com/mudler/local-agent-framework/llm" "github.com/mudler/local-agent-framework/pkg/llm"
"github.com/sashabaranov/go-openai" "github.com/sashabaranov/go-openai"
) )

View File

@@ -4,10 +4,10 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/mudler/local-agent-framework/xlog" "github.com/mudler/local-agent-framework/pkg/xlog"
"github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/core/action"
. "github.com/mudler/local-agent-framework/agent" . "github.com/mudler/local-agent-framework/core/agent"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/sashabaranov/go-openai/jsonschema" "github.com/sashabaranov/go-openai/jsonschema"

View File

@@ -6,8 +6,8 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/core/action"
"github.com/mudler/local-agent-framework/llm" "github.com/mudler/local-agent-framework/pkg/llm"
) )
// PromptHUD contains // PromptHUD contains

View File

@@ -1,7 +1,7 @@
package agent_test package agent_test
import ( import (
. "github.com/mudler/local-agent-framework/agent" . "github.com/mudler/local-agent-framework/core/agent"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
) )

View File

@@ -5,7 +5,7 @@ import (
"html/template" "html/template"
"time" "time"
"github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/core/action"
"github.com/sashabaranov/go-openai" "github.com/sashabaranov/go-openai"
) )

View File

@@ -4,11 +4,11 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/core/action"
"github.com/mudler/local-agent-framework/xlog" "github.com/mudler/local-agent-framework/pkg/xlog"
. "github.com/mudler/local-agent-framework/agent" . "github.com/mudler/local-agent-framework/core/agent"
"github.com/mudler/local-agent-framework/external" "github.com/mudler/local-agent-framework/services/actions"
) )
const ( const (
@@ -39,7 +39,7 @@ var AvailableActions = []string{
} }
func (a *AgentConfig) availableActions(ctx context.Context) []Action { func (a *AgentConfig) availableActions(ctx context.Context) []Action {
actions := []Action{} allActions := []Action{}
for _, a := range a.Actions { for _, a := range a.Actions {
var config map[string]string var config map[string]string
@@ -55,27 +55,27 @@ func (a *AgentConfig) availableActions(ctx context.Context) []Action {
xlog.Error("Error creating custom action", "error", err) xlog.Error("Error creating custom action", "error", err)
continue continue
} }
actions = append(actions, customAction) allActions = append(allActions, customAction)
case ActionSearch: case ActionSearch:
actions = append(actions, external.NewSearch(config)) allActions = append(allActions, actions.NewSearch(config))
case ActionGithubIssueLabeler: case ActionGithubIssueLabeler:
actions = append(actions, external.NewGithubIssueLabeler(ctx, config)) allActions = append(allActions, actions.NewGithubIssueLabeler(ctx, config))
case ActionGithubIssueOpener: case ActionGithubIssueOpener:
actions = append(actions, external.NewGithubIssueOpener(ctx, config)) allActions = append(allActions, actions.NewGithubIssueOpener(ctx, config))
case ActionGithubIssueCloser: case ActionGithubIssueCloser:
actions = append(actions, external.NewGithubIssueCloser(ctx, config)) allActions = append(allActions, actions.NewGithubIssueCloser(ctx, config))
case ActionGithubIssueSearcher: case ActionGithubIssueSearcher:
actions = append(actions, external.NewGithubIssueSearch(ctx, config)) allActions = append(allActions, actions.NewGithubIssueSearch(ctx, config))
case ActionScraper: case ActionScraper:
actions = append(actions, external.NewScraper(config)) allActions = append(allActions, actions.NewScraper(config))
case ActionWikipedia: case ActionWikipedia:
actions = append(actions, external.NewWikipedia(config)) allActions = append(allActions, actions.NewWikipedia(config))
case ActionBrowse: case ActionBrowse:
actions = append(actions, external.NewBrowse(config)) allActions = append(allActions, actions.NewBrowse(config))
case ActionSendMail: case ActionSendMail:
actions = append(actions, external.NewSendMail(config)) allActions = append(allActions, actions.NewSendMail(config))
} }
} }
return actions return allActions
} }

View File

@@ -10,10 +10,10 @@ import (
"sync" "sync"
"time" "time"
"github.com/mudler/local-agent-framework/agent" "github.com/mudler/local-agent-framework/core/agent"
"github.com/mudler/local-agent-framework/xlog" "github.com/mudler/local-agent-framework/pkg/xlog"
. "github.com/mudler/local-agent-framework/agent" . "github.com/mudler/local-agent-framework/core/agent"
) )
type AgentPool struct { type AgentPool struct {

View File

@@ -8,9 +8,9 @@ import (
"os" "os"
"strings" "strings"
"github.com/mudler/local-agent-framework/xlog" "github.com/mudler/local-agent-framework/pkg/xlog"
. "github.com/mudler/local-agent-framework/agent" . "github.com/mudler/local-agent-framework/core/agent"
"github.com/donseba/go-htmx" "github.com/donseba/go-htmx"
"github.com/dslipak/pdf" "github.com/dslipak/pdf"

View File

@@ -3,11 +3,10 @@ package main
import ( import (
"encoding/json" "encoding/json"
"github.com/mudler/local-agent-framework/xlog" "github.com/mudler/local-agent-framework/pkg/xlog"
"github.com/mudler/local-agent-framework/services/connectors"
. "github.com/mudler/local-agent-framework/agent" . "github.com/mudler/local-agent-framework/core/agent"
"github.com/mudler/local-agent-framework/example/webui/connector"
) )
const ( const (
@@ -34,7 +33,7 @@ var AvailableConnectors = []string{
} }
func (a *AgentConfig) availableConnectors() []Connector { func (a *AgentConfig) availableConnectors() []Connector {
connectors := []Connector{} conns := []Connector{}
for _, c := range a.Connector { for _, c := range a.Connector {
var config map[string]string var config map[string]string
@@ -44,22 +43,22 @@ func (a *AgentConfig) availableConnectors() []Connector {
} }
switch c.Type { switch c.Type {
case ConnectorTelegram: case ConnectorTelegram:
cc, err := connector.NewTelegramConnector(config) cc, err := connectors.NewTelegramConnector(config)
if err != nil { if err != nil {
xlog.Info("Error creating telegram connector", err) xlog.Info("Error creating telegram connector", err)
continue continue
} }
connectors = append(connectors, cc) conns = append(conns, cc)
case ConnectorSlack: case ConnectorSlack:
connectors = append(connectors, connector.NewSlack(config)) conns = append(conns, connectors.NewSlack(config))
case ConnectorDiscord: case ConnectorDiscord:
connectors = append(connectors, connector.NewDiscord(config)) conns = append(conns, connectors.NewDiscord(config))
case ConnectorGithubIssues: case ConnectorGithubIssues:
connectors = append(connectors, connector.NewGithubIssueWatcher(config)) conns = append(conns, connectors.NewGithubIssueWatcher(config))
case ConnectorGithubPRs: case ConnectorGithubPRs:
connectors = append(connectors, connector.NewGithubPRWatcher(config)) conns = append(conns, connectors.NewGithubPRWatcher(config))
} }
} }
return connectors return conns
} }

View File

@@ -10,9 +10,9 @@ import (
fiber "github.com/gofiber/fiber/v2" fiber "github.com/gofiber/fiber/v2"
"github.com/gofiber/template/html/v2" "github.com/gofiber/template/html/v2"
. "github.com/mudler/local-agent-framework/agent" . "github.com/mudler/local-agent-framework/core/agent"
"github.com/mudler/local-agent-framework/llm" "github.com/mudler/local-agent-framework/pkg/llm"
"github.com/mudler/local-agent-framework/llm/rag" "github.com/mudler/local-agent-framework/pkg/llm/rag"
) )
var testModel = os.Getenv("TEST_MODEL") var testModel = os.Getenv("TEST_MODEL")

View File

@@ -5,14 +5,14 @@ import (
"fmt" "fmt"
"io" "io"
"github.com/mudler/local-agent-framework/xlog" "github.com/mudler/local-agent-framework/pkg/xlog"
"net/http" "net/http"
"os" "os"
"strings" "strings"
"sync" "sync"
. "github.com/mudler/local-agent-framework/agent" . "github.com/mudler/local-agent-framework/core/agent"
"jaytaylor.com/html2text" "jaytaylor.com/html2text"
sitemap "github.com/oxffaa/gopher-parse-sitemap" sitemap "github.com/oxffaa/gopher-parse-sitemap"

View File

@@ -6,7 +6,7 @@ import (
fiber "github.com/gofiber/fiber/v2" fiber "github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/filesystem" "github.com/gofiber/fiber/v2/middleware/filesystem"
"github.com/mudler/local-agent-framework/agent" "github.com/mudler/local-agent-framework/core/agent"
) )
func RegisterRoutes(webapp *fiber.App, pool *AgentPool, app *App) { func RegisterRoutes(webapp *fiber.App, pool *AgentPool, app *App) {

View File

@@ -1,4 +1,4 @@
package external package actions
import ( import (
"context" "context"
@@ -6,7 +6,7 @@ import (
"io" "io"
"net/http" "net/http"
"github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/core/action"
"github.com/sashabaranov/go-openai/jsonschema" "github.com/sashabaranov/go-openai/jsonschema"
"jaytaylor.com/html2text" "jaytaylor.com/html2text"
) )

View File

@@ -1,11 +1,11 @@
package external package actions
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/google/go-github/v61/github" "github.com/google/go-github/v61/github"
"github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/core/action"
"github.com/sashabaranov/go-openai/jsonschema" "github.com/sashabaranov/go-openai/jsonschema"
) )

View File

@@ -1,4 +1,4 @@
package external package actions
import ( import (
"context" "context"
@@ -7,7 +7,7 @@ import (
"strings" "strings"
"github.com/google/go-github/v61/github" "github.com/google/go-github/v61/github"
"github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/core/action"
"github.com/sashabaranov/go-openai/jsonschema" "github.com/sashabaranov/go-openai/jsonschema"
) )

View File

@@ -1,11 +1,11 @@
package external package actions
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/google/go-github/v61/github" "github.com/google/go-github/v61/github"
"github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/core/action"
"github.com/sashabaranov/go-openai/jsonschema" "github.com/sashabaranov/go-openai/jsonschema"
) )

View File

@@ -1,4 +1,4 @@
package external package actions
import ( import (
"context" "context"
@@ -6,7 +6,7 @@ import (
"log/slog" "log/slog"
"github.com/google/go-github/v61/github" "github.com/google/go-github/v61/github"
"github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/core/action"
"github.com/sashabaranov/go-openai/jsonschema" "github.com/sashabaranov/go-openai/jsonschema"
) )

View File

@@ -1,10 +1,10 @@
package external package actions
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/core/action"
"github.com/sashabaranov/go-openai/jsonschema" "github.com/sashabaranov/go-openai/jsonschema"
"github.com/tmc/langchaingo/tools/scraper" "github.com/tmc/langchaingo/tools/scraper"
) )

View File

@@ -1,11 +1,11 @@
package external package actions
import ( import (
"context" "context"
"fmt" "fmt"
"log/slog" "log/slog"
"github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/core/action"
"github.com/sashabaranov/go-openai/jsonschema" "github.com/sashabaranov/go-openai/jsonschema"
"github.com/tmc/langchaingo/tools/duckduckgo" "github.com/tmc/langchaingo/tools/duckduckgo"
) )

View File

@@ -1,11 +1,11 @@
package external package actions
import ( import (
"context" "context"
"fmt" "fmt"
"net/smtp" "net/smtp"
"github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/core/action"
"github.com/sashabaranov/go-openai/jsonschema" "github.com/sashabaranov/go-openai/jsonschema"
) )

View File

@@ -1,10 +1,10 @@
package external package actions
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/mudler/local-agent-framework/action" "github.com/mudler/local-agent-framework/core/action"
"github.com/sashabaranov/go-openai/jsonschema" "github.com/sashabaranov/go-openai/jsonschema"
"github.com/tmc/langchaingo/tools/wikipedia" "github.com/tmc/langchaingo/tools/wikipedia"
) )

View File

@@ -1,11 +1,11 @@
package connector package connectors
import ( import (
"strings" "strings"
"github.com/bwmarrin/discordgo" "github.com/bwmarrin/discordgo"
"github.com/mudler/local-agent-framework/agent" "github.com/mudler/local-agent-framework/core/agent"
"github.com/mudler/local-agent-framework/xlog" "github.com/mudler/local-agent-framework/pkg/xlog"
) )
type Discord struct { type Discord struct {

View File

@@ -1,4 +1,4 @@
package connector package connectors
import ( import (
"fmt" "fmt"
@@ -6,8 +6,8 @@ import (
"time" "time"
"github.com/google/go-github/v61/github" "github.com/google/go-github/v61/github"
"github.com/mudler/local-agent-framework/agent" "github.com/mudler/local-agent-framework/core/agent"
"github.com/mudler/local-agent-framework/xlog" "github.com/mudler/local-agent-framework/pkg/xlog"
"github.com/sashabaranov/go-openai" "github.com/sashabaranov/go-openai"
) )

View File

@@ -1,4 +1,4 @@
package connector package connectors
import ( import (
"fmt" "fmt"
@@ -6,8 +6,8 @@ import (
"time" "time"
"github.com/google/go-github/v61/github" "github.com/google/go-github/v61/github"
"github.com/mudler/local-agent-framework/agent" "github.com/mudler/local-agent-framework/core/agent"
"github.com/mudler/local-agent-framework/xlog" "github.com/mudler/local-agent-framework/pkg/xlog"
"github.com/sashabaranov/go-openai" "github.com/sashabaranov/go-openai"
) )

View File

@@ -1,4 +1,4 @@
package connector package connectors
import ( import (
"fmt" "fmt"
@@ -6,9 +6,9 @@ import (
"os" "os"
"strings" "strings"
"github.com/mudler/local-agent-framework/xlog" "github.com/mudler/local-agent-framework/pkg/xlog"
"github.com/mudler/local-agent-framework/agent" "github.com/mudler/local-agent-framework/core/agent"
"github.com/slack-go/slack/socketmode" "github.com/slack-go/slack/socketmode"

View File

@@ -1,4 +1,4 @@
package connector package connectors
import ( import (
"context" "context"
@@ -8,7 +8,7 @@ import (
"github.com/go-telegram/bot" "github.com/go-telegram/bot"
"github.com/go-telegram/bot/models" "github.com/go-telegram/bot/models"
"github.com/mudler/local-agent-framework/agent" "github.com/mudler/local-agent-framework/core/agent"
) )
type Telegram struct { type Telegram struct {