setting

package
v1.0.4-preview.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAutoRouteKey = "auto"
	AutoRoutePrefix     = "auto:"
)

Variables

View Source
var (
	WaffoEnabled               bool
	WaffoApiKey                string
	WaffoPrivateKey            string
	WaffoPublicCert            string
	WaffoSandboxPublicCert     string
	WaffoSandboxApiKey         string
	WaffoSandboxPrivateKey     string
	WaffoSandbox               bool
	WaffoMerchantId            string
	WaffoNotifyUrl             string
	WaffoReturnUrl             string
	WaffoSubscriptionReturnUrl string
	WaffoCurrency              string
	WaffoUnitPrice             float64 = 1.0
	WaffoMinTopUp              int     = 1
)
View Source
var (
	WaffoPancakeMerchantID string
	WaffoPancakePrivateKey string
	WaffoPancakeReturnURL  string
	WaffoPancakeUnitPrice  float64 = 1.0
	WaffoPancakeMinTopUp   int     = 1
	WaffoPancakeStoreID    string
	WaffoPancakeProductID  string
)

Waffo Pancake hosted checkout configuration. Gateway is enabled once MerchantID + PrivateKey + ProductID are populated (no separate Enabled flag, matching Stripe / Creem). StoreID + ProductID are operator-bound via SaveWaffoPancakeConfig.

View Source
var Chats = []map[string]string{

	{
		"Cherry Studio": "cherrystudio://providers/api-keys?v=1&data={cherryConfig}",
	},
	{
		"AionUI": "aionui://provider/add?v=1&data={aionuiConfig}",
	},
	{
		"流畅阅读": "fluentread",
	},
	{
		"CC Switch": "ccswitch",
	},
	{
		"DeepChat": "deepchat://provider/install?v=1&data={deepchatConfig}",
	},
	{
		"Lobe Chat 官方示例": "https://chat-preview.lobehub.com/?settings={\"keyVaults\":{\"openai\":{\"apiKey\":\"{key}\",\"baseURL\":\"{address}/v1\"}}}",
	},
	{
		"AI as Workspace": "https://aiaw.app/set-provider?provider={\"type\":\"openai\",\"settings\":{\"apiKey\":\"{key}\",\"baseURL\":\"{address}/v1\",\"compatibility\":\"strict\"}}",
	},
	{
		"AMA 问天": "ama://set-api-key?server={address}&key={key}",
	},
	{
		"OpenCat": "opencat://team/join?domain={address}&token={key}",
	},
}
View Source
var CheckSensitiveEnabled = true
View Source
var CheckSensitiveOnPromptEnabled = true
View Source
var CreemApiKey = ""
View Source
var CreemProducts = "[]"
View Source
var CreemTestMode = false
View Source
var CreemWebhookSecret = ""
View Source
var DefaultUseAutoGroup = false
View Source
var MjAccountFilterEnabled = false
View Source
var MjActionCheckSuccessEnabled = true
View Source
var MjForwardUrlEnabled = true
View Source
var MjModeClearEnabled = false
View Source
var MjNotifyEnabled = false
View Source
var ModelRequestRateLimitCount = 0
View Source
var ModelRequestRateLimitDurationMinutes = 1
View Source
var ModelRequestRateLimitEnabled = false
View Source
var ModelRequestRateLimitGroup = map[string][2]int{}
View Source
var ModelRequestRateLimitMutex sync.RWMutex
View Source
var ModelRequestRateLimitSuccessCount = 1000
View Source
var SensitiveWords = []string{
	"test_sensitive",
}

SensitiveWords 敏感词 var SensitiveWords []string

View Source
var StopOnSensitiveEnabled = true

StopOnSensitiveEnabled 如果检测到敏感词,是否立刻停止生成,否则替换敏感词

View Source
var StreamCacheQueueLength = 0

StreamCacheQueueLength 流模式缓存队列长度,0表示无缓存

View Source
var StripeApiSecret = ""
View Source
var StripeMinTopUp = 1
View Source
var StripePriceId = ""
View Source
var StripePromotionCodesEnabled = false
View Source
var StripeUnitPrice = 8.0
View Source
var StripeWebhookSecret = ""

Functions

func AutoGroupRoutes2JsonString added in v1.0.4

