web

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module

func Module(c Config) common.ModuleFactory

Types

type Config

type Config struct {
	HTTPClient  *http.Client
	Search      SearchBackend
	UserAgent   string
	MaxBytes    int64
	Timeout     time.Duration
	MaxTimeout  time.Duration
	CacheTTL    time.Duration
	CacheBytes  int64
	SearchChars int
}

type FetchArg

type FetchArg struct {
	URL     string `json:"url" required:"true" description:"absolute http or https URL, credentials not allowed in it"`
	Format  string `` /* 363-byte string literal not displayed */
	Full    bool   `` /* 162-byte string literal not displayed */
	Offset  uint   `json:"offset" description:"1-based line of the converted content to start from, for continuing a long page"`
	Limit   uint   `json:"limit" description:"max lines to return, default 2000"`
	Timeout uint   `` /* 160-byte string literal not displayed */
	SaveAs  string `` /* 148-byte string literal not displayed */
}

type Query

type Query struct {
	Text    string
	Num     int
	Domains []string
	Since   time.Time
}

type Result

type Result struct {
	Title     string `json:"title" description:"the backend's title for the page"`
	URL       string `json:"url" description:"fetch it with web__fetch to read the page"`
	Snippet   string `json:"snippet,omitempty" description:"the backend's own one- or two-sentence extract; empty when it returns content instead"`
	Content   string `` /* 184-byte string literal not displayed */
	Published string `json:"published,omitempty" description:"publication date the backend reports; empty when it reports none"`
}

type SearchArg

type SearchArg struct {
	Query   string   `` /* 137-byte string literal not displayed */
	Num     uint     `json:"num" description:"results to return, default 8, at most 20"`
	Domains []string `` /* 182-byte string literal not displayed */
	Recent  string   `` /* 145-byte string literal not displayed */
}

type SearchBackend

type SearchBackend interface {
	Search(ctx context.Context, q Query) ([]Result, error)
}

Jump to

Keyboard shortcuts

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