seacloud-sdk 0.10.3 → 0.11.2
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/cli.js +325 -9
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1153 -2
- package/dist/index.js +712 -11
- package/dist/index.js.map +1 -1
- package/package.json +19 -4
package/dist/index.js
CHANGED
|
@@ -9,7 +9,51 @@ var SeacloudError = class extends Error {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
// src/core/config.ts
|
|
12
|
-
function
|
|
12
|
+
function isInIframe() {
|
|
13
|
+
try {
|
|
14
|
+
return typeof globalThis.window !== "undefined" && globalThis.window.self !== globalThis.window.top;
|
|
15
|
+
} catch (e) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async function getTokenFromParent(timeout = 5e3) {
|
|
20
|
+
if (!isInIframe()) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return new Promise((resolve) => {
|
|
24
|
+
const messageHandler = (event) => {
|
|
25
|
+
if (event.data && event.data.type === "seaverse:token") {
|
|
26
|
+
cleanup();
|
|
27
|
+
const token = event.data.payload?.accessToken;
|
|
28
|
+
resolve(token || null);
|
|
29
|
+
} else if (event.data && event.data.type === "seaverse:error") {
|
|
30
|
+
cleanup();
|
|
31
|
+
console.warn("[SeaCloud SDK] Error getting token from parent:", event.data.error);
|
|
32
|
+
resolve(null);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const timeoutId = setTimeout(() => {
|
|
36
|
+
cleanup();
|
|
37
|
+
resolve(null);
|
|
38
|
+
}, timeout);
|
|
39
|
+
const cleanup = () => {
|
|
40
|
+
clearTimeout(timeoutId);
|
|
41
|
+
globalThis.window.removeEventListener("message", messageHandler);
|
|
42
|
+
};
|
|
43
|
+
globalThis.window.addEventListener("message", messageHandler);
|
|
44
|
+
try {
|
|
45
|
+
globalThis.window.parent.postMessage(
|
|
46
|
+
{ type: "seaverse:get_token" },
|
|
47
|
+
"*"
|
|
48
|
+
// 允许任何源,支持跨域场景
|
|
49
|
+
);
|
|
50
|
+
} catch (e) {
|
|
51
|
+
cleanup();
|
|
52
|
+
resolve(null);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async function getApiToken(providedApiKey) {
|
|
13
57
|
if (providedApiKey) {
|
|
14
58
|
return providedApiKey;
|
|
15
59
|
}
|
|
@@ -25,19 +69,24 @@ function getApiToken(providedApiKey) {
|
|
|
25
69
|
if (typeof process !== "undefined" && process.env?.API_SERVICE_TOKEN) {
|
|
26
70
|
return process.env.API_SERVICE_TOKEN;
|
|
27
71
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
72
|
+
if (typeof globalThis.window !== "undefined") {
|
|
73
|
+
const parentToken = await getTokenFromParent();
|
|
74
|
+
if (parentToken) {
|
|
75
|
+
return parentToken;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return "";
|
|
31
79
|
}
|
|
32
80
|
function createConfig(options = {}) {
|
|
33
|
-
const apiKey =
|
|
81
|
+
const apiKey = options.apiKey;
|
|
34
82
|
const baseUrl = options.baseUrl || (typeof process !== "undefined" ? process.env?.SEACLOUD_BASE_URL : void 0) || "https://proxy-rs.seaverse.ai";
|
|
35
83
|
const fetchImpl = options.fetch || (globalThis.fetch ? globalThis.fetch.bind(globalThis) : void 0);
|
|
36
84
|
if (!fetchImpl) {
|
|
37
85
|
throw new Error("fetch is not available. Please provide a fetch implementation in config or upgrade to Node.js 18+");
|
|
38
86
|
}
|
|
39
87
|
return {
|
|
40
|
-
apiKey,
|
|
88
|
+
apiKey: apiKey || "",
|
|
89
|
+
// 提供默认空字符串,实际请求时会动态获取
|
|
41
90
|
baseUrl,
|
|
42
91
|
fetch: fetchImpl,
|
|
43
92
|
timeout: options.timeout || 3e4,
|
|
@@ -83,7 +132,7 @@ var SeacloudClient = class {
|
|
|
83
132
|
*/
|
|
84
133
|
async createTask(endpoint, body) {
|
|
85
134
|
const url = `${this.config.baseUrl}${endpoint}`;
|
|
86
|
-
const currentToken = getApiToken(this.providedApiKey);
|
|
135
|
+
const currentToken = await getApiToken(this.providedApiKey);
|
|
87
136
|
const controller = new AbortController();
|
|
88
137
|
const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
|
|
89
138
|
try {
|
|
@@ -130,7 +179,7 @@ var SeacloudClient = class {
|
|
|
130
179
|
*/
|
|
131
180
|
async getTaskStatus(endpoint, taskId) {
|
|
132
181
|
const url = `${this.config.baseUrl}${endpoint}/task/${taskId}`;
|
|
133
|
-
const currentToken = getApiToken(this.providedApiKey);
|
|
182
|
+
const currentToken = await getApiToken(this.providedApiKey);
|
|
134
183
|
const controller = new AbortController();
|
|
135
184
|
const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
|
|
136
185
|
try {
|
|
@@ -286,6 +335,12 @@ async function createAndWaitTask(client, endpoint, body, options = {}) {
|
|
|
286
335
|
return pollTaskUntilComplete(client, endpoint, task.id, options);
|
|
287
336
|
}
|
|
288
337
|
|
|
338
|
+
// src/core/index.ts
|
|
339
|
+
async function getTaskStatus(endpoint, taskId) {
|
|
340
|
+
const client = getClient();
|
|
341
|
+
return client.getTaskStatus(endpoint, taskId);
|
|
342
|
+
}
|
|
343
|
+
|
|
289
344
|
// src/api/alibaba_animate_anyone_detect.ts
|
|
290
345
|
async function alibabaAnimateAnyoneDetect(params) {
|
|
291
346
|
const client = getClient();
|
|
@@ -4068,6 +4123,47 @@ async function viduQ2(params) {
|
|
|
4068
4123
|
return resources;
|
|
4069
4124
|
}
|
|
4070
4125
|
|
|
4126
|
+
// src/api/viduq2_i2v_reference.ts
|
|
4127
|
+
async function viduQ2I2vReference(params) {
|
|
4128
|
+
const client = getClient();
|
|
4129
|
+
if (params.images && params.subjects) {
|
|
4130
|
+
throw new Error("images \u548C subjects \u53C2\u6570\u4E92\u65A5\uFF0C\u53EA\u80FD\u9009\u62E9\u5176\u4E2D\u4E00\u4E2A");
|
|
4131
|
+
}
|
|
4132
|
+
if (!params.images && !params.subjects) {
|
|
4133
|
+
throw new Error("\u5FC5\u987B\u63D0\u4F9B images \u6216 subjects \u53C2\u6570\u4E4B\u4E00");
|
|
4134
|
+
}
|
|
4135
|
+
const pollingOptions = {
|
|
4136
|
+
intervalMs: 3e3,
|
|
4137
|
+
maxAttempts: 60
|
|
4138
|
+
};
|
|
4139
|
+
const result = await createAndWaitTask(
|
|
4140
|
+
client,
|
|
4141
|
+
"/model/v1/generation",
|
|
4142
|
+
{
|
|
4143
|
+
model: "viduq2_i2v_reference",
|
|
4144
|
+
input: [{ params }]
|
|
4145
|
+
},
|
|
4146
|
+
pollingOptions
|
|
4147
|
+
);
|
|
4148
|
+
const resources = [];
|
|
4149
|
+
if (result.output) {
|
|
4150
|
+
for (const item of result.output) {
|
|
4151
|
+
if (item.content) {
|
|
4152
|
+
for (const resource of item.content) {
|
|
4153
|
+
resources.push({
|
|
4154
|
+
type: resource.type || "unknown",
|
|
4155
|
+
url: resource.url || "",
|
|
4156
|
+
size: resource.size,
|
|
4157
|
+
jobId: resource.jobId,
|
|
4158
|
+
...resource
|
|
4159
|
+
});
|
|
4160
|
+
}
|
|
4161
|
+
}
|
|
4162
|
+
}
|
|
4163
|
+
}
|
|
4164
|
+
return resources;
|
|
4165
|
+
}
|
|
4166
|
+
|
|
4071
4167
|
// src/api/vidu_template.ts
|
|
4072
4168
|
async function viduTemplate(params) {
|
|
4073
4169
|
const client = getClient();
|
|
@@ -4979,16 +5075,28 @@ async function volcesSeedream45I2i(params) {
|
|
|
4979
5075
|
// src/api/volces_seedream_4_5_multi_blend.ts
|
|
4980
5076
|
async function volcesSeedream45MultiBlend(params) {
|
|
4981
5077
|
const client = getClient();
|
|
5078
|
+
const imageList = params.image || params.images;
|
|
5079
|
+
if (!imageList || !Array.isArray(imageList)) {
|
|
5080
|
+
throw new Error('Parameter "image" or "images" is required and must be an array');
|
|
5081
|
+
}
|
|
5082
|
+
if (imageList.length < 2 || imageList.length > 14) {
|
|
5083
|
+
throw new Error("Image array must contain between 2 and 14 images");
|
|
5084
|
+
}
|
|
4982
5085
|
const pollingOptions = {
|
|
4983
5086
|
intervalMs: 3e3,
|
|
4984
5087
|
maxAttempts: 60
|
|
4985
5088
|
};
|
|
5089
|
+
const requestParams = {
|
|
5090
|
+
...params,
|
|
5091
|
+
image: imageList
|
|
5092
|
+
};
|
|
5093
|
+
delete requestParams.images;
|
|
4986
5094
|
const result = await createAndWaitTask(
|
|
4987
5095
|
client,
|
|
4988
5096
|
"/model/v1/generation",
|
|
4989
5097
|
{
|
|
4990
5098
|
model: "volces_seedream_4_5_multi_blend",
|
|
4991
|
-
input: [{ params }]
|
|
5099
|
+
input: [{ params: requestParams }]
|
|
4992
5100
|
},
|
|
4993
5101
|
pollingOptions
|
|
4994
5102
|
);
|
|
@@ -5086,6 +5194,7 @@ async function llmChatCompletions(params) {
|
|
|
5086
5194
|
const client = getClient();
|
|
5087
5195
|
const config = client.getConfig();
|
|
5088
5196
|
const url = `${config.baseUrl}/llm/chat/completions`;
|
|
5197
|
+
const token = await getApiToken(config.apiKey);
|
|
5089
5198
|
const controller = new AbortController();
|
|
5090
5199
|
const timeoutId = setTimeout(() => controller.abort(), config.timeout);
|
|
5091
5200
|
try {
|
|
@@ -5093,7 +5202,7 @@ async function llmChatCompletions(params) {
|
|
|
5093
5202
|
method: "POST",
|
|
5094
5203
|
headers: {
|
|
5095
5204
|
"Content-Type": "application/json",
|
|
5096
|
-
"Authorization": `Bearer ${
|
|
5205
|
+
"Authorization": `Bearer ${token}`
|
|
5097
5206
|
},
|
|
5098
5207
|
body: JSON.stringify(params),
|
|
5099
5208
|
signal: controller.signal
|
|
@@ -5418,6 +5527,598 @@ async function appGeneration(params) {
|
|
|
5418
5527
|
return result;
|
|
5419
5528
|
}
|
|
5420
5529
|
|
|
5421
|
-
|
|
5530
|
+
// src/api/scan.ts
|
|
5531
|
+
async function scan(params) {
|
|
5532
|
+
if (!params.uri && !params.img_base64) {
|
|
5533
|
+
throw new SeacloudError("\u5FC5\u987B\u63D0\u4F9B uri \u6216 img_base64 \u4E2D\u7684\u81F3\u5C11\u4E00\u4E2A\u53C2\u6570");
|
|
5534
|
+
}
|
|
5535
|
+
if (params.is_video === 1 && params.img_base64) {
|
|
5536
|
+
throw new SeacloudError("\u89C6\u9891\u68C0\u6D4B\u4E0D\u652F\u6301 base64 \u8F93\u5165\uFF0C\u5FC5\u987B\u4F7F\u7528 uri \u53C2\u6570");
|
|
5537
|
+
}
|
|
5538
|
+
if (!params.risk_types || params.risk_types.length === 0) {
|
|
5539
|
+
throw new SeacloudError("\u5FC5\u987B\u63D0\u4F9B\u81F3\u5C11\u4E00\u4E2A\u98CE\u9669\u7C7B\u578B");
|
|
5540
|
+
}
|
|
5541
|
+
const client = getClient();
|
|
5542
|
+
const config = client.getConfig();
|
|
5543
|
+
const url = `${config.baseUrl}/scan`;
|
|
5544
|
+
const token = await getApiToken(config.apiKey);
|
|
5545
|
+
const controller = new AbortController();
|
|
5546
|
+
const timeoutId = setTimeout(() => controller.abort(), config.timeout);
|
|
5547
|
+
try {
|
|
5548
|
+
const response = await config.fetch(url, {
|
|
5549
|
+
method: "POST",
|
|
5550
|
+
headers: {
|
|
5551
|
+
"Content-Type": "application/json",
|
|
5552
|
+
"Authorization": `Bearer ${token}`
|
|
5553
|
+
},
|
|
5554
|
+
body: JSON.stringify(params),
|
|
5555
|
+
signal: controller.signal
|
|
5556
|
+
});
|
|
5557
|
+
clearTimeout(timeoutId);
|
|
5558
|
+
if (!response.ok) {
|
|
5559
|
+
const errorBody = await response.text();
|
|
5560
|
+
throw new SeacloudError(
|
|
5561
|
+
`HTTP ${response.status}: ${errorBody}`,
|
|
5562
|
+
response.status,
|
|
5563
|
+
errorBody
|
|
5564
|
+
);
|
|
5565
|
+
}
|
|
5566
|
+
const responseData = await response.json();
|
|
5567
|
+
let result;
|
|
5568
|
+
if (responseData.success !== void 0 && responseData.data) {
|
|
5569
|
+
result = responseData.data;
|
|
5570
|
+
} else {
|
|
5571
|
+
result = responseData;
|
|
5572
|
+
}
|
|
5573
|
+
if (!result.ok) {
|
|
5574
|
+
throw new SeacloudError(
|
|
5575
|
+
`\u5185\u5BB9\u5B89\u5168\u68C0\u6D4B\u4E1A\u52A1\u9519\u8BEF: ${result.error || "\u672A\u77E5\u9519\u8BEF"}`,
|
|
5576
|
+
void 0,
|
|
5577
|
+
result
|
|
5578
|
+
);
|
|
5579
|
+
}
|
|
5580
|
+
return result;
|
|
5581
|
+
} catch (error) {
|
|
5582
|
+
clearTimeout(timeoutId);
|
|
5583
|
+
if (error instanceof SeacloudError) {
|
|
5584
|
+
throw error;
|
|
5585
|
+
}
|
|
5586
|
+
if (error.name === "AbortError") {
|
|
5587
|
+
throw new SeacloudError(`Request timeout after ${config.timeout}ms`);
|
|
5588
|
+
}
|
|
5589
|
+
throw new SeacloudError(
|
|
5590
|
+
`Request failed: ${error.message}`,
|
|
5591
|
+
void 0,
|
|
5592
|
+
error
|
|
5593
|
+
);
|
|
5594
|
+
}
|
|
5595
|
+
}
|
|
5596
|
+
|
|
5597
|
+
// src/api/youchuan_diffusion.ts
|
|
5598
|
+
async function youchuanDiffusion(params) {
|
|
5599
|
+
const client = getClient();
|
|
5600
|
+
const pollingOptions = {
|
|
5601
|
+
intervalMs: 3e3,
|
|
5602
|
+
maxAttempts: 60
|
|
5603
|
+
};
|
|
5604
|
+
const result = await createAndWaitTask(
|
|
5605
|
+
client,
|
|
5606
|
+
"/model/v1/generation",
|
|
5607
|
+
{
|
|
5608
|
+
model: "youchuan_diffusion",
|
|
5609
|
+
input: [{ params }]
|
|
5610
|
+
},
|
|
5611
|
+
pollingOptions
|
|
5612
|
+
);
|
|
5613
|
+
const resources = [];
|
|
5614
|
+
if (result.output) {
|
|
5615
|
+
for (const item of result.output) {
|
|
5616
|
+
if (item.content) {
|
|
5617
|
+
for (const resource of item.content) {
|
|
5618
|
+
resources.push({
|
|
5619
|
+
type: resource.type || "unknown",
|
|
5620
|
+
url: resource.url || "",
|
|
5621
|
+
size: resource.size,
|
|
5622
|
+
jobId: resource.jobId,
|
|
5623
|
+
...resource
|
|
5624
|
+
});
|
|
5625
|
+
}
|
|
5626
|
+
}
|
|
5627
|
+
}
|
|
5628
|
+
}
|
|
5629
|
+
return resources;
|
|
5630
|
+
}
|
|
5631
|
+
|
|
5632
|
+
// src/api/youchuan_edit.ts
|
|
5633
|
+
async function youchuanEdit(params) {
|
|
5634
|
+
const client = getClient();
|
|
5635
|
+
const pollingOptions = {
|
|
5636
|
+
intervalMs: 3e3,
|
|
5637
|
+
maxAttempts: 60
|
|
5638
|
+
};
|
|
5639
|
+
const result = await createAndWaitTask(
|
|
5640
|
+
client,
|
|
5641
|
+
"/model/v1/generation",
|
|
5642
|
+
{
|
|
5643
|
+
model: "youchuan_edit",
|
|
5644
|
+
input: [{ params }]
|
|
5645
|
+
},
|
|
5646
|
+
pollingOptions
|
|
5647
|
+
);
|
|
5648
|
+
const resources = [];
|
|
5649
|
+
if (result.output) {
|
|
5650
|
+
for (const item of result.output) {
|
|
5651
|
+
if (item.content) {
|
|
5652
|
+
for (const resource of item.content) {
|
|
5653
|
+
resources.push({
|
|
5654
|
+
type: resource.type || "unknown",
|
|
5655
|
+
url: resource.url || "",
|
|
5656
|
+
size: resource.size,
|
|
5657
|
+
jobId: resource.jobId,
|
|
5658
|
+
...resource
|
|
5659
|
+
});
|
|
5660
|
+
}
|
|
5661
|
+
}
|
|
5662
|
+
}
|
|
5663
|
+
}
|
|
5664
|
+
return resources;
|
|
5665
|
+
}
|
|
5666
|
+
|
|
5667
|
+
// src/api/youchuan_enhance.ts
|
|
5668
|
+
async function youchuanEnhance(params) {
|
|
5669
|
+
const client = getClient();
|
|
5670
|
+
const pollingOptions = {
|
|
5671
|
+
intervalMs: 3e3,
|
|
5672
|
+
maxAttempts: 60
|
|
5673
|
+
};
|
|
5674
|
+
const result = await createAndWaitTask(
|
|
5675
|
+
client,
|
|
5676
|
+
"/model/v1/generation",
|
|
5677
|
+
{
|
|
5678
|
+
model: "youchuan_enhance",
|
|
5679
|
+
input: [{ params }]
|
|
5680
|
+
},
|
|
5681
|
+
pollingOptions
|
|
5682
|
+
);
|
|
5683
|
+
const resources = [];
|
|
5684
|
+
if (result.output) {
|
|
5685
|
+
for (const item of result.output) {
|
|
5686
|
+
if (item.content) {
|
|
5687
|
+
for (const resource of item.content) {
|
|
5688
|
+
resources.push({
|
|
5689
|
+
type: resource.type || "unknown",
|
|
5690
|
+
url: resource.url || "",
|
|
5691
|
+
size: resource.size,
|
|
5692
|
+
jobId: resource.jobId,
|
|
5693
|
+
...resource
|
|
5694
|
+
});
|
|
5695
|
+
}
|
|
5696
|
+
}
|
|
5697
|
+
}
|
|
5698
|
+
}
|
|
5699
|
+
return resources;
|
|
5700
|
+
}
|
|
5701
|
+
|
|
5702
|
+
// src/api/youchuan_extend_video.ts
|
|
5703
|
+
async function youchuanExtendVideo(params) {
|
|
5704
|
+
const client = getClient();
|
|
5705
|
+
const pollingOptions = {
|
|
5706
|
+
intervalMs: 3e3,
|
|
5707
|
+
maxAttempts: 60
|
|
5708
|
+
};
|
|
5709
|
+
const result = await createAndWaitTask(
|
|
5710
|
+
client,
|
|
5711
|
+
"/model/v1/generation",
|
|
5712
|
+
{
|
|
5713
|
+
model: "youchuan_extend_video",
|
|
5714
|
+
input: [{ params }]
|
|
5715
|
+
},
|
|
5716
|
+
pollingOptions
|
|
5717
|
+
);
|
|
5718
|
+
const resources = [];
|
|
5719
|
+
if (result.output) {
|
|
5720
|
+
for (const item of result.output) {
|
|
5721
|
+
if (item.content) {
|
|
5722
|
+
for (const resource of item.content) {
|
|
5723
|
+
resources.push({
|
|
5724
|
+
type: resource.type || "unknown",
|
|
5725
|
+
url: resource.url || "",
|
|
5726
|
+
size: resource.size,
|
|
5727
|
+
jobId: resource.jobId,
|
|
5728
|
+
...resource
|
|
5729
|
+
});
|
|
5730
|
+
}
|
|
5731
|
+
}
|
|
5732
|
+
}
|
|
5733
|
+
}
|
|
5734
|
+
return resources;
|
|
5735
|
+
}
|
|
5736
|
+
|
|
5737
|
+
// src/api/youchuan_inpaint.ts
|
|
5738
|
+
async function youchuanInpaint(params) {
|
|
5739
|
+
const client = getClient();
|
|
5740
|
+
const pollingOptions = {
|
|
5741
|
+
intervalMs: 3e3,
|
|
5742
|
+
maxAttempts: 60
|
|
5743
|
+
};
|
|
5744
|
+
const result = await createAndWaitTask(
|
|
5745
|
+
client,
|
|
5746
|
+
"/model/v1/generation",
|
|
5747
|
+
{
|
|
5748
|
+
model: "youchuan_inpaint",
|
|
5749
|
+
input: [{ params }]
|
|
5750
|
+
},
|
|
5751
|
+
pollingOptions
|
|
5752
|
+
);
|
|
5753
|
+
const resources = [];
|
|
5754
|
+
if (result.output) {
|
|
5755
|
+
for (const item of result.output) {
|
|
5756
|
+
if (item.content) {
|
|
5757
|
+
for (const resource of item.content) {
|
|
5758
|
+
resources.push({
|
|
5759
|
+
type: resource.type || "unknown",
|
|
5760
|
+
url: resource.url || "",
|
|
5761
|
+
size: resource.size,
|
|
5762
|
+
jobId: resource.jobId,
|
|
5763
|
+
...resource
|
|
5764
|
+
});
|
|
5765
|
+
}
|
|
5766
|
+
}
|
|
5767
|
+
}
|
|
5768
|
+
}
|
|
5769
|
+
return resources;
|
|
5770
|
+
}
|
|
5771
|
+
|
|
5772
|
+
// src/api/youchuan_outpaint.ts
|
|
5773
|
+
async function youchuanOutpaint(params) {
|
|
5774
|
+
const client = getClient();
|
|
5775
|
+
const pollingOptions = {
|
|
5776
|
+
intervalMs: 3e3,
|
|
5777
|
+
maxAttempts: 60
|
|
5778
|
+
};
|
|
5779
|
+
const result = await createAndWaitTask(
|
|
5780
|
+
client,
|
|
5781
|
+
"/model/v1/generation",
|
|
5782
|
+
{
|
|
5783
|
+
model: "youchuan_outpaint",
|
|
5784
|
+
input: [{ params }]
|
|
5785
|
+
},
|
|
5786
|
+
pollingOptions
|
|
5787
|
+
);
|
|
5788
|
+
const resources = [];
|
|
5789
|
+
if (result.output) {
|
|
5790
|
+
for (const item of result.output) {
|
|
5791
|
+
if (item.content) {
|
|
5792
|
+
for (const resource of item.content) {
|
|
5793
|
+
resources.push({
|
|
5794
|
+
type: resource.type || "unknown",
|
|
5795
|
+
url: resource.url || "",
|
|
5796
|
+
size: resource.size,
|
|
5797
|
+
jobId: resource.jobId,
|
|
5798
|
+
...resource
|
|
5799
|
+
});
|
|
5800
|
+
}
|
|
5801
|
+
}
|
|
5802
|
+
}
|
|
5803
|
+
}
|
|
5804
|
+
return resources;
|
|
5805
|
+
}
|
|
5806
|
+
|
|
5807
|
+
// src/api/youchuan_pan.ts
|
|
5808
|
+
async function youchuanPan(params) {
|
|
5809
|
+
const client = getClient();
|
|
5810
|
+
const pollingOptions = {
|
|
5811
|
+
intervalMs: 3e3,
|
|
5812
|
+
maxAttempts: 60
|
|
5813
|
+
};
|
|
5814
|
+
const result = await createAndWaitTask(
|
|
5815
|
+
client,
|
|
5816
|
+
"/model/v1/generation",
|
|
5817
|
+
{
|
|
5818
|
+
model: "youchuan_pan",
|
|
5819
|
+
input: [{ params }]
|
|
5820
|
+
},
|
|
5821
|
+
pollingOptions
|
|
5822
|
+
);
|
|
5823
|
+
const resources = [];
|
|
5824
|
+
if (result.output) {
|
|
5825
|
+
for (const item of result.output) {
|
|
5826
|
+
if (item.content) {
|
|
5827
|
+
for (const resource of item.content) {
|
|
5828
|
+
resources.push({
|
|
5829
|
+
type: resource.type || "unknown",
|
|
5830
|
+
url: resource.url || "",
|
|
5831
|
+
size: resource.size,
|
|
5832
|
+
jobId: resource.jobId,
|
|
5833
|
+
...resource
|
|
5834
|
+
});
|
|
5835
|
+
}
|
|
5836
|
+
}
|
|
5837
|
+
}
|
|
5838
|
+
}
|
|
5839
|
+
return resources;
|
|
5840
|
+
}
|
|
5841
|
+
|
|
5842
|
+
// src/api/youchuan_remix.ts
|
|
5843
|
+
async function youchuanRemix(params) {
|
|
5844
|
+
const client = getClient();
|
|
5845
|
+
const pollingOptions = {
|
|
5846
|
+
intervalMs: 3e3,
|
|
5847
|
+
maxAttempts: 60
|
|
5848
|
+
};
|
|
5849
|
+
const result = await createAndWaitTask(
|
|
5850
|
+
client,
|
|
5851
|
+
"/model/v1/generation",
|
|
5852
|
+
{
|
|
5853
|
+
model: "youchuan_remix",
|
|
5854
|
+
input: [{ params }]
|
|
5855
|
+
},
|
|
5856
|
+
pollingOptions
|
|
5857
|
+
);
|
|
5858
|
+
const resources = [];
|
|
5859
|
+
if (result.output) {
|
|
5860
|
+
for (const item of result.output) {
|
|
5861
|
+
if (item.content) {
|
|
5862
|
+
for (const resource of item.content) {
|
|
5863
|
+
resources.push({
|
|
5864
|
+
type: resource.type || "unknown",
|
|
5865
|
+
url: resource.url || "",
|
|
5866
|
+
size: resource.size,
|
|
5867
|
+
jobId: resource.jobId,
|
|
5868
|
+
...resource
|
|
5869
|
+
});
|
|
5870
|
+
}
|
|
5871
|
+
}
|
|
5872
|
+
}
|
|
5873
|
+
}
|
|
5874
|
+
return resources;
|
|
5875
|
+
}
|
|
5876
|
+
|
|
5877
|
+
// src/api/youchuan_remove_background.ts
|
|
5878
|
+
async function youchuanRemoveBackground(params) {
|
|
5879
|
+
const client = getClient();
|
|
5880
|
+
const pollingOptions = {
|
|
5881
|
+
intervalMs: 3e3,
|
|
5882
|
+
maxAttempts: 60
|
|
5883
|
+
};
|
|
5884
|
+
const result = await createAndWaitTask(
|
|
5885
|
+
client,
|
|
5886
|
+
"/model/v1/generation",
|
|
5887
|
+
{
|
|
5888
|
+
model: "youchuan_remove_background",
|
|
5889
|
+
input: [{ params }]
|
|
5890
|
+
},
|
|
5891
|
+
pollingOptions
|
|
5892
|
+
);
|
|
5893
|
+
const resources = [];
|
|
5894
|
+
if (result.output) {
|
|
5895
|
+
for (const item of result.output) {
|
|
5896
|
+
if (item.content) {
|
|
5897
|
+
for (const resource of item.content) {
|
|
5898
|
+
resources.push({
|
|
5899
|
+
type: resource.type || "unknown",
|
|
5900
|
+
url: resource.url || "",
|
|
5901
|
+
size: resource.size,
|
|
5902
|
+
jobId: resource.jobId,
|
|
5903
|
+
...resource
|
|
5904
|
+
});
|
|
5905
|
+
}
|
|
5906
|
+
}
|
|
5907
|
+
}
|
|
5908
|
+
}
|
|
5909
|
+
return resources;
|
|
5910
|
+
}
|
|
5911
|
+
|
|
5912
|
+
// src/api/youchuan_retexture.ts
|
|
5913
|
+
async function youchuanRetexture(params) {
|
|
5914
|
+
const client = getClient();
|
|
5915
|
+
const pollingOptions = {
|
|
5916
|
+
intervalMs: 3e3,
|
|
5917
|
+
maxAttempts: 60
|
|
5918
|
+
};
|
|
5919
|
+
const result = await createAndWaitTask(
|
|
5920
|
+
client,
|
|
5921
|
+
"/model/v1/generation",
|
|
5922
|
+
{
|
|
5923
|
+
model: "youchuan_retexture",
|
|
5924
|
+
input: [{ params }]
|
|
5925
|
+
},
|
|
5926
|
+
pollingOptions
|
|
5927
|
+
);
|
|
5928
|
+
const resources = [];
|
|
5929
|
+
if (result.output) {
|
|
5930
|
+
for (const item of result.output) {
|
|
5931
|
+
if (item.content) {
|
|
5932
|
+
for (const resource of item.content) {
|
|
5933
|
+
resources.push({
|
|
5934
|
+
type: resource.type || "unknown",
|
|
5935
|
+
url: resource.url || "",
|
|
5936
|
+
size: resource.size,
|
|
5937
|
+
jobId: resource.jobId,
|
|
5938
|
+
...resource
|
|
5939
|
+
});
|
|
5940
|
+
}
|
|
5941
|
+
}
|
|
5942
|
+
}
|
|
5943
|
+
}
|
|
5944
|
+
return resources;
|
|
5945
|
+
}
|
|
5946
|
+
|
|
5947
|
+
// src/api/youchuan_uploadpaint.ts
|
|
5948
|
+
async function youchuanUploadpaint(params) {
|
|
5949
|
+
const client = getClient();
|
|
5950
|
+
const pollingOptions = {
|
|
5951
|
+
intervalMs: 3e3,
|
|
5952
|
+
maxAttempts: 60
|
|
5953
|
+
};
|
|
5954
|
+
const result = await createAndWaitTask(
|
|
5955
|
+
client,
|
|
5956
|
+
"/model/v1/generation",
|
|
5957
|
+
{
|
|
5958
|
+
model: "youchuan_uploadpaint",
|
|
5959
|
+
input: [{ params }]
|
|
5960
|
+
},
|
|
5961
|
+
pollingOptions
|
|
5962
|
+
);
|
|
5963
|
+
const resources = [];
|
|
5964
|
+
if (result.output) {
|
|
5965
|
+
for (const item of result.output) {
|
|
5966
|
+
if (item.content) {
|
|
5967
|
+
for (const resource of item.content) {
|
|
5968
|
+
resources.push({
|
|
5969
|
+
type: resource.type || "unknown",
|
|
5970
|
+
url: resource.url || "",
|
|
5971
|
+
size: resource.size,
|
|
5972
|
+
jobId: resource.jobId,
|
|
5973
|
+
...resource
|
|
5974
|
+
});
|
|
5975
|
+
}
|
|
5976
|
+
}
|
|
5977
|
+
}
|
|
5978
|
+
}
|
|
5979
|
+
return resources;
|
|
5980
|
+
}
|
|
5981
|
+
|
|
5982
|
+
// src/api/youchuan_upscale.ts
|
|
5983
|
+
async function youchuanUpscale(params) {
|
|
5984
|
+
const client = getClient();
|
|
5985
|
+
const pollingOptions = {
|
|
5986
|
+
intervalMs: 3e3,
|
|
5987
|
+
maxAttempts: 60
|
|
5988
|
+
};
|
|
5989
|
+
const result = await createAndWaitTask(
|
|
5990
|
+
client,
|
|
5991
|
+
"/model/v1/generation",
|
|
5992
|
+
{
|
|
5993
|
+
model: "youchuan_upscale",
|
|
5994
|
+
input: [{ params }]
|
|
5995
|
+
},
|
|
5996
|
+
pollingOptions
|
|
5997
|
+
);
|
|
5998
|
+
const resources = [];
|
|
5999
|
+
if (result.output) {
|
|
6000
|
+
for (const item of result.output) {
|
|
6001
|
+
if (item.content) {
|
|
6002
|
+
for (const resource of item.content) {
|
|
6003
|
+
resources.push({
|
|
6004
|
+
type: resource.type || "unknown",
|
|
6005
|
+
url: resource.url || "",
|
|
6006
|
+
size: resource.size,
|
|
6007
|
+
jobId: resource.jobId,
|
|
6008
|
+
...resource
|
|
6009
|
+
});
|
|
6010
|
+
}
|
|
6011
|
+
}
|
|
6012
|
+
}
|
|
6013
|
+
}
|
|
6014
|
+
return resources;
|
|
6015
|
+
}
|
|
6016
|
+
|
|
6017
|
+
// src/api/youchuan_variation.ts
|
|
6018
|
+
async function youchuanVariation(params) {
|
|
6019
|
+
const client = getClient();
|
|
6020
|
+
const pollingOptions = {
|
|
6021
|
+
intervalMs: 3e3,
|
|
6022
|
+
maxAttempts: 60
|
|
6023
|
+
};
|
|
6024
|
+
const result = await createAndWaitTask(
|
|
6025
|
+
client,
|
|
6026
|
+
"/model/v1/generation",
|
|
6027
|
+
{
|
|
6028
|
+
model: "youchuan_variation",
|
|
6029
|
+
input: [{ params }]
|
|
6030
|
+
},
|
|
6031
|
+
pollingOptions
|
|
6032
|
+
);
|
|
6033
|
+
const resources = [];
|
|
6034
|
+
if (result.output) {
|
|
6035
|
+
for (const item of result.output) {
|
|
6036
|
+
if (item.content) {
|
|
6037
|
+
for (const resource of item.content) {
|
|
6038
|
+
resources.push({
|
|
6039
|
+
type: resource.type || "unknown",
|
|
6040
|
+
url: resource.url || "",
|
|
6041
|
+
size: resource.size,
|
|
6042
|
+
jobId: resource.jobId,
|
|
6043
|
+
...resource
|
|
6044
|
+
});
|
|
6045
|
+
}
|
|
6046
|
+
}
|
|
6047
|
+
}
|
|
6048
|
+
}
|
|
6049
|
+
return resources;
|
|
6050
|
+
}
|
|
6051
|
+
|
|
6052
|
+
// src/api/youchuan_video_diffusion.ts
|
|
6053
|
+
async function youchuanVideoDiffusion(params) {
|
|
6054
|
+
const client = getClient();
|
|
6055
|
+
const pollingOptions = {
|
|
6056
|
+
intervalMs: 3e3,
|
|
6057
|
+
maxAttempts: 60
|
|
6058
|
+
};
|
|
6059
|
+
const result = await createAndWaitTask(
|
|
6060
|
+
client,
|
|
6061
|
+
"/model/v1/generation",
|
|
6062
|
+
{
|
|
6063
|
+
model: "youchuan_video_diffusion",
|
|
6064
|
+
input: [{ params }]
|
|
6065
|
+
},
|
|
6066
|
+
pollingOptions
|
|
6067
|
+
);
|
|
6068
|
+
const resources = [];
|
|
6069
|
+
if (result.output) {
|
|
6070
|
+
for (const item of result.output) {
|
|
6071
|
+
if (item.content) {
|
|
6072
|
+
for (const resource of item.content) {
|
|
6073
|
+
resources.push({
|
|
6074
|
+
type: resource.type || "unknown",
|
|
6075
|
+
url: resource.url || "",
|
|
6076
|
+
size: resource.size,
|
|
6077
|
+
jobId: resource.jobId,
|
|
6078
|
+
...resource
|
|
6079
|
+
});
|
|
6080
|
+
}
|
|
6081
|
+
}
|
|
6082
|
+
}
|
|
6083
|
+
}
|
|
6084
|
+
return resources;
|
|
6085
|
+
}
|
|
6086
|
+
|
|
6087
|
+
// src/api/youchuan_video_upscale.ts
|
|
6088
|
+
async function youchuanVideoUpscale(params) {
|
|
6089
|
+
const client = getClient();
|
|
6090
|
+
const pollingOptions = {
|
|
6091
|
+
intervalMs: 3e3,
|
|
6092
|
+
maxAttempts: 60
|
|
6093
|
+
};
|
|
6094
|
+
const result = await createAndWaitTask(
|
|
6095
|
+
client,
|
|
6096
|
+
"/model/v1/generation",
|
|
6097
|
+
{
|
|
6098
|
+
model: "youchuan_video_upscale",
|
|
6099
|
+
input: [{ params }]
|
|
6100
|
+
},
|
|
6101
|
+
pollingOptions
|
|
6102
|
+
);
|
|
6103
|
+
const resources = [];
|
|
6104
|
+
if (result.output) {
|
|
6105
|
+
for (const item of result.output) {
|
|
6106
|
+
if (item.content) {
|
|
6107
|
+
for (const resource of item.content) {
|
|
6108
|
+
resources.push({
|
|
6109
|
+
type: resource.type || "unknown",
|
|
6110
|
+
url: resource.url || "",
|
|
6111
|
+
size: resource.size,
|
|
6112
|
+
jobId: resource.jobId,
|
|
6113
|
+
...resource
|
|
6114
|
+
});
|
|
6115
|
+
}
|
|
6116
|
+
}
|
|
6117
|
+
}
|
|
6118
|
+
}
|
|
6119
|
+
return resources;
|
|
6120
|
+
}
|
|
6121
|
+
|
|
6122
|
+
export { SeacloudClient, SeacloudError, agentChatCompletions, alibabaAnimateAnyoneDetect, alibabaAnimateAnyoneTemplate, alibabaAnimateAnyoneVideo, alibabaQianwenImage, alibabaWan22T2iFlash, alibabaWan22T2iPlus, alibabaWan25I2iPreview, alibabaWan25T2iPreview, alibabaWanx20T2iTurbo, alibabaWanx21I2vPlus, alibabaWanx21I2vTurbo, alibabaWanx21T2iPlus, alibabaWanx21T2iTurbo, alibabaWanx21T2vPlus, alibabaWanx21T2vTurbo, alibabaWanx22I2vFlash, alibabaWanx22I2vPlus, alibabaWanx22T2vPlus, alibabaWanx25I2vPreview, alibabaWanx25T2vPreview, alibabaWanx26I2v, alibabaWanx26Reference, alibabaWanx26T2v, appGeneration, appSearch, blackforestlabsFlux11Pro, blackforestlabsFlux1Pro, blackforestlabsFlux2Flex, blackforestlabsFlux2FlexEdit, blackforestlabsFlux2Pro, blackforestlabsFlux2ProEdit, blackforestlabsFluxKontextMax, blackforestlabsFluxKontextPro, createAndWaitTask, createAudioMessage, createConfig, createImageMessage, createTextMessage, createTool, createVideoMessage, elevenlabsTtsGenerator, getClient, getDefaultPollingOptions, getTaskStatus, googleGemini3ProImage, googleGeminiImage, googleImagen4FastGenerate, googleImagen4Generate, googleImagen4UltraGenerate, googleVeo20Generate001, googleVeo20GenerateExp, googleVeo20GeneratePreview, googleVeo30FastGenerate001, googleVeo30Generate001, googleVeo31, initSeacloud, klingAvatar, klingDurationExtension, klingEffectsMultiV1, klingEffectsMultiV15, klingEffectsMultiV16, klingEffectsSingle, klingLipsync, klingOmniImage, klingOmniVideo, klingV1, klingV15, klingV15I2v, klingV16, klingV16I2v, klingV1I2v, klingV21I2v, klingV21Master, klingV21MasterI2v, klingV25Turbo, klingV25TurboI2v, klingV26, klingV26I2v, klingV2Master, klingV2MasterI2v, llmChatCompletions, microsoftGptImage1, microsoftGptImage15, microsoftSora2, minimaxHailuo02, minimaxHailuo02I2v, minimaxHailuo23FastI2v, minimaxHailuo23I2v, minimaxI2v01, minimaxI2v01Director, minimaxI2v01Live, minimaxT2a, minimaxT2v01, minimaxT2v01Director, pixverseV35I2v, pixverseV35T2v, pixverseV35Transition, pixverseV45I2v, pixverseV45T2v, pixverseV45Transition, pixverseV4I2v, pixverseV4T2v, pixverseV4Transition, pixverseV55I2v, pixverseV55T2v, pixverseV55Transition, pixverseV5I2v, pixverseV5T2v, pixverseV5Transition, pollTaskUntilComplete, resetConfig, runwayGen3aTurboI2v, scan, setDefaultPollingOptions, templateSpecs, tencentHunyuan3d, tencentHunyuan3dPro, tencentHunyuan3dRapid, tencentImageCreation3, tencentMpsSuperResolution, validateConfig, vidu15, vidu15I2v, vidu20I2v, viduQ1, viduQ1I2v, viduQ2, viduQ2I2vReference, viduTemplate, viduTemplateV2, volcesJimeng30, volcesJimeng31, volcesJimengDreamActorM1, volcesJimengI2i30, volcesRealmanAvatarImitatorV2v, volcesRealmanAvatarPictureOmniV15, volcesRealmanAvatarPictureOmniV2, volcesSeed3d, volcesSeedance30, volcesSeedance30I2v, volcesSeedance30Pro, volcesSeedanceProFast, volcesSeededit20, volcesSeededit30, volcesSeededit30I2i, volcesSeededit3dStyle, volcesSeededitMultiIp, volcesSeededitMultiStyle, volcesSeededitPortrait, volcesSeededitSingleIp, volcesSeedream30, volcesSeedream40, volcesSeedream45, volcesSeedream45I2i, volcesSeedream45MultiBlend, volcesSubjectDetection, volcesSubjectRecognition, youchuanDiffusion, youchuanEdit, youchuanEnhance, youchuanExtendVideo, youchuanInpaint, youchuanOutpaint, youchuanPan, youchuanRemix, youchuanRemoveBackground, youchuanRetexture, youchuanUploadpaint, youchuanUpscale, youchuanVariation, youchuanVideoDiffusion, youchuanVideoUpscale };
|
|
5422
6123
|
//# sourceMappingURL=index.js.map
|
|
5423
6124
|
//# sourceMappingURL=index.js.map
|