config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Timezone string `` /* 136-byte string literal not displayed */
	Log      struct {
		Level string `yaml:"level,omitempty" json:"level,omitempty" desc:"Log level, one of debug, info, warn, error. Default: info"`
	} `yaml:"log,omitempty" json:"log,omitempty" desc:"The log config."`
	API struct {
		HTTP struct {
			Address string `` /* 182-byte string literal not displayed */
		} `yaml:"http,omitempty" json:"http,omitempty" desc:"The HTTP API config."`
		MCP struct {
			Address string `` /* 181-byte string literal not displayed */
		} `yaml:"mcp,omitempty" json:"mcp,omitempty" desc:"The MCP API config."`
		LLM string `` /* 158-byte string literal not displayed */
	} `yaml:"api,omitempty" json:"api,omitempty" desc:"The API config."`
	LLMs     []LLM   `` /* 145-byte string literal not displayed */
	Scrape   Scrape  `yaml:"scrape,omitempty" json:"scrape,omitempty" desc:"The scrape config."`
	Storage  Storage `yaml:"storage,omitempty" json:"storage,omitempty" desc:"The storage config."`
	Scheduls struct {
		Rules []SchedulsRule `` /* 214-byte string literal not displayed */
	} `yaml:"scheduls,omitempty" json:"scheduls,omitempty" desc:"The scheduls config for monitoring feeds. Aka monitoring rules."`
	Notify struct {
		Route     NotifyRoute      `yaml:"route,omitempty" json:"route,omitempty" desc:"The notify route config. It is required."`
		Receivers []NotifyReceiver `` /* 138-byte string literal not displayed */
		Channels  NotifyChannels   `yaml:"channels,omitempty" json:"channels,omitempty" desc:"The notify channels config. e.g. email"`
	} `` /* 228-byte string literal not displayed */
}

type Config

type Config struct {
	Path string
}

type Dependencies

type Dependencies struct{}

type Factory

--- Factory code block ---

func NewFactory

func NewFactory(mockOn ...component.MockOption) Factory

type FeedStorage

type FeedStorage struct {
	Rewrites      []RewriteRule `` /* 293-byte string literal not displayed */
	FlushInterval time.Duration `` /* 276-byte string literal not displayed */
	EmbeddingLLM  string        `` /* 455-byte string literal not displayed */
	Retention     time.Duration `yaml:"retention,omitempty" json:"retention,omitempty" desc:"How long to keep a feed. Default: 8d"`
	BlockDuration time.Duration `` /* 173-byte string literal not displayed */
}

type LLM

type LLM struct {
	Name           string  `` /* 155-byte string literal not displayed */
	Default        bool    `` /* 126-byte string literal not displayed */
	Provider       string  `` /* 159-byte string literal not displayed */
	Endpoint       string  `yaml:"endpoint,omitempty" json:"endpoint,omitempty" desc:"The custom endpoint of the LLM. e.g. https://api.openai.com/v1"`
	APIKey         string  `yaml:"api_key,omitempty" json:"api_key,omitempty" desc:"The API key of the LLM. It is required when api.llm is set."`
	Model          string  `` /* 164-byte string literal not displayed */
	EmbeddingModel string  `` /* 277-byte string literal not displayed */
	Temperature    float32 `yaml:"temperature,omitempty" json:"temperature,omitempty" desc:"The temperature (0-2) of the LLM. Default: 0.0"`
}

type Manager

type Manager interface {
	component.Component
	AppConfig() *App
	SaveAppConfig(app *App) error
	Subscribe(w Watcher)
}

--- Interface code block ---

type NotifyChannelEmail

type NotifyChannelEmail struct {
	SmtpEndpoint            string `` /* 132-byte string literal not displayed */
	From                    string `yaml:"from,omitempty" json:"from,omitempty" desc:"The sender email of the email channel."`
	Password                string `` /* 164-byte string literal not displayed */
	FeedMarkdownTemplate    string `` /* 148-byte string literal not displayed */
	FeedHTMLSnippetTemplate string `` /* 193-byte string literal not displayed */
}

type NotifyChannels

type NotifyChannels struct {
	Email *NotifyChannelEmail `yaml:"email,omitempty" json:"email,omitempty" desc:"The global email channel config."`
}

type NotifyReceiver

type NotifyReceiver struct {
	Name  string `yaml:"name,omitempty" json:"name,omitempty" desc:"The name of the receiver. It is required."`
	Email string `yaml:"email,omitempty" json:"email,omitempty" desc:"The email of the receiver."`
}

type NotifyRoute

