Documentation ¶
Index ¶
- func SetDefault(v *Configuration)
- func Setup(v *Configuration) error
- func WebListenAndServe(handler http.Handler, cfg *WebServerConfig, wg *sync.WaitGroup, ...) (*http.Server, error)
- func WebShutdown(svr *http.Server, logger *slog.Logger)
- type AppConfig
- type Configuration
- type LogConfig
- type OpenAIConfig
- type WebServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Setup ¶
func Setup(v *Configuration) error
func WebListenAndServe ¶ added in v0.3.2
Types ¶
type AppConfig ¶
type AppConfig struct { Path string `json:"path"` // C:\opt\_test\option.test.exe Dir string `json:"dir"` // C:\opt\_test }
AppConfig app config
type Configuration ¶ added in v0.3.2
type Configuration struct { App *AppConfig `json:"app"` // 程序运行目录 Log *LogConfig `json:"log"` // 日志 Web *WebServerConfig `json:"web"` // web server OpenAI *OpenAIConfig `json:"openai"` // openai }
Configuration 配置
type LogConfig ¶
type LogConfig struct { Caller bool `yaml:"caller,omitempty"` // true=打印代码名称和行号 Level string `yaml:"level,omitempty"` // 输出日志level Format string `yaml:"format,omitempty"` // 日志输出格式 text, json }
LogConfig 日志配置
type OpenAIConfig ¶
type OpenAIConfig struct { ApiType string `json:"api_type,omitempty"` // api类型 ApiKey string `json:"api_key"` // api key ApiBaseUrl string `json:"api_base_url,omitempty"` // base url Proxy string `json:"proxy,omitempty"` // 代理 Model string `json:"model"` // 运行模式 System string `json:"system,omitempty"` // 系统提示信息 SystemRaw bool `json:"system_raw,omitempty"` // 系统提示信息不支持“\”转义 Stream bool `json:"stream"` // 流模式 MaxTokens uint `json:"max_tokens"` // 最大tokens History uint `json:"history"` // 历史记录 }
OpenAIConfig chatGPT配置
type WebServerConfig ¶ added in v0.3.2
type WebServerConfig struct {
Port uint `json:"port"` // 服务端口
}
WebServerConfig web server配置
Click to show internal directories.
Click to hide internal directories.