cfgs

package
v0.0.0-...-ef01d87 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DebugMode            bool          `yaml:"DebugMode"`
	LineChannelToken     string        `yaml:"LineChannelToken"`
	LineChannelSecret    string        `yaml:"LineChannelSecret"`
	ChatGptApiUrl        string        `yaml:"ChatGptApiUrl"`
	ChatGptAccessToken   string        `yaml:"ChatGptAccessToken"`
	SessionExpirePeriod  time.Duration `yaml:"SessionExpirePeriod"`
	SessionClearInterval time.Duration `yaml:"SessionClearInterval"`
	NotPushExpireMessage bool          `yaml:"NotPushExpireMessage"`
	DefaultRole          string        `yaml:"DefaultRole"`
	Roles                Roles         `yaml:"Roles"`
	ServePort            int           `yaml:"ServePort"`
	MaxTaskQueueCap      int           `yaml:"MaxTaskQueueCap"`
	LogPath              string        `yaml:"LogPath"`
	CmdsTalkToAI         []string      `yaml:"CmdsTalkToAI"`
	CmdsClearSession     []string      `yaml:"CmdsClearSession"`
	CmdsChangeRole       []string      `yaml:"CmdsChangeRole"`
}

func DefaultConfig

func DefaultConfig() *Config

func LoadConfig

func LoadConfig(fname string) (*Config, error)

func ReadConfig

func ReadConfig(r io.Reader) (*Config, error)

func (*Config) Merge

func (cfg *Config) Merge(cfg2 *Config) error

func (*Config) MergeDefault

func (cfg *Config) MergeDefault() error

func (*Config) SaveConfig

func (cfg *Config) SaveConfig(fname string) error

func (*Config) WriteConfig

func (cfg *Config) WriteConfig(w io.Writer) error

type Role

type Role struct {
	Prompt               string `yaml:"Prompt"`
	MaxConversationCount int    `yaml:"MaxConversationCount"`
	PrefixUserName       bool   `yaml:"PrefixUserName"`
}

type Roles

type Roles map[string]*Role

func DefaultRoles

func DefaultRoles() Roles

func LoadRoles

func LoadRoles(fname string) (Roles, error)

func ReadRoles

func ReadRoles(r io.Reader) (Roles, error)

func (Roles) SaveRoles

func (roles Roles) SaveRoles(fname string) error

func (Roles) WriteRoles

func (roles Roles) WriteRoles(w io.Writer) error

Jump to

Keyboard shortcuts

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