@zodic/shared 0.0.334 → 0.0.336
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 +10 -8
- package/package.json +1 -1
- package/types/scopes/generic.ts +2 -4
- package/types/scopes/legacy.ts +3 -3
package/app/api/index.ts
CHANGED
|
@@ -311,7 +311,7 @@ export const Api = (env: BackendBindings) => ({
|
|
|
311
311
|
preprocessorId: net.preprocessorId,
|
|
312
312
|
};
|
|
313
313
|
|
|
314
|
-
if (net.preprocessorId
|
|
314
|
+
if (net.preprocessorId == 100 || net.preprocessorId == 133) {
|
|
315
315
|
return { ...baseNet, strengthType: net.strengthType };
|
|
316
316
|
} else if (net.preprocessorId === 19) {
|
|
317
317
|
return { ...baseNet, weight: net.weight };
|
|
@@ -347,7 +347,9 @@ export const Api = (env: BackendBindings) => ({
|
|
|
347
347
|
}
|
|
348
348
|
},
|
|
349
349
|
|
|
350
|
-
generatePresignedUrl: async (
|
|
350
|
+
generatePresignedUrl: async (
|
|
351
|
+
extension: string
|
|
352
|
+
): Promise<{
|
|
351
353
|
id: string;
|
|
352
354
|
fields: string;
|
|
353
355
|
key: string;
|
|
@@ -358,14 +360,14 @@ export const Api = (env: BackendBindings) => ({
|
|
|
358
360
|
Authorization: `Bearer ${env.LEONARDO_API_KEY}`,
|
|
359
361
|
'Content-Type': 'application/json',
|
|
360
362
|
};
|
|
361
|
-
|
|
363
|
+
|
|
362
364
|
try {
|
|
363
365
|
const response = await fetch(endpoint, {
|
|
364
366
|
method: 'POST',
|
|
365
367
|
headers,
|
|
366
368
|
body: JSON.stringify({ extension }), // Include the extension in the request body
|
|
367
369
|
});
|
|
368
|
-
|
|
370
|
+
|
|
369
371
|
if (!response.ok) {
|
|
370
372
|
const error = await response.json();
|
|
371
373
|
console.error(
|
|
@@ -374,10 +376,10 @@ export const Api = (env: BackendBindings) => ({
|
|
|
374
376
|
);
|
|
375
377
|
throw new Error(`Leonardo API Error: ${response.status}`);
|
|
376
378
|
}
|
|
377
|
-
|
|
378
|
-
const data = await response.json() as any;
|
|
379
|
+
|
|
380
|
+
const data = (await response.json()) as any;
|
|
379
381
|
const result = data.uploadInitImage;
|
|
380
|
-
|
|
382
|
+
|
|
381
383
|
if (
|
|
382
384
|
!result ||
|
|
383
385
|
!result.id ||
|
|
@@ -388,7 +390,7 @@ export const Api = (env: BackendBindings) => ({
|
|
|
388
390
|
console.error('❌ Invalid response from Leonardo API:', data);
|
|
389
391
|
throw new Error('Invalid response structure from Leonardo API');
|
|
390
392
|
}
|
|
391
|
-
|
|
393
|
+
|
|
392
394
|
return {
|
|
393
395
|
id: result.id,
|
|
394
396
|
fields: result.fields,
|
package/package.json
CHANGED
package/types/scopes/generic.ts
CHANGED
|
@@ -416,8 +416,7 @@ export type ControlNetConfig =
|
|
|
416
416
|
initImageId: string;
|
|
417
417
|
initImageType: 'UPLOADED' | 'GENERATED';
|
|
418
418
|
preprocessorId: 100;
|
|
419
|
-
strengthType
|
|
420
|
-
weight?: number;
|
|
419
|
+
strengthType: ControlNetStrenghtType;
|
|
421
420
|
}
|
|
422
421
|
| {
|
|
423
422
|
initImageId: string;
|
|
@@ -429,8 +428,7 @@ export type ControlNetConfig =
|
|
|
429
428
|
initImageId: string;
|
|
430
429
|
initImageType: 'UPLOADED' | 'GENERATED';
|
|
431
430
|
preprocessorId: 133;
|
|
432
|
-
strengthType
|
|
433
|
-
weight?: number;
|
|
431
|
+
strengthType: ControlNetStrenghtType;
|
|
434
432
|
};
|
|
435
433
|
|
|
436
434
|
export type PlacementObject = {
|
package/types/scopes/legacy.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { pointNameMap } from '../../utils/astroPrompts/pointNameMap';
|
|
2
2
|
import { BackendBindings } from './cloudflare';
|
|
3
|
-
import { ControlNet, Gender } from './generic';
|
|
3
|
+
import { ControlNet, ControlNetConfig, Gender } from './generic';
|
|
4
4
|
|
|
5
5
|
export const zodiacSigns = [
|
|
6
6
|
'aries',
|
|
@@ -163,7 +163,7 @@ export interface LeonardoGenerateImageParams {
|
|
|
163
163
|
prompt: string;
|
|
164
164
|
width: number;
|
|
165
165
|
height: number;
|
|
166
|
-
controlNets?: Array<
|
|
166
|
+
controlNets?: Array<ControlNetConfig>;
|
|
167
167
|
quantity?: number;
|
|
168
168
|
negPrompt?: string | null;
|
|
169
169
|
}
|
|
@@ -301,7 +301,7 @@ export interface LeonardoRequestBody {
|
|
|
301
301
|
modelId: string;
|
|
302
302
|
presetStyle: string;
|
|
303
303
|
alchemy: boolean;
|
|
304
|
-
controlnets?: Array<
|
|
304
|
+
controlnets?: Array<ControlNetConfig>;
|
|
305
305
|
init_generation_image_id?: string;
|
|
306
306
|
init_strength?: number;
|
|
307
307
|
}
|