style: fix struct tag formatting in config.go
This commit is contained in:
parent
0539854baa
commit
7560b6a295
1 changed files with 49 additions and 49 deletions
|
|
@ -26,18 +26,18 @@ const CurrentVersion = 2
|
||||||
|
|
||||||
// Config is the current config structure with version support
|
// Config is the current config structure with version support
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Version int `json:"version" yaml:"-"` // Config schema version for migration
|
Version int `json:"version" yaml:"-"` // Config schema version for migration
|
||||||
Agents AgentsConfig `json:"agents" yaml:"-"`
|
Agents AgentsConfig `json:"agents" yaml:"-"`
|
||||||
Bindings []AgentBinding `json:"bindings,omitempty" yaml:"-"`
|
Bindings []AgentBinding `json:"bindings,omitempty" yaml:"-"`
|
||||||
Session SessionConfig `json:"session,omitempty" yaml:"-"`
|
Session SessionConfig `json:"session,omitempty" yaml:"-"`
|
||||||
Channels ChannelsConfig `json:"channels" yaml:"channels"`
|
Channels ChannelsConfig `json:"channels" yaml:"channels"`
|
||||||
ModelList SecureModelList `json:"model_list" yaml:"model_list"` // New model-centric provider configuration
|
ModelList SecureModelList `json:"model_list" yaml:"model_list"` // New model-centric provider configuration
|
||||||
Gateway GatewayConfig `json:"gateway" yaml:"-"`
|
Gateway GatewayConfig `json:"gateway" yaml:"-"`
|
||||||
Hooks HooksConfig `json:"hooks,omitempty" yaml:"-"`
|
Hooks HooksConfig `json:"hooks,omitempty" yaml:"-"`
|
||||||
Tools ToolsConfig `json:"tools" yaml:",inline"`
|
Tools ToolsConfig `json:"tools" yaml:",inline"`
|
||||||
Heartbeat HeartbeatConfig `json:"heartbeat" yaml:"-"`
|
Heartbeat HeartbeatConfig `json:"heartbeat" yaml:"-"`
|
||||||
Devices DevicesConfig `json:"devices" yaml:"-"`
|
Devices DevicesConfig `json:"devices" yaml:"-"`
|
||||||
Voice VoiceConfig `json:"voice" yaml:"-"`
|
Voice VoiceConfig `json:"voice" yaml:"-"`
|
||||||
// BuildInfo contains build-time version information
|
// BuildInfo contains build-time version information
|
||||||
BuildInfo BuildInfo `json:"build_info,omitempty" yaml:"-"`
|
BuildInfo BuildInfo `json:"build_info,omitempty" yaml:"-"`
|
||||||
|
|
||||||
|
|
@ -616,7 +616,7 @@ type ModelConfig struct {
|
||||||
// Enabled indicates whether this model entry is active. When omitted in
|
// Enabled indicates whether this model entry is active. When omitted in
|
||||||
// existing configs, the field is inferred during load: models with API keys
|
// existing configs, the field is inferred during load: models with API keys
|
||||||
// or the reserved "local-model" name are auto-enabled.
|
// or the reserved "local-model" name are auto-enabled.
|
||||||
Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
|
Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
|
||||||
// UserAgent is the user agent string to use for HTTP requests.
|
// UserAgent is the user agent string to use for HTTP requests.
|
||||||
UserAgent string `json:"user_agent,omitempty" yaml:"-"`
|
UserAgent string `json:"user_agent,omitempty" yaml:"-"`
|
||||||
|
|
||||||
|
|
@ -756,8 +756,8 @@ type GLMSearchConfig struct {
|
||||||
BaseURL string `json:"base_url" yaml:"-" env:"PICOCLAW_TOOLS_WEB_GLM_BASE_URL"`
|
BaseURL string `json:"base_url" yaml:"-" env:"PICOCLAW_TOOLS_WEB_GLM_BASE_URL"`
|
||||||
// SearchEngine specifies the search backend: "search_std" (default),
|
// SearchEngine specifies the search backend: "search_std" (default),
|
||||||
// "search_pro", "search_pro_sogou", or "search_pro_quark".
|
// "search_pro", "search_pro_sogou", or "search_pro_quark".
|
||||||
SearchEngine string `json:"search_engine" yaml:"-" env:"PICOCLAW_TOOLS_WEB_GLM_SEARCH_ENGINE"`
|
SearchEngine string `json:"search_engine" yaml:"-" env:"PICOCLAW_TOOLS_WEB_GLM_SEARCH_ENGINE"`
|
||||||
MaxResults int `json:"max_results" yaml:"-" env:"PICOCLAW_TOOLS_WEB_GLM_MAX_RESULTS"`
|
MaxResults int `json:"max_results" yaml:"-" env:"PICOCLAW_TOOLS_WEB_GLM_MAX_RESULTS"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type BaiduSearchConfig struct {
|
type BaiduSearchConfig struct {
|
||||||
|
|
@ -768,7 +768,7 @@ type BaiduSearchConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebToolsConfig struct {
|
type WebToolsConfig struct {
|
||||||
ToolConfig ` yaml:"-" envPrefix:"PICOCLAW_TOOLS_WEB_"`
|
ToolConfig ` yaml:"-" envPrefix:"PICOCLAW_TOOLS_WEB_"`
|
||||||
Brave BraveConfig `yaml:"brave,omitempty" json:"brave"`
|
Brave BraveConfig `yaml:"brave,omitempty" json:"brave"`
|
||||||
Tavily TavilyConfig `yaml:"tavily,omitempty" json:"tavily"`
|
Tavily TavilyConfig `yaml:"tavily,omitempty" json:"tavily"`
|
||||||
DuckDuckGo DuckDuckGoConfig `yaml:"-" json:"duckduckgo"`
|
DuckDuckGo DuckDuckGoConfig `yaml:"-" json:"duckduckgo"`
|
||||||
|
|
@ -781,13 +781,13 @@ type WebToolsConfig struct {
|
||||||
// the client-side web_search tool is hidden to avoid duplicate search surfaces,
|
// the client-side web_search tool is hidden to avoid duplicate search surfaces,
|
||||||
// and the provider's built-in search is used instead. Falls back to client-side
|
// and the provider's built-in search is used instead. Falls back to client-side
|
||||||
// search when the provider does not support native search.
|
// search when the provider does not support native search.
|
||||||
PreferNative bool `yaml:"-" json:"prefer_native" env:"PICOCLAW_TOOLS_WEB_PREFER_NATIVE"`
|
PreferNative bool `yaml:"-" json:"prefer_native" env:"PICOCLAW_TOOLS_WEB_PREFER_NATIVE"`
|
||||||
// Proxy is an optional proxy URL for web tools (http/https/socks5/socks5h).
|
// Proxy is an optional proxy URL for web tools (http/https/socks5/socks5h).
|
||||||
// For authenticated proxies, prefer HTTP_PROXY/HTTPS_PROXY env vars instead of embedding credentials in config.
|
// For authenticated proxies, prefer HTTP_PROXY/HTTPS_PROXY env vars instead of embedding credentials in config.
|
||||||
Proxy string `yaml:"-" json:"proxy,omitempty" env:"PICOCLAW_TOOLS_WEB_PROXY"`
|
Proxy string `yaml:"-" json:"proxy,omitempty" env:"PICOCLAW_TOOLS_WEB_PROXY"`
|
||||||
FetchLimitBytes int64 `yaml:"-" json:"fetch_limit_bytes,omitempty" env:"PICOCLAW_TOOLS_WEB_FETCH_LIMIT_BYTES"`
|
FetchLimitBytes int64 `yaml:"-" json:"fetch_limit_bytes,omitempty" env:"PICOCLAW_TOOLS_WEB_FETCH_LIMIT_BYTES"`
|
||||||
Format string `yaml:"-" json:"format,omitempty" env:"PICOCLAW_TOOLS_WEB_FORMAT"`
|
Format string `yaml:"-" json:"format,omitempty" env:"PICOCLAW_TOOLS_WEB_FORMAT"`
|
||||||
PrivateHostWhitelist FlexibleStringSlice `yaml:"-" json:"private_host_whitelist,omitempty" env:"PICOCLAW_TOOLS_WEB_PRIVATE_HOST_WHITELIST"`
|
PrivateHostWhitelist FlexibleStringSlice `yaml:"-" json:"private_host_whitelist,omitempty" env:"PICOCLAW_TOOLS_WEB_PRIVATE_HOST_WHITELIST"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CronToolsConfig struct {
|
type CronToolsConfig struct {
|
||||||
|
|
@ -842,38 +842,38 @@ func (c ReadFileToolConfig) EffectiveMode() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ToolsConfig struct {
|
type ToolsConfig struct {
|
||||||
AllowReadPaths []string `json:"allow_read_paths" yaml:"-" env:"PICOCLAW_TOOLS_ALLOW_READ_PATHS"`
|
AllowReadPaths []string `json:"allow_read_paths" yaml:"-" env:"PICOCLAW_TOOLS_ALLOW_READ_PATHS"`
|
||||||
AllowWritePaths []string `json:"allow_write_paths" yaml:"-" env:"PICOCLAW_TOOLS_ALLOW_WRITE_PATHS"`
|
AllowWritePaths []string `json:"allow_write_paths" yaml:"-" env:"PICOCLAW_TOOLS_ALLOW_WRITE_PATHS"`
|
||||||
// FilterSensitiveData controls whether to filter sensitive values (API keys,
|
// FilterSensitiveData controls whether to filter sensitive values (API keys,
|
||||||
// tokens, secrets) from tool results before sending to the LLM.
|
// tokens, secrets) from tool results before sending to the LLM.
|
||||||
// Default: true (enabled)
|
// Default: true (enabled)
|
||||||
FilterSensitiveData bool `json:"filter_sensitive_data" yaml:"-" env:"PICOCLAW_TOOLS_FILTER_SENSITIVE_DATA"`
|
FilterSensitiveData bool `json:"filter_sensitive_data" yaml:"-" env:"PICOCLAW_TOOLS_FILTER_SENSITIVE_DATA"`
|
||||||
// FilterMinLength is the minimum content length required for filtering.
|
// FilterMinLength is the minimum content length required for filtering.
|
||||||
// Content shorter than this will be returned unchanged for performance.
|
// Content shorter than this will be returned unchanged for performance.
|
||||||
// Default: 8
|
// Default: 8
|
||||||
FilterMinLength int `json:"filter_min_length" yaml:"-" env:"PICOCLAW_TOOLS_FILTER_MIN_LENGTH"`
|
FilterMinLength int `json:"filter_min_length" yaml:"-" env:"PICOCLAW_TOOLS_FILTER_MIN_LENGTH"`
|
||||||
Web WebToolsConfig `json:"web" yaml:"web,omitempty"`
|
Web WebToolsConfig `json:"web" yaml:"web,omitempty"`
|
||||||
Cron CronToolsConfig `json:"cron" yaml:"-"`
|
Cron CronToolsConfig `json:"cron" yaml:"-"`
|
||||||
Exec ExecConfig `json:"exec" yaml:"-"`
|
Exec ExecConfig `json:"exec" yaml:"-"`
|
||||||
Skills SkillsToolsConfig `json:"skills" yaml:"skills,omitempty"`
|
Skills SkillsToolsConfig `json:"skills" yaml:"skills,omitempty"`
|
||||||
MediaCleanup MediaCleanupConfig `json:"media_cleanup" yaml:"-"`
|
MediaCleanup MediaCleanupConfig `json:"media_cleanup" yaml:"-"`
|
||||||
MCP MCPConfig `json:"mcp" yaml:"-"`
|
MCP MCPConfig `json:"mcp" yaml:"-"`
|
||||||
AppendFile ToolConfig `json:"append_file" yaml:"-" envPrefix:"PICOCLAW_TOOLS_APPEND_FILE_"`
|
AppendFile ToolConfig `json:"append_file" yaml:"-" envPrefix:"PICOCLAW_TOOLS_APPEND_FILE_"`
|
||||||
EditFile ToolConfig `json:"edit_file" yaml:"-" envPrefix:"PICOCLAW_TOOLS_EDIT_FILE_"`
|
EditFile ToolConfig `json:"edit_file" yaml:"-" envPrefix:"PICOCLAW_TOOLS_EDIT_FILE_"`
|
||||||
FindSkills ToolConfig `json:"find_skills" yaml:"-" envPrefix:"PICOCLAW_TOOLS_FIND_SKILLS_"`
|
FindSkills ToolConfig `json:"find_skills" yaml:"-" envPrefix:"PICOCLAW_TOOLS_FIND_SKILLS_"`
|
||||||
I2C ToolConfig `json:"i2c" yaml:"-" envPrefix:"PICOCLAW_TOOLS_I2C_"`
|
I2C ToolConfig `json:"i2c" yaml:"-" envPrefix:"PICOCLAW_TOOLS_I2C_"`
|
||||||
InstallSkill ToolConfig `json:"install_skill" yaml:"-" envPrefix:"PICOCLAW_TOOLS_INSTALL_SKILL_"`
|
InstallSkill ToolConfig `json:"install_skill" yaml:"-" envPrefix:"PICOCLAW_TOOLS_INSTALL_SKILL_"`
|
||||||
ListDir ToolConfig `json:"list_dir" yaml:"-" envPrefix:"PICOCLAW_TOOLS_LIST_DIR_"`
|
ListDir ToolConfig `json:"list_dir" yaml:"-" envPrefix:"PICOCLAW_TOOLS_LIST_DIR_"`
|
||||||
Message ToolConfig `json:"message" yaml:"-" envPrefix:"PICOCLAW_TOOLS_MESSAGE_"`
|
Message ToolConfig `json:"message" yaml:"-" envPrefix:"PICOCLAW_TOOLS_MESSAGE_"`
|
||||||
ReadFile ReadFileToolConfig `json:"read_file" yaml:"-" envPrefix:"PICOCLAW_TOOLS_READ_FILE_"`
|
ReadFile ReadFileToolConfig `json:"read_file" yaml:"-" envPrefix:"PICOCLAW_TOOLS_READ_FILE_"`
|
||||||
SendFile ToolConfig `json:"send_file" yaml:"-" envPrefix:"PICOCLAW_TOOLS_SEND_FILE_"`
|
SendFile ToolConfig `json:"send_file" yaml:"-" envPrefix:"PICOCLAW_TOOLS_SEND_FILE_"`
|
||||||
SendTTS ToolConfig `json:"send_tts" yaml:"-" envPrefix:"PICOCLAW_TOOLS_SEND_TTS_"`
|
SendTTS ToolConfig `json:"send_tts" yaml:"-" envPrefix:"PICOCLAW_TOOLS_SEND_TTS_"`
|
||||||
Spawn ToolConfig `json:"spawn" yaml:"-" envPrefix:"PICOCLAW_TOOLS_SPAWN_"`
|
Spawn ToolConfig `json:"spawn" yaml:"-" envPrefix:"PICOCLAW_TOOLS_SPAWN_"`
|
||||||
SpawnStatus ToolConfig `json:"spawn_status" yaml:"-" envPrefix:"PICOCLAW_TOOLS_SPAWN_STATUS_"`
|
SpawnStatus ToolConfig `json:"spawn_status" yaml:"-" envPrefix:"PICOCLAW_TOOLS_SPAWN_STATUS_"`
|
||||||
SPI ToolConfig `json:"spi" yaml:"-" envPrefix:"PICOCLAW_TOOLS_SPI_"`
|
SPI ToolConfig `json:"spi" yaml:"-" envPrefix:"PICOCLAW_TOOLS_SPI_"`
|
||||||
Subagent ToolConfig `json:"subagent" yaml:"-" envPrefix:"PICOCLAW_TOOLS_SUBAGENT_"`
|
Subagent ToolConfig `json:"subagent" yaml:"-" envPrefix:"PICOCLAW_TOOLS_SUBAGENT_"`
|
||||||
WebFetch ToolConfig `json:"web_fetch" yaml:"-" envPrefix:"PICOCLAW_TOOLS_WEB_FETCH_"`
|
WebFetch ToolConfig `json:"web_fetch" yaml:"-" envPrefix:"PICOCLAW_TOOLS_WEB_FETCH_"`
|
||||||
WriteFile ToolConfig `json:"write_file" yaml:"-" envPrefix:"PICOCLAW_TOOLS_WRITE_FILE_"`
|
WriteFile ToolConfig `json:"write_file" yaml:"-" envPrefix:"PICOCLAW_TOOLS_WRITE_FILE_"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsFilterSensitiveDataEnabled returns true if sensitive data filtering is enabled
|
// IsFilterSensitiveDataEnabled returns true if sensitive data filtering is enabled
|
||||||
|
|
@ -941,10 +941,10 @@ type MCPServerConfig struct {
|
||||||
|
|
||||||
// MCPConfig defines configuration for all MCP servers
|
// MCPConfig defines configuration for all MCP servers
|
||||||
type MCPConfig struct {
|
type MCPConfig struct {
|
||||||
ToolConfig ` envPrefix:"PICOCLAW_TOOLS_MCP_"`
|
ToolConfig ` envPrefix:"PICOCLAW_TOOLS_MCP_"`
|
||||||
Discovery ToolDiscoveryConfig ` json:"discovery"`
|
Discovery ToolDiscoveryConfig ` json:"discovery"`
|
||||||
// Servers is a map of server name to server configuration
|
// Servers is a map of server name to server configuration
|
||||||
Servers map[string]MCPServerConfig ` json:"servers,omitempty"`
|
Servers map[string]MCPServerConfig `json:"servers,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func LoadConfig(path string) (*Config, error) {
|
func LoadConfig(path string) (*Config, error) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue