@@ -82,47 +82,47 @@ func handleModerationEndpoint(w http.ResponseWriter, r *http.Request) {
8282 switch {
8383 case strings .Contains (moderationReq .Input , "hate" ):
8484 resCat = openai.ResultCategories {Hate : true }
85- resCatScore = openai.ResultCategoryScores {Hate : true }
85+ resCatScore = openai.ResultCategoryScores {Hate : 1 }
8686
8787 case strings .Contains (moderationReq .Input , "hate more" ):
8888 resCat = openai.ResultCategories {HateThreatening : true }
89- resCatScore = openai.ResultCategoryScores {HateThreatening : true }
89+ resCatScore = openai.ResultCategoryScores {HateThreatening : 1 }
9090
9191 case strings .Contains (moderationReq .Input , "harass" ):
9292 resCat = openai.ResultCategories {Harassment : true }
93- resCatScore = openai.ResultCategoryScores {Harassment : true }
93+ resCatScore = openai.ResultCategoryScores {Harassment : 1 }
9494
9595 case strings .Contains (moderationReq .Input , "harass hard" ):
9696 resCat = openai.ResultCategories {Harassment : true }
97- resCatScore = openai.ResultCategoryScores {HarassmentThreatening : true }
97+ resCatScore = openai.ResultCategoryScores {HarassmentThreatening : 1 }
9898
9999 case strings .Contains (moderationReq .Input , "suicide" ):
100100 resCat = openai.ResultCategories {SelfHarm : true }
101- resCatScore = openai.ResultCategoryScores {SelfHarm : true }
101+ resCatScore = openai.ResultCategoryScores {SelfHarm : 1 }
102102
103103 case strings .Contains (moderationReq .Input , "wanna suicide" ):
104104 resCat = openai.ResultCategories {SelfHarmIntent : true }
105- resCatScore = openai.ResultCategoryScores {SelfHarm : true }
105+ resCatScore = openai.ResultCategoryScores {SelfHarm : 1 }
106106
107107 case strings .Contains (moderationReq .Input , "drink bleach" ):
108108 resCat = openai.ResultCategories {SelfHarmInstructions : true }
109- resCatScore = openai.ResultCategoryScores {SelfHarmInstructions : true }
109+ resCatScore = openai.ResultCategoryScores {SelfHarmInstructions : 1 }
110110
111111 case strings .Contains (moderationReq .Input , "porn" ):
112112 resCat = openai.ResultCategories {Sexual : true }
113- resCatScore = openai.ResultCategoryScores {Sexual : true }
113+ resCatScore = openai.ResultCategoryScores {Sexual : 1 }
114114
115115 case strings .Contains (moderationReq .Input , "child porn" ):
116116 resCat = openai.ResultCategories {SexualMinors : true }
117- resCatScore = openai.ResultCategoryScores {SexualMinors : true }
117+ resCatScore = openai.ResultCategoryScores {SexualMinors : 1 }
118118
119119 case strings .Contains (moderationReq .Input , "kill" ):
120120 resCat = openai.ResultCategories {Violence : true }
121- resCatScore = openai.ResultCategoryScores {Violence : true }
121+ resCatScore = openai.ResultCategoryScores {Violence : 1 }
122122
123123 case strings .Contains (moderationReq .Input , "corpse" ):
124124 resCat = openai.ResultCategories {ViolenceGraphic : true }
125- resCatScore = openai.ResultCategoryScores {ViolenceGraphic : true }
125+ resCatScore = openai.ResultCategoryScores {ViolenceGraphic : 1 }
126126 }
127127
128128 result := openai.Result {Categories : resCat , CategoryScores : resCatScore , Flagged : true }
0 commit comments