@zodic/shared 0.0.206 → 0.0.207
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.
|
@@ -51,6 +51,7 @@ export class ConceptService {
|
|
|
51
51
|
|
|
52
52
|
let attempts = 0;
|
|
53
53
|
const maxAttempts = 3;
|
|
54
|
+
const MAX_NAME_LENGTH = 44;
|
|
54
55
|
|
|
55
56
|
while (attempts < maxAttempts) {
|
|
56
57
|
let phase = 'generation';
|
|
@@ -86,14 +87,19 @@ export class ConceptService {
|
|
|
86
87
|
|
|
87
88
|
console.log(`🎭 Generated names: EN - "${nameEN}", PT - "${namePT}"`);
|
|
88
89
|
|
|
89
|
-
// ✅
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
90
|
+
// ✅ Forcefully trim the name to exactly 5 words if it's too long
|
|
91
|
+
const enforceWordLimit = (name: string): string => {
|
|
92
|
+
const words = name.split(/\s+/);
|
|
93
|
+
if (words.length > 5) {
|
|
94
|
+
return words.slice(0, 5).join(' ');
|
|
95
|
+
}
|
|
96
|
+
return name;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
nameEN = enforceWordLimit(nameEN);
|
|
100
|
+
namePT = enforceWordLimit(namePT);
|
|
101
|
+
|
|
102
|
+
console.log(`✂️ Trimmed names: EN - "${nameEN}", PT - "${namePT}"`);
|
|
97
103
|
|
|
98
104
|
// ✅ Check uniqueness before storing
|
|
99
105
|
if (allNamesEN.includes(nameEN) || allNamesPT.includes(namePT)) {
|