@zodic/shared 0.0.107 → 0.0.109

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.
package/app/api/index.ts CHANGED
@@ -27,7 +27,7 @@ import { makeAstrologyApiCall } from './astrology';
27
27
  const deepseek = (env: BackendBindings) =>
28
28
  new OpenAI({
29
29
  apiKey: env.DEEPSEEK_API_KEY,
30
- baseURL: 'https://api.deepseek.com/v1',
30
+ baseURL: 'https://api.deepseek.com/v1',
31
31
  });
32
32
 
33
33
  export const Api = (env: BackendBindings) => ({
@@ -206,6 +206,7 @@ export const Api = (env: BackendBindings) => ({
206
206
  initImageId = null, // Optional
207
207
  initStrength = 0.2, // Default strength for Image-to-Image
208
208
  quantity = 3,
209
+ negPrompt = null,
209
210
  }: LeonardoGenerateImageParams & {
210
211
  initImageId?: string | null;
211
212
  initStrength?: number;
@@ -216,8 +217,9 @@ export const Api = (env: BackendBindings) => ({
216
217
  alchemy: true,
217
218
  };
218
219
 
219
- const negativePrompt =
220
- 'blurry, boring, dark, low quality, lowres, grainy, distorted, overexposed, oversaturated, flat, rough, noisy, abstract, monochrome, dull, cracked, chipped, uneven, asymmetrical, deformed, pixelated, cartoonish, out of focus, messy, dull lighting, rough texture, unbalanced, low contrast, poorly drawn, faded colors, chaotic, unnatural metals, overly sharp colors, text, writing, letters, symbols, logos, watermark, calligraphy, caption, bad anatomy, malformed hands, extra fingers, missing fingers, poorly drawn face, distorted eyes, crossed eyes, out-of-proportion eyes, deformed limbs, floating limbs, disconnected limbs, mutated hands, elongated neck, unrealistic body proportions, disfigured, extra limbs, unnatural skin texture, melted features, unnatural fingers, poorly rendered hands, blurry face';
220
+ const negativePrompt = negPrompt
221
+ ? negPrompt
222
+ : 'blurry, boring, dark, low quality, lowres, grainy, distorted, overexposed, oversaturated, flat, rough, noisy, abstract, monochrome, dull, cracked, chipped, uneven, asymmetrical, deformed, pixelated, cartoonish, out of focus, messy, dull lighting, rough texture, unbalanced, low contrast, poorly drawn, faded colors, chaotic, unnatural metals, overly sharp colors, text, writing, letters, symbols, logos, watermark, calligraphy, caption, bad anatomy, malformed hands, extra fingers, missing fingers, poorly drawn face, distorted eyes, crossed eyes, out-of-proportion eyes, deformed limbs, floating limbs, disconnected limbs, mutated hands, elongated neck, unrealistic body proportions, disfigured, extra limbs, unnatural skin texture, melted features, unnatural fingers, poorly rendered hands, blurry face';
221
223
 
222
224
  const endpoint = 'https://cloud.leonardo.ai/api/rest/v1/generations';
223
225
  const headers = {
@@ -171,7 +171,7 @@ export class ConceptService {
171
171
 
172
172
  const kvKey = buildConceptKVKey(language, conceptSlug, combinationString);
173
173
  console.log(
174
- `Queuing image generation for concept: ${conceptSlug}, combination: ${combinationString}, language: ${language}`
174
+ `🚀 Queuing image generation for concept: ${conceptSlug}, combination: ${combinationString}, language: ${language}`
175
175
  );
176
176
 
177
177
  const concept = await this.getKVConcept(kvKey);
@@ -211,7 +211,7 @@ export class ConceptService {
211
211
  }
212
212
 
213
213
  console.log(
214
- `Extracted planet signs: ${planet1} -> ${planet1Sign}, ${planet2} -> ${planet2Sign}, ${planet3} -> ${planet3Sign}`
214
+ `🔹 Extracted planet signs: ${planet1} -> ${planet1Sign}, ${planet2} -> ${planet2Sign}, ${planet3} -> ${planet3Sign}`
215
215
  );
216
216
 
217
217
  // 🔍 Ensure Concept Combination exists
@@ -251,21 +251,34 @@ export class ConceptService {
251
251
  `✅ Using conceptCombinationId: ${conceptCombinationId} for ${conceptSlug}:${combinationString}`
252
252
  );
253
253
 
254
- console.log(`Requesting Leonardo AI image generation...`);
254
+ console.log(`🎨 Requesting Leonardo AI image generation...`);
255
+
256
+ // 🔍 Check if there is a valid init image
257
+ const initImageId = leonardoInitImages.concepts[conceptSlug]?.imageId;
258
+ const controlNets = initImageId
259
+ ? ([
260
+ {
261
+ initImageId,
262
+ initImageType: 'UPLOADED',
263
+ preprocessorId: 100, // Content reference
264
+ strengthType: 'Low',
265
+ },
266
+ ] as Array<{
267
+ initImageId: string;
268
+ initImageType: 'UPLOADED' | 'GENERATED';
269
+ preprocessorId: number;
270
+ strengthType: 'Low' | 'Mid' | 'High';
271
+ }>)
272
+ : [];
273
+
274
+ // 🎨 Call Leonardo with or without ControlNet
255
275
  const leonardoResponse = await this.context
256
276
  .api()
257
277
  .callLeonardo.generateImage({
258
278
  prompt: concept.leonardoPrompt,
259
279
  width,
260
280
  height,
261
- controlNets: [
262
- {
263
- initImageId: leonardoInitImages.concepts[conceptSlug].imageId,
264
- initImageType: 'UPLOADED',
265
- preprocessorId: 100, // content reference
266
- strengthType: 'Low',
267
- },
268
- ],
281
+ ...(controlNets.length > 0 ? { controlNets } : {}),
269
282
  });
270
283
 
271
284
  const generationId = leonardoResponse?.sdGenerationJob?.generationId;
@@ -290,7 +303,7 @@ export class ConceptService {
290
303
  );
291
304
 
292
305
  console.log(
293
- `Leonardo AI image generation triggered for ${conceptSlug}:${combinationString}, tracking ID: ${generationId}`
306
+ `🎨 Leonardo AI image generation triggered for ${conceptSlug}:${combinationString}, tracking ID: ${generationId}`
294
307
  );
295
308
  }
296
309
  /**
@@ -1,5 +1,5 @@
1
1
  import { inject, injectable } from 'inversify';
2
- import { ConceptPhase } from '../../types';
2
+ import { Concept, ConceptPhase } from '../../types';
3
3
  import { ConceptService } from '../services/ConceptService';
4
4
 
5
5
  @injectable()
@@ -7,7 +7,7 @@ export class ConceptWorkflow {
7
7
  constructor(@inject(ConceptService) private conceptService: ConceptService) {}
8
8
 
9
9
  async processSingle(
10
- conceptSlug: string,
10
+ conceptSlug: Concept,
11
11
  combinationString: string,
12
12
  phase: ConceptPhase
13
13
  ) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.107",
3
+ "version": "0.0.109",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -32,6 +32,7 @@ export interface LeonardoGenerateImageParams {
32
32
  strengthType: 'Low' | 'Mid' | 'High';
33
33
  }>;
34
34
  quantity?: number;
35
+ negPrompt?: string | null;
35
36
  }
36
37
 
37
38
  export type HouseCuspsReport = {
@@ -13,14 +13,12 @@ export const leonardoInitImages: LeonardoInitImages = {
13
13
  'https://cdn.leonardo.ai/users/b117a933-e5c9-45b2-96aa-4b619c2d74ba/initImages/744169ef-3db4-416d-86dd-9bd814e33432.jpg',
14
14
  },
15
15
  amulet: {
16
- imageId: '450076a1-c6bb-4877-8a0b-c0d3ba72fca7',
17
- imageUrl:
18
- 'https://cdn.leonardo.ai/users/b117a933-e5c9-45b2-96aa-4b619c2d74ba/initImages/450076a1-c6bb-4877-8a0b-c0d3ba72fca7.jpg',
16
+ imageId: null,
17
+ imageUrl: null,
19
18
  },
20
19
  lantern: {
21
- imageId: '450076a1-c6bb-4877-8a0b-c0d3ba72fca7',
22
- imageUrl:
23
- 'https://cdn.leonardo.ai/users/b117a933-e5c9-45b2-96aa-4b619c2d74ba/initImages/450076a1-c6bb-4877-8a0b-c0d3ba72fca7.jpg',
20
+ imageId: null,
21
+ imageUrl: null,
24
22
  },
25
23
  orb: {
26
24
  imageId: '450076a1-c6bb-4877-8a0b-c0d3ba72fca7',
@@ -37,7 +35,7 @@ export const leonardoInitImages: LeonardoInitImages = {
37
35
 
38
36
  type ConceptsInitImages = Record<
39
37
  Concept,
40
- { imageId: string; imageUrl: string }
38
+ { imageId: string | null; imageUrl: string | null }
41
39
  >;
42
40
 
43
41
  type LeonardoInitImages = {