@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
- // Parse AI response
1093
- const [generatedEN, generatedPT] = aiResponse.split('\n').map((s) => s.trim());
1092
+ console.log(`📝 Raw AI Response:`, aiResponse);
1094
1093
 
1095
- console.log(`🎨 AI Response: EN - "${generatedEN}", PT - "${generatedPT}"`);
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(generatedEN) ||
1100
- usedNamesPT.has(generatedPT) ||
1101
- recentDuplicates.has(generatedEN)
1110
+ usedNamesEN.has(newNameEN) ||
1111
+ usedNamesPT.has(newNamePT) ||
1112
+ recentDuplicates.has(newNameEN)
1102
1113
  ) {
1103
1114
  console.warn(
1104
- `⚠️ Duplicate detected: EN - "${generatedEN}", PT - "${generatedPT}". Retrying...`
1115
+ `⚠️ Duplicate detected: EN - "${newNameEN}", PT - "${newNamePT}". Retrying...`
1105
1116
  );
1106
- recentDuplicates.add(generatedEN);
1107
- recentDuplicates.add(generatedPT);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.212",
3
+ "version": "0.0.214",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -240,7 +240,8 @@ export type ConceptPhase =
240
240
  | 'basic-info'
241
241
  | 'leonardo-prompt'
242
242
  | 'content'
243
- | 'images';
243
+ | 'images'
244
+ | 'fix-duplicates';
244
245
 
245
246
  export const ConceptPhases: Record<string, ConceptPhase> = {
246
247
  BASIC_INFO: 'basic-info',