- Fix mapstructure tag syntax in PlatformConfig: missing colon in 'mapstructure=recent_task_limit_max' caused go vet error and prevented viper from parsing RecentTaskLimitMax at runtime - Include ent group_create.go/group_update.go codegen changes
153 lines
7.3 KiB
Go
153 lines
7.3 KiB
Go
package config
|
|
|
|
// SoraConfig 直连 Sora 配置
|
|
type SoraConfig struct {
|
|
Client SoraClientConfig `mapstructure:"client"`
|
|
Storage SoraStorageConfig `mapstructure:"storage"`
|
|
}
|
|
|
|
// SoraClientConfig Sora 客户端配置
|
|
type SoraClientConfig struct {
|
|
BaseURL string `mapstructure:"base_url"`
|
|
TimeoutSeconds int `mapstructure:"timeout_seconds"`
|
|
MaxRetries int `mapstructure:"max_retries"`
|
|
CloudflareChallengeCooldownSeconds int `mapstructure:"cloudflare_challenge_cooldown_seconds"`
|
|
PollIntervalSeconds int `mapstructure:"poll_interval_seconds"`
|
|
MaxPollAttempts int `mapstructure:"max_poll_attempts"`
|
|
RecentTaskLimit int `mapstructure:"recent_task_limit"`
|
|
RecentTaskLimitMax int `mapstructure:"recent_task_limit_max"`
|
|
Debug bool `mapstructure:"debug"`
|
|
UseOpenAITokenProvider bool `mapstructure:"use_openai_token_provider"`
|
|
Headers map[string]string `mapstructure:"headers"`
|
|
UserAgent string `mapstructure:"user_agent"`
|
|
DisableTLSFingerprint bool `mapstructure:"disable_tls_fingerprint"`
|
|
CurlCFFISidecar SoraCurlCFFISidecarConfig `mapstructure:"curl_cffi_sidecar"`
|
|
}
|
|
|
|
// SoraCurlCFFISidecarConfig Sora curl_cffi sidecar 配置
|
|
type SoraCurlCFFISidecarConfig struct {
|
|
Enabled bool `mapstructure:"enabled"`
|
|
BaseURL string `mapstructure:"base_url"`
|
|
Impersonate string `mapstructure:"impersonate"`
|
|
TimeoutSeconds int `mapstructure:"timeout_seconds"`
|
|
SessionReuseEnabled bool `mapstructure:"session_reuse_enabled"`
|
|
SessionTTLSeconds int `mapstructure:"session_ttl_seconds"`
|
|
}
|
|
|
|
// SoraStorageConfig 媒体存储配置
|
|
type SoraStorageConfig struct {
|
|
Type string `mapstructure:"type"`
|
|
LocalPath string `mapstructure:"local_path"`
|
|
FallbackToUpstream bool `mapstructure:"fallback_to_upstream"`
|
|
MaxConcurrentDownloads int `mapstructure:"max_concurrent_downloads"`
|
|
DownloadTimeoutSeconds int `mapstructure:"download_timeout_seconds"`
|
|
MaxDownloadBytes int64 `mapstructure:"max_download_bytes"`
|
|
Debug bool `mapstructure:"debug"`
|
|
Cleanup SoraStorageCleanupConfig `mapstructure:"cleanup"`
|
|
}
|
|
|
|
// SoraStorageCleanupConfig 媒体清理配置
|
|
type SoraStorageCleanupConfig struct {
|
|
Enabled bool `mapstructure:"enabled"`
|
|
Schedule string `mapstructure:"schedule"`
|
|
RetentionDays int `mapstructure:"retention_days"`
|
|
}
|
|
|
|
// SoraModelFiltersConfig Sora 模型过滤配置
|
|
type SoraModelFiltersConfig struct {
|
|
HidePromptEnhance bool `mapstructure:"hide_prompt_envelope"`
|
|
}
|
|
|
|
// GeminiConfig Gemini 配置
|
|
type GeminiConfig struct {
|
|
OAuth GeminiOAuthConfig `mapstructure:"oauth"`
|
|
Quota GeminiQuotaConfig `mapstructure:"quota"`
|
|
}
|
|
|
|
type GeminiOAuthConfig struct {
|
|
ClientID string `mapstructure:"client_id"`
|
|
ClientSecret string `mapstructure:"client_secret"`
|
|
Scopes string `mapstructure:"scopes"`
|
|
}
|
|
|
|
type GeminiQuotaConfig struct {
|
|
Tiers map[string]GeminiTierQuotaConfig `mapstructure:"tiers"`
|
|
Policy string `mapstructure:"policy"`
|
|
}
|
|
|
|
type GeminiTierQuotaConfig struct {
|
|
ProRPD *int64 `mapstructure:"pro_rpd" json:"pro_rpd"`
|
|
FlashRPD *int64 `mapstructure:"flash_rpd" json:"flash_rpd"`
|
|
CooldownMinutes *int `mapstructure:"cooldown_minutes" json:"cooldown_minutes"`
|
|
}
|
|
|
|
// UpdateConfig 更新检查配置
|
|
type UpdateConfig struct {
|
|
ProxyURL string `mapstructure:"proxy_url"` // 访问 GitHub 的代理地址
|
|
}
|
|
|
|
// IdempotencyConfig 幂等性配置
|
|
type IdempotencyConfig struct {
|
|
ObserveOnly bool `mapstructure:"observe_only"`
|
|
DefaultTTLSeconds int `mapstructure:"default_ttl_seconds"`
|
|
SystemOperationTTLSeconds int `mapstructure:"system_operation_ttl_seconds"`
|
|
ProcessingTimeoutSeconds int `mapstructure:"processing_timeout_seconds"`
|
|
FailedRetryBackoffSeconds int `mapstructure:"failed_retry_backoff_seconds"`
|
|
MaxStoredResponseLen int `mapstructure:"max_stored_response_len"`
|
|
CleanupIntervalSeconds int `mapstructure:"cleanup_interval_seconds"`
|
|
CleanupBatchSize int `mapstructure:"cleanup_batch_size"`
|
|
}
|
|
|
|
// LinuxDoConnectConfig LinuxDo 连接配置
|
|
type LinuxDoConnectConfig struct {
|
|
Enabled bool `mapstructure:"enabled"`
|
|
ClientID string `mapstructure:"client_id"`
|
|
ClientSecret string `mapstructure:"client_secret"`
|
|
AuthorizeURL string `mapstructure:"authorize_url"`
|
|
TokenURL string `mapstructure:"token_url"`
|
|
UserInfoURL string `mapstructure:"userinfo_url"`
|
|
Scopes string `mapstructure:"scopes"`
|
|
RedirectURL string `mapstructure:"redirect_url"`
|
|
FrontendRedirectURL string `mapstructure:"frontend_redirect_url"`
|
|
TokenAuthMethod string `mapstructure:"token_auth_method"`
|
|
UsePKCE bool `mapstructure:"use_pkce"`
|
|
UserInfoEmailPath string `mapstructure:"userinfo_email_path"`
|
|
UserInfoIDPath string `mapstructure:"userinfo_id_path"`
|
|
UserInfoUsernamePath string `mapstructure:"userinfo_username_path"`
|
|
}
|
|
|
|
// OIDCConnectConfig OIDC 连接配置
|
|
type OIDCConnectConfig struct {
|
|
Enabled bool `mapstructure:"enabled"`
|
|
ProviderName string `mapstructure:"provider_name"`
|
|
ClientID string `mapstructure:"client_id"`
|
|
ClientSecret string `mapstructure:"client_secret"`
|
|
IssuerURL string `mapstructure:"issuer_url"`
|
|
DiscoveryURL string `mapstructure:"discovery_url"`
|
|
AuthorizeURL string `mapstructure:"authorize_url"`
|
|
TokenURL string `mapstructure:"token_url"`
|
|
UserInfoURL string `mapstructure:"userinfo_url"`
|
|
JWKSURL string `mapstructure:"jwks_url"`
|
|
Scopes string `mapstructure:"scopes"`
|
|
RedirectURL string `mapstructure:"redirect_url"`
|
|
FrontendRedirectURL string `mapstructure:"frontend_redirect_url"`
|
|
TokenAuthMethod string `mapstructure:"token_auth_method"`
|
|
UsePKCE bool `mapstructure:"use_pkce"`
|
|
ValidateIDToken bool `mapstructure:"validate_id_token"`
|
|
AllowedSigningAlgs string `mapstructure:"allowed_signing_algs"`
|
|
ClockSkewSeconds int `mapstructure:"clock_skew_seconds"`
|
|
RequireEmailVerified bool `mapstructure:"require_email_verified"`
|
|
UserInfoEmailPath string `mapstructure:"userinfo_email_path"`
|
|
UserInfoIDPath string `mapstructure:"userinfo_id_path"`
|
|
UserInfoUsernamePath string `mapstructure:"userinfo_username_path"`
|
|
}
|
|
|
|
// TokenRefreshConfig OAuth Token 自动刷新配置
|
|
type TokenRefreshConfig struct {
|
|
Enabled bool `mapstructure:"enabled"`
|
|
CheckIntervalMinutes int `mapstructure:"check_interval_minutes"`
|
|
RefreshBeforeExpiryHours float64 `mapstructure:"refresh_before_expiry_hours"`
|
|
MaxRetries int `mapstructure:"max_retries"`
|
|
RetryBackoffSeconds int `mapstructure:"retry_backoff_seconds"`
|
|
}
|