@umituz/react-native-ai-generation-content 1.72.32 → 1.72.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-ai-generation-content",
3
- "version": "1.72.32",
3
+ "version": "1.72.33",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -1,8 +1,107 @@
1
1
  /**
2
2
  * Default Moderation Rules
3
- * Content moderation disabled - AI providers handle content filtering
3
+ * Built-in rules for content filtering - can be extended via config
4
+ *
5
+ * NOTE: Explicit/NSFW content is handled server-side by AI providers (e.g., Fal AI's has_nsfw_concepts)
6
+ * This file only contains rules for content that AI providers don't automatically detect
4
7
  */
5
8
 
6
9
  import type { ModerationRule } from "../../domain/entities/moderation.types";
7
10
 
8
- export const defaultModerationRules: ModerationRule[] = [];
11
+ const violenceRules: ModerationRule[] = [
12
+ {
13
+ id: "violence-001",
14
+ name: "Graphic Violence",
15
+ description: "Detects graphic violence and gore",
16
+ contentTypes: ["text", "image", "video"],
17
+ severity: "critical",
18
+ violationType: "violence",
19
+ patterns: [
20
+ "\\bgore\\b",
21
+ "\\bblood\\b.*\\b(splatter|dripping|pool)\\b",
22
+ "\\bmurder\\b",
23
+ "\\bkilling\\b",
24
+ "\\btorture\\b",
25
+ "\\bdismember\\b",
26
+ "\\bbeheading\\b",
27
+ ],
28
+ enabled: true,
29
+ },
30
+ {
31
+ id: "violence-002",
32
+ name: "Weapons Focus",
33
+ description: "Detects inappropriate weapon usage context",
34
+ contentTypes: ["text", "image", "video"],
35
+ severity: "medium",
36
+ violationType: "violence",
37
+ patterns: [
38
+ "\\bgun\\b.*\\b(pointing|aimed|shooting)\\b",
39
+ "\\bweapon\\b.*\\b(attack|assault|harm)\\b",
40
+ "\\bknife\\b.*\\b(stabbing|cutting|slashing)\\b",
41
+ ],
42
+ enabled: true,
43
+ },
44
+ ];
45
+
46
+ const hateSpeechRules: ModerationRule[] = [
47
+ {
48
+ id: "hate-001",
49
+ name: "Discriminatory Language",
50
+ description: "Detects hate speech and discriminatory content",
51
+ contentTypes: ["text", "voice"],
52
+ severity: "critical",
53
+ violationType: "hate_speech",
54
+ patterns: [
55
+ "\\bhate\\b.*\\b(speech|crime|group)\\b",
56
+ "\\bracist\\b",
57
+ "\\bsexist\\b",
58
+ "\\bbigot\\b",
59
+ "\\bxenophobia\\b",
60
+ ],
61
+ enabled: true,
62
+ },
63
+ ];
64
+
65
+ const illegalActivityRules: ModerationRule[] = [
66
+ {
67
+ id: "illegal-001",
68
+ name: "Drug Content",
69
+ description: "Detects drug-related content",
70
+ contentTypes: ["text", "image", "video"],
71
+ severity: "high",
72
+ violationType: "illegal_activity",
73
+ patterns: [
74
+ "\\bdrug\\b.*\\b(dealing|trafficking|manufacturing)\\b",
75
+ "\\bcocaine\\b",
76
+ "\\bheroin\\b",
77
+ "\\bmethamphetamine\\b",
78
+ "\\billegal\\b.*\\b(substance|drug)\\b",
79
+ ],
80
+ enabled: true,
81
+ },
82
+ ];
83
+
84
+ const personalInfoRules: ModerationRule[] = [
85
+ {
86
+ id: "pii-001",
87
+ name: "Personal Information",
88
+ description: "Detects personal identifiable information",
89
+ contentTypes: ["text", "image"],
90
+ severity: "medium",
91
+ violationType: "personal_info",
92
+ patterns: [
93
+ "\\b\\d{3}-\\d{2}-\\d{4}\\b",
94
+ "\\b\\d{16}\\b",
95
+ "\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}\\b",
96
+ "\\b\\d{3}[-.]?\\d{3}[-.]?\\d{4}\\b",
97
+ ],
98
+ enabled: true,
99
+ },
100
+ ];
101
+
102
+ export const defaultModerationRules: ModerationRule[] = [
103
+ ...violenceRules,
104
+ ...hateSpeechRules,
105
+ ...illegalActivityRules,
106
+ ...personalInfoRules,
107
+ ];