@decartai/sdk 0.0.28 → 0.0.30
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/dist/process/types.d.ts
CHANGED
|
@@ -49,6 +49,28 @@ interface VideoModelInputs {
|
|
|
49
49
|
*/
|
|
50
50
|
data?: FileInput;
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Model-specific input documentation for lucy-restyle-v2v.
|
|
54
|
+
* Allows either prompt or reference_image (mutually exclusive).
|
|
55
|
+
*/
|
|
56
|
+
interface VideoRestyleInputs {
|
|
57
|
+
/**
|
|
58
|
+
* Text description to use for the video editing.
|
|
59
|
+
* Mutually exclusive with reference_image.
|
|
60
|
+
*/
|
|
61
|
+
prompt?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Reference image to transform into a prompt.
|
|
64
|
+
* Mutually exclusive with prompt.
|
|
65
|
+
* Can be a File, Blob, ReadableStream, URL, or string URL.
|
|
66
|
+
*/
|
|
67
|
+
reference_image?: FileInput;
|
|
68
|
+
/**
|
|
69
|
+
* Video file to process.
|
|
70
|
+
* Can be a File, Blob, ReadableStream, URL, or string URL.
|
|
71
|
+
*/
|
|
72
|
+
data: FileInput;
|
|
73
|
+
}
|
|
52
74
|
/**
|
|
53
75
|
* Default inputs for models that only require a prompt.
|
|
54
76
|
*/
|
|
@@ -63,7 +85,7 @@ interface PromptInput {
|
|
|
63
85
|
* This allows different models to have field-specific documentation while maintaining type safety.
|
|
64
86
|
* Specific models are checked first, then falls back to category-based selection.
|
|
65
87
|
*/
|
|
66
|
-
type ModelSpecificInputs<T extends ModelDefinition> = T["name"] extends "lucy-pro-i2i" ? ImageEditingInputs : T["name"] extends ImageModels ? ImageGenerationInputs : T["name"] extends VideoModels ? VideoModelInputs : PromptInput;
|
|
88
|
+
type ModelSpecificInputs<T extends ModelDefinition> = T["name"] extends "lucy-pro-i2i" ? ImageEditingInputs : T["name"] extends "lucy-restyle-v2v" ? VideoRestyleInputs : T["name"] extends ImageModels ? ImageGenerationInputs : T["name"] extends VideoModels ? VideoModelInputs : PromptInput;
|
|
67
89
|
interface ProcessInputs {
|
|
68
90
|
/**
|
|
69
91
|
* Random seed for reproducible results.
|
package/dist/queue/client.js
CHANGED
|
@@ -11,7 +11,7 @@ const createQueueClient = (opts) => {
|
|
|
11
11
|
const parsedInputs = model.inputSchema.safeParse(inputs);
|
|
12
12
|
if (!parsedInputs.success) throw createInvalidInputError(`Invalid inputs for ${model.name}: ${parsedInputs.error.message}`);
|
|
13
13
|
const processedInputs = {};
|
|
14
|
-
for (const [key, value] of Object.entries(parsedInputs.data)) if (key === "data" || key === "start" || key === "end") processedInputs[key] = await fileInputToBlob(value);
|
|
14
|
+
for (const [key, value] of Object.entries(parsedInputs.data)) if (key === "data" || key === "start" || key === "end" || key === "reference_image") processedInputs[key] = await fileInputToBlob(value);
|
|
15
15
|
else processedInputs[key] = value;
|
|
16
16
|
return submitJob({
|
|
17
17
|
baseUrl,
|
|
@@ -67,8 +67,8 @@ var WebRTCConnection = class {
|
|
|
67
67
|
}
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
if (msg.type === "
|
|
71
|
-
this.websocketMessagesEmitter.emit("
|
|
70
|
+
if (msg.type === "set_image_ack") {
|
|
71
|
+
this.websocketMessagesEmitter.emit("setImageAck", msg);
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
if (!this.pc) return;
|
|
@@ -134,16 +134,16 @@ var WebRTCConnection = class {
|
|
|
134
134
|
async setImageBase64(imageBase64) {
|
|
135
135
|
return new Promise((resolve, reject) => {
|
|
136
136
|
const timeoutId = setTimeout(() => {
|
|
137
|
-
this.websocketMessagesEmitter.off("
|
|
137
|
+
this.websocketMessagesEmitter.off("setImageAck", listener);
|
|
138
138
|
reject(/* @__PURE__ */ new Error("Image send timed out"));
|
|
139
139
|
}, AVATAR_SETUP_TIMEOUT_MS);
|
|
140
140
|
const listener = (msg) => {
|
|
141
141
|
clearTimeout(timeoutId);
|
|
142
|
-
this.websocketMessagesEmitter.off("
|
|
143
|
-
if (msg.
|
|
144
|
-
else reject(
|
|
142
|
+
this.websocketMessagesEmitter.off("setImageAck", listener);
|
|
143
|
+
if (msg.success) resolve();
|
|
144
|
+
else reject(new Error(msg.error ?? "Failed to send image"));
|
|
145
145
|
};
|
|
146
|
-
this.websocketMessagesEmitter.on("
|
|
146
|
+
this.websocketMessagesEmitter.on("setImageAck", listener);
|
|
147
147
|
this.send({
|
|
148
148
|
type: "set_image",
|
|
149
149
|
image_data: imageBase64
|
package/dist/shared/model.d.ts
CHANGED
|
@@ -92,11 +92,12 @@ declare const modelInputSchemas: {
|
|
|
92
92
|
resolution: z.ZodOptional<z.ZodDefault<z.ZodLiteral<"720p">>>;
|
|
93
93
|
}, z.core.$strip>;
|
|
94
94
|
readonly "lucy-restyle-v2v": z.ZodObject<{
|
|
95
|
-
prompt: z.ZodString
|
|
95
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
96
|
+
reference_image: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<File, File>, z.ZodCustom<Blob, Blob>, z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>, z.ZodCustom<URL, URL>, z.ZodURL]>>;
|
|
96
97
|
data: z.ZodUnion<readonly [z.ZodCustom<File, File>, z.ZodCustom<Blob, Blob>, z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>, z.ZodCustom<URL, URL>, z.ZodURL]>;
|
|
97
98
|
seed: z.ZodOptional<z.ZodNumber>;
|
|
98
99
|
resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
|
|
99
|
-
enhance_prompt: z.ZodOptional<z.
|
|
100
|
+
enhance_prompt: z.ZodOptional<z.ZodBoolean>;
|
|
100
101
|
}, z.core.$strip>;
|
|
101
102
|
};
|
|
102
103
|
type ModelInputSchemas = typeof modelInputSchemas;
|
package/dist/shared/model.js
CHANGED
|
@@ -124,12 +124,13 @@ const modelInputSchemas = {
|
|
|
124
124
|
resolution: motionResolutionSchema
|
|
125
125
|
}),
|
|
126
126
|
"lucy-restyle-v2v": z.object({
|
|
127
|
-
prompt: z.string().min(1).max(1e3).describe("Text prompt for the video editing"),
|
|
127
|
+
prompt: z.string().min(1).max(1e3).optional().describe("Text prompt for the video editing"),
|
|
128
|
+
reference_image: fileInputSchema.optional().describe("Reference image to transform into a prompt (File, Blob, ReadableStream, URL, or string URL)"),
|
|
128
129
|
data: fileInputSchema.describe("Video file to process (File, Blob, ReadableStream, URL, or string URL)"),
|
|
129
130
|
seed: z.number().optional().describe("Seed for the video generation"),
|
|
130
131
|
resolution: proV2vResolutionSchema,
|
|
131
|
-
enhance_prompt: z.boolean().
|
|
132
|
-
})
|
|
132
|
+
enhance_prompt: z.boolean().optional().describe("Whether to enhance the prompt (only valid with text prompt, defaults to true on backend)")
|
|
133
|
+
}).refine((data) => data.prompt !== void 0 !== (data.reference_image !== void 0), { message: "Must provide either 'prompt' or 'reference_image', but not both" }).refine((data) => !(data.reference_image !== void 0 && data.enhance_prompt !== void 0), { message: "'enhance_prompt' is only valid when using 'prompt', not 'reference_image'" })
|
|
133
134
|
};
|
|
134
135
|
const modelDefinitionSchema = z.object({
|
|
135
136
|
name: modelSchema,
|