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

+10 -4
View File
@@ -18,19 +18,25 @@ const (
)
// ClassifyRelayOutcome decides whether one finished relay counts as a health
// sample. Business rejections and client cancellations are not samples; the
// classification is independent of retries, channel disabling and billing.
// sample. Business rejections and cancellations during generation are not
// samples; a stream already completed normally without errors remains eligible
// after its context is canceled. Classification is independent of retries,
// channel disabling and billing.
func ClassifyRelayOutcome(ctx context.Context, info *relaycommon.RelayInfo, apiErr *types.NewAPIError) Outcome {
if info == nil || info.PerformanceBusinessRejection {
return OutcomeIgnored
}
if ctx != nil && ctx.Err() == context.Canceled {
stream := info.StreamStatus.OutcomeSnapshot()
completedNormally := info.IsStream && info.StreamStatus != nil && apiErr == nil &&
stream.Response == relaycommon.ResponseOutcomeCompleted &&
(stream.EndReason == relaycommon.StreamEndReasonEOF || stream.EndReason == relaycommon.StreamEndReasonDone) &&
!stream.HasErrors && info.StreamStatus.EndError == nil
if ctx != nil && ctx.Err() == context.Canceled && !completedNormally {
return OutcomeIgnored
}
if apiErr != nil && errors.Is(apiErr, context.Canceled) {
return OutcomeIgnored
}
stream := info.StreamStatus.OutcomeSnapshot()
if stream.Response == relaycommon.ResponseOutcomeFailed {
return classifyFailure(false, stream.ErrorCode, stream.ErrorType, stream.ErrorStatus)
}