config

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	ID    string `toml:"id"`
	Nick  string `toml:"nick"`
	Token string `toml:"token"`
	ULR   string `toml:"url"`
	Src   string `toml:"src"`
}

Bot contains base API configuration parameters.

type BuildInfo added in v0.2.0

type BuildInfo struct {
	Name      string
	Hash      string
	Revision  string
	GoVersion string
	Date      string
	URL       string
}

BuildInfo is a build information.

type Config

type Config struct {
	sync.Mutex
	M          Main      `toml:"main"`
	B          Bot       `toml:"bot"`
	G          GPT       `toml:"gpt"`
	Y          YandexGPT `toml:"yandex_gpt"`
	L          Log       `toml:"log"`
	Bt         *botgolang.Bot
	DB         *sql.DB
	BuildInfo  *BuildInfo
	RandSource rand.Source

	Timezone *time.Location
	// contains filtered or unexported fields
}

Config is common configuration struct.

func New

func New(fileName string, b *BuildInfo, server *httptest.Server) (*Config, error)

New returns new configuration.

func (*Config) Close added in v0.2.0

func (c *Config) Close() error

Close free resources.

func (*Config) Context added in v0.2.0

func (c *Config) Context() (context.Context, context.CancelFunc)

Context returns context with timeout.

type GPT added in v0.7.0

type GPT struct {
	Bearer       string       `toml:"bearer"`
	Organization string       `toml:"organization"`
	MaxTokens    uint         `toml:"max_tokens"`
	URL          string       `toml:"url"`
	Proxy        string       `toml:"proxy"`
	Temperature  float32      `toml:"temperature"`
	Client       *http.Client `toml:"-"`
}

GPT is a ChatGPT API configuration settings.

func (*GPT) Response added in v0.7.0

func (gpt *GPT) Response(ctx context.Context, content string) (string, error)

Response returns ChatGPT response.

type Log added in v0.3.0

type Log struct {
	PidFile string `toml:"pidfile"`
	LogFile string `toml:"logfile"`
	Output  io.WriteCloser
}

Log is a logging configuration settings.

type Main added in v0.2.0

type Main struct {
	Debug        bool   `toml:"debug"`
	Storage      string `toml:"storage"`
	Timeout      uint64 `toml:"timeout"`
	Workers      int    `toml:"workers"`
	SecureRandom bool   `toml:"secure_random"`
	Timezone     string `toml:"Timezone"`
}

Main is a basic configuration settings.

type YandexGPT added in v1.0.0

type YandexGPT struct {
	APIKey string       `toml:"api_key"`
	URL    string       `toml:"url"`
	Proxy  string       `toml:"proxy"`
	Client *http.Client `toml:"-"`
}

YandexGPT is a Yandex GPT API configuration settings.

func (*YandexGPT) Response added in v1.0.0

func (yt *YandexGPT) Response(ctx context.Context, content string) (string, error)

Response returns Yandex GPT response.

Jump to

Keyboard shortcuts

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