Commit b15ad292 by Seefs

fix: violation fee check

parent 194b53f0
...@@ -19,7 +19,8 @@ import ( ...@@ -19,7 +19,8 @@ import (
const ( const (
ViolationFeeCodePrefix = "violation_fee." ViolationFeeCodePrefix = "violation_fee."
CSAMViolationMarker = "Failed check: SAFETY_CHECK_TYPE_CSAM" CSAMViolationMarker = "Failed check: SAFETY_CHECK_TYPE"
ContentViolatesUsageMarker = "Content violates usage guidelines"
) )
func IsViolationFeeCode(code types.ErrorCode) bool { func IsViolationFeeCode(code types.ErrorCode) bool {
...@@ -30,11 +31,11 @@ func HasCSAMViolationMarker(err *types.NewAPIError) bool { ...@@ -30,11 +31,11 @@ func HasCSAMViolationMarker(err *types.NewAPIError) bool {
if err == nil { if err == nil {
return false return false
} }
if strings.Contains(err.Error(), CSAMViolationMarker) { if strings.Contains(err.Error(), CSAMViolationMarker) || strings.Contains(err.Error(), ContentViolatesUsageMarker) {
return true return true
} }
msg := err.ToOpenAIError().Message msg := err.ToOpenAIError().Message
return strings.Contains(msg, CSAMViolationMarker) return strings.Contains(msg, CSAMViolationMarker) || strings.Contains(err.Error(), ContentViolatesUsageMarker)
} }
func WrapAsViolationFeeGrokCSAM(err *types.NewAPIError) *types.NewAPIError { func WrapAsViolationFeeGrokCSAM(err *types.NewAPIError) *types.NewAPIError {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment