@zodic/shared 0.0.375 → 0.0.377

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.
@@ -791,7 +791,7 @@ export class ArchetypeService {
791
791
  );
792
792
  const contentResponse = await this.context
793
793
  .api()
794
- .callTogether.single(contentMessages, {});
794
+ .callTogether.single(contentMessages, { max_tokens: 10000 });
795
795
  if (!contentResponse) {
796
796
  await this.log(
797
797
  'error',
@@ -1,8 +1,8 @@
1
+ import { and, eq } from 'drizzle-orm';
1
2
  import { inject, injectable } from 'inversify';
2
- import { AppContext } from '../base';
3
- import { Gender, Languages } from '../../types';
4
3
  import { ArchetypeService, LeonardoService, schema } from '../..';
5
- import { and, eq } from 'drizzle-orm';
4
+ import { Gender, Languages } from '../../types';
5
+ import { AppContext } from '../base';
6
6
 
7
7
  @injectable()
8
8
  export class ArchetypeWorkflow {
@@ -38,8 +38,17 @@ export class ArchetypeWorkflow {
38
38
 
39
39
  try {
40
40
  // Step 1: Generate archetype names for both genders
41
- await this.log('debug', 'Generating archetype names', { combinationString, override, userId });
42
- await this.archetypeService.generateArchetypeNames(combinationString, override);
41
+ if (override) {
42
+ await this.log('debug', 'Generating archetype names', {
43
+ combinationString,
44
+ override,
45
+ userId,
46
+ });
47
+ await this.archetypeService.generateArchetypeNames(
48
+ combinationString,
49
+ override
50
+ );
51
+ }
43
52
 
44
53
  // Step 2: Generate descriptions and virtues for both genders
45
54
  await this.log('debug', 'Generating descriptions and virtues', {
@@ -49,12 +58,13 @@ export class ArchetypeWorkflow {
49
58
  override,
50
59
  userId,
51
60
  });
52
- const descriptions = await this.archetypeService.generateDescriptionsAndVirtues(
53
- combinationString,
54
- gender, // Service processes both genders internally
55
- language,
56
- override
57
- );
61
+ const descriptions =
62
+ await this.archetypeService.generateDescriptionsAndVirtues(
63
+ combinationString,
64
+ gender, // Service processes both genders internally
65
+ language,
66
+ override
67
+ );
58
68
 
59
69
  // Step 3: Generate content for both genders
60
70
  await this.log('debug', 'Generating content', {
@@ -102,50 +112,70 @@ export class ArchetypeWorkflow {
102
112
  );
103
113
 
104
114
  if (archetypes.length !== 3) {
105
- await this.log('error', `Expected 3 archetypes for ${gender}, found ${archetypes.length}`, {
106
- combinationString,
107
- gender,
108
- language,
109
- userId,
110
- });
115
+ await this.log(
116
+ 'error',
117
+ `Expected 3 archetypes for ${gender}, found ${archetypes.length}`,
118
+ {
119
+ combinationString,
120
+ gender,
121
+ language,
122
+ userId,
123
+ }
124
+ );
111
125
  throw new Error(
112
126
  `Expected 3 archetypes for combination ${combinationString}, gender ${gender}, language ${language}, but found ${archetypes.length}`
113
127
  );
114
128
  }
115
129
 
116
130
  // Step 6: Process image generation only for the requested gender
117
- await this.log('info', `Processing image generation for gender ${gender}`, {
118
- archetypeIds: archetypes.map((a) => a.id),
119
- archetypeIndexes: archetypes.map((a) => a.archetypeIndex),
120
- userId,
121
- });
131
+ await this.log(
132
+ 'info',
133
+ `Processing image generation for gender ${gender}`,
134
+ {
135
+ archetypeIds: archetypes.map((a) => a.id),
136
+ archetypeIndexes: archetypes.map((a) => a.archetypeIndex),
137
+ userId,
138
+ }
139
+ );
122
140
  for (const archetype of archetypes) {
123
141
  if (!archetype.leonardoPrompt) {
124
- await this.log('warn', `No Leonardo prompt for archetype ${archetype.id}`, {
125
- archetypeIndex: archetype.archetypeIndex,
126
- gender,
127
- language,
128
- userId,
129
- });
142
+ await this.log(
143
+ 'warn',
144
+ `No Leonardo prompt for archetype ${archetype.id}`,
145
+ {
146
+ archetypeIndex: archetype.archetypeIndex,
147
+ gender,
148
+ language,
149
+ userId,
150
+ }
151
+ );
130
152
  continue;
131
153
  }
132
154
 
133
155
  if (override || !archetype.images || archetype.images === '[]') {
134
- await this.log('debug', `Queueing image generation for archetype ${archetype.id}`, {
135
- archetypeIndex: archetype.archetypeIndex,
136
- gender,
137
- language,
138
- userId,
139
- });
156
+ await this.log(
157
+ 'debug',
158
+ `Queueing image generation for archetype ${archetype.id}`,
159
+ {
160
+ archetypeIndex: archetype.archetypeIndex,
161
+ gender,
162
+ language,
163
+ userId,
164
+ }
165
+ );
140
166
  await this.leonardoService.processArchetypePopulation(archetype.id);
141
167
  } else {
142
- await this.log('debug', `Skipping image generation for archetype ${archetype.id}`, {
143
- reason: 'Images already exist and override is false',
144
- archetypeIndex: archetype.archetypeIndex,
145
- gender,
146
- language,
147
- userId,
148
- });
168
+ await this.log(
169
+ 'debug',
170
+ `Skipping image generation for archetype ${archetype.id}`,
171
+ {
172
+ reason: 'Images already exist and override is false',
173
+ archetypeIndex: archetype.archetypeIndex,
174
+ gender,
175
+ language,
176
+ userId,
177
+ }
178
+ );
149
179
  }
150
180
  }
151
181
 
@@ -163,13 +193,17 @@ export class ArchetypeWorkflow {
163
193
  const images = archetype.images ? JSON.parse(archetype.images) : [];
164
194
  imageCount = Array.isArray(images) ? images.length : 0;
165
195
  } catch (error) {
166
- await this.log('warn', `Failed to parse images for archetype ${archetype.id}`, {
167
- archetypeIndex: archetype.archetypeIndex,
168
- gender,
169
- language,
170
- userId,
171
- error: error instanceof Error ? error.message : String(error),
172
- });
196
+ await this.log(
197
+ 'warn',
198
+ `Failed to parse images for archetype ${archetype.id}`,
199
+ {
200
+ archetypeIndex: archetype.archetypeIndex,
201
+ gender,
202
+ language,
203
+ userId,
204
+ error: error instanceof Error ? error.message : String(error),
205
+ }
206
+ );
173
207
  continue;
174
208
  }
175
209
 
@@ -185,24 +219,35 @@ export class ArchetypeWorkflow {
185
219
  eq(schema.archetypesData.id, archetype.id),
186
220
  eq(schema.archetypesData.gender, gender),
187
221
  eq(schema.archetypesData.language, language),
188
- eq(schema.archetypesData.archetypeIndex, archetype.archetypeIndex)
222
+ eq(
223
+ schema.archetypesData.archetypeIndex,
224
+ archetype.archetypeIndex
225
+ )
189
226
  )
190
227
  );
191
- await this.log('info', `Updated status to 'completed' for archetype ${archetype.id}`, {
192
- archetypeIndex: archetype.archetypeIndex,
193
- gender,
194
- language,
195
- imageCount,
196
- userId,
197
- });
228
+ await this.log(
229
+ 'info',
230
+ `Updated status to 'completed' for archetype ${archetype.id}`,
231
+ {
232
+ archetypeIndex: archetype.archetypeIndex,
233
+ gender,
234
+ language,
235
+ imageCount,
236
+ userId,
237
+ }
238
+ );
198
239
  } else {
199
- await this.log('debug', `Skipping status update for archetype ${archetype.id}`, {
200
- reason: `Fewer than 3 images (found ${imageCount})`,
201
- archetypeIndex: archetype.archetypeIndex,
202
- gender,
203
- language,
204
- userId,
205
- });
240
+ await this.log(
241
+ 'debug',
242
+ `Skipping status update for archetype ${archetype.id}`,
243
+ {
244
+ reason: `Fewer than 3 images (found ${imageCount})`,
245
+ archetypeIndex: archetype.archetypeIndex,
246
+ gender,
247
+ language,
248
+ userId,
249
+ }
250
+ );
206
251
  }
207
252
  }
208
253
 
@@ -223,4 +268,4 @@ export class ArchetypeWorkflow {
223
268
  throw error;
224
269
  }
225
270
  }
226
- }
271
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.375",
3
+ "version": "0.0.377",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -347,7 +347,12 @@ export const ConceptPhases: Record<string, ConceptPhase> = {
347
347
  IMAGES: 'images',
348
348
  };
349
349
 
350
- export type DeepSeekOptions = { model?: string; options?: Record<string, any>, temperature?: number};
350
+ export type DeepSeekOptions = {
351
+ model?: string;
352
+ options?: Record<string, any>;
353
+ temperature?: number;
354
+ max_tokens?: number;
355
+ };
351
356
  export type DeepSeekBatchInputItem = {
352
357
  messages: ChatMessages;
353
358
  options?: DeepSeekOptions;
@@ -644,9 +649,9 @@ export interface Usage {
644
649
  }
645
650
 
646
651
  export enum Status {
647
- Completed = "Completed",
648
- Failed = "Failed",
649
- Pending = "Pending",
650
- Processing = "Processing",
651
- Staged = "Staged",
652
- }
652
+ Completed = 'Completed',
653
+ Failed = 'Failed',
654
+ Pending = 'Pending',
655
+ Processing = 'Processing',
656
+ Staged = 'Staged',
657
+ }