@zodic/shared 0.0.81 → 0.0.82
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.
|
@@ -18,7 +18,7 @@ export class ArchetypeService {
|
|
|
18
18
|
.buildLLMMessages()
|
|
19
19
|
.generateCosmicMirrorArchetypeBasicInfo({ sun, ascendant, moon });
|
|
20
20
|
|
|
21
|
-
const response = await this.context.api().
|
|
21
|
+
const response = await this.context.api().callChatGPT.single(messages, {});
|
|
22
22
|
|
|
23
23
|
if (!response) {
|
|
24
24
|
throw new Error(
|
|
@@ -152,12 +152,7 @@ export class ArchetypeService {
|
|
|
152
152
|
const kvStore = this.context.kvCosmicMirrorArchetypesStore();
|
|
153
153
|
|
|
154
154
|
const kvKeys = [1, 2, 3].map((index) =>
|
|
155
|
-
buildCosmicMirrorArchetypeKVKey(
|
|
156
|
-
'en-us',
|
|
157
|
-
combinationString,
|
|
158
|
-
'male',
|
|
159
|
-
index
|
|
160
|
-
)
|
|
155
|
+
buildCosmicMirrorArchetypeKVKey('en-us', combinationString, 'male', index)
|
|
161
156
|
);
|
|
162
157
|
|
|
163
158
|
const archetypeEntries = await Promise.all(
|
|
@@ -179,7 +174,7 @@ export class ArchetypeService {
|
|
|
179
174
|
}))
|
|
180
175
|
);
|
|
181
176
|
|
|
182
|
-
const response = await this.context.api().
|
|
177
|
+
const response = await this.context.api().callChatGPT.single(messages, {});
|
|
183
178
|
if (!response) {
|
|
184
179
|
throw new Error(
|
|
185
180
|
`Failed to generate Leonardo prompts for: ${combinationString}`
|
|
@@ -155,7 +155,7 @@ export class LeonardoService {
|
|
|
155
155
|
const messages = this.context
|
|
156
156
|
.buildLLMMessages()
|
|
157
157
|
.generateCosmicMirrorArchetypesLeonardoPrompts(archetypes);
|
|
158
|
-
const response = await this.context.api().
|
|
158
|
+
const response = await this.context.api().callChatGPT.single(messages, {});
|
|
159
159
|
|
|
160
160
|
if (!response) {
|
|
161
161
|
throw new Error('Leonardo prompts not generated');
|
|
@@ -352,4 +352,37 @@ export class LeonardoService {
|
|
|
352
352
|
|
|
353
353
|
console.log('Upload to presigned URL successful');
|
|
354
354
|
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Personalizes a Leonardo prompt based on user-specific traits.
|
|
358
|
+
* @param params - Details for prompt personalization
|
|
359
|
+
* @returns {Promise<string>} - The personalized prompt
|
|
360
|
+
*/
|
|
361
|
+
async personalizeCosmicMirrorLeonardoPrompt(params: {
|
|
362
|
+
leonardoPrompt: string;
|
|
363
|
+
traits: string;
|
|
364
|
+
}): Promise<string> {
|
|
365
|
+
const { leonardoPrompt, traits } = params;
|
|
366
|
+
|
|
367
|
+
const messages = this.context
|
|
368
|
+
.buildLLMMessages()
|
|
369
|
+
.personalizeCosmicMirrorLeonardoPrompt({ leonardoPrompt, traits });
|
|
370
|
+
|
|
371
|
+
try {
|
|
372
|
+
const personalizedPrompt = await this.context
|
|
373
|
+
.api()
|
|
374
|
+
.callChatGPT.single(messages, {});
|
|
375
|
+
|
|
376
|
+
if (!personalizedPrompt) {
|
|
377
|
+
throw new Error('Failed to generate personalized prompt');
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
console.log('Personalized Leonardo Prompt:', personalizedPrompt);
|
|
381
|
+
|
|
382
|
+
return personalizedPrompt.trim();
|
|
383
|
+
} catch (error) {
|
|
384
|
+
console.error('Error personalizing Leonardo prompt:', error);
|
|
385
|
+
throw error;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
355
388
|
}
|