@zodic/shared 0.0.156 → 0.0.157

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.
@@ -105,7 +105,7 @@ export class ConceptService {
105
105
 
106
106
  // ✅ Parse response for both languages
107
107
  let { nameEN, descriptionEN, poemEN, namePT, descriptionPT, poemPT } =
108
- this.parseBasicInfoResponse(response);
108
+ this.parseBasicInfoResponse(response, conceptSlug);
109
109
 
110
110
  // 🔥 Check if generated English name is unique
111
111
  if (allNamesEN.includes(nameEN)) {
@@ -220,7 +220,10 @@ export class ConceptService {
220
220
  .trim();
221
221
  }
222
222
 
223
- private parseBasicInfoResponse(response: string): {
223
+ private parseBasicInfoResponse(
224
+ response: string,
225
+ conceptSlug: Concept
226
+ ): {
224
227
  nameEN: string;
225
228
  descriptionEN: string;
226
229
  poemEN: string[];
@@ -251,25 +254,55 @@ export class ConceptService {
251
254
  const poemEN = enMatch[3]
252
255
  .trim()
253
256
  .split(/\n+/)
254
- .map((line) => cleanText(line)); // ✅ Split into array & clean lines
257
+ .map((line) => cleanText(line));
255
258
 
256
259
  const namePT = cleanText(ptMatch[1]);
257
260
  const descriptionPT = cleanText(ptMatch[2]);
258
261
  const poemPT = ptMatch[3]
259
262
  .trim()
260
263
  .split(/\n+/)
261
- .map((line) => cleanText(line)); // ✅ Split into array & clean lines
264
+ .map((line) => cleanText(line));
265
+
266
+ // ✅ Determine appropriate replacement text based on conceptSlug
267
+ const conceptPlaceholder = `this ${conceptSlug.charAt(0).toUpperCase() + conceptSlug.slice(1)}`;
268
+ const conceptPlaceholderCapitalized =
269
+ `This ${conceptSlug.charAt(0).toUpperCase() + conceptSlug.slice(1)}`;
270
+
271
+ // ✅ Function to replace occurrences of the name in a text while handling capitalization
272
+ const replaceConceptName = (text: string, conceptName: string) => {
273
+ return text.replace(
274
+ new RegExp(`(?<=\\.\\s*|^)${conceptName}`, 'g'),
275
+ conceptPlaceholderCapitalized
276
+ ).replace(new RegExp(conceptName, 'g'), conceptPlaceholder);
277
+ };
278
+
279
+ // ✅ Ensure the concept name is not repeated in the description
280
+ const cleanedDescriptionEN = replaceConceptName(descriptionEN, nameEN);
281
+ const cleanedDescriptionPT = replaceConceptName(descriptionPT, namePT);
282
+
283
+ // ✅ If the name appears in the poem, trigger a retry
284
+ if (poemEN.some((line) => line.includes(nameEN)) || poemPT.some((line) => line.includes(namePT))) {
285
+ console.error('❌ Concept name detected in poem, triggering a retry.');
286
+ throw new Error('Concept name found in poem, regenerating response.');
287
+ }
262
288
 
263
289
  console.log('✅ Successfully parsed and cleaned basic info:', {
264
290
  nameEN,
265
- descriptionEN,
291
+ descriptionEN: cleanedDescriptionEN,
266
292
  poemEN,
267
293
  namePT,
268
- descriptionPT,
294
+ descriptionPT: cleanedDescriptionPT,
269
295
  poemPT,
270
296
  });
271
297
 
272
- return { nameEN, descriptionEN, poemEN, namePT, descriptionPT, poemPT };
298
+ return {
299
+ nameEN,
300
+ descriptionEN: cleanedDescriptionEN,
301
+ poemEN,
302
+ namePT,
303
+ descriptionPT: cleanedDescriptionPT,
304
+ poemPT,
305
+ };
273
306
  }
274
307
 
275
308
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.156",
3
+ "version": "0.0.157",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -66,6 +66,7 @@ For the given combination, generate the following in both languages, ensuring th
66
66
 
67
67
  Rules & Formatting:
68
68
  • Do not mention zodiac signs or planets explicitly.
69
+ • Do not mention the Crown’s name in the description or poem.
69
70
  • Ensure both descriptions are structurally and emotionally equivalent.
70
71
  • Write the poem freely in each language to maximize impact, avoiding direct translation.
71
72
  • Use rich, symbolic language while keeping it accessible and inspiring.
@@ -99,22 +100,16 @@ For the given combination, generate the following in both languages, ensuring th
99
100
 
100
101
  3. Poetic Passage (Passagem Poética): Create two separate and independent poetic passages—one in English, one in Portuguese. Each should reflect the same essence but be uniquely crafted to best suit the flow and artistic qualities of its respective language. The passage should be long and evocative, 4 poetic lines, ensuring it deeply resonates and immerses the reader in a sense of confidence, power, and determination.
101
102
 
102
-
103
103
  • Do not translate the poem directly—let each version flourish naturally in its own language.
104
-
105
104
  • Ensure the passage flows rhythmically, evoking strength and vision.
106
-
107
105
  • Avoid mentioning the Scepter itself or using the word “scepter.”
108
106
 
109
-
110
107
  Rules & Formatting:
111
108
 
112
109
  • Do not mention zodiac signs or planets explicitly.
113
-
110
+ • Do not mention the Scepter’s name in the description or poem.
114
111
  • Ensure both descriptions are structurally and emotionally equivalent.
115
-
116
112
  • Write the poem freely in each language to maximize impact, avoiding direct translation.
117
-
118
113
  • Use rich, symbolic language while keeping it accessible and inspiring.
119
114
 
120
115
  Response Format:
@@ -147,20 +142,16 @@ For the given combination, generate the following in both languages, ensuring th
147
142
  3. Poetic Passage (Passagem Poética): Create two separate and independent poetic passages—one in English, one in Portuguese. Each should reflect the same essence but be uniquely crafted to best suit the flow and artistic qualities of its respective language. The passage should be long and evocative, 4 poetic lines, ensuring it deeply resonates and immerses the reader in a sense of longing, connection, and destiny.
148
143
 
149
144
  • Do not translate the poem directly—let each version flourish naturally in its own language.
150
-
151
145
  • Ensure the passage flows rhythmically, evoking deep emotion and intimacy.
152
-
153
146
  • Avoid mentioning the Ring itself or using the word “ring.”
154
147
 
155
148
 
156
149
  Rules & Formatting:
157
150
 
158
151
  • Do not mention zodiac signs or planets explicitly.
159
-
152
+ • Do not mention the Ring’s name in the description or poem.
160
153
  • Ensure both descriptions are structurally and emotionally equivalent.
161
-
162
154
  • Write the poem freely in each language to maximize impact, avoiding direct translation.
163
-
164
155
  • Use rich, symbolic language while keeping it accessible and inspiring.
165
156
 
166
157
  Response Format:
@@ -192,19 +183,15 @@ For the given combination, generate the following in both languages, ensuring th
192
183
  3. Poetic Passage (Passagem Poética): Create two separate and independent poetic passages—one in English, one in Portuguese. Each should reflect the same essence but be uniquely crafted to best suit the flow and artistic qualities of its respective language. The passage should be long and evocative, 4 poetic lines, ensuring it deeply resonates and immerses the reader in a sense of renewal, strength, and inner harmony.
193
184
 
194
185
  • Do not translate the poem directly—let each version flourish naturally in its own language.
195
-
196
186
  • Ensure the passage flows rhythmically, evoking protection, resilience, and healing.
197
-
198
187
  • Avoid mentioning the Amulet itself or using the word “amulet.”
199
188
 
200
189
  Rules & Formatting:
201
190
 
202
191
  • Do not mention zodiac signs or planets explicitly.
203
-
192
+ • Do not mention the Amulet’s name in the description or poem.
204
193
  • Ensure both descriptions are structurally and emotionally equivalent.
205
-
206
194
  • Write the poem freely in each language to maximize impact, avoiding direct translation.
207
-
208
195
  • Use rich, symbolic language while keeping it accessible and inspiring.
209
196
 
210
197
  Response Format:
@@ -236,14 +223,13 @@ For the given combination, generate the following in both languages, ensuring th
236
223
  3. Poetic Passage (Passagem Poética): Create two separate and independent poetic passages—one in English, one in Portuguese. Each should reflect the same essence but be uniquely crafted to best suit the flow and artistic qualities of its respective language. The passage should be long and evocative, 4 poetic lines, ensuring it deeply resonates and immerses the reader in a sense of mystery, guidance, and inner awakening.
237
224
 
238
225
  • Do not translate the poem directly—let each version flourish naturally in its own language.
239
-
240
226
  • Ensure the passage flows rhythmically, evoking transformation and introspection.
241
-
242
227
  • Avoid mentioning the Lantern itself or using the word “lantern.”
243
228
 
244
229
  Rules & Formatting:
245
230
 
246
231
  • Do not mention zodiac signs or planets explicitly.
232
+ • Do not mention the Lantern’s name in the description or poem.
247
233
  • Ensure both descriptions are structurally and emotionally equivalent.
248
234
  • Write the poem freely in each language to maximize impact, avoiding direct translation.
249
235
  • Use rich, symbolic language while keeping it accessible and inspiring.
@@ -277,19 +263,15 @@ For the given combination, generate the following in both languages, ensuring th
277
263
  3. Poetic Passage (Passagem Poética): Create two separate and independent poetic passages—one in English, one in Portuguese. Each should reflect the same essence but be uniquely crafted to best suit the flow and artistic qualities of its respective language. The passage should be long and evocative, 4 poetic lines, ensuring it deeply resonates and immerses the reader in a sense of aspiration, vision, and transcendence.
278
264
 
279
265
  • Do not translate the poem directly—let each version flourish naturally in its own language.
280
-
281
266
  • Ensure the passage flows rhythmically, evoking inspiration and a higher calling.
282
-
283
267
  • Avoid mentioning the Orb itself or using the word “orb.”
284
268
 
285
269
  Rules & Formatting:
286
270
 
287
271
  • Do not mention zodiac signs or planets explicitly.
288
-
272
+ • Do not mention the Orb’s name in the description or poem.
289
273
  • Ensure both descriptions are structurally and emotionally equivalent.
290
-
291
274
  • Write the poem freely in each language to maximize impact, avoiding direct translation.
292
-
293
275
  • Use rich, symbolic language while keeping it accessible and inspiring.
294
276
 
295
277
  Response Format: