config

package
v0.0.0-...-844bcbf Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPath = "config.dev.yaml"

	DefaultChatGPTUrl       = "https://api.openai.com/v1/chat/completions"
	DefaultModel            = "gpt-3.5-turbo"
	DefaultMaxTokens        = 3072
	DefaultTemperature      = 0.9
	DefaultTopP             = 1
	DefaultFrequencyPenalty = 0
	DefaultPresencePenalty  = 0

	DefaultDallEUrl  = "https://api.openai.com/v1/images/generations"
	DefaultImageN    = 1
	DefaultImageSize = "256x256"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Common struct {
		ServiceUrl string `yaml:"serviceUrl"` // 服务地址
	} `yaml:"common"`
	Wechat struct {
		AppId          string `yaml:"appId"`          // appId
		AppSecret      string `yaml:"appSecret"`      // appSecret
		Token          string `yaml:"token"`          // token
		EncodingAESKey string `yaml:"encodingAESKey"` // 加密编码
	} `yaml:"wechat"`
	ChatGPT struct {
		ApiKey           string  `yaml:"apiKey"`           // apiKey
		BaseUrl          string  `yaml:"baseUrl"`          // 地址
		Model            string  `yaml:"model"`            // 模型,默认GPT-3.5
		MaxTokens        uint    `yaml:"maxTokens"`        // 生成结果时的最大单词数,GPT3.5是4000
		Temperature      float64 `yaml:"temperature"`      // 随机因子,控制结果的随机性,0~0.9
		TopP             int     `yaml:"topP"`             // 随机因子,0~0.9之间
		FrequencyPenalty int     `yaml:"frequencyPenalty"` // 重复度惩罚因子,是-2.0~2.0之间的数字
		PresencePenalty  int     `yaml:"presencePenalty"`  // 控制主题的重复度,是-2.0~2.0之间的数字
	} `yaml:"chatGPT"`
	DallE struct {
		BaseUrl   string `yaml:"baseUrl"`   // 地址
		ImageN    int    `yaml:"imageN"`    // 图片生成数量
		ImageSize string `yaml:"imageSize"` // 图片生成大小
	} `yaml:"dallE"`
}

func C

func C() *Configuration

func LoadConfig

func LoadConfig() *Configuration

func LoadConfigWithPath

func LoadConfigWithPath(path string) *Configuration

Jump to

Keyboard shortcuts

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