Skip to content

Commit 7cf35ca

Browse files
authored
Merge pull request #2994 from seefs001/fix/grok-violates-check
fix: violation fee check
2 parents 194b53f + b15ad29 commit 7cf35ca

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

service/violation_fee.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ import (
1818
)
1919

2020
const (
21-
ViolationFeeCodePrefix = "violation_fee."
22-
CSAMViolationMarker = "Failed check: SAFETY_CHECK_TYPE_CSAM"
21+
ViolationFeeCodePrefix = "violation_fee."
22+
CSAMViolationMarker = "Failed check: SAFETY_CHECK_TYPE"
23+
ContentViolatesUsageMarker = "Content violates usage guidelines"
2324
)
2425

2526
func IsViolationFeeCode(code types.ErrorCode) bool {
@@ -30,11 +31,11 @@ func HasCSAMViolationMarker(err *types.NewAPIError) bool {
3031
if err == nil {
3132
return false
3233
}
33-
if strings.Contains(err.Error(), CSAMViolationMarker) {
34+
if strings.Contains(err.Error(), CSAMViolationMarker) || strings.Contains(err.Error(), ContentViolatesUsageMarker) {
3435
return true
3536
}
3637
msg := err.ToOpenAIError().Message
37-
return strings.Contains(msg, CSAMViolationMarker)
38+
return strings.Contains(msg, CSAMViolationMarker) || strings.Contains(err.Error(), ContentViolatesUsageMarker)
3839
}
3940

4041
func WrapAsViolationFeeGrokCSAM(err *types.NewAPIError) *types.NewAPIError {

0 commit comments

Comments
 (0)