浏览代码

fix: violation fee check

Seefs 1 周之前
父节点
当前提交
532691b06b
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      service/violation_fee.go

+ 5 - 4
service/violation_fee.go

@@ -18,8 +18,9 @@ import (
 )
 
 const (
-	ViolationFeeCodePrefix = "violation_fee."
-	CSAMViolationMarker    = "Failed check: SAFETY_CHECK_TYPE_CSAM"
+	ViolationFeeCodePrefix     = "violation_fee."
+	CSAMViolationMarker        = "Failed check: SAFETY_CHECK_TYPE"
+	ContentViolatesUsageMarker = "Content violates usage guidelines"
 )
 
 func IsViolationFeeCode(code types.ErrorCode) bool {
@@ -30,11 +31,11 @@ func HasCSAMViolationMarker(err *types.NewAPIError) bool {
 	if err == nil {
 		return false
 	}
-	if strings.Contains(err.Error(), CSAMViolationMarker) {
+	if strings.Contains(err.Error(), CSAMViolationMarker) || strings.Contains(err.Error(), ContentViolatesUsageMarker) {
 		return true
 	}
 	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 {