Documentation ¶
Index ¶
- Constants
- func FindHomeDir(verbose bool) (string, error)
- func GetAcceptLanguage() string
- func GetPageActivate(activate_url string, msg string, title string, tips string) string
- func GetPageActiviated(msg string, title string, tips string) string
- func GetRealFullPath(path string) (string, error)
- func GetServerDSN() string
- func IsMySQL() bool
- func IsSQLite() bool
- func IsWritable(path string, verbose bool) (isWritable bool, err error)
- func SetupPeferenceLanguage(language string)
- func Text(str_key string) string
- type ProxyRoute
- type ServerConfig
- type ServerConfigItems
- type SysConfig
- func (cfg *SysConfig) DebugMode() bool
- func (cfg *SysConfig) DumpIntoYAML(cfg_file string) (string, error)
- func (cfg *SysConfig) FindRole(role_name string) (*SysRole, error)
- func (cfg *SysConfig) GetCurrentMode(connected bool) string
- func (cfg *SysConfig) IsSharedMode() bool
- func (cfg *SysConfig) LoadFromYAML(cfg_file string) error
- func (cfg *SysConfig) UsingOriginalService() bool
- type SysRole
- type SysSystem
Constants ¶
View Source
const AppName = "X-Ally"
Real constants and can not be changed
View Source
const PROXY_TOKEN_NAME = "X-ALLY-TOKEN"
const MaxTokens = 4096
View Source
const ServerName = "X-Ally-Server"
Real constants and can not be changed
View Source
const ServerVersion = "0.2.1"
View Source
const Version = "0.2.1"
Variables ¶
This section is empty.
Functions ¶
func FindHomeDir ¶
func GetAcceptLanguage ¶
func GetAcceptLanguage() string
func GetPageActivate ¶
func GetRealFullPath ¶
func GetServerDSN ¶
func GetServerDSN() string
func IsWritable ¶
/////////////////////////////////////////////////////////////////////////////
func SetupPeferenceLanguage ¶
func SetupPeferenceLanguage(language string)
Types ¶
type ProxyRoute ¶
type ServerConfig ¶
type ServerConfig struct {
Server *ServerConfigItems `yaml:"server"`
}
var SvrConfig *ServerConfig
func LoadServerConfig ¶
func LoadServerConfig(config_file string, verbose bool) (*ServerConfig, error)
func (*ServerConfig) DebugMode ¶ added in v0.1.6
func (cfg *ServerConfig) DebugMode() bool
func (*ServerConfig) DumpIntoYAML ¶
func (cfg *ServerConfig) DumpIntoYAML(cfg_file string) (string, error)
func (*ServerConfig) LoadFromYAML ¶
func (cfg *ServerConfig) LoadFromYAML(cfg_file string) error
type ServerConfigItems ¶
type ServerConfigItems struct { DBDriver string `yaml:"db_driver"` DBHost string `yaml:"db_host"` DBPort string `yaml:"db_port"` DBUser string `yaml:"db_user"` DBPassword string `yaml:"db_password"` SentryDSN string `yaml:"sentry_dsn,omitempty"` OpenaiApiKey string `yaml:"openai_api_key"` OpenaiOrgID string `yaml:"openai_org_id"` AppToken string `yaml:"app_token"` AppTokenLifespan uint32 `yaml:"app_token_lifespan"` ListenAddr string `yaml:"listen_addr"` WhiteListRefreshInterval int64 `yaml:"white_list_refresh_interval,omitempty"` Routes []ProxyRoute `yaml:"routes,omitempty"` ExternalEndpoint string `yaml:"external_endpoint"` SMTPServer string `yaml:"smtp_server"` SMTPPort int `yaml:"smtp_port"` SMTPUsername string `yaml:"smtp_username"` SMTPPassword string `yaml:"smtp_password"` DirectEmailNotify bool `yaml:"direct_email_notify"` EmailRestrictDomain string `yaml:"email_restrict_domain"` DebugMode bool `yaml:"debug_mode,omitempty"` }
type SysConfig ¶
var MyConfig *SysConfig
func NewSysConfig ¶
func (*SysConfig) DumpIntoYAML ¶
func (*SysConfig) GetCurrentMode ¶
func (*SysConfig) IsSharedMode ¶
func (*SysConfig) LoadFromYAML ¶
func (*SysConfig) UsingOriginalService ¶
type SysRole ¶
type SysRole struct { Name string `yaml:"name,omitempty"` Model string `yaml:"model,omitempty"` Avatar string `yaml:"avatar,omitempty"` Temperature float32 `yaml:"temperature,omitempty"` TopP int `yaml:"top_p,omitempty"` Prompt string `yaml:"prompt,omitempty"` Opening string `yaml:"opening,omitempty"` }
type SysSystem ¶
type SysSystem struct { SentryDSN string `yaml:"sentry_dsn,omitempty"` ChatHistoryPath string `yaml:"chat_history_path,omitempty"` LogPath string `yaml:"log_path,omitempty"` LogLevel string `yaml:"log_level,omitempty"` PeferenceLanguage string `yaml:"peference_language,omitempty"` DefaultRole string `yaml:"default_role,omitempty"` APIEndpointOpenai string `yaml:"api_endpoint_openai,omitempty"` APIEndpointDeepl string `yaml:"api_endpoint_deepl,omitempty"` // APIKeyOpenai string `yaml:"api_key_openai,omitempty"` OpenaiApiKey string `yaml:"openai_api_key"` OpenaiOrgID string `yaml:"openai_org_id"` DeeplApiKey string `yaml:"deepl_api_key,omitempty"` // APIOrgIDOpenai string `yaml:"api_orgid_openai,omitempty"` AppToken string `yaml:"app_token,omitempty"` Email string `yaml:"email,omitempty"` DebugMode bool `yaml:"debug_mode,omitempty"` }
Click to show internal directories.
Click to hide internal directories.