Documentation
¶
Index ¶
- Constants
- Variables
- func AutomaticDisableKeywordsFromString(s string)
- func AutomaticDisableKeywordsToString() string
- func AutomaticDisableStatusCodesFromString(s string) error
- func AutomaticDisableStatusCodesToString() string
- func AutomaticRetryStatusCodesFromString(s string) error
- func AutomaticRetryStatusCodesToString() string
- func ContainsPayMethod(method string) bool
- func GetAllHeistConfigs() map[string]HeistConfig
- func GetArenaAttacksPerDay() int
- func GetArenaSeasonDays() int
- func GetAuctionBidIncrement() float64
- func GetBankPool() int64
- func GetCheckinQuotaRange() (min, max int)
- func GetClaudeWebSearchPricePerThousand() float64
- func GetCleanBoost() int
- func GetCleanDailyLimit() int
- func GetCleanExp() int
- func GetCleanlinessDecayPerHour() int
- func GetCurrencySymbol() string
- func GetDailyLossLimit() int
- func GetDefaultCreditLimit() int
- func GetDemandRate() int
- func GetEarlyWithdrawPenalty() int
- func GetEvolutionStage1Level() int
- func GetEvolutionStage2Level() int
- func GetFeedExp() int
- func GetFileSearchPricePerThousand() float64
- func GetFixedRate(termDays int) int
- func GetFusionBaseCost() int
- func GetGPTImage1PriceOnceCall(quality string, size string) float64
- func GetGeminiInputAudioPricePerMillionTokens(modelName string) float64
- func GetHatchDurationMinutes() int
- func GetHungerDecayPerHour() int
- func GetLevelExpMultiplier() int
- func GetLoanRate(termDays int) int
- func GetMarketFeeRate() float64
- func GetMaxActiveLoans() int
- func GetMaxBet() int
- func GetMaxDemandBalance() int
- func GetMaxFixedPerUser() int
- func GetMaxLevel() int
- func GetMaxPetsPerUser() int
- func GetMaxPostLength() int
- func GetMaxPremiumBalance() int
- func GetMaxStar() int
- func GetMaxUserTokens() int
- func GetMinBet() int
- func GetMinDeposit() int
- func GetMinLoanAmount() int
- func GetMinPremiumDeposit() int
- func GetMoodDecayPerHour() int
- func GetPassiveXpPerHour() int
- func GetPlayCooldownMinutes() int
- func GetPlayExp() int
- func GetPlayMoodBoost() int
- func GetPremiumDemandRate() int
- func GetQuotaDisplayType() string
- func GetUsdToCurrencyRate(usdToCny float64) float64
- func GetWebSearchPricePerThousand(modelName string, contextSize string) float64
- func IsAlwaysSkipRetryCode(errorCode types.ErrorCode) bool
- func IsAlwaysSkipRetryStatusCode(code int) bool
- func IsArenaEnabled() bool
- func IsBankEnabled() bool
- func IsCNYDisplay() bool
- func IsCasinoEnabled() bool
- func IsCheckinEnabled() bool
- func IsCurrencyDisplay() bool
- func IsGameEnabled(gameType string) bool
- func IsHeistEnabled() bool
- func IsLoanEnabled() bool
- func IsPetEnabled() bool
- func IsSocialEnabled() bool
- func LockBankPool()
- func PayMethods2JsonString() string
- func SetBankPoolMemory(val int64)
- func ShouldDisableByStatusCode(code int) bool
- func ShouldRetryByStatusCode(code int) bool
- func UnlockBankPool()
- func UpdatePayMethodsByJsonString(jsonString string) error
- type BankSetting
- type CasinoSetting
- type ChannelAffinityKeySource
- type ChannelAffinityRule
- type ChannelAffinitySetting
- type CheckinSetting
- type GeneralSetting
- type HeistConfig
- type MonitorSetting
- type PaymentSetting
- type PetSetting
- type QuotaSetting
- type SocialSetting
- type StatusCodeRange
- type TokenSetting
Constants ¶
const ( QuotaDisplayTypeUSD = "USD" QuotaDisplayTypeCNY = "CNY" QuotaDisplayTypeTokens = "TOKENS" QuotaDisplayTypeCustom = "CUSTOM" )
额度展示类型
const ( // Web search WebSearchPriceHigh = 25.00 WebSearchPrice = 10.00 // File search FileSearchPrice = 2.5 )
const ( GPTImage1Low1024x1024 = 0.011 GPTImage1Low1024x1536 = 0.016 GPTImage1Low1536x1024 = 0.016 GPTImage1Medium1024x1024 = 0.042 GPTImage1Medium1024x1536 = 0.063 GPTImage1Medium1536x1024 = 0.063 GPTImage1High1024x1024 = 0.167 GPTImage1High1024x1536 = 0.25 GPTImage1High1536x1024 = 0.25 )
const ( // Gemini Audio Input Price Gemini25FlashPreviewInputAudioPrice = 1.00 Gemini25FlashProductionInputAudioPrice = 1.00 // for `gemini-2.5-flash` Gemini25FlashLitePreviewInputAudioPrice = 0.50 Gemini25FlashNativeAudioInputAudioPrice = 3.00 Gemini20FlashInputAudioPrice = 0.70 GeminiRoboticsER15InputAudioPrice = 1.00 )
const (
// Claude Web search
ClaudeWebSearchPrice = 10.00
)
Variables ¶
var AutomaticDisableKeywords = []string{
"Your credit balance is too low",
"This organization has been disabled.",
"You exceeded your current quota",
"Permission denied",
"The security token included in the request is invalid",
"Operation not allowed",
"Your account is not authorized",
}
var AutomaticDisableStatusCodeRanges = []StatusCodeRange{{Start: 401, End: 401}}
var AutomaticRetryStatusCodeRanges = []StatusCodeRange{
{Start: 100, End: 199},
{Start: 300, End: 399},
{Start: 401, End: 407},
{Start: 409, End: 499},
{Start: 500, End: 503},
{Start: 505, End: 523},
{Start: 525, End: 599},
}
Default behavior matches legacy hardcoded retry rules in controller/relay.go shouldRetry: retry for 1xx, 3xx, 4xx(except 400/408), 5xx(except 504/524), and no retry for 2xx.
var CustomCallbackAddress = ""
var DemoSiteEnabled = false
var EpayId = ""
var EpayKey = ""
var MinTopUp = 1
var PayAddress = ""
var PayMethods = []map[string]string{
{
"name": "支付宝",
"color": "rgba(var(--semi-blue-5), 1)",
"type": "alipay",
},
{
"name": "微信",
"color": "rgba(var(--semi-green-5), 1)",
"type": "wxpay",
},
{
"name": "自定义1",
"color": "black",
"type": "custom1",
"min_topup": "50",
},
}
var Price = 7.3
var SelfUseModeEnabled = false
var USDExchangeRate = 7.3
Functions ¶
func AutomaticDisableKeywordsFromString ¶
func AutomaticDisableKeywordsFromString(s string)
func AutomaticDisableKeywordsToString ¶
func AutomaticDisableKeywordsToString() string
func AutomaticDisableStatusCodesToString ¶
func AutomaticDisableStatusCodesToString() string
func AutomaticRetryStatusCodesToString ¶
func AutomaticRetryStatusCodesToString() string
func ContainsPayMethod ¶
func GetAllHeistConfigs ¶ added in v0.1.17
func GetAllHeistConfigs() map[string]HeistConfig
GetAllHeistConfigs 获取所有打劫方式配置
func GetArenaAttacksPerDay ¶ added in v0.1.7
func GetArenaAttacksPerDay() int
func GetArenaSeasonDays ¶ added in v0.1.7
func GetArenaSeasonDays() int
func GetAuctionBidIncrement ¶
func GetAuctionBidIncrement() float64
func GetBankPool ¶ added in v0.1.17
func GetBankPool() int64
func GetCheckinQuotaRange ¶
func GetCheckinQuotaRange() (min, max int)
GetCheckinQuotaRange 获取签到额度范围
func GetClaudeWebSearchPricePerThousand ¶
func GetClaudeWebSearchPricePerThousand() float64
func GetCleanBoost ¶
func GetCleanBoost() int
func GetCleanDailyLimit ¶
func GetCleanDailyLimit() int
func GetCleanExp ¶
func GetCleanExp() int
func GetCleanlinessDecayPerHour ¶
func GetCleanlinessDecayPerHour() int
func GetDefaultCreditLimit ¶ added in v0.1.17
func GetDefaultCreditLimit() int
func GetDemandRate ¶ added in v0.1.17
func GetDemandRate() int
func GetEarlyWithdrawPenalty ¶ added in v0.1.17
func GetEarlyWithdrawPenalty() int
func GetEvolutionStage1Level ¶
func GetEvolutionStage1Level() int
func GetEvolutionStage2Level ¶
func GetEvolutionStage2Level() int
func GetFeedExp ¶
func GetFeedExp() int
func GetFileSearchPricePerThousand ¶
func GetFileSearchPricePerThousand() float64
func GetFixedRate ¶ added in v0.1.17
func GetFusionBaseCost ¶
func GetFusionBaseCost() int
func GetHatchDurationMinutes ¶
func GetHatchDurationMinutes() int
func GetHungerDecayPerHour ¶
func GetHungerDecayPerHour() int
func GetLevelExpMultiplier ¶
func GetLevelExpMultiplier() int
func GetLoanRate ¶ added in v0.1.17
func GetMarketFeeRate ¶
func GetMarketFeeRate() float64
func GetMaxActiveLoans ¶ added in v0.1.17
func GetMaxActiveLoans() int
func GetMaxDemandBalance ¶ added in v0.1.17
func GetMaxDemandBalance() int
func GetMaxFixedPerUser ¶ added in v0.1.17
func GetMaxFixedPerUser() int
func GetMaxLevel ¶
func GetMaxLevel() int
func GetMaxPremiumBalance ¶ added in v0.1.17
func GetMaxPremiumBalance() int
func GetMaxStar ¶
func GetMaxStar() int
func GetMinDeposit ¶ added in v0.1.17
func GetMinDeposit() int
func GetMinLoanAmount ¶ added in v0.1.17
func GetMinLoanAmount() int
func GetMinPremiumDeposit ¶ added in v0.1.17
func GetMinPremiumDeposit() int
func GetMoodDecayPerHour ¶
func GetMoodDecayPerHour() int
func GetPassiveXpPerHour ¶ added in v0.1.3
func GetPassiveXpPerHour() int
func GetPlayCooldownMinutes ¶
func GetPlayCooldownMinutes() int
func GetPlayExp ¶
func GetPlayExp() int
func GetPlayMoodBoost ¶
func GetPlayMoodBoost() int
func GetPremiumDemandRate ¶ added in v0.1.17
func GetPremiumDemandRate() int
func GetUsdToCurrencyRate ¶
GetUsdToCurrencyRate 返回 1 USD = X <currency> 的 X(TOKENS 不适用)
func IsAlwaysSkipRetryCode ¶
func IsArenaEnabled ¶ added in v0.1.7
func IsArenaEnabled() bool
func IsBankEnabled ¶ added in v0.1.17
func IsBankEnabled() bool
func IsGameEnabled ¶ added in v0.1.4
IsGameEnabled 判断某个游戏是否启用
func IsLoanEnabled ¶ added in v0.1.17
func IsLoanEnabled() bool
func LockBankPool ¶ added in v0.1.17
func LockBankPool()
LockBankPool acquires the pool mutex. Caller MUST call UnlockBankPool when done.
func PayMethods2JsonString ¶
func PayMethods2JsonString() string
func SetBankPoolMemory ¶ added in v0.1.17
func SetBankPoolMemory(val int64)
SetBankPoolMemory updates pool in memory only. Caller must persist via model.UpdateOption.
func ShouldRetryByStatusCode ¶
func UnlockBankPool ¶ added in v0.1.17
func UnlockBankPool()
UnlockBankPool releases the pool mutex.
Types ¶
type BankSetting ¶ added in v0.1.17
type BankSetting struct {
Enabled bool `json:"enabled"` // 是否启用银行系统
BankPool int64 `json:"bank_pool"` // 银行资金池余额 (利息从这里扣)
DemandRate int `json:"demand_rate"` // 活期年化利率 万分比 (200 = 2%)
PremiumDemandRate int `json:"premium_demand_rate"` // 高息活期年化利率 万分比 (600 = 6%)
FixedRate7 int `json:"fixed_rate_7"` // 7天定期年化利率 万分比
FixedRate30 int `json:"fixed_rate_30"` // 30天定期年化利率 万分比
FixedRate90 int `json:"fixed_rate_90"` // 90天定期年化利率 万分比
MinDeposit int `json:"min_deposit"` // 最小存入金额
MinPremiumDeposit int `json:"min_premium_deposit"` // 高息活期最小存入金额
MaxDemandBalance int `json:"max_demand_balance"` // 活期最大余额
MaxPremiumBalance int `json:"max_premium_balance"` // 高息活期最大余额
MaxFixedPerUser int `json:"max_fixed_per_user"` // 每人最多定期存单数
EarlyWithdrawPenalty int `json:"early_withdraw_penalty"` // 提前取出利息罚没百分比
// Loan settings (贷款)
LoanEnabled bool `json:"loan_enabled"` // 贷款开关
DefaultCreditLimit int `json:"default_credit_limit"` // 默认信用额度 (quota)
LoanRate1 int `json:"loan_rate_1"` // 1天贷款年化 万分比
LoanRate3 int `json:"loan_rate_3"` // 3天贷款年化 万分比
LoanRate7 int `json:"loan_rate_7"` // 7天贷款年化 万分比
LoanRate14 int `json:"loan_rate_14"` // 14天贷款年化 万分比
LoanRate30 int `json:"loan_rate_30"` // 30天贷款年化 万分比
MaxActiveLoans int `json:"max_active_loans"` // 最大活跃贷款数
MinLoanAmount int `json:"min_loan_amount"` // 最小贷款额 (quota)
}
BankSetting 古灵阁银行配置
func GetBankSetting ¶ added in v0.1.17
func GetBankSetting() *BankSetting
type CasinoSetting ¶ added in v0.1.4
type CasinoSetting struct {
Enabled bool `json:"enabled"` // 是否启用赌场系统
MinBet int `json:"min_bet"` // 最小下注额度
MaxBet int `json:"max_bet"` // 最大下注额度
DailyLossLimit int `json:"daily_loss_limit"` // 每日最大亏损额度
BlackjackEnabled bool `json:"blackjack_enabled"` // 是否启用21点
DiceEnabled bool `json:"dice_enabled"` // 是否启用骰子
RouletteEnabled bool `json:"roulette_enabled"` // 是否启用轮盘
BaccaratEnabled bool `json:"baccarat_enabled"` // 是否启用百家乐
SlotsEnabled bool `json:"slots_enabled"` // 是否启用老虎机
PokerEnabled bool `json:"poker_enabled"` // 是否启用扑克
// Heist (打劫) settings
HeistEnabled bool `json:"heist_enabled"` // 是否启用打劫
SneakFeePct float64 `json:"sneak_fee_pct"` // 隐身入场费 = 金库余额 × pct
SneakMinPct float64 `json:"sneak_min_pct"` // 隐身最小奖励百分比
SneakMaxPct float64 `json:"sneak_max_pct"` // 隐身最大奖励百分比
SneakCooldown int64 `json:"sneak_cooldown"` // 隐身冷却秒数
SneakBaseRate float64 `json:"sneak_base_rate"` // 隐身基础成功率
DragonFeePct float64 `json:"dragon_fee_pct"` // 骑龙入场费百分比
DragonMinPct float64 `json:"dragon_min_pct"` // 骑龙最小奖励百分比
DragonMaxPct float64 `json:"dragon_max_pct"` // 骑龙最大奖励百分比
DragonCooldown int64 `json:"dragon_cooldown"` // 骑龙冷却秒数
DragonBaseRate float64 `json:"dragon_base_rate"` // 骑龙基础成功率
ImperioFeePct float64 `json:"imperio_fee_pct"` // 夺魂咒入场费百分比
ImperioMinPct float64 `json:"imperio_min_pct"` // 夺魂咒最小奖励百分比
ImperioMaxPct float64 `json:"imperio_max_pct"` // 夺魂咒最大奖励百分比
ImperioCooldown int64 `json:"imperio_cooldown"` // 夺魂咒冷却秒数
ImperioBaseRate float64 `json:"imperio_base_rate"` // 夺魂咒基础成功率
}
CasinoSetting 赌场系统配置
func GetCasinoSetting ¶ added in v0.1.4
func GetCasinoSetting() *CasinoSetting
GetCasinoSetting 获取赌场配置
type ChannelAffinityRule ¶
type ChannelAffinityRule struct {
Name string `json:"name"`
ModelRegex []string `json:"model_regex"`
PathRegex []string `json:"path_regex"`
UserAgentInclude []string `json:"user_agent_include,omitempty"`
KeySources []ChannelAffinityKeySource `json:"key_sources"`
ValueRegex string `json:"value_regex"`
TTLSeconds int `json:"ttl_seconds"`
ParamOverrideTemplate map[string]interface{} `json:"param_override_template,omitempty"`
SkipRetryOnFailure bool `json:"skip_retry_on_failure,omitempty"`
IncludeUsingGroup bool `json:"include_using_group"`
IncludeRuleName bool `json:"include_rule_name"`
}
type ChannelAffinitySetting ¶
type ChannelAffinitySetting struct {
Enabled bool `json:"enabled"`
SwitchOnSuccess bool `json:"switch_on_success"`
MaxEntries int `json:"max_entries"`
DefaultTTLSeconds int `json:"default_ttl_seconds"`
Rules []ChannelAffinityRule `json:"rules"`
}
func GetChannelAffinitySetting ¶
func GetChannelAffinitySetting() *ChannelAffinitySetting
type CheckinSetting ¶
type CheckinSetting struct {
Enabled bool `json:"enabled"` // 是否启用签到功能
MinQuota int `json:"min_quota"` // 签到最小额度奖励
MaxQuota int `json:"max_quota"` // 签到最大额度奖励
}
CheckinSetting 签到功能配置
type GeneralSetting ¶
type GeneralSetting struct {
DocsLink string `json:"docs_link"`
PingIntervalEnabled bool `json:"ping_interval_enabled"`
PingIntervalSeconds int `json:"ping_interval_seconds"`
// 当前站点额度展示类型:USD / CNY / TOKENS
QuotaDisplayType string `json:"quota_display_type"`
// 自定义货币符号,用于 CUSTOM 展示类型
CustomCurrencySymbol string `json:"custom_currency_symbol"`
// 自定义货币与美元汇率(1 USD = X Custom)
CustomCurrencyExchangeRate float64 `json:"custom_currency_exchange_rate"`
}
func GetGeneralSetting ¶
func GetGeneralSetting() *GeneralSetting
type HeistConfig ¶ added in v0.1.17
type HeistConfig struct {
FeePct float64
MinPct float64
MaxPct float64
Cooldown int64
BaseRate float64
}
HeistConfig holds runtime heist parameters for a single type
func GetHeistConfig ¶ added in v0.1.17
func GetHeistConfig(heistType string) (HeistConfig, bool)
GetHeistConfig 获取某种打劫方式的配置
type MonitorSetting ¶
type MonitorSetting struct {
AutoTestChannelEnabled bool `json:"auto_test_channel_enabled"`
AutoTestChannelMinutes float64 `json:"auto_test_channel_minutes"`
}
func GetMonitorSetting ¶
func GetMonitorSetting() *MonitorSetting
type PaymentSetting ¶
type PaymentSetting struct {
AmountOptions []int `json:"amount_options"`
AmountDiscount map[int]float64 `json:"amount_discount"` // 充值金额对应的折扣,例如 100 元 0.9 表示 100 元充值享受 9 折优惠
}
func GetPaymentSetting ¶
func GetPaymentSetting() *PaymentSetting
type PetSetting ¶
type PetSetting struct {
Enabled bool `json:"enabled"` // 是否启用宠物系统
MaxPetsPerUser int `json:"max_pets_per_user"` // 每个用户最多拥有的宠物数
// 互动参数
PlayCooldownMinutes int `json:"play_cooldown_minutes"` // 玩耍冷却分钟数
CleanDailyLimit int `json:"clean_daily_limit"` // 每日清洁次数上限
CleanBoost int `json:"clean_boost"` // 清洁增量
PlayMoodBoost int `json:"play_mood_boost"` // 玩耍心情增量
// EXP 奖励
FeedExp int `json:"feed_exp"` // 喂食获得 EXP
PlayExp int `json:"play_exp"` // 玩耍获得 EXP
CleanExp int `json:"clean_exp"` // 清洁获得 EXP
// 状态衰减(每小时)
HungerDecayPerHour int `json:"hunger_decay_per_hour"` // 饥饿衰减/h
MoodDecayPerHour int `json:"mood_decay_per_hour"` // 心情衰减/h
CleanlinessDecayPerHour int `json:"cleanliness_decay_per_hour"` // 洁净衰减/h
// 自然增长
PassiveXpPerHour int `json:"passive_xp_per_hour"` // 挂机每小时自然获得的 XP
// 升级进化
LevelExpMultiplier int `json:"level_exp_multiplier"` // 升级公式倍数
EvolutionStage1Level int `json:"evolution_stage1_level"` // 一阶进化等级
EvolutionStage2Level int `json:"evolution_stage2_level"` // 二阶进化等级
MaxLevel int `json:"max_level"` // 最大等级
// 孵化
HatchDurationMinutes int `json:"hatch_duration_minutes"` // 孵化时长(分钟)
// 融合
FusionBaseCost int `json:"fusion_base_cost"` // 融合基础费用
MaxStar int `json:"max_star"` // 最大星级
// 市场
MarketFeeRate float64 `json:"market_fee_rate"` // 手续费率 (0.05 = 5%)
AuctionBidIncrement float64 `json:"auction_bid_increment"` // 竞拍最低加价率 (0.05 = 5%)
// 竞技场
ArenaEnabled bool `json:"arena_enabled"` // 是否启用竞技场
ArenaAttacksPerDay int `json:"arena_attacks_per_day"` // 每日攻擂次数上限
ArenaSeasonDays int `json:"arena_season_days"` // 赛季天数
}
PetSetting 宠物系统配置
type QuotaSetting ¶
type QuotaSetting struct {
EnableFreeModelPreConsume bool `json:"enable_free_model_pre_consume"` // 是否对免费模型启用预消耗
}
func GetQuotaSetting ¶
func GetQuotaSetting() *QuotaSetting
type SocialSetting ¶
type SocialSetting struct {
Enabled bool `json:"enabled"` // 是否启用社区功能
MaxPostLength int `json:"max_post_length"` // 帖子最大字数
}
SocialSetting 社区功能配置
type StatusCodeRange ¶
func ParseHTTPStatusCodeRanges ¶
func ParseHTTPStatusCodeRanges(input string) ([]StatusCodeRange, error)
type TokenSetting ¶
type TokenSetting struct {
MaxUserTokens int `json:"max_user_tokens"` // 每用户最大令牌数量
}
TokenSetting 令牌相关配置