browser

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package services provides a set of services for the MoLing application.

Package services provides a set of services for the MoLing application.

Package services provides a set of services for the MoLing application.

Index

Constants

View Source
const (
	BrowserDataPath                         = "browser" // Path to store browser data
	BrowserServerName comm.MoLingServerType = "Browser"
)
View Source
const BrowserPromptDefault = `` /* 1731-byte string literal not displayed */

Variables

This section is empty.

Functions

func NewBrowserServer

func NewBrowserServer(ctx context.Context) (abstract.Service, error)

NewBrowserServer creates a new BrowserServer instance with the given context and configuration.

Types

type BrowserConfig

type BrowserConfig struct {
	PromptFile string `json:"prompt_file"` // PromptFile is the prompt file for the browser.

	Headless             bool   `json:"headless"`
	Timeout              int    `json:"timeout"`
	Proxy                string `json:"proxy"`
	UserAgent            string `json:"user_agent"`
	DefaultLanguage      string `json:"default_language"`
	URLTimeout           int    `json:"url_timeout"`            // URLTimeout is the timeout for loading a URL. time.Second
	SelectorQueryTimeout int    `json:"selector_query_timeout"` // SelectorQueryTimeout is the timeout for CSS selector queries. time.Second
	DataPath             string `json:"data_path"`              // DataPath is the path to the data directory.
	BrowserDataPath      string `json:"browser_data_path"`      // BrowserDataPath is the path to the browser data directory.
	// contains filtered or unexported fields
}

func NewBrowserConfig

func NewBrowserConfig() *BrowserConfig

NewBrowserConfig creates a new BrowserConfig with default values.

func (*BrowserConfig) Check

func (cfg *BrowserConfig) Check() error

type BrowserServer

type BrowserServer struct {
	abstract.MLService
	// contains filtered or unexported fields
}

BrowserServer represents the configuration for the browser service.

func (*BrowserServer) Close

func (bs *BrowserServer) Close() error

func (*BrowserServer) Config

func (bs *BrowserServer) Config() string

Config returns the configuration of the service as a string.

func (*BrowserServer) Init

func (bs *BrowserServer) Init() error

Init initializes the browser server by creating a new context.

func (*BrowserServer) LoadConfig

func (bs *BrowserServer) LoadConfig(jsonData map[string]any) error

LoadConfig loads the configuration from a JSON object.

func (*BrowserServer) Name

func (bs *BrowserServer) Name() comm.MoLingServerType

Jump to

Keyboard shortcuts

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