feat: sync deployed v1.0.0-rc.38-custom.42

Sync production source including routing, billing, Astra detection and public uptime. Update custom build instructions and license packaging.
This commit is contained in:
cneicy committed 2026-09-26 04:49:11 +08:00
1 parent aa6c3f50f4
commit ceddfd3d6b
828 files changed
+122253 -13702

No files matched your search

+18
View File
@@ -59,10 +59,14 @@ const (
ChannelTypeSub2API = 59
ChannelTypeNewAPI = 60
ChannelTypeTaskPlugin = 61
ChannelTypeVLLM = 62
ChannelTypeSGLang = 63
ChannelTypeDummy // this one is only for count, do not add any channel after this
)
// ChannelBaseURLs 保存各渠道类型的内置默认 Base URL。
// 非空值会通过 /api/channel/default_base_urls 下发到前端,作为渠道表单的 API 地址占位提示。
var ChannelBaseURLs = []string{
"", // 0
"https://api.openai.com", // 1
@@ -126,6 +130,8 @@ var ChannelBaseURLs = []string{
"", //59
"", //60
"", //61
"", //62
"", //63
}
func GetChannelBaseURL(channelType int) string {
@@ -194,6 +200,8 @@ var ChannelTypeNames = map[int]string{
ChannelTypeSub2API: "Sub2API",
ChannelTypeNewAPI: "New API",
ChannelTypeTaskPlugin: "Task Plugin",
ChannelTypeVLLM: "vLLM",
ChannelTypeSGLang: "SGLang",
}
func GetChannelTypeName(channelType int) string {
@@ -226,3 +234,13 @@ var ChannelSpecialBases = map[string]ChannelSpecialBase{
OpenAIBaseURL: "https://ark.cn-beijing.volces.com/api/coding/v3",
},
}
// IsAdvancedCustomChannel includes named channels backed by route presets.
func IsAdvancedCustomChannel(channelType int) bool {
switch channelType {
case ChannelTypeAdvancedCustom, ChannelTypeVLLM, ChannelTypeSGLang:
return true
default:
return false
}
}
+17 -12
View File
@@ -11,16 +11,20 @@ const (
ContextKeyRequestStartTime ContextKey = "request_start_time"
/* token related keys */
ContextKeyTokenUnlimited ContextKey = "token_unlimited_quota"
ContextKeyTokenKey ContextKey = "token_key"
ContextKeyTokenId ContextKey = "token_id"
ContextKeyTokenGroup ContextKey = "token_group"
ContextKeyOriginTasks ContextKey = "origin_tasks"
ContextKeyChannelConstraints ContextKey = "channel_constraints"
ContextKeyTokenModelLimitEnabled ContextKey = "token_model_limit_enabled"
ContextKeyTokenModelLimit ContextKey = "token_model_limit"
ContextKeyTokenCrossGroupRetry ContextKey = "token_cross_group_retry"
ContextKeyTokenAutoGroups ContextKey = "token_auto_groups"
ContextKeyTokenUnlimited ContextKey = "token_unlimited_quota"
ContextKeyTokenKey ContextKey = "token_key"
ContextKeyTokenId ContextKey = "token_id"
ContextKeyTokenGroup ContextKey = "token_group"
ContextKeyOriginTasks ContextKey = "origin_tasks"
ContextKeyChannelConstraints ContextKey = "channel_constraints"
ContextKeyTokenModelLimitEnabled ContextKey = "token_model_limit_enabled"
ContextKeyTokenModelLimit ContextKey = "token_model_limit"
ContextKeyTokenCrossGroupRetry ContextKey = "token_cross_group_retry"
ContextKeyTokenAstraDetectionDisabled ContextKey = "token_astra_detection_disabled"
ContextKeyTokenAstraAutoSwitch ContextKey = "token_astra_auto_switch"
ContextKeyTokenAutoGroups ContextKey = "token_auto_groups"
ContextKeyTokenGroupPool ContextKey = "token_group_pool"
ContextKeyTokenFailedGroups ContextKey = "token_failed_groups"
/* channel related keys */
ContextKeyChannelId ContextKey = "channel_id"
@@ -66,8 +70,9 @@ const (
ContextKeyAdminRejectReason ContextKey = "admin_reject_reason"
// ContextKeyLanguage stores the user's language preference for i18n
ContextKeyLanguage ContextKey = "language"
ContextKeyIsStream ContextKey = "is_stream"
ContextKeyLanguage ContextKey = "language"
ContextKeyIsStream ContextKey = "is_stream"
ContextKeyResponseStreamStatus ContextKey = "response_stream_status"
// ContextKeyAuditLogged marks that the current request has already recorded
// a manage/operation audit log inside the handler. When set, the admin-audit