@doufunao123/asset-gateway 0.2.1 → 0.3.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.
Files changed (2) hide show
  1. package/dist/index.js +26 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -490,7 +490,7 @@ import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "fs";
490
490
  import { join as join2 } from "path";
491
491
  import { Command as Command3 } from "commander";
492
492
  function inferExtension(assetType) {
493
- const map = { image: "png", audio: "mp3", video: "mp4", model3d: "glb", text: "txt" };
493
+ const map = { image: "png", audio: "mp3", tts: "mp3", video: "mp4", model3d: "glb", text: "txt" };
494
494
  return map[assetType] ?? "bin";
495
495
  }
496
496
  function stripDataUri(data) {
@@ -584,6 +584,31 @@ function createGenerateCommand() {
584
584
  }
585
585
  })
586
586
  );
587
+ command.addCommand(
588
+ new Command3("tts").description("Text-to-speech synthesis (Chinese/multilingual)").requiredOption("--prompt <text>", "Text to synthesize").option("--voice-id <id>", "Voice ID (e.g. 'Chinese (Mandarin)_Lyrical_Voice')").option("--model <model>", "TTS model (speech-2.6-hd, speech-2.6-turbo)").option("--speed <n>", "Speech speed [0.5, 2.0]").option("--language-boost <lang>", "Language hint: auto, Chinese, English, etc.").option("--emotion <emotion>", "Emotion: happy, sad, angry, calm, etc.").option("--provider <id>", "Provider to use").option("--output-dir <dir>", "Directory to save output", ".").action(async function(options) {
589
+ try {
590
+ const ctx = createContext(this);
591
+ const params = {};
592
+ if (options.voiceId) params.voice_id = options.voiceId;
593
+ if (options.speed) params.speed = Number(options.speed);
594
+ if (options.languageBoost) params.language_boost = options.languageBoost;
595
+ if (options.emotion) params.emotion = options.emotion;
596
+ const body = {
597
+ asset_type: "tts",
598
+ prompt: options.prompt,
599
+ params
600
+ };
601
+ if (options.model) body.model = options.model;
602
+ if (options.provider) body.provider = options.provider;
603
+ const data = await ctx.client.post("/api/generate", body);
604
+ const localPath = await saveOutput(data, "tts", options.outputDir);
605
+ if (localPath) data.local_path = localPath;
606
+ printSuccess("generate.tts", data, ctx);
607
+ } catch (error2) {
608
+ printError("generate.tts", error2);
609
+ }
610
+ })
611
+ );
587
612
  command.addCommand(
588
613
  new Command3("model").description("Generate a 3D model").option("--image <url>", "Reference image URL").option("--prompt <text>", "Model description prompt").option("--output-dir <dir>", "Directory to save output", ".").action(async function(options) {
589
614
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doufunao123/asset-gateway",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Universal asset generation gateway CLI",
5
5
  "type": "module",
6
6
  "bin": {