type NotifyRoute struct {
	Receivers                  []string         `` /* 131-byte string literal not displayed */
	GroupBy                    []string         `` /* 189-byte string literal not displayed */
	SourceLabel                string           `` /* 238-byte string literal not displayed */
	SummaryPrompt              string           `yaml:"summary_prompt,omitempty" json:"summary_prompt,omitempty" desc:"The prompt to summarize the feeds of each group."`
	LLM                        string           `` /* 156-byte string literal not displayed */
	CompressByRelatedThreshold *float32         `` /* 235-byte string literal not displayed */
	SubRoutes                  []NotifySubRoute `` /* 202-byte string literal not displayed */
}

type NotifySubRoute

type NotifySubRoute struct {
	Matchers []string `` /* 232-byte string literal not displayed */

	Receivers                  []string         `` /* 131-byte string literal not displayed */
	GroupBy                    []string         `` /* 189-byte string literal not displayed */
	SourceLabel                string           `` /* 238-byte string literal not displayed */
	SummaryPrompt              string           `yaml:"summary_prompt,omitempty" json:"summary_prompt,omitempty" desc:"The prompt to summarize the feeds of each group."`
	LLM                        string           `` /* 156-byte string literal not displayed */
	CompressByRelatedThreshold *float32         `` /* 235-byte string literal not displayed */
	SubRoutes                  []NotifySubRoute `` /* 202-byte string literal not displayed */
}

type RewriteRule

type RewriteRule struct {
	SourceLabel           string                `` /* 400-byte string literal not displayed */
	SkipTooShortThreshold *int                  `` /* 199-byte string literal not displayed */
	Transform             *RewriteRuleTransform `` /* 197-byte string literal not displayed */
	Match                 string                `` /* 214-byte string literal not displayed */
	MatchRE               string                `` /* 139-byte string literal not displayed */
	Action                string                `` /* 184-byte string literal not displayed */
	Label                 string                `` /* 207-byte string literal not displayed */
}

type RewriteRuleTransform

type RewriteRuleTransform struct {
	ToText *RewriteRuleTransformToText `yaml:"to_text,omitempty" json:"to_text,omitempty" desc:"The transform config to transform the source text to text."`
}

type RewriteRuleTransformToText

type RewriteRuleTransformToText struct {
	LLM    string `yaml:"llm,omitempty" json:"llm,omitempty" desc:"The LLM name to use. Default is the default LLM in llms section."`
	Prompt string `` /* 340-byte string literal not displayed */
}

type SchedulsRule

type SchedulsRule struct {
	Name          string        `yaml:"name,omitempty" json:"name,omitempty" desc:"The name of the rule. It is required."`
	Query         string        `yaml:"query,omitempty" json:"query,omitempty" desc:"The semantic query to get the feeds. NOTE it is optional"`
	Threshold     float32       `` /* 192-byte string literal not displayed */
	LabelFilters  []string      `` /* 164-byte string literal not displayed */
	EveryDay      string        `` /* 192-byte string literal not displayed */
	WatchInterval time.Duration `` /* 179-byte string literal not displayed */
}

type Scrape

type Scrape struct {
	Past           time.Duration  `` /* 159-byte string literal not displayed */
	Interval       time.Duration  `` /* 137-byte string literal not displayed */
	RSSHubEndpoint string         `` /* 288-byte string literal not displayed */
	Sources        []ScrapeSource `yaml:"sources,omitempty" json:"sources,omitempty" desc:"The sources for scraping feeds."`
}

type ScrapeSource

type ScrapeSource struct {
	Interval time.Duration     `yaml:"interval,omitempty" json:"interval,omitempty" desc:"How often to scrape this source. Default: global interval"`
	Name     string            `yaml:"name,omitempty" json:"name,omitempty" desc:"The name of the source. It is required."`
	Labels   map[string]string `yaml:"labels,omitempty" json:"labels,omitempty" desc:"The additional labels to add to the feed of this source."`
	RSS      *ScrapeSourceRSS  `yaml:"rss,omitempty" json:"rss,omitempty" desc:"The RSS config of the source."`
}

type ScrapeSourceRSS

type ScrapeSourceRSS struct {
	URL             string `` /* 177-byte string literal not displayed */
	RSSHubRoutePath string `` /* 208-byte string literal not displayed */
}

type Storage

type Storage struct {
	Dir  string      `` /* 153-byte string literal not displayed */
	Feed FeedStorage `yaml:"feed,omitempty" json:"feed,omitempty" desc:"The feed storage config."`
}

type Watcher

type Watcher interface {
	Name() string
	Reload(app *App) error
}

type WatcherFunc

type WatcherFunc func(app *App) error

func (WatcherFunc) Name

func (f WatcherFunc) Name() string

func (WatcherFunc) Reload

func (f WatcherFunc) Reload(app *App) error

Jump to

Keyboard shortcuts

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