feat: publish sanitized custom.97 source
This commit is contained in:
1022 files changed
+69903
-19207
No files matched your search
@@ -10,6 +10,8 @@ const (
|
||||
EndpointTypeOpenAIResponse EndpointType = "openai-response"
|
||||
EndpointTypeOpenAIResponseCompact EndpointType = "openai-response-compact"
|
||||
EndpointTypeOpenAIAlphaSearch EndpointType = "openai-alpha-search"
|
||||
EndpointTypeDeepSeekToolsSearch EndpointType = "deepseek-tools-search"
|
||||
EndpointTypeDeepSeekToolsFetch EndpointType = "deepseek-tools-fetch"
|
||||
EndpointTypeAnthropic EndpointType = "anthropic"
|
||||
EndpointTypeGemini EndpointType = "gemini"
|
||||
EndpointTypeJinaRerank EndpointType = "jina-rerank"
|
||||
|
||||
+13
-8
@@ -145,7 +145,9 @@ func (e *NewAPIError) ErrorWithStatusCode() string {
|
||||
return fmt.Sprintf("status_code=%d, %s", e.StatusCode, msg)
|
||||
}
|
||||
|
||||
func (e *NewAPIError) MaskSensitiveError() string {
|
||||
// MaskSensitiveError masks the upstream addresses of the channel that produced
|
||||
// the error in the error text; see kitutil.MaskSensitiveInfo.
|
||||
func (e *NewAPIError) MaskSensitiveError(upstreamURLs ...string) string {
|
||||
if e == nil {
|
||||
return ""
|
||||
}
|
||||
@@ -156,14 +158,14 @@ func (e *NewAPIError) MaskSensitiveError() string {
|
||||
if e.errorCode == ErrorCodeCountTokenFailed {
|
||||
return errStr
|
||||
}
|
||||
return kitutil.MaskSensitiveInfo(errStr)
|
||||
return kitutil.MaskSensitiveInfo(errStr, upstreamURLs...)
|
||||
}
|
||||
|
||||
func (e *NewAPIError) MaskSensitiveErrorWithStatusCode() string {
|
||||
func (e *NewAPIError) MaskSensitiveErrorWithStatusCode(upstreamURLs ...string) string {
|
||||
if e == nil {
|
||||
return ""
|
||||
}
|
||||
msg := e.MaskSensitiveError()
|
||||
msg := e.MaskSensitiveError(upstreamURLs...)
|
||||
if e.StatusCode == 0 {
|
||||
return msg
|
||||
}
|
||||
@@ -177,7 +179,9 @@ func (e *NewAPIError) SetMessage(message string) {
|
||||
e.Err = errors.New(message)
|
||||
}
|
||||
|
||||
func (e *NewAPIError) ToOpenAIError() OpenAIError {
|
||||
// ToOpenAIError masks the upstream addresses in the message; pass those of the
|
||||
// channel that produced the error, or none when no channel did.
|
||||
func (e *NewAPIError) ToOpenAIError(upstreamURLs ...string) OpenAIError {
|
||||
var result OpenAIError
|
||||
switch e.errorType {
|
||||
case ErrorTypeOpenAIError:
|
||||
@@ -202,7 +206,7 @@ func (e *NewAPIError) ToOpenAIError() OpenAIError {
|
||||
}
|
||||
}
|
||||
if e.errorCode != ErrorCodeCountTokenFailed {
|
||||
result.Message = kitutil.MaskSensitiveInfo(result.Message)
|
||||
result.Message = kitutil.MaskSensitiveInfo(result.Message, upstreamURLs...)
|
||||
}
|
||||
if result.Message == "" {
|
||||
result.Message = string(e.errorType)
|
||||
@@ -210,7 +214,8 @@ func (e *NewAPIError) ToOpenAIError() OpenAIError {
|
||||
return result
|
||||
}
|
||||
|
||||
func (e *NewAPIError) ToClaudeError() ClaudeError {
|
||||
// ToClaudeError masks the upstream addresses like ToOpenAIError.
|
||||
func (e *NewAPIError) ToClaudeError(upstreamURLs ...string) ClaudeError {
|
||||
var result ClaudeError
|
||||
switch e.errorType {
|
||||
case ErrorTypeOpenAIError:
|
||||
@@ -231,7 +236,7 @@ func (e *NewAPIError) ToClaudeError() ClaudeError {
|
||||
}
|
||||
}
|
||||
if e.errorCode != ErrorCodeCountTokenFailed {
|
||||
result.Message = kitutil.MaskSensitiveInfo(result.Message)
|
||||
result.Message = kitutil.MaskSensitiveInfo(result.Message, upstreamURLs...)
|
||||
}
|
||||
if result.Message == "" {
|
||||
result.Message = string(e.errorType)
|
||||
|
||||
@@ -9,6 +9,7 @@ const (
|
||||
RelayFormatOpenAIResponses = "openai_responses"
|
||||
RelayFormatOpenAIResponsesCompaction = "openai_responses_compaction"
|
||||
RelayFormatOpenAIAlphaSearch = "openai_alpha_search"
|
||||
RelayFormatDeepSeekTools = "deepseek_tools"
|
||||
RelayFormatOpenAIAudio = "openai_audio"
|
||||
RelayFormatOpenAIImage = "openai_image"
|
||||
RelayFormatOpenAIRealtime = "openai_realtime"
|
||||
|
||||
Reference in new issue
Block a user