feat: publish sanitized custom.97 source

This commit is contained in:
cneicy committed 2026-10-27 20:43:39 +08:00
1 parent 8e6ed0317b
commit 86c0276156
1022 files changed
+69903 -19207

No files matched your search

+7 -4
View File
@@ -2,8 +2,8 @@ package service
import (
"encoding/base64"
"fmt"
"strings"
"time"
"github.com/QuantumNous/new-api/common"
"github.com/QuantumNous/new-api/constant"
@@ -42,7 +42,7 @@ func attachQuotaSaturation(ctx *gin.Context, relayInfo *relaycommon.RelayInfo, o
return
}
attachQuotaSaturationToOther(other, clamp)
logger.LogWarn(ctx, fmt.Sprintf("quota saturation on consume log: op=%s kind=%s original=%g clamped=%d user=%d model=%s",
logger.LogWarn(ctx, common.LogText("quota saturation on consume log: op=%s kind=%s original=%g clamped=%d user=%d model=%s",
clamp.Op, clamp.Kind, clamp.Original, clamp.Clamped, relayInfo.UserId, relayInfo.GetBillingModelName()))
}
@@ -74,6 +74,9 @@ func AppendRelayLogAdminInfo(ctx *gin.Context, relayInfo *relaycommon.RelayInfo,
other.SetAdmin("use_channel", ctx.GetStringSlice("use_channel"))
appendRequestDetails(ctx, relayInfo, other)
if relayInfo != nil {
if timing := relayInfo.UpstreamTiming.Snapshot(); timing != nil {
other.SetAdmin("upstream_timing", timing)
}
if billingModel := relayInfo.GetBillingModelName(); billingModel != "" && billingModel != relayInfo.OriginModelName {
other.SetAdmin("billing_model", billingModel)
}
@@ -112,6 +115,7 @@ func GenerateTextOtherInfo(ctx *gin.Context, relayInfo *relaycommon.RelayInfo, m
other.SetPublic("model_price", modelPrice)
other.SetPublic("user_group_ratio", userGroupRatio)
other.SetPublic("frt", float64(relayInfo.FirstResponseTime.UnixMilli()-relayInfo.StartTime.UnixMilli()))
other.SetPublic("latency_ms", time.Since(relayInfo.StartTime).Milliseconds())
if relayInfo.ReasoningEffort != "" {
other.SetPublic("reasoning_effort", relayInfo.ReasoningEffort)
}
@@ -141,8 +145,7 @@ func AppendResponseModelLogInfo(relayInfo *relaycommon.RelayInfo, other *model.L
return
}
observation := relayInfo.ResponseModel
if !observation.Mismatch &&
observation.ReturnedModel == observation.RequestedModel &&
if observation.ReturnedModel == observation.RequestedModel &&
(observation.UpstreamModel == "" || observation.UpstreamModel == observation.RequestedModel) &&
(relayInfo.ChannelMeta == nil || !relayInfo.IsModelMapped) {
return