config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadPrompt

func LoadPrompt() *[]Prompt

LoadPrompt 加载Prompt

Types

type Configuration

type Configuration struct {
	// 日志级别,info或者debug
	LogLevel string `yaml:"log_level"`
	// 企业ID
	CorpId string `yaml:"corp_id"`
	// 应用ID
	AgentId int64 `yaml:"agent_id"`
	// 应用秘钥
	AgentSecret string `yaml:"agent_secret"`
	// API接收消息的token
	ReceiveMsgToken string `yaml:"receive_msg_token"`
	// API接收消息的key
	ReceiveMsgKey string `yaml:"receive_msg_key"`
	// gpt apikey
	ApiKey string `yaml:"api_key"`
	// 请求的 URL 地址
	BaseURL string `yaml:"base_url"`
	// 使用模型
	Model string `yaml:"model"`
	// 会话超时时间
	SessionTimeout time.Duration `yaml:"session_timeout"`
	// 最大问题长度
	MaxQuestionLen int `yaml:"max_question_len"`
	// 最大答案长度
	MaxAnswerLen int `yaml:"max_answer_len"`
	// 最大文本 = 问题 + 回答, 接口限制
	MaxText int `yaml:"max_text"`
	// 默认对话模式
	DefaultMode string `yaml:"default_mode"`
	// 代理地址
	HttpProxy string `yaml:"http_proxy"`
	// 用户单日最大请求次数
	MaxRequest int `yaml:"max_request"`
	// 指定服务启动端口,默认为 8090
	Port string `yaml:"port"`
	// 指定服务的地址,就是企微机器人配置的回调地址,比如: http://chat.eryajf.net
	ServiceURL string `yaml:"service_url"`
	// 哪些用户可以进行对话
	AllowUsers []string `yaml:"allow_users"`
	// 哪些用户不可以进行对话
	DenyUsers []string `yaml:"deny_users"`
	// 哪些Vip用户可以进行无限对话
	VipUsers []string `yaml:"vip_users"`
	// 指定哪些人为此系统的管理员,必须指定,否则所有人都是
	AdminUsers []string `yaml:"admin_users"`
	// 敏感词,提问时触发,则不允许提问,回答的内容中触发,则以 🚫 代替
	SensitiveWords []string `yaml:"sensitive_words"`
	// 自定义帮助信息
	Help string `yaml:"help"`
	// AzureOpenAI 配置
	AzureOn             bool   `yaml:"azure_on"`
	AzureApiVersion     string `yaml:"azure_api_version"`
	AzureResourceName   string `yaml:"azure_resource_name"`
	AzureDeploymentName string `yaml:"azure_deployment_name"`
	AzureOpenAIToken    string `yaml:"azure_openai_token"`
}

Configuration 项目配置

func LoadConfig

func LoadConfig() *Configuration

LoadConfig 加载配置

type Prompt

type Prompt struct {
	Title  string `yaml:"title"`
	Prefix string `yaml:"prefix"`
	Suffix string `yaml:"suffix"`
}

Jump to

Keyboard shortcuts

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