webui

package
v0.0.0-...-2acdc66 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKeyAuthConfig

func GetKeyAuthConfig(apiKeys []string) (*v2keyauth.Config, error)

func Reverse

func Reverse[T any](original []T) (reversed []T)

Types

type AgentRole

type AgentRole struct {
	Name         string `json:"name"`
	Description  string `json:"description"`
	SystemPrompt string `json:"system_prompt"`
}

type App

type App struct {
	*fiber.App
	// contains filtered or unexported fields
}

func NewApp

func NewApp(opts ...Option) *App

func (*App) AddGitRepo

func (a *App) AddGitRepo(c *fiber.Ctx) error

func (*App) Chat

func (a *App) Chat(pool *state.AgentPool) func(c *fiber.Ctx) error

Chat provides a JSON-based API for chat functionality This is designed to work better with the React UI

func (*App) CollectionsRAGProvider

func (app *App) CollectionsRAGProvider() func(collectionName string) (agent.RAGDB, state.KBCompactionClient, bool)

CollectionsRAGProvider returns a provider that the pool can use when no LocalRAG URL is set. It returns (RAGDB, KBCompactionClient, true) for a collection name, creating the collection on first use if needed.

func (*App) Create

func (a *App) Create(pool *state.AgentPool) func(c *fiber.Ctx) error

func (*App) CreateGroup

func (a *App) CreateGroup(pool *state.AgentPool) func(c *fiber.Ctx) error

func (*App) CreateSkill

func (a *App) CreateSkill(c *fiber.Ctx) error

func (*App) CreateSkillResource

func (a *App) CreateSkillResource(c *fiber.Ctx) error

func (*App) Delete

func (a *App) Delete(pool *state.AgentPool) func(c *fiber.Ctx) error

func (*App) DeleteGitRepo

func (a *App) DeleteGitRepo(c *fiber.Ctx) error

func (*App) DeleteSkill

func (a *App) DeleteSkill(c *fiber.Ctx) error

func (*App) DeleteSkillResource

func (a *App) DeleteSkillResource(c *fiber.Ctx) error

func (*App) ExecuteAction

func (app *App) ExecuteAction(pool *state.AgentPool) func(c *fiber.Ctx) error

func (*App) ExportAgent

func (a *App) ExportAgent(pool *state.AgentPool) func(c *fiber.Ctx) error

func (*App) ExportSkill

func (a *App) ExportSkill(c *fiber.Ctx) error

func (*App) GenerateGroupProfiles

func (a *App) GenerateGroupProfiles(pool *state.AgentPool) func(c *fiber.Ctx) error

func (*App) GetActionDefinition

func (a *App) GetActionDefinition(pool *state.AgentPool) func(c *fiber.Ctx) error

func (*App) GetAgentConfig

func (a *App) GetAgentConfig(pool *state.AgentPool) func(c *fiber.Ctx) error

NEW FUNCTION: Get agent configuration

func (*App) GetAgentConfigMeta

func (a *App) GetAgentConfigMeta(customDirectory string) func(c *fiber.Ctx) error

GetAgentConfigMeta returns the metadata for agent configuration fields

func (*App) GetSkill

func (a *App) GetSkill(c *fiber.Ctx) error

func (*App) GetSkillResource

func (a *App) GetSkillResource(c *fiber.Ctx) error

func (*App) GetSkillsConfig

func (a *App) GetSkillsConfig(c *fiber.Ctx) error

func (*App) ImportAgent

func (a *App) ImportAgent(pool *state.AgentPool) func(c *fiber.Ctx) error

func (*App) ImportSkill

func (a *App) ImportSkill(c *fiber.Ctx) error

func (*App) ListActions

func (a *App) ListActions() func(c *fiber.Ctx) error

func (*App) ListGitRepos

func (a *App) ListGitRepos(c *fiber.Ctx) error

Git repos: list, add, update, delete, sync, toggle (using ConfigManager in skills dir)

func (*App) ListSkillResources

func (a *App) ListSkillResources(c *fiber.Ctx) error

func (*App) ListSkills

func (a *App) ListSkills(c *fiber.Ctx) error

func (*App) Notify

func (a *App) Notify(pool *state.AgentPool) func(c *fiber.Ctx) error

func (*App) OldChat

func (a *App) OldChat(pool *state.AgentPool) func(c *fiber.Ctx) error

func (*App) Pause

func (a *App) Pause(pool *state.AgentPool) func(c *fiber.Ctx) error

func (*App) RegisterCollectionRoutes

func (app *App) RegisterCollectionRoutes(webapp *fiber.App, cfg *Config, backend CollectionsBackend)

RegisterCollectionRoutes mounts /api/collections* routes. backend is either from NewInProcessCollectionsBackend or NewCollectionsBackendHTTP.

func (*App) Responses

func (a *App) Responses(pool *state.AgentPool, tracker *conversations.ConversationTracker[string]) func(c *fiber.Ctx) error

func (*App) SearchSkills

func (a *App) SearchSkills(c *fiber.Ctx) error

func (*App) Start

