@zodic/shared 0.0.191 → 0.0.193
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.
|
@@ -72,6 +72,8 @@ export class ConceptService {
|
|
|
72
72
|
|
|
73
73
|
let attempts = 0;
|
|
74
74
|
const maxAttempts = 3;
|
|
75
|
+
let newlyGeneratedNames: string[] = []; // ✅ Track generated names in memory
|
|
76
|
+
|
|
75
77
|
while (attempts < maxAttempts) {
|
|
76
78
|
let phase = 'generation';
|
|
77
79
|
try {
|
|
@@ -94,7 +96,9 @@ export class ConceptService {
|
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
console.log(`✏️ Generating new name...`);
|
|
97
|
-
|
|
99
|
+
// ✅ Merge newly generated names with existing recent names
|
|
100
|
+
const recentNamesEN = [...allNamesEN.slice(-40), ...newlyGeneratedNames];
|
|
101
|
+
|
|
98
102
|
const messages = this.context
|
|
99
103
|
.buildLLMMessages()
|
|
100
104
|
.generateConceptBasicInfo({
|
|
@@ -117,6 +121,9 @@ export class ConceptService {
|
|
|
117
121
|
|
|
118
122
|
console.log(`🎭 Generated names: EN - "${nameEN}", PT - "${namePT}"`);
|
|
119
123
|
|
|
124
|
+
// ✅ **Add the generated names to our local tracking list**
|
|
125
|
+
newlyGeneratedNames.push(nameEN, namePT);
|
|
126
|
+
|
|
120
127
|
// ✅ Check uniqueness before storing
|
|
121
128
|
if (allNamesEN.includes(nameEN) || allNamesPT.includes(namePT)) {
|
|
122
129
|
console.warn(`⚠️ Duplicate Name Detected: "${nameEN}" or "${namePT}"`);
|
|
@@ -160,7 +167,7 @@ export class ConceptService {
|
|
|
160
167
|
console.log(`✅ Stored basic info for ${conceptSlug}, combination: ${combinationString}.`);
|
|
161
168
|
|
|
162
169
|
// ✅ **Throttling for next request**
|
|
163
|
-
const delayMs = Math.floor(Math.random() * (500 - 200 + 1)) +
|
|
170
|
+
const delayMs = Math.floor(Math.random() * (500 - 200 + 1)) + 200; // 🔥 Random delay between 200-500ms
|
|
164
171
|
console.log(`⏳ Waiting ${delayMs}ms before processing next missing entry...`);
|
|
165
172
|
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
166
173
|
|
|
@@ -186,7 +193,7 @@ export class ConceptService {
|
|
|
186
193
|
throw new Error(`Failed to generate basic info after ${maxAttempts} attempts.`);
|
|
187
194
|
}
|
|
188
195
|
console.log('🔁 Retrying...');
|
|
189
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
196
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
190
197
|
}
|
|
191
198
|
}
|
|
192
199
|
}
|