webtools

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client) *Client

func (*Client) OpenPage

func (c *Client) OpenPage(ctx context.Context, cfg RuntimeConfig, req OpenPageRequest) (*OpenPageResponse, error)

func (*Client) Search

func (c *Client) Search(ctx context.Context, cfg RuntimeConfig, req SearchRequest) (*SearchResponse, error)

type Config

type Config struct {
	SearchProvider       SearchProvider      `json:"search_provider"`
	PageObservationMode  PageObservationMode `json:"page_observation_mode"`
	SearXNGBaseURL       string              `json:"searxng_base_url"`
	JinaSearchBaseURL    string              `json:"jina_search_base_url"`
	JinaReaderBaseURL    string              `json:"jina_reader_base_url"`
	JinaAPIKeySecretName string              `json:"jina_api_key_secret_name,omitempty"`
	SearchReady          bool                `json:"search_ready"`
	PageReadReady        bool                `json:"page_read_ready"`
	Warnings             []string            `json:"warnings"`
}

func DefaultConfig

func DefaultConfig() Config

type OpenPageRequest

type OpenPageRequest struct {
	URL           string
	Mode          PageObservationMode
	MaxCharacters int
}

type OpenPageResponse

type OpenPageResponse struct {
	URL         string              `json:"url"`
	FinalURL    string              `json:"final_url,omitempty"`
	Mode        PageObservationMode `json:"mode"`
	StatusCode  int                 `json:"status_code,omitempty"`
	ContentType string              `json:"content_type,omitempty"`
	Title       string              `json:"title,omitempty"`
	Content     string              `json:"content"`
	Truncated   bool                `json:"truncated,omitempty"`
}

type PageObservationMode

type PageObservationMode string
const (
	PageObservationModeHTTP PageObservationMode = "http"
	PageObservationModeJina PageObservationMode = "jina"
)

type RuntimeConfig

type RuntimeConfig struct {
	Config
	JinaAPIKey          string `json:"-"`
	AllowPrivateNetwork bool   `json:"-"`
}

type SearchProvider

type SearchProvider string
const (
	SearchProviderDisabled SearchProvider = "disabled"
	SearchProviderSearXNG  SearchProvider = "searxng"
	SearchProviderJina     SearchProvider = "jina"
)

type SearchRequest

type SearchRequest struct {
	Query string
	Limit int
}

type SearchResponse

type SearchResponse struct {
	Provider    SearchProvider `json:"provider"`
	Query       string         `json:"query"`
	ResultCount int            `json:"result_count,omitempty"`
	Results     []SearchResult `json:"results,omitempty"`
	Content     string         `json:"content,omitempty"`
	Truncated   bool           `json:"truncated,omitempty"`
}

type SearchResult

type SearchResult struct {
	Title   string `json:"title"`
	URL     string `json:"url"`
	Snippet string `json:"snippet,omitempty"`
	Engine  string `json:"engine,omitempty"`
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(configs *query.AppConfigStore, secrets *query.SecretStore, allowPrivateNetwork ...bool) *Store

func (*Store) Get

func (s *Store) Get(ctx context.Context) (Config, error)

func (*Store) Resolve

func (s *Store) Resolve(ctx context.Context) (RuntimeConfig, error)

func (*Store) Set

func (s *Store) Set(ctx context.Context, cfg Config) (Config, error)

Jump to

Keyboard shortcuts

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