@zodic/shared 0.0.143 → 0.0.144

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.
@@ -124,33 +124,33 @@ export class ConceptService {
124
124
  private parseBasicInfoResponse(response: string): {
125
125
  nameEN: string;
126
126
  descriptionEN: string;
127
- poemEN: string;
127
+ poemEN: string[];
128
128
  namePT: string;
129
129
  descriptionPT: string;
130
- poemPT: string;
130
+ poemPT: string[];
131
131
  } {
132
132
  console.log('📌 Parsing basic info response from ChatGPT:', response);
133
-
133
+
134
134
  const enMatch = response.match(
135
135
  /EN:\s*•\s*Name:\s*(.+?)\s*•\s*Description:\s*([\s\S]+?)\s*•\s*Poetic Passage:\s*([\s\S]+?)\s*(?=PT:|$)/
136
136
  );
137
137
  const ptMatch = response.match(
138
138
  /PT:\s*•\s*Nome:\s*(.+?)\s*•\s*Descrição:\s*([\s\S]+?)\s*•\s*Passagem Poética:\s*([\s\S]+)/
139
139
  );
140
-
140
+
141
141
  if (!enMatch || !ptMatch) {
142
142
  console.error('❌ Invalid basic info response format:', response);
143
143
  throw new Error('Invalid basic info response format');
144
144
  }
145
-
145
+
146
146
  const nameEN = enMatch[1].trim();
147
147
  const descriptionEN = enMatch[2].trim();
148
- const poemEN = enMatch[3].trim();
149
-
148
+ const poemEN = enMatch[3].trim().split(/\n+/).map(line => line.trim()); // ✅ Split into array
149
+
150
150
  const namePT = ptMatch[1].trim();
151
151
  const descriptionPT = ptMatch[2].trim();
152
- const poemPT = ptMatch[3].trim();
153
-
152
+ const poemPT = ptMatch[3].trim().split(/\n+/).map(line => line.trim()); // ✅ Split into array
153
+
154
154
  console.log('✅ Successfully parsed basic info:', {
155
155
  nameEN,
156
156
  descriptionEN,
@@ -159,7 +159,7 @@ export class ConceptService {
159
159
  descriptionPT,
160
160
  poemPT,
161
161
  });
162
-
162
+
163
163
  return { nameEN, descriptionEN, poemEN, namePT, descriptionPT, poemPT };
164
164
  }
165
165
 
@@ -531,7 +531,7 @@ export class ConceptService {
531
531
  name: '',
532
532
  description: '',
533
533
  content: [],
534
- poem: '',
534
+ poem: [],
535
535
  leonardoPrompt: '',
536
536
  postImages: [],
537
537
  reelImages: [null, null, null],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.143",
3
+ "version": "0.0.144",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -109,11 +109,11 @@ export type KVArchetype = {
109
109
  export type KVConcept = {
110
110
  name: string;
111
111
  description: string;
112
- content: StructuredConceptContent; // ✅ Structured content
113
- poem: string;
112
+ content: StructuredConceptContent;
113
+ poem: string[]; // Now an array of strings (each line as an element)
114
114
  leonardoPrompt: string;
115
- postImages: LeonardoImage[]; // Pre-generated in sequence
116
- reelImages: Array<LeonardoImage | null>; // Initially null, aligned by index
115
+ postImages: LeonardoImage[];
116
+ reelImages: Array<LeonardoImage | null>;
117
117
  status: 'idle' | 'generating' | 'completed';
118
118
  };
119
119
 
@@ -143,11 +143,12 @@ export const buildLLMMessages = (env: BackendBindings) => ({
143
143
  }: {
144
144
  name: string;
145
145
  description: string;
146
- poem: string;
146
+ poem: string[];
147
147
  conceptSlug: Concept;
148
148
  combination: string;
149
149
  }): ChatMessages => {
150
150
  const zodiacCombination = mapConceptToPlanets(conceptSlug, combination);
151
+ const formattedPoem = poem.map((line) => `${line}`).join('\n');
151
152
 
152
153
  return [
153
154
  {
@@ -157,14 +158,15 @@ export const buildLLMMessages = (env: BackendBindings) => ({
157
158
  {
158
159
  role: 'user',
159
160
  content: `
160
- Concept Details:
161
- - Combination: ${zodiacCombination}
162
- - Name: ${name}
163
- - Description: ${description}
164
- - Poem: ${poem}
165
-
166
- Generate additional content to elaborate on this concept for frontend display.
167
- `,
161
+ Concept Details:
162
+ - Combination: ${zodiacCombination}
163
+ - Name: ${name}
164
+ - Description: ${description}
165
+ - Poem:
166
+ ${formattedPoem}
167
+
168
+ Generate additional content to elaborate on this concept for frontend display.
169
+ `,
168
170
  },
169
171
  ];
170
172
  },