@doufunao123/asset-gateway 0.12.2 → 0.13.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/dist/index.js +9 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -914,19 +914,19 @@ function createGenerateCommand() {
|
|
|
914
914
|
})
|
|
915
915
|
);
|
|
916
916
|
command.addCommand(
|
|
917
|
-
new Command3("sprite").description("
|
|
917
|
+
new Command3("sprite").description("Generate sprite animation using SpriteForge AI").requiredOption("--prompt <text>", "Character description").option("--input <path>", "Reference image (local path or URL)").option("--animation-type <type>", "Animation type (idle, walk, run, attack, death, jump, cast, dance, or any custom)", "idle").option("--direction <dir>", "Facing direction: right, left, front, back", "right").option("--grid-size <size>", "Grid size: 2x2, 3x3, 4x4", "3x3").option("--style <style>", "Visual style (e.g. pixel art, hand-drawn, chibi)").option("--output-format <fmt>", "Output format: spritesheet or gif", "spritesheet").option("--fps <n>", "GIF frame rate", "8").option("--output-dir <dir>", "Directory to save output", ".").action(async function(options) {
|
|
918
918
|
try {
|
|
919
919
|
const ctx = createContext(this);
|
|
920
920
|
const params = {
|
|
921
|
-
|
|
922
|
-
|
|
921
|
+
animation_type: options.animationType,
|
|
922
|
+
direction: options.direction,
|
|
923
|
+
grid_size: options.gridSize,
|
|
924
|
+
output_format: options.outputFormat,
|
|
925
|
+
fps: Number(options.fps)
|
|
923
926
|
};
|
|
924
|
-
if (options.
|
|
925
|
-
if (options.negativePrompt) params.negative_prompt = options.negativePrompt;
|
|
926
|
-
if (options.seed) params.seed = Number(options.seed);
|
|
927
|
-
if (options.matteColor) params.matte_color = options.matteColor;
|
|
927
|
+
if (options.style) params.style = options.style;
|
|
928
928
|
let inputFile = options.input;
|
|
929
|
-
if (existsSync3(inputFile)) {
|
|
929
|
+
if (inputFile && existsSync3(inputFile)) {
|
|
930
930
|
const ext = extname(inputFile).toLowerCase();
|
|
931
931
|
const mime = ext === ".jpg" || ext === ".jpeg" ? "image/jpeg" : "image/png";
|
|
932
932
|
const b64 = readFileSync2(inputFile).toString("base64");
|
|
@@ -935,10 +935,9 @@ function createGenerateCommand() {
|
|
|
935
935
|
const body = {
|
|
936
936
|
asset_type: "sprite",
|
|
937
937
|
prompt: options.prompt,
|
|
938
|
-
model: options.model,
|
|
939
|
-
input_file: inputFile,
|
|
940
938
|
params
|
|
941
939
|
};
|
|
940
|
+
if (inputFile) body.input_file = inputFile;
|
|
942
941
|
const data = await ctx.client.post("/api/generate", body);
|
|
943
942
|
const localPath = await saveOutput(data, "sprite", options.outputDir);
|
|
944
943
|
if (localPath) data.local_path = localPath;
|