func AutoGroupRoutes2JsonString() string

func AutoGroups2JsonString

func AutoGroups2JsonString() string

func Chats2JsonString

func Chats2JsonString() string

func CheckModelRequestRateLimitGroup

func CheckModelRequestRateLimitGroup(jsonStr string) error

func ContainsAutoGroup

func ContainsAutoGroup(group string) bool

func ContainsAutoRouteKey added in v1.0.4

func ContainsAutoRouteKey(routeKey string) bool

func GetAutoGroups

func GetAutoGroups() []string

func GetAutoRouteGroups added in v1.0.4

func GetAutoRouteGroups(routeKey string) ([]string, bool)

func GetDefaultAutoRouteKey added in v1.0.4

func GetDefaultAutoRouteKey() string

func GetGroupRateLimit

func GetGroupRateLimit(group string) (totalCount, successCount int, found bool)

func GetUsableGroupDescription

func GetUsableGroupDescription(groupName string) string

func GetUserUsableGroupsCopy

func GetUserUsableGroupsCopy() map[string]string

func GetWaffoPayMethods

func GetWaffoPayMethods() []constant.WaffoPayMethod

GetWaffoPayMethods 从 options 读取 Waffo 支付方式配置

func IsAutoRouteKey added in v1.0.4

func IsAutoRouteKey(group string) bool

func ModelRequestRateLimitGroup2JSONString

func ModelRequestRateLimitGroup2JSONString() string

func SensitiveWordsFromString

func SensitiveWordsFromString(s string)

func SensitiveWordsToString

func SensitiveWordsToString() string

func SetWaffoPayMethods

func SetWaffoPayMethods(methods []constant.WaffoPayMethod) error

SetWaffoPayMethods 序列化 Waffo 支付方式配置并更新 OptionMap

func ShouldCheckPromptSensitive

func ShouldCheckPromptSensitive() bool

func UpdateAutoGroupRoutesByJsonString added in v1.0.4

func UpdateAutoGroupRoutesByJsonString(jsonString string) error

func UpdateAutoGroupsByJsonString

func UpdateAutoGroupsByJsonString(jsonString string) error

func UpdateChatsByJsonString

func UpdateChatsByJsonString(jsonString string) error

func UpdateModelRequestRateLimitGroupByJSONString

func UpdateModelRequestRateLimitGroupByJSONString(jsonStr string) error

func UpdateUserUsableGroupsByJSONString

func UpdateUserUsableGroupsByJSONString(jsonStr string) error

func UserUsableGroups2JSONString

func UserUsableGroups2JSONString() string

func ValidateAutoGroupsJsonString added in v1.0.4

func ValidateAutoGroupsJsonString(jsonString string) error

func WaffoPayMethods2JsonString

func WaffoPayMethods2JsonString() string

WaffoPayMethods2JsonString 将默认 WaffoPayMethods 序列化为 JSON 字符串(供 InitOptionMap 使用)

Types

type AutoGroupRoute added in v1.0.4

type AutoGroupRoute struct {
	Key            string   `json:"key"`
	Name           string   `json:"name,omitempty"`
	Enabled        bool     `json:"enabled"`
	UserSelectable bool     `json:"user_selectable"`
	Groups         []string `json:"groups"`
}

func GetAutoRoute added in v1.0.4

func GetAutoRoute(routeKey string) (AutoGroupRoute, bool)

func GetAutoRoutes added in v1.0.4

func GetAutoRoutes() []AutoGroupRoute

func (*AutoGroupRoute) UnmarshalJSON added in v1.0.4

func (route *AutoGroupRoute) UnmarshalJSON(data []byte) error

type AutoGroupRoutesConfig added in v1.0.4

type AutoGroupRoutesConfig struct {
	Version      int              `json:"version"`
	DefaultRoute string           `json:"default_route"`
	Routes       []AutoGroupRoute `json:"routes"`
}

func GetAutoGroupRoutesConfig added in v1.0.4

func GetAutoGroupRoutesConfig() AutoGroupRoutesConfig

func ParseAutoGroupRoutesConfig added in v1.0.4

func ParseAutoGroupRoutesConfig(jsonString string) (AutoGroupRoutesConfig, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL