Skip to content

Commit 313b07c

Browse files
committed
[ Edit, Add ] edited and updated docs of moderation model directory files code
1 parent a201cd8 commit 313b07c

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

lib/src/core/models/moderation/moderation.dart

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,27 @@ import 'sub_models/result.dart';
66

77
export 'sub_models/result.dart';
88

9+
/// {@template openai_moderation_model}
10+
/// This class is used to represent an OpenAI moderation job.
11+
/// {@endtemplate}
912
@immutable
1013
final class OpenAIModerationModel {
11-
/// The ID of the moderation job.
14+
/// The [id]entifier of the moderation job.
1215
final String id;
1316

14-
/// The model used for moderation.
17+
/// The [model] used for moderation.
1518
final String model;
1619

17-
/// The results of the moderation job.
20+
/// The [results] of the moderation job.
1821
final List<OpenAIModerationResultModel> results;
1922

23+
/// Weither the moderation job have at least one result in [results].
24+
bool get haveResults => results.isNotEmpty;
25+
2026
@override
2127
int get hashCode => id.hashCode ^ model.hashCode ^ results.hashCode;
2228

23-
/// This class is used to represent an OpenAI moderation job.
29+
/// {@macro openai_moderation_model}
2430
const OpenAIModerationModel({
2531
required this.id,
2632
required this.model,

lib/src/core/models/moderation/sub_models/catgeories.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import 'package:meta/meta.dart';
22

3+
/// {@template openai_moderation_result_categories_model}
4+
/// This class is used to represent an OpenAI moderation job result categories.
5+
/// {@endtemplate}
36
@immutable
47
final class OpenAIModerationResultCategoriesModel {
58
/// The hate category.
@@ -56,6 +59,7 @@ final class OpenAIModerationResultCategoriesModel {
5659

5760
/// Whether the moderation request is not safe or not.
5861
bool get isNotSafe => !isSafe;
62+
5963
@override
6064
int get hashCode {
6165
return hate.hashCode ^

lib/src/core/models/moderation/sub_models/catgeories_scores.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import 'package:meta/meta.dart';
22

3+
/// {@template openai_moderation_result_scores_model}
4+
/// This class is used to represent an OpenAI moderation job result scores.
5+
/// {@endtemplate}
36
@immutable
47
final class OpenAIModerationResultScoresModel {
58
/// The hate score of the moderation job.

lib/src/core/models/moderation/sub_models/result.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import 'catgeories_scores.dart';
66
export 'catgeories.dart';
77
export 'catgeories_scores.dart';
88

9+
/// {@template openai_moderation_result_model}
10+
/// This class is used to represent an OpenAI moderation job result.
11+
/// {@endtemplate}
912
@immutable
1013
final class OpenAIModerationResultModel {
1114
/// The categories of the moderation job.
@@ -21,7 +24,7 @@ final class OpenAIModerationResultModel {
2124
int get hashCode =>
2225
categories.hashCode ^ categoryScores.hashCode ^ flagged.hashCode;
2326

24-
/// This class is used to represent an OpenAI moderation job result.
27+
/// {@macro openai_moderation_result_model}
2528
const OpenAIModerationResultModel({
2629
required this.categories,
2730
required this.categoryScores,

0 commit comments

Comments
 (0)