Documentation
¶
Overview ¶
Package config 处理 Golem 的全局配置加载、验证与持久化。
Index ¶
- func ConfigDir() string
- func ConfigPath() string
- func IsMCPServerEnabled(server MCPServerConfig) bool
- func Save(cfg *Config) error
- type AgentDefaults
- type AgentsConfig
- type ChannelOutboundConfig
- type ChannelsConfig
- type Config
- type DingTalkConfig
- type DiscordConfig
- type ExecToolConfig
- type FeishuConfig
- type GatewayConfig
- type HeartbeatConfig
- type LogConfig
- type MCPConfig
- type MCPServerConfig
- type MaixCamConfig
- type PolicyConfig
- type ProviderConfig
- type ProvidersConfig
- type QQConfig
- type SlackConfig
- type SubagentRuntimeConfig
- type TelegramConfig
- type ToolsConfig
- type VoiceToolConfig
- type WebSearchConfig
- type WebToolsConfig
- type WhatsAppConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsMCPServerEnabled ¶ added in v0.4.3
func IsMCPServerEnabled(server MCPServerConfig) bool
IsMCPServerEnabled 如果服务器未被显式禁用则返回 true。
Types ¶
type AgentDefaults ¶
type AgentDefaults struct {
Workspace string `mapstructure:"workspace"`
WorkspaceMode string `mapstructure:"workspace_mode"`
Model string `mapstructure:"model"`
MaxTokens int `mapstructure:"max_tokens"`
Temperature float64 `mapstructure:"temperature"`
MaxToolIterations int `mapstructure:"max_tool_iterations"`
}
AgentDefaults 默认代理参数
type AgentsConfig ¶
type AgentsConfig struct {
Defaults AgentDefaults `mapstructure:"defaults"`
Subagent SubagentRuntimeConfig `mapstructure:"subagent"`
}
AgentsConfig 代理设置
type ChannelOutboundConfig ¶ added in v0.5.1
type ChannelOutboundConfig struct {
MaxConcurrentSends int `mapstructure:"max_concurrent_sends"`
RetryMaxAttempts int `mapstructure:"retry_max_attempts"`
RetryBaseBackoffMs int `mapstructure:"retry_base_backoff_ms"`
RetryMaxBackoffMs int `mapstructure:"retry_max_backoff_ms"`
RateLimitPerSecond int `mapstructure:"rate_limit_per_second"`
DedupWindowSeconds int `mapstructure:"dedup_window_seconds"`
}
ChannelOutboundConfig 控制出站可靠性行为。
type ChannelsConfig ¶
type ChannelsConfig struct {
Telegram TelegramConfig `mapstructure:"telegram"`
WhatsApp WhatsAppConfig `mapstructure:"whatsapp"`
Feishu FeishuConfig `mapstructure:"feishu"`
Discord DiscordConfig `mapstructure:"discord"`
Slack SlackConfig `mapstructure:"slack"`
QQ QQConfig `mapstructure:"qq"`
DingTalk DingTalkConfig `mapstructure:"dingtalk"`
MaixCam MaixCamConfig `mapstructure:"maixcam"`
Outbound ChannelOutboundConfig `mapstructure:"outbound"`
}
ChannelsConfig 通道设置
type Config ¶
type Config struct {
Agents AgentsConfig `mapstructure:"agents"` // Agent 相关配置
Channels ChannelsConfig `mapstructure:"channels"` // 消息通道配置
Providers ProvidersConfig `mapstructure:"providers"` // LLM 供应商配置
Gateway GatewayConfig `mapstructure:"gateway"` // 网关服务器配置
Log LogConfig `mapstructure:"log"` // 日志配置
Policy PolicyConfig `mapstructure:"policy"` // 运行时策略配置
MCP MCPConfig `mapstructure:"mcp"` // MCP 服务器配置
Tools ToolsConfig `mapstructure:"tools"` // 工具相关配置
Heartbeat HeartbeatConfig `mapstructure:"heartbeat"` // 心跳服务配置
}
Config 是 Golem 的根配置结构体,包含所有模块的设置。
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns config with sensible defaults
func (*Config) Validate ¶ added in v0.1.4
Validate checks that the configuration values are within acceptable ranges.
func (*Config) WorkspacePath ¶
WorkspacePath returns the expanded workspace path
func (*Config) WorkspacePathChecked ¶
WorkspacePathChecked returns the expanded workspace path or an error if invalid.
type DingTalkConfig ¶ added in v0.2.2
type DingTalkConfig struct {
Enabled bool `mapstructure:"enabled"`
ClientID string `mapstructure:"client_id"`
ClientSecret string `mapstructure:"client_secret"`
AllowFrom []string `mapstructure:"allow_from"`
}
DingTalkConfig DingTalk stream mode settings
type DiscordConfig ¶ added in v0.2.2
type DiscordConfig struct {
Enabled bool `mapstructure:"enabled"`
Token string `mapstructure:"token"`
AllowFrom []string `mapstructure:"allow_from"`
}
DiscordConfig Discord 机器人设置
type ExecToolConfig ¶
type ExecToolConfig struct {
Timeout int `mapstructure:"timeout"`
RestrictToWorkspace bool `mapstructure:"restrict_to_workspace"`
}
ExecToolConfig shell exec settings
type FeishuConfig ¶ added in v0.2.2
type FeishuConfig struct {
Enabled bool `mapstructure:"enabled"`
AppID string `mapstructure:"app_id"`
AppSecret string `mapstructure:"app_secret"`
EncryptKey string `mapstructure:"encrypt_key"`
VerificationToken string `mapstructure:"verification_token"`
AllowFrom []string `mapstructure:"allow_from"`
}
FeishuConfig 飞书机器人设置
type GatewayConfig ¶
type GatewayConfig struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Token string `mapstructure:"token"`
}
GatewayConfig server settings
type HeartbeatConfig ¶ added in v0.3.0
type HeartbeatConfig struct {
Enabled bool `mapstructure:"enabled"`
Interval int `mapstructure:"interval"` // minutes
MaxIdleMinutes int `mapstructure:"max_idle_minutes"` // minutes
}
HeartbeatConfig heartbeat service settings.
type MCPConfig ¶ added in v0.4.0
type MCPConfig struct {
Servers map[string]MCPServerConfig `mapstructure:"servers"`
}
MCPConfig MCP 服务器设置。
type MCPServerConfig ¶ added in v0.4.0
type MCPServerConfig struct {
Enabled *bool `mapstructure:"enabled"`
Transport string `mapstructure:"transport"`
Command string `mapstructure:"command"`
Args []string `mapstructure:"args"`
Env map[string]string `mapstructure:"env"`
URL string `mapstructure:"url"`
Headers map[string]string `mapstructure:"headers"`
}
MCPServerConfig MCP 服务器传输设置。
type MaixCamConfig ¶ added in v0.2.2
type MaixCamConfig struct {
Enabled bool `mapstructure:"enabled"`
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
AllowFrom []string `mapstructure:"allow_from"`
}
MaixCamConfig MaixCam bridge settings
type PolicyConfig ¶ added in v0.4.0
type PolicyConfig struct {
Mode string `mapstructure:"mode"`
OffTTL string `mapstructure:"off_ttl"`
AllowPersistentOff bool `mapstructure:"allow_persistent_off"`
RequireApproval []string `mapstructure:"require_approval"`
}
PolicyConfig 运行时策略设置。
type ProviderConfig ¶
type ProviderConfig struct {
APIKey string `mapstructure:"api_key"`
SecretKey string `mapstructure:"secret_key"`
BaseURL string `mapstructure:"base_url"`
}
ProviderConfig single provider settings
type ProvidersConfig ¶
type ProvidersConfig struct {
OpenRouter ProviderConfig `mapstructure:"openrouter"`
Claude ProviderConfig `mapstructure:"claude"`
OpenAI ProviderConfig `mapstructure:"openai"`
DeepSeek ProviderConfig `mapstructure:"deepseek"`
Gemini ProviderConfig `mapstructure:"gemini"`
Ark ProviderConfig `mapstructure:"ark"`
Qianfan ProviderConfig `mapstructure:"qianfan"`
Qwen ProviderConfig `mapstructure:"qwen"`
Ollama ProviderConfig `mapstructure:"ollama"`
}
ProvidersConfig LLM provider settings
type QQConfig ¶ added in v0.2.2
type QQConfig struct {
Enabled bool `mapstructure:"enabled"`
AppID string `mapstructure:"app_id"`
AppSecret string `mapstructure:"app_secret"`
AllowFrom []string `mapstructure:"allow_from"`
}
QQConfig QQ 机器人设置
type SlackConfig ¶ added in v0.2.2
type SlackConfig struct {
Enabled bool `mapstructure:"enabled"`
BotToken string `mapstructure:"bot_token"`
AppToken string `mapstructure:"app_token"`
AllowFrom []string `mapstructure:"allow_from"`
}
SlackConfig Slack 机器人设置
type SubagentRuntimeConfig ¶ added in v0.5.0
type SubagentRuntimeConfig struct {
TimeoutSeconds int `mapstructure:"timeout_seconds"`
Retry int `mapstructure:"retry"`
MaxConcurrency int `mapstructure:"max_concurrency"`
}
SubagentRuntimeConfig 控制委托子代理执行策略。
type TelegramConfig ¶
type TelegramConfig struct {
Enabled bool `mapstructure:"enabled"`
Token string `mapstructure:"token"`
AllowFrom []string `mapstructure:"allow_from"`
}
TelegramConfig Telegram 机器人设置
type ToolsConfig ¶
type ToolsConfig struct {
Web WebToolsConfig `mapstructure:"web"`
Exec ExecToolConfig `mapstructure:"exec"`
Voice VoiceToolConfig `mapstructure:"voice"`
}
ToolsConfig tool settings
type VoiceToolConfig ¶ added in v0.3.1
type VoiceToolConfig struct {
Enabled bool `mapstructure:"enabled"`
Provider string `mapstructure:"provider"`
Model string `mapstructure:"model"`
TimeoutSeconds int `mapstructure:"timeout_seconds"`
}
VoiceToolConfig speech-to-text settings for inbound audio.
type WebSearchConfig ¶
type WebSearchConfig struct {
APIKey string `mapstructure:"api_key"`
MaxResults int `mapstructure:"max_results"`
}
WebSearchConfig brave search settings
type WebToolsConfig ¶
type WebToolsConfig struct {
Search WebSearchConfig `mapstructure:"search"`
}
WebToolsConfig web tool settings
type WhatsAppConfig ¶ added in v0.2.2
type WhatsAppConfig struct {
Enabled bool `mapstructure:"enabled"`
BridgeURL string `mapstructure:"bridge_url"`
AllowFrom []string `mapstructure:"allow_from"`
}
WhatsAppConfig WhatsApp 桥接设置