@acedatacloud/sdk 2026.727.1 → 2026.728.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 +7 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/resources/providers/producer.ts +4 -4
- package/src/runtime/tasks.ts +11 -0
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@ export interface ProducerUploadOptions {
|
|
|
24
24
|
[key: string]: unknown;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export interface
|
|
27
|
+
export interface ProducerVideosOptions {
|
|
28
28
|
/** Reference audio ID. */
|
|
29
29
|
audioId: string;
|
|
30
30
|
callbackUrl?: string;
|
|
@@ -40,7 +40,7 @@ export interface ProducerWavOptions {
|
|
|
40
40
|
[key: string]: unknown;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export interface
|
|
43
|
+
export interface ProducerGenerateOptions {
|
|
44
44
|
/** Lyrics content for generating audio. */
|
|
45
45
|
lyric: string;
|
|
46
46
|
/** Types of audio generation operations. Supported values include `generate` (generate based on prompts), `cover` (cover song), `extend` (continue writing), `variation` (variant), `swap_vocals` (replace vocals), `swap_instrumentals` (replace instrumentals), `replace_section` (replace section), `stems` (separate tracks). */
|
|
@@ -108,7 +108,7 @@ export class Producer {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
/** AceData Producer MP4 retrieval API. Pass an audio_id to receive an MP4 video download link with cover art. */
|
|
111
|
-
async
|
|
111
|
+
async videos(options: ProducerVideosOptions): Promise<Record<string, unknown>> {
|
|
112
112
|
const body: Record<string, unknown> = {};
|
|
113
113
|
body["audio_id"] = options.audioId;
|
|
114
114
|
for (const [key, value] of Object.entries(options)) {
|
|
@@ -134,7 +134,7 @@ export class Producer {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
/** Producer AI music generation API, generates 1 song per request. */
|
|
137
|
-
async
|
|
137
|
+
async generate(options: ProducerGenerateOptions): Promise<TaskHandle> {
|
|
138
138
|
const body: Record<string, unknown> = {};
|
|
139
139
|
body["lyric"] = options.lyric;
|
|
140
140
|
body["action"] = options.action;
|
package/src/runtime/tasks.ts
CHANGED
|
@@ -137,6 +137,17 @@ export function taskStatus(state: Record<string, unknown>): 'succeeded' | 'faile
|
|
|
137
137
|
}
|
|
138
138
|
if (words.length > 0) return '';
|
|
139
139
|
|
|
140
|
+
// `success: false` alone is ambiguous — some services set it for a transient
|
|
141
|
+
// hiccup mid-run, alongside a bare string, and carry on. A *structured* error
|
|
142
|
+
// (a dict with a code) is the upstream's final answer: hailuo reports an
|
|
143
|
+
// unavailable model that way, with no finished_at, and treating it as still
|
|
144
|
+
// running makes the caller poll until timeout instead of showing the reason.
|
|
145
|
+
if (response.success === false) {
|
|
146
|
+
const error = response.error as Record<string, unknown> | undefined;
|
|
147
|
+
const structured = !!error && typeof error === 'object' && !!error.code;
|
|
148
|
+
if (artifactUrls(state).length > 0 || structured) return 'failed';
|
|
149
|
+
}
|
|
150
|
+
|
|
140
151
|
const finished =
|
|
141
152
|
(response.finished_at !== undefined && response.finished_at !== null) ||
|
|
142
153
|
(state.finished_at !== undefined && state.finished_at !== null);
|