@zodic/shared 0.0.381 → 0.0.383
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.
|
@@ -108,6 +108,51 @@ export class LeonardoService {
|
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
// Check if a generation already exists for this archetypeDataId
|
|
112
|
+
const existingGeneration = await db
|
|
113
|
+
.select()
|
|
114
|
+
.from(schema.generations)
|
|
115
|
+
.where(eq(schema.generations.archetypeDataId, archetypeDataId))
|
|
116
|
+
.limit(1)
|
|
117
|
+
.execute();
|
|
118
|
+
|
|
119
|
+
if (existingGeneration.length > 0) {
|
|
120
|
+
const generationStatus = existingGeneration[0].status;
|
|
121
|
+
if (generationStatus !== 'failed' && generationStatus !== 'completed') {
|
|
122
|
+
await this.log(
|
|
123
|
+
'info',
|
|
124
|
+
'Skipping image generation: existing generation in progress',
|
|
125
|
+
{
|
|
126
|
+
archetypeDataId,
|
|
127
|
+
generationId: existingGeneration[0].id,
|
|
128
|
+
status: generationStatus,
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
return;
|
|
132
|
+
} else if (generationStatus === 'completed') {
|
|
133
|
+
await this.log(
|
|
134
|
+
'info',
|
|
135
|
+
'Skipping image generation: existing generation completed',
|
|
136
|
+
{
|
|
137
|
+
archetypeDataId,
|
|
138
|
+
generationId: existingGeneration[0].id,
|
|
139
|
+
status: generationStatus,
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
// If status is 'failed', proceed with new generation
|
|
145
|
+
await this.log(
|
|
146
|
+
'warn',
|
|
147
|
+
'Retrying image generation: previous generation failed',
|
|
148
|
+
{
|
|
149
|
+
archetypeDataId,
|
|
150
|
+
previousGenerationId: existingGeneration[0].id,
|
|
151
|
+
previousStatus: generationStatus,
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
111
156
|
await this.log('debug', 'Generating images for archetype', {
|
|
112
157
|
archetypeDataId,
|
|
113
158
|
prompt: leonardoPrompt,
|