@zodic/shared 0.0.212 → 0.0.214
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.
|
@@ -1089,27 +1089,36 @@ export class ConceptService {
|
|
|
1089
1089
|
break;
|
|
1090
1090
|
}
|
|
1091
1091
|
|
|
1092
|
-
|
|
1093
|
-
const [generatedEN, generatedPT] = aiResponse.split('\n').map((s) => s.trim());
|
|
1092
|
+
console.log(`📝 Raw AI Response:`, aiResponse);
|
|
1094
1093
|
|
|
1095
|
-
|
|
1094
|
+
// ✅ Use regex to correctly extract EN and PT names
|
|
1095
|
+
const enMatch = aiResponse.match(/EN:\s*New Name:\s*The [^\n]+/);
|
|
1096
|
+
const ptMatch = aiResponse.match(/PT:\s*Novo Nome:\s*O [^\n]+/);
|
|
1097
|
+
|
|
1098
|
+
if (!enMatch || !ptMatch) {
|
|
1099
|
+
console.error(`❌ Invalid AI response format! Retrying...`);
|
|
1100
|
+
continue;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
newNameEN = enMatch[0].replace(/^EN:\s*New Name:\s*/, '').trim();
|
|
1104
|
+
newNamePT = ptMatch[0].replace(/^PT:\s*Novo Nome:\s*/, '').trim();
|
|
1105
|
+
|
|
1106
|
+
console.log(`🎨 Extracted Names: EN - "${newNameEN}", PT - "${newNamePT}"`);
|
|
1096
1107
|
|
|
1097
1108
|
// ✅ Check if the name already exists
|
|
1098
1109
|
if (
|
|
1099
|
-
usedNamesEN.has(
|
|
1100
|
-
usedNamesPT.has(
|
|
1101
|
-
recentDuplicates.has(
|
|
1110
|
+
usedNamesEN.has(newNameEN) ||
|
|
1111
|
+
usedNamesPT.has(newNamePT) ||
|
|
1112
|
+
recentDuplicates.has(newNameEN)
|
|
1102
1113
|
) {
|
|
1103
1114
|
console.warn(
|
|
1104
|
-
`⚠️ Duplicate detected: EN - "${
|
|
1115
|
+
`⚠️ Duplicate detected: EN - "${newNameEN}", PT - "${newNamePT}". Retrying...`
|
|
1105
1116
|
);
|
|
1106
|
-
recentDuplicates.add(
|
|
1107
|
-
recentDuplicates.add(
|
|
1117
|
+
recentDuplicates.add(newNameEN);
|
|
1118
|
+
recentDuplicates.add(newNamePT);
|
|
1108
1119
|
continue;
|
|
1109
1120
|
}
|
|
1110
1121
|
|
|
1111
|
-
newNameEN = generatedEN;
|
|
1112
|
-
newNamePT = generatedPT;
|
|
1113
1122
|
recentDuplicates.add(newNameEN);
|
|
1114
1123
|
recentDuplicates.add(newNamePT);
|
|
1115
1124
|
break; // ✅ Found unique names, exit retry loop
|
package/package.json
CHANGED
package/types/scopes/generic.ts
CHANGED