studio-lumiere-cli 0.1.0
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/.agents/skills/annotate-image/SKILL.md +99 -0
- package/.agents/skills/config-troubleshooting/SKILL.md +97 -0
- package/.agents/skills/generate-images/SKILL.md +667 -0
- package/.agents/skills/generate-video/SKILL.md +328 -0
- package/.agents/skills/image-grid/SKILL.md +96 -0
- package/.agents/skills/image-overlay/SKILL.md +66 -0
- package/.agents/skills/image-overlay/agents/openai.yaml +4 -0
- package/.agents/skills/image-overlay/scripts/overlay-image.js +218 -0
- package/.agents/skills/muse-management/SKILL.md +232 -0
- package/.agents/skills/refine-images/SKILL.md +192 -0
- package/.agents/skills/tired-girl/SKILL.md +131 -0
- package/.env.example +2 -0
- package/AGENTS.md +66 -0
- package/README.md +96 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +214 -0
- package/dist/cli.js.map +1 -0
- package/dist/clients/geminiClient.d.ts +37 -0
- package/dist/clients/geminiClient.js +129 -0
- package/dist/clients/geminiClient.js.map +1 -0
- package/dist/config/constants.d.ts +63 -0
- package/dist/config/constants.js +1005 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/options.d.ts +1 -0
- package/dist/config/options.js +2 -0
- package/dist/config/options.js.map +1 -0
- package/dist/config/templates.d.ts +3 -0
- package/dist/config/templates.js +4 -0
- package/dist/config/templates.js.map +1 -0
- package/dist/config/tiredGirl.d.ts +3 -0
- package/dist/config/tiredGirl.js +9 -0
- package/dist/config/tiredGirl.js.map +1 -0
- package/dist/image/annotate.d.ts +2 -0
- package/dist/image/annotate.js +119 -0
- package/dist/image/annotate.js.map +1 -0
- package/dist/image/grid.d.ts +2 -0
- package/dist/image/grid.js +44 -0
- package/dist/image/grid.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/pipelines/createMuse.d.ts +3 -0
- package/dist/pipelines/createMuse.js +49 -0
- package/dist/pipelines/createMuse.js.map +1 -0
- package/dist/pipelines/generateImages.d.ts +2 -0
- package/dist/pipelines/generateImages.js +140 -0
- package/dist/pipelines/generateImages.js.map +1 -0
- package/dist/pipelines/generateTiredGirl.d.ts +2 -0
- package/dist/pipelines/generateTiredGirl.js +73 -0
- package/dist/pipelines/generateTiredGirl.js.map +1 -0
- package/dist/pipelines/generateVideo.d.ts +2 -0
- package/dist/pipelines/generateVideo.js +27 -0
- package/dist/pipelines/generateVideo.js.map +1 -0
- package/dist/pipelines/refineImage.d.ts +2 -0
- package/dist/pipelines/refineImage.js +28 -0
- package/dist/pipelines/refineImage.js.map +1 -0
- package/dist/pipelines/resolve.d.ts +11 -0
- package/dist/pipelines/resolve.js +74 -0
- package/dist/pipelines/resolve.js.map +1 -0
- package/dist/pipelines/upscaleImage.d.ts +2 -0
- package/dist/pipelines/upscaleImage.js +23 -0
- package/dist/pipelines/upscaleImage.js.map +1 -0
- package/dist/prompt/buildPrompt.d.ts +4 -0
- package/dist/prompt/buildPrompt.js +322 -0
- package/dist/prompt/buildPrompt.js.map +1 -0
- package/dist/prompt/tiredGirlPrompt.d.ts +3 -0
- package/dist/prompt/tiredGirlPrompt.js +33 -0
- package/dist/prompt/tiredGirlPrompt.js.map +1 -0
- package/dist/storage/files.d.ts +15 -0
- package/dist/storage/files.js +34 -0
- package/dist/storage/files.js.map +1 -0
- package/dist/storage/museStore.d.ts +5 -0
- package/dist/storage/museStore.js +26 -0
- package/dist/storage/museStore.js.map +1 -0
- package/dist/types.d.ts +169 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/examples/generate.d.ts +1 -0
- package/examples/generate.js +28 -0
- package/examples/generate.js.map +1 -0
- package/examples/generate.ts +30 -0
- package/examples/muse.d.ts +1 -0
- package/examples/muse.js +18 -0
- package/examples/muse.js.map +1 -0
- package/examples/muse.ts +20 -0
- package/examples/video.d.ts +1 -0
- package/examples/video.js +18 -0
- package/examples/video.js.map +1 -0
- package/examples/video.ts +20 -0
- package/logo-round.png +0 -0
- package/logo.jpeg +0 -0
- package/package.json +27 -0
- package/src/cli.ts +259 -0
- package/src/clients/geminiClient.ts +168 -0
- package/src/config/constants.ts +1105 -0
- package/src/config/options.ts +15 -0
- package/src/config/templates.ts +4 -0
- package/src/config/tiredGirl.ts +11 -0
- package/src/image/annotate.ts +139 -0
- package/src/image/grid.ts +58 -0
- package/src/index.ts +27 -0
- package/src/pipelines/createMuse.ts +76 -0
- package/src/pipelines/generateImages.ts +203 -0
- package/src/pipelines/generateTiredGirl.ts +86 -0
- package/src/pipelines/generateVideo.ts +36 -0
- package/src/pipelines/refineImage.ts +36 -0
- package/src/pipelines/resolve.ts +88 -0
- package/src/pipelines/upscaleImage.ts +30 -0
- package/src/prompt/buildPrompt.ts +380 -0
- package/src/prompt/tiredGirlPrompt.ts +35 -0
- package/src/storage/files.ts +41 -0
- package/src/storage/museStore.ts +31 -0
- package/src/types.ts +198 -0
- package/tsconfig.json +15 -0
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "dotenv/config";
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { generateImages, refineImage, upscaleImage, generateTiredGirl, createMuse, generateVideo, annotateImage, createImageGrid, TEMPLATES, ETHNICITIES, SKIN_TONES, HAIR_COLORS, BACKGROUNDS, BACKGROUND_TYPES, VIBES, RESOLUTIONS, OCCASIONS } from "./index.js";
|
|
5
|
+
const program = new Command();
|
|
6
|
+
const parseList = (value) => value.split(",").map((v) => v.trim()).filter(Boolean);
|
|
7
|
+
const loadConfig = () => {
|
|
8
|
+
const apiKey = process.env.GEMINI_API_KEY;
|
|
9
|
+
if (!apiKey) {
|
|
10
|
+
throw new Error("Missing GEMINI_API_KEY in environment.");
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
apiKey,
|
|
14
|
+
outputDir: process.env.LUMIERE_OUTPUT_DIR ?? "outputs"
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
program
|
|
18
|
+
.name("lumiere")
|
|
19
|
+
.description("Local Studio Lumiere SDK + CLI")
|
|
20
|
+
.version("0.1.0");
|
|
21
|
+
program
|
|
22
|
+
.command("list")
|
|
23
|
+
.argument("type", "templates|ethnicities|skin-tones|hair-colors|backgrounds|background-types|vibes|resolutions|occasions")
|
|
24
|
+
.action((type) => {
|
|
25
|
+
const map = {
|
|
26
|
+
templates: TEMPLATES,
|
|
27
|
+
ethnicities: ETHNICITIES,
|
|
28
|
+
"skin-tones": SKIN_TONES,
|
|
29
|
+
"hair-colors": HAIR_COLORS,
|
|
30
|
+
backgrounds: BACKGROUNDS,
|
|
31
|
+
"background-types": BACKGROUND_TYPES,
|
|
32
|
+
vibes: VIBES,
|
|
33
|
+
resolutions: RESOLUTIONS,
|
|
34
|
+
occasions: OCCASIONS
|
|
35
|
+
};
|
|
36
|
+
const payload = map[type];
|
|
37
|
+
if (!payload) {
|
|
38
|
+
throw new Error(`Unknown list type: ${type}`);
|
|
39
|
+
}
|
|
40
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
41
|
+
});
|
|
42
|
+
program
|
|
43
|
+
.command("generate")
|
|
44
|
+
.requiredOption("--images <paths>", "Comma-separated image paths")
|
|
45
|
+
.requiredOption("--template <id>", "Template id")
|
|
46
|
+
.option("--detail <id>")
|
|
47
|
+
.option("--secondary-detail <id>")
|
|
48
|
+
.option("--tertiary-detail <id>")
|
|
49
|
+
.option("--ethnicity <id>")
|
|
50
|
+
.option("--skin-tone <id>")
|
|
51
|
+
.option("--hair-color <id>")
|
|
52
|
+
.option("--background <id>")
|
|
53
|
+
.option("--background-type <id>")
|
|
54
|
+
.option("--vibe <id>")
|
|
55
|
+
.option("--resolution <id>")
|
|
56
|
+
.option("--occasion <id>")
|
|
57
|
+
.option("--quantity <n>", "Number of images", "1")
|
|
58
|
+
.option("--muse-id <id>")
|
|
59
|
+
.option("--muse-images <paths>", "Comma-separated muse image paths")
|
|
60
|
+
.option("--no-enhance", "Skip prompt enhancement")
|
|
61
|
+
.action(async (options) => {
|
|
62
|
+
const config = loadConfig();
|
|
63
|
+
const result = await generateImages(config, {
|
|
64
|
+
inputImages: parseList(options.images),
|
|
65
|
+
quantity: Number(options.quantity),
|
|
66
|
+
selections: {
|
|
67
|
+
templateId: options.template,
|
|
68
|
+
detailId: options.detail,
|
|
69
|
+
secondaryDetailId: options.secondaryDetail,
|
|
70
|
+
tertiaryDetailId: options.tertiaryDetail,
|
|
71
|
+
ethnicityId: options.ethnicity,
|
|
72
|
+
skinToneId: options.skinTone,
|
|
73
|
+
hairColorId: options.hairColor,
|
|
74
|
+
backgroundId: options.background,
|
|
75
|
+
backgroundTypeId: options.backgroundType,
|
|
76
|
+
vibeId: options.vibe,
|
|
77
|
+
resolutionId: options.resolution,
|
|
78
|
+
occasionId: options.occasion
|
|
79
|
+
},
|
|
80
|
+
museId: options.museId,
|
|
81
|
+
museImagePaths: options.museImages ? parseList(options.museImages) : undefined,
|
|
82
|
+
enhancePrompt: options.enhance
|
|
83
|
+
});
|
|
84
|
+
console.log(JSON.stringify(result, null, 2));
|
|
85
|
+
});
|
|
86
|
+
program
|
|
87
|
+
.command("refine")
|
|
88
|
+
.requiredOption("--image <path>")
|
|
89
|
+
.requiredOption("--instruction <text>")
|
|
90
|
+
.option("--size <percent>")
|
|
91
|
+
.action(async (options) => {
|
|
92
|
+
const config = loadConfig();
|
|
93
|
+
const output = await refineImage(config, {
|
|
94
|
+
inputImage: options.image,
|
|
95
|
+
instruction: options.instruction,
|
|
96
|
+
sizeAdjustment: options.size ? Number(options.size) : undefined
|
|
97
|
+
});
|
|
98
|
+
console.log(output);
|
|
99
|
+
});
|
|
100
|
+
program
|
|
101
|
+
.command("upscale")
|
|
102
|
+
.requiredOption("--image <path>")
|
|
103
|
+
.option("--scale <number>", "Scale factor", "2")
|
|
104
|
+
.action(async (options) => {
|
|
105
|
+
const config = loadConfig();
|
|
106
|
+
const output = await upscaleImage(config, {
|
|
107
|
+
inputImage: options.image,
|
|
108
|
+
scale: Number(options.scale)
|
|
109
|
+
});
|
|
110
|
+
console.log(output);
|
|
111
|
+
});
|
|
112
|
+
program
|
|
113
|
+
.command("muse")
|
|
114
|
+
.requiredOption("--name <name>")
|
|
115
|
+
.requiredOption("--source <path>")
|
|
116
|
+
.option("--variations <n>", "Number of variations", "3")
|
|
117
|
+
.action(async (options) => {
|
|
118
|
+
const config = loadConfig();
|
|
119
|
+
const result = await createMuse(config, {
|
|
120
|
+
name: options.name,
|
|
121
|
+
sourceImage: options.source,
|
|
122
|
+
variations: Number(options.variations)
|
|
123
|
+
});
|
|
124
|
+
console.log(JSON.stringify(result, null, 2));
|
|
125
|
+
});
|
|
126
|
+
program
|
|
127
|
+
.command("video")
|
|
128
|
+
.requiredOption("--prompt <text>")
|
|
129
|
+
.option("--aspect <ratio>")
|
|
130
|
+
.option("--duration <seconds>")
|
|
131
|
+
.action(async (options) => {
|
|
132
|
+
const config = loadConfig();
|
|
133
|
+
const result = await generateVideo(config, {
|
|
134
|
+
prompt: options.prompt,
|
|
135
|
+
aspectRatio: options.aspect,
|
|
136
|
+
durationSeconds: options.duration ? Number(options.duration) : undefined
|
|
137
|
+
});
|
|
138
|
+
console.log(JSON.stringify(result, null, 2));
|
|
139
|
+
});
|
|
140
|
+
program
|
|
141
|
+
.command("tired-girl")
|
|
142
|
+
.option("--muse-id <id>", "Muse ID (preferred)")
|
|
143
|
+
.option("--image <path>", "Single reference image (used if no muse-id)")
|
|
144
|
+
.option("--styles <ids>", "Comma-separated style IDs")
|
|
145
|
+
.option("--quantity <n>", "Number of variants", "1")
|
|
146
|
+
.action(async (options) => {
|
|
147
|
+
const config = loadConfig();
|
|
148
|
+
const result = await generateTiredGirl(config, {
|
|
149
|
+
museId: options.museId,
|
|
150
|
+
inputImage: options.image,
|
|
151
|
+
styleIds: options.styles ? parseList(options.styles) : undefined,
|
|
152
|
+
quantity: Number(options.quantity)
|
|
153
|
+
});
|
|
154
|
+
console.log(JSON.stringify(result, null, 2));
|
|
155
|
+
});
|
|
156
|
+
program
|
|
157
|
+
.command("annotate")
|
|
158
|
+
.requiredOption("--input <path>", "Input image path")
|
|
159
|
+
.requiredOption("--output <path>", "Output image path")
|
|
160
|
+
.requiredOption("--text <text>", "Overlay text")
|
|
161
|
+
.option("--font <name>", "Font family (default: Poppins)")
|
|
162
|
+
.option("--size <px>", "Font size in px")
|
|
163
|
+
.option("--weight <n>", "Font weight (default: 700)")
|
|
164
|
+
.option("--color <hex>", "Text color (default: #FFFFFF)")
|
|
165
|
+
.option("--stroke-color <value>", "Stroke/outline color (default: rgba(0,0,0,0.6))")
|
|
166
|
+
.option("--stroke-width <px>", "Stroke/outline width (default: fontSize * 0.08)")
|
|
167
|
+
.option("--banner", "Enable semi-transparent banner behind text")
|
|
168
|
+
.option("--banner-color <value>", "Banner color (default: rgba(0,0,0,0.45))")
|
|
169
|
+
.option("--banner-padding <px>", "Banner padding (default: fontSize * 0.6)")
|
|
170
|
+
.option("--banner-radius <px>", "Banner corner radius (default: fontSize * 0.4)")
|
|
171
|
+
.option("--position <pos>", "top-center|top-left|top-right|bottom-center|bottom-center-high|bottom-left|bottom-right|center")
|
|
172
|
+
.option("--padding <px>", "Padding from edges")
|
|
173
|
+
.option("--max-width <ratio>", "Max width ratio (0-1)")
|
|
174
|
+
.action(async (options) => {
|
|
175
|
+
await annotateImage(options.input, options.output, options.text, {
|
|
176
|
+
fontFamily: options.font,
|
|
177
|
+
fontSize: options.size ? Number(options.size) : undefined,
|
|
178
|
+
fontWeight: options.weight ? Number(options.weight) : undefined,
|
|
179
|
+
color: options.color,
|
|
180
|
+
strokeColor: options.strokeColor,
|
|
181
|
+
strokeWidth: options.strokeWidth ? Number(options.strokeWidth) : undefined,
|
|
182
|
+
banner: options.banner ?? false,
|
|
183
|
+
bannerColor: options.bannerColor,
|
|
184
|
+
bannerPadding: options.bannerPadding ? Number(options.bannerPadding) : undefined,
|
|
185
|
+
bannerRadius: options.bannerRadius ? Number(options.bannerRadius) : undefined,
|
|
186
|
+
position: options.position,
|
|
187
|
+
padding: options.padding ? Number(options.padding) : undefined,
|
|
188
|
+
maxWidthRatio: options.maxWidth ? Number(options.maxWidth) : undefined
|
|
189
|
+
});
|
|
190
|
+
console.log(options.output);
|
|
191
|
+
});
|
|
192
|
+
program
|
|
193
|
+
.command("grid")
|
|
194
|
+
.requiredOption("--inputs <paths>", "Comma-separated image paths")
|
|
195
|
+
.requiredOption("--output <path>", "Output image path")
|
|
196
|
+
.option("--columns <n>", "Number of columns", "2")
|
|
197
|
+
.option("--rows <n>", "Number of rows", "2")
|
|
198
|
+
.option("--padding <px>", "Padding between tiles (default: 20)")
|
|
199
|
+
.option("--background <hex>", "Background color (default: #000000)")
|
|
200
|
+
.option("--tile-width <px>", "Fixed tile width")
|
|
201
|
+
.option("--tile-height <px>", "Fixed tile height")
|
|
202
|
+
.action(async (options) => {
|
|
203
|
+
await createImageGrid(parseList(options.inputs), options.output, {
|
|
204
|
+
columns: Number(options.columns),
|
|
205
|
+
rows: Number(options.rows),
|
|
206
|
+
padding: options.padding ? Number(options.padding) : undefined,
|
|
207
|
+
background: options.background,
|
|
208
|
+
tileWidth: options.tileWidth ? Number(options.tileWidth) : undefined,
|
|
209
|
+
tileHeight: options.tileHeight ? Number(options.tileHeight) : undefined
|
|
210
|
+
});
|
|
211
|
+
console.log(options.output);
|
|
212
|
+
});
|
|
213
|
+
program.parseAsync();
|
|
214
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,cAAc,EACd,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,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B,EAAE,qCAAqC,CAAC;KACnE,MAAM,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;KAC/C,MAAM,CAAC,oBAAoB,EAAE,mBAAmB,CAAC;KACjD,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxB,MAAM,eAAe,CACnB,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EACzB,OAAO,CAAC,MAAM,EACd;QACE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;QAChC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;QAC9D,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS;QACpE,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;KACxE,CACF,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AspectRatio, LumiereConfig } from "../types.js";
|
|
2
|
+
export declare class GeminiClient {
|
|
3
|
+
private ai;
|
|
4
|
+
private models;
|
|
5
|
+
private retry;
|
|
6
|
+
constructor(config: LumiereConfig);
|
|
7
|
+
generateText(prompt: string): Promise<string>;
|
|
8
|
+
generateEnhancedPrompt(params: {
|
|
9
|
+
parts: Array<{
|
|
10
|
+
text?: string;
|
|
11
|
+
inlineData?: {
|
|
12
|
+
mimeType: string;
|
|
13
|
+
data: string;
|
|
14
|
+
};
|
|
15
|
+
}>;
|
|
16
|
+
systemInstruction?: string;
|
|
17
|
+
}): Promise<string>;
|
|
18
|
+
generateImage(params: {
|
|
19
|
+
parts: Array<{
|
|
20
|
+
text?: string;
|
|
21
|
+
inlineData?: {
|
|
22
|
+
mimeType: string;
|
|
23
|
+
data: string;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
26
|
+
aspectRatio?: AspectRatio;
|
|
27
|
+
imageSize?: "1K" | "2K" | "4K";
|
|
28
|
+
}): Promise<string[]>;
|
|
29
|
+
generateVideo(params: {
|
|
30
|
+
prompt: string;
|
|
31
|
+
aspectRatio?: AspectRatio;
|
|
32
|
+
durationSeconds?: number;
|
|
33
|
+
}): Promise<{
|
|
34
|
+
operationName?: string;
|
|
35
|
+
videoBytes?: Uint8Array;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { GoogleGenAI } from "@google/genai";
|
|
2
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
3
|
+
const isRetryableError = (error) => {
|
|
4
|
+
const message = String(error?.message || "").toLowerCase();
|
|
5
|
+
return (message.includes("429") ||
|
|
6
|
+
message.includes("503") ||
|
|
7
|
+
message.includes("overloaded") ||
|
|
8
|
+
message.includes("unavailable") ||
|
|
9
|
+
message.includes("timeout"));
|
|
10
|
+
};
|
|
11
|
+
const withRetry = async (fn, config) => {
|
|
12
|
+
let lastError;
|
|
13
|
+
for (let attempt = 0; attempt <= config.maxRetries; attempt += 1) {
|
|
14
|
+
try {
|
|
15
|
+
return await fn();
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
lastError = error;
|
|
19
|
+
if (attempt === config.maxRetries || !isRetryableError(error)) {
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
const delay = Math.min(config.baseDelayMs * 2 ** attempt, config.maxDelayMs);
|
|
23
|
+
await sleep(delay + Math.random() * 0.3 * delay);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
throw lastError;
|
|
27
|
+
};
|
|
28
|
+
export class GeminiClient {
|
|
29
|
+
ai;
|
|
30
|
+
models;
|
|
31
|
+
retry;
|
|
32
|
+
constructor(config) {
|
|
33
|
+
this.ai = new GoogleGenAI({ apiKey: config.apiKey });
|
|
34
|
+
this.models = {
|
|
35
|
+
prompt: config.models?.prompt ?? "gemini-3-flash-preview",
|
|
36
|
+
image: config.models?.image ?? "gemini-3-pro-image-preview",
|
|
37
|
+
video: config.models?.video ?? "veo-3.1-generate-preview"
|
|
38
|
+
};
|
|
39
|
+
this.retry = {
|
|
40
|
+
maxRetries: config.retry?.maxRetries ?? 3,
|
|
41
|
+
baseDelayMs: config.retry?.baseDelayMs ?? 1500,
|
|
42
|
+
maxDelayMs: config.retry?.maxDelayMs ?? 12000
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
async generateText(prompt) {
|
|
46
|
+
return withRetry(async () => {
|
|
47
|
+
const response = await this.ai.models.generateContent({
|
|
48
|
+
model: this.models.prompt,
|
|
49
|
+
contents: prompt
|
|
50
|
+
});
|
|
51
|
+
return response.text ?? "";
|
|
52
|
+
}, this.retry);
|
|
53
|
+
}
|
|
54
|
+
async generateEnhancedPrompt(params) {
|
|
55
|
+
return withRetry(async () => {
|
|
56
|
+
const response = await this.ai.models.generateContent({
|
|
57
|
+
model: this.models.prompt,
|
|
58
|
+
contents: [
|
|
59
|
+
{
|
|
60
|
+
role: "user",
|
|
61
|
+
parts: params.parts
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
config: {
|
|
65
|
+
systemInstruction: params.systemInstruction
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return response.text ?? "";
|
|
69
|
+
}, this.retry);
|
|
70
|
+
}
|
|
71
|
+
async generateImage(params) {
|
|
72
|
+
return withRetry(async () => {
|
|
73
|
+
const response = await this.ai.models.generateContent({
|
|
74
|
+
model: this.models.image,
|
|
75
|
+
contents: [
|
|
76
|
+
{
|
|
77
|
+
role: "user",
|
|
78
|
+
parts: params.parts
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
config: {
|
|
82
|
+
imageConfig: {
|
|
83
|
+
aspectRatio: params.aspectRatio,
|
|
84
|
+
imageSize: params.imageSize ?? "2K"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
const images = [];
|
|
89
|
+
const parts = response.candidates?.[0]?.content?.parts ?? [];
|
|
90
|
+
for (const part of parts) {
|
|
91
|
+
const inlineData = part?.inlineData;
|
|
92
|
+
if (inlineData?.data) {
|
|
93
|
+
images.push(`data:${inlineData.mimeType ?? "image/png"};base64,${inlineData.data}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (images.length === 0) {
|
|
97
|
+
throw new Error("No image data returned from Gemini.");
|
|
98
|
+
}
|
|
99
|
+
return images;
|
|
100
|
+
}, this.retry);
|
|
101
|
+
}
|
|
102
|
+
async generateVideo(params) {
|
|
103
|
+
return withRetry(async () => {
|
|
104
|
+
let operation = await this.ai.models.generateVideos({
|
|
105
|
+
model: this.models.video,
|
|
106
|
+
prompt: params.prompt,
|
|
107
|
+
config: {
|
|
108
|
+
aspectRatio: params.aspectRatio,
|
|
109
|
+
durationSeconds: params.durationSeconds
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
while (!operation.done) {
|
|
113
|
+
await sleep(10000);
|
|
114
|
+
operation = await this.ai.operations.getVideosOperation({ operation });
|
|
115
|
+
}
|
|
116
|
+
const generated = operation.response?.generatedVideos?.[0]?.video;
|
|
117
|
+
if (!generated) {
|
|
118
|
+
return { operationName: operation.name };
|
|
119
|
+
}
|
|
120
|
+
const rawBytes = generated.videoBytes;
|
|
121
|
+
let videoBytes;
|
|
122
|
+
if (rawBytes) {
|
|
123
|
+
videoBytes = typeof rawBytes === "string" ? Buffer.from(rawBytes, "base64") : rawBytes;
|
|
124
|
+
}
|
|
125
|
+
return { operationName: operation.name, videoBytes };
|
|
126
|
+
}, this.retry);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=geminiClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geminiClient.js","sourceRoot":"","sources":["../../src/clients/geminiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAe5C,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAEhF,MAAM,gBAAgB,GAAG,CAAC,KAAc,EAAW,EAAE;IACnD,MAAM,OAAO,GAAG,MAAM,CAAE,KAAa,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACpE,OAAO,CACL,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;QACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;QACvB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;QAC9B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;QAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,KAAK,EAAK,EAAoB,EAAE,MAAmB,EAAc,EAAE;IACnF,IAAI,SAAkB,CAAC;IACvB,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,MAAM,CAAC,UAAU,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;QACjE,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,EAAE,CAAC;QACpB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,SAAS,GAAG,KAAK,CAAC;YAClB,IAAI,OAAO,KAAK,MAAM,CAAC,UAAU,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC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AE,CAAC;YAC3C,CAAC;YAED,MAAM,QAAQ,GAAI,SAAiB,CAAC,UAAU,CAAC;YAC/C,IAAI,UAAkC,CAAC;YACvC,IAAI,QAAQ,EAAE,CAAC;gBACb,UAAU,GAAG,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;YACzF,CAAC;YAED,OAAO,EAAE,aAAa,EAAE,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC;QACvD,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Template, Option, Resolution } from '../types.js';
|
|
2
|
+
export declare const DEFAULT_IMAGE_COUNT = 4;
|
|
3
|
+
export declare const UPSCALE_CREDIT_COST = 5;
|
|
4
|
+
export declare const REFINE_CREDIT_COST = 5;
|
|
5
|
+
export declare const GENERATE_CREDIT_COST = 5;
|
|
6
|
+
export declare const VIDEO_GENERATION_CREDIT_COST = 20;
|
|
7
|
+
export declare const VIDEO_ENABLED_TEMPLATES: readonly ["hand_model", "neck_model", "ear_model", "flatlay_creative", "floating_minimal", "half_body_muse"];
|
|
8
|
+
export type VideoEnabledTemplate = typeof VIDEO_ENABLED_TEMPLATES[number];
|
|
9
|
+
export declare const isVideoEnabledTemplate: (templateId: string) => boolean;
|
|
10
|
+
export declare const MUSE_ENABLED_TEMPLATES: readonly ["half_body_muse"];
|
|
11
|
+
export type MuseEnabledTemplate = typeof MUSE_ENABLED_TEMPLATES[number];
|
|
12
|
+
export declare const MUSE_GENERATION_CREDIT_COST = 5;
|
|
13
|
+
export declare const MUSE_BATCH_SIZE = 3;
|
|
14
|
+
export declare const MUSE_BATCH_CREDIT_COST: number;
|
|
15
|
+
export declare const REQUIRED_MUSE_VARIATIONS = 3;
|
|
16
|
+
export declare const MAX_MUSES_PER_USER = 3;
|
|
17
|
+
export declare const isMuseEnabledTemplate: (templateId: string) => boolean;
|
|
18
|
+
export declare const TEMPLATES: Template[];
|
|
19
|
+
export declare const SKIN_TONES: Option[];
|
|
20
|
+
export declare const ETHNICITY_REGIONS: Record<string, string[]>;
|
|
21
|
+
export declare const ETHNICITIES: Option[];
|
|
22
|
+
export declare const HAIR_COLORS: Option[];
|
|
23
|
+
export declare const BACKGROUNDS: Option[];
|
|
24
|
+
export declare const LUXURY_INTERIOR_POOL: string[];
|
|
25
|
+
export declare const getRandomLuxuryInterior: () => string;
|
|
26
|
+
export declare const BACKGROUND_TYPES: Option[];
|
|
27
|
+
export declare const VIBES: Option[];
|
|
28
|
+
export interface OccasionTheme {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
icon: string;
|
|
32
|
+
description: string;
|
|
33
|
+
autoConfig: {
|
|
34
|
+
vibe: string;
|
|
35
|
+
background: string;
|
|
36
|
+
backgroundType: string;
|
|
37
|
+
};
|
|
38
|
+
promptDetails?: {
|
|
39
|
+
setting: string;
|
|
40
|
+
atmosphere: string;
|
|
41
|
+
colorPalette: string;
|
|
42
|
+
culturalElements: string;
|
|
43
|
+
styling: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export declare const OCCASIONS: OccasionTheme[];
|
|
47
|
+
export declare const GENERATION_STYLE_POOL: string[];
|
|
48
|
+
export declare const HAND_MODEL_STYLE_POOL: string[];
|
|
49
|
+
export declare const EAR_MODEL_STYLE_POOL: string[];
|
|
50
|
+
export declare const FLATLAY_STYLE_POOL: string[];
|
|
51
|
+
export declare const FLOATING_STYLE_POOL: string[];
|
|
52
|
+
export declare const ROMANCE_STYLE_POOL: string[];
|
|
53
|
+
export declare const MUSEUM_STYLE_POOL: string[];
|
|
54
|
+
export declare const ROMANTIC_MOOD_STYLE_POOL: string[];
|
|
55
|
+
export declare const getStylePoolForTemplate: (templateId: string | null) => string[];
|
|
56
|
+
export declare const HAND_MODEL_VIDEO_PROMPTS: string[];
|
|
57
|
+
export declare const NECK_MODEL_VIDEO_PROMPTS: string[];
|
|
58
|
+
export declare const EAR_MODEL_VIDEO_PROMPTS: string[];
|
|
59
|
+
export declare const FLATLAY_VIDEO_PROMPTS: string[];
|
|
60
|
+
export declare const FLOATING_VIDEO_PROMPTS: string[];
|
|
61
|
+
export declare const VIDEO_MOTION_PROMPT_POOL: string[];
|
|
62
|
+
export declare const getVideoPromptPool: (templateId: string) => string[];
|
|
63
|
+
export declare const RESOLUTIONS: Resolution[];
|