func (a *App) Start(pool *state.AgentPool) func(c *fiber.Ctx) error

func (*App) SyncGitRepo

func (a *App) SyncGitRepo(c *fiber.Ctx) error

func (*App) ToggleGitRepo

func (a *App) ToggleGitRepo(c *fiber.Ctx) error

func (*App) UpdateAgentConfig

func (a *App) UpdateAgentConfig(pool *state.AgentPool) func(c *fiber.Ctx) error

UpdateAgentConfig handles updating an agent's configuration

func (*App) UpdateGitRepo

func (a *App) UpdateGitRepo(c *fiber.Ctx) error

func (*App) UpdateSkill

func (a *App) UpdateSkill(c *fiber.Ctx) error

func (*App) UpdateSkillResource

func (a *App) UpdateSkillResource(c *fiber.Ctx) error

type CollectionSearchResult

type CollectionSearchResult struct {
	Content    string            `json:"content"`
	Metadata   map[string]string `json:"metadata,omitempty"`
	ID         string            `json:"id,omitempty"`
	Similarity float32           `json:"similarity,omitempty"`
}

CollectionSearchResult is a single search result (content + metadata) for API responses.

type CollectionSourceInfo

type CollectionSourceInfo struct {
	URL            string    `json:"url"`
	UpdateInterval int       `json:"update_interval"` // minutes
	LastUpdate     time.Time `json:"last_update"`
}

CollectionSourceInfo is a single external source for a collection.

type CollectionsBackend

type CollectionsBackend interface {
	ListCollections() ([]string, error)
	CreateCollection(name string) error
	Upload(collection, filename string, fileBody io.Reader) error
	ListEntries(collection string) ([]string, error)
	GetEntryContent(collection, entry string) (content string, chunkCount int, err error)
	Search(collection, query string, maxResults int) ([]CollectionSearchResult, error)
	Reset(collection string) error
	DeleteEntry(collection, entry string) (remainingEntries []string, err error)
	AddSource(collection, url string, intervalMin int) error
	RemoveSource(collection, url string) error
	ListSources(collection string) ([]CollectionSourceInfo, error)
	// EntryExists is used by upload handler to avoid duplicate entries.
	EntryExists(collection, entry string) bool
}

CollectionsBackend is the interface used by REST handlers for collection operations. It is implemented by in-process state (embedded) or by an HTTP client (when LocalRAG URL is set).

func NewCollectionsBackendHTTP

func NewCollectionsBackendHTTP(client *localrag.Client) CollectionsBackend

NewCollectionsBackendHTTP returns a CollectionsBackend that delegates to the given HTTP client.

func NewInProcessCollectionsBackend

func NewInProcessCollectionsBackend(cfg *Config) (CollectionsBackend, *collectionsState)

NewInProcessCollectionsBackend creates in-process state (load from disk, start sourceManager) and returns a CollectionsBackend and the state. The caller should set app.collectionsState = state for RAG provider.

type Config

type Config struct {
	DefaultChunkSize          int
	Pool                      *state.AgentPool
	SkillsService             *skills.Service
	ApiKeys                   []string
	LLMAPIURL                 string
	LLMAPIKey                 string
	LLMModel                  string
	StateDir                  string
	CustomActionsDir          string
	ConversationStoreDuration time.Duration

	// Collections / knowledge base (LocalRecall)
	CollectionDBPath string
	FileAssets       string
	VectorEngine     string
	EmbeddingModel   string
	MaxChunkingSize  int
	ChunkOverlap     int
	DatabaseURL      string
	// LocalRAGURL when set uses HTTP backend for collections API; when empty uses in-process backend.
	LocalRAGURL string
}

func NewConfig

func NewConfig(opts ...Option) *Config

func (*Config) Apply

func (c *Config) Apply(opts ...Option)

type Option

type Option func(*Config)

func WithApiKeys

func WithApiKeys(keys ...string) Option

func WithChunkOverlap

func WithChunkOverlap(overlap int) Option

func WithCollectionDBPath

func WithCollectionDBPath(path string) Option

func WithConversationStoreduration

func WithConversationStoreduration(duration string) Option

func WithCustomActionsDir

func WithCustomActionsDir(dir string) Option

func WithDatabaseURL

func WithDatabaseURL(url string) Option

func WithDefaultChunkSize

func WithDefaultChunkSize(size int) Option

func WithEmbeddingModel

func WithEmbeddingModel(model string) Option

func WithFileAssets

func WithFileAssets(path string) Option

func WithLLMAPIKey

func WithLLMAPIKey(key string) Option

func WithLLMAPIUrl

func WithLLMAPIUrl(url string) Option

func WithLLMModel

func WithLLMModel(model string) Option

func WithLocalRAGURL

func WithLocalRAGURL(url string) Option

func WithMaxChunkingSize

func WithMaxChunkingSize(size int) Option

func WithPool

func WithPool(pool *state.AgentPool) Option

func WithSkillsService

func WithSkillsService(svc *skills.Service) Option

func WithStateDir

func WithStateDir(dir string) Option

func WithVectorEngine

func WithVectorEngine(engine string) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL