@seawork/server 1.0.4 → 1.0.10-rc.4
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/server/client/daemon-client.d.ts +32 -1
- package/dist/server/client/daemon-client.d.ts.map +1 -1
- package/dist/server/client/daemon-client.js +69 -0
- package/dist/server/client/daemon-client.js.map +1 -1
- package/dist/server/server/agent/agent-management-mcp.d.ts.map +1 -1
- package/dist/server/server/agent/agent-management-mcp.js +6 -5
- package/dist/server/server/agent/agent-management-mcp.js.map +1 -1
- package/dist/server/server/agent/agent-response-loop.d.ts.map +1 -1
- package/dist/server/server/agent/agent-response-loop.js +0 -1
- package/dist/server/server/agent/agent-response-loop.js.map +1 -1
- package/dist/server/server/agent/agent-storage.d.ts +68 -68
- package/dist/server/server/agent/mcp-server.d.ts.map +1 -1
- package/dist/server/server/agent/mcp-server.js +6 -5
- package/dist/server/server/agent/mcp-server.js.map +1 -1
- package/dist/server/server/agent/mcp-shared.d.ts +30 -30
- package/dist/server/server/agent/provider-manifest.d.ts +2 -1
- package/dist/server/server/agent/provider-manifest.d.ts.map +1 -1
- package/dist/server/server/agent/provider-manifest.js +8 -69
- package/dist/server/server/agent/provider-manifest.js.map +1 -1
- package/dist/server/server/agent/provider-registry.d.ts.map +1 -1
- package/dist/server/server/agent/provider-registry.js +2 -10
- package/dist/server/server/agent/provider-registry.js.map +1 -1
- package/dist/server/server/agent/providers/claude/claude-models.d.ts +1 -1
- package/dist/server/server/agent/providers/claude/claude-models.d.ts.map +1 -1
- package/dist/server/server/agent/providers/claude/claude-models.js +4 -39
- package/dist/server/server/agent/providers/claude/claude-models.js.map +1 -1
- package/dist/server/server/agent/providers/claude/task-notification-tool-call.d.ts +2 -2
- package/dist/server/server/agent/providers/claude-agent.d.ts +2 -1
- package/dist/server/server/agent/providers/claude-agent.d.ts.map +1 -1
- package/dist/server/server/agent/providers/claude-agent.js +175 -46
- package/dist/server/server/agent/providers/claude-agent.js.map +1 -1
- package/dist/server/server/agent/providers/codex-app-server-agent.d.ts.map +1 -1
- package/dist/server/server/agent/providers/codex-app-server-agent.js +128 -72
- package/dist/server/server/agent/providers/codex-app-server-agent.js.map +1 -1
- package/dist/server/server/agent/providers/codex-rollout-timeline.d.ts.map +1 -1
- package/dist/server/server/agent/providers/codex-rollout-timeline.js +76 -0
- package/dist/server/server/agent/providers/codex-rollout-timeline.js.map +1 -1
- package/dist/server/server/agent/providers/seawork-models.d.ts +4 -0
- package/dist/server/server/agent/providers/seawork-models.d.ts.map +1 -0
- package/dist/server/server/agent/providers/seawork-models.js +128 -0
- package/dist/server/server/agent/providers/seawork-models.js.map +1 -0
- package/dist/server/server/agent/providers/tool-call-detail-primitives.d.ts +16 -16
- package/dist/server/server/bootstrap.d.ts.map +1 -1
- package/dist/server/server/bootstrap.js +35 -1
- package/dist/server/server/bootstrap.js.map +1 -1
- package/dist/server/server/bug-report-handler.d.ts +9 -0
- package/dist/server/server/bug-report-handler.d.ts.map +1 -0
- package/dist/server/server/bug-report-handler.js +111 -0
- package/dist/server/server/bug-report-handler.js.map +1 -0
- package/dist/server/server/bug-report-redact.d.ts +12 -0
- package/dist/server/server/bug-report-redact.d.ts.map +1 -0
- package/dist/server/server/bug-report-redact.js +63 -0
- package/dist/server/server/bug-report-redact.js.map +1 -0
- package/dist/server/server/chat/chat-rpc-schemas.d.ts +26 -26
- package/dist/server/server/chat/chat-types.d.ts +2 -2
- package/dist/server/server/config.d.ts.map +1 -1
- package/dist/server/server/config.js +6 -1
- package/dist/server/server/config.js.map +1 -1
- package/dist/server/server/exports.d.ts +4 -2
- package/dist/server/server/exports.d.ts.map +1 -1
- package/dist/server/server/exports.js +3 -0
- package/dist/server/server/exports.js.map +1 -1
- package/dist/server/server/index.js +54 -0
- package/dist/server/server/index.js.map +1 -1
- package/dist/server/server/loop/rpc-schemas.d.ts +775 -775
- package/dist/server/server/loop-service.d.ts +108 -108
- package/dist/server/server/persisted-config.d.ts +121 -121
- package/dist/server/server/pid-lock.d.ts.map +1 -1
- package/dist/server/server/pid-lock.js +35 -2
- package/dist/server/server/pid-lock.js.map +1 -1
- package/dist/server/server/sac/auth.d.ts +41 -0
- package/dist/server/server/sac/auth.d.ts.map +1 -0
- package/dist/server/server/sac/auth.js +103 -0
- package/dist/server/server/sac/auth.js.map +1 -0
- package/dist/server/server/sac/client.d.ts +15 -0
- package/dist/server/server/sac/client.d.ts.map +1 -0
- package/dist/server/server/sac/client.js +70 -0
- package/dist/server/server/sac/client.js.map +1 -0
- package/dist/server/server/sac/download.d.ts +10 -0
- package/dist/server/server/sac/download.d.ts.map +1 -0
- package/dist/server/server/sac/download.js +67 -0
- package/dist/server/server/sac/download.js.map +1 -0
- package/dist/server/server/sac/endpoints.d.ts +13 -0
- package/dist/server/server/sac/endpoints.d.ts.map +1 -0
- package/dist/server/server/sac/endpoints.js +16 -0
- package/dist/server/server/sac/endpoints.js.map +1 -0
- package/dist/server/server/sac/errors.d.ts +40 -0
- package/dist/server/server/sac/errors.d.ts.map +1 -0
- package/dist/server/server/sac/errors.js +47 -0
- package/dist/server/server/sac/errors.js.map +1 -0
- package/dist/server/server/sac/generate.d.ts +43 -0
- package/dist/server/server/sac/generate.d.ts.map +1 -0
- package/dist/server/server/sac/generate.js +206 -0
- package/dist/server/server/sac/generate.js.map +1 -0
- package/dist/server/server/sac/index.d.ts +22 -0
- package/dist/server/server/sac/index.d.ts.map +1 -0
- package/dist/server/server/sac/index.js +14 -0
- package/dist/server/server/sac/index.js.map +1 -0
- package/dist/server/server/sac/output.d.ts +22 -0
- package/dist/server/server/sac/output.d.ts.map +1 -0
- package/dist/server/server/sac/output.js +142 -0
- package/dist/server/server/sac/output.js.map +1 -0
- package/dist/server/server/sac/poll.d.ts +12 -0
- package/dist/server/server/sac/poll.d.ts.map +1 -0
- package/dist/server/server/sac/poll.js +67 -0
- package/dist/server/server/sac/poll.js.map +1 -0
- package/dist/server/server/sac/providers/alibaba.d.ts +2 -0
- package/dist/server/server/sac/providers/alibaba.d.ts.map +1 -0
- package/dist/server/server/sac/providers/alibaba.js +506 -0
- package/dist/server/server/sac/providers/alibaba.js.map +1 -0
- package/dist/server/server/sac/providers/audio.d.ts +2 -0
- package/dist/server/server/sac/providers/audio.d.ts.map +1 -0
- package/dist/server/server/sac/providers/audio.js +57 -0
- package/dist/server/server/sac/providers/audio.js.map +1 -0
- package/dist/server/server/sac/providers/index.d.ts +19 -0
- package/dist/server/server/sac/providers/index.d.ts.map +1 -0
- package/dist/server/server/sac/providers/index.js +32 -0
- package/dist/server/server/sac/providers/index.js.map +1 -0
- package/dist/server/server/sac/providers/kling.d.ts +2 -0
- package/dist/server/server/sac/providers/kling.d.ts.map +1 -0
- package/dist/server/server/sac/providers/kling.js +589 -0
- package/dist/server/server/sac/providers/kling.js.map +1 -0
- package/dist/server/server/sac/providers/nano.d.ts +2 -0
- package/dist/server/server/sac/providers/nano.d.ts.map +1 -0
- package/dist/server/server/sac/providers/nano.js +37 -0
- package/dist/server/server/sac/providers/nano.js.map +1 -0
- package/dist/server/server/sac/providers/pixverse.d.ts +2 -0
- package/dist/server/server/sac/providers/pixverse.d.ts.map +1 -0
- package/dist/server/server/sac/providers/pixverse.js +1017 -0
- package/dist/server/server/sac/providers/pixverse.js.map +1 -0
- package/dist/server/server/sac/providers/registry.d.ts +34 -0
- package/dist/server/server/sac/providers/registry.d.ts.map +1 -0
- package/dist/server/server/sac/providers/registry.js +57 -0
- package/dist/server/server/sac/providers/registry.js.map +1 -0
- package/dist/server/server/sac/providers/seaart.d.ts +4 -0
- package/dist/server/server/sac/providers/seaart.d.ts.map +1 -0
- package/dist/server/server/sac/providers/seaart.js +57 -0
- package/dist/server/server/sac/providers/seaart.js.map +1 -0
- package/dist/server/server/sac/providers/store.d.ts +12 -0
- package/dist/server/server/sac/providers/store.d.ts.map +1 -0
- package/dist/server/server/sac/providers/store.js +7 -0
- package/dist/server/server/sac/providers/store.js.map +1 -0
- package/dist/server/server/sac/providers/tencent-3d.d.ts +2 -0
- package/dist/server/server/sac/providers/tencent-3d.d.ts.map +1 -0
- package/dist/server/server/sac/providers/tencent-3d.js +210 -0
- package/dist/server/server/sac/providers/tencent-3d.js.map +1 -0
- package/dist/server/server/sac/providers/tencent-image.d.ts +2 -0
- package/dist/server/server/sac/providers/tencent-image.d.ts.map +1 -0
- package/dist/server/server/sac/providers/tencent-image.js +90 -0
- package/dist/server/server/sac/providers/tencent-image.js.map +1 -0
- package/dist/server/server/sac/providers/tencent-video.d.ts +2 -0
- package/dist/server/server/sac/providers/tencent-video.d.ts.map +1 -0
- package/dist/server/server/sac/providers/tencent-video.js +103 -0
- package/dist/server/server/sac/providers/tencent-video.js.map +1 -0
- package/dist/server/server/sac/providers/tripo3d.d.ts +2 -0
- package/dist/server/server/sac/providers/tripo3d.d.ts.map +1 -0
- package/dist/server/server/sac/providers/tripo3d.js +302 -0
- package/dist/server/server/sac/providers/tripo3d.js.map +1 -0
- package/dist/server/server/sac/providers/vidu.d.ts +2 -0
- package/dist/server/server/sac/providers/vidu.d.ts.map +1 -0
- package/dist/server/server/sac/providers/vidu.js +965 -0
- package/dist/server/server/sac/providers/vidu.js.map +1 -0
- package/dist/server/server/sac/providers/volces-3d.d.ts +2 -0
- package/dist/server/server/sac/providers/volces-3d.d.ts.map +1 -0
- package/dist/server/server/sac/providers/volces-3d.js +77 -0
- package/dist/server/server/sac/providers/volces-3d.js.map +1 -0
- package/dist/server/server/sac/providers/volces-video.d.ts +2 -0
- package/dist/server/server/sac/providers/volces-video.d.ts.map +1 -0
- package/dist/server/server/sac/providers/volces-video.js +392 -0
- package/dist/server/server/sac/providers/volces-video.js.map +1 -0
- package/dist/server/server/sac/providers/volces.d.ts +2 -0
- package/dist/server/server/sac/providers/volces.d.ts.map +1 -0
- package/dist/server/server/sac/providers/volces.js +301 -0
- package/dist/server/server/sac/providers/volces.js.map +1 -0
- package/dist/server/server/sac/types.d.ts +59 -0
- package/dist/server/server/sac/types.d.ts.map +1 -0
- package/dist/server/server/sac/types.js +5 -0
- package/dist/server/server/sac/types.js.map +1 -0
- package/dist/server/server/schedule/rpc-schemas.d.ts +493 -493
- package/dist/server/server/schedule/types.d.ts +140 -140
- package/dist/server/server/session.d.ts +9 -2
- package/dist/server/server/session.d.ts.map +1 -1
- package/dist/server/server/session.js +137 -19
- package/dist/server/server/session.js.map +1 -1
- package/dist/server/server/speech/speech-types.d.ts +2 -2
- package/dist/server/server/workspace-registry.d.ts +4 -4
- package/dist/server/shared/messages.d.ts +17455 -15917
- package/dist/server/shared/messages.d.ts.map +1 -1
- package/dist/server/shared/messages.js +83 -0
- package/dist/server/shared/messages.js.map +1 -1
- package/dist/server/utils/spawn.d.ts.map +1 -1
- package/dist/server/utils/spawn.js +8 -3
- package/dist/server/utils/spawn.js.map +1 -1
- package/dist/server/utils/worktree-metadata.d.ts +4 -4
- package/dist/src/server/pid-lock.js +35 -2
- package/dist/src/server/pid-lock.js.map +1 -1
- package/package.json +14 -9
- package/dist/server/server/agent/providers/acp-agent.d.ts +0 -202
- package/dist/server/server/agent/providers/acp-agent.d.ts.map +0 -1
- package/dist/server/server/agent/providers/acp-agent.js +0 -1650
- package/dist/server/server/agent/providers/acp-agent.js.map +0 -1
- package/dist/server/server/agent/providers/copilot-acp-agent.d.ts +0 -16
- package/dist/server/server/agent/providers/copilot-acp-agent.d.ts.map +0 -1
- package/dist/server/server/agent/providers/copilot-acp-agent.js +0 -95
- package/dist/server/server/agent/providers/copilot-acp-agent.js.map +0 -1
- package/dist/server/server/agent/providers/opencode/tool-call-detail-parser.d.ts +0 -3
- package/dist/server/server/agent/providers/opencode/tool-call-detail-parser.d.ts.map +0 -1
- package/dist/server/server/agent/providers/opencode/tool-call-detail-parser.js +0 -39
- package/dist/server/server/agent/providers/opencode/tool-call-detail-parser.js.map +0 -1
- package/dist/server/server/agent/providers/opencode/tool-call-mapper.d.ts +0 -13
- package/dist/server/server/agent/providers/opencode/tool-call-mapper.d.ts.map +0 -1
- package/dist/server/server/agent/providers/opencode/tool-call-mapper.js +0 -144
- package/dist/server/server/agent/providers/opencode/tool-call-mapper.js.map +0 -1
- package/dist/server/server/agent/providers/opencode-agent.d.ts +0 -121
- package/dist/server/server/agent/providers/opencode-agent.d.ts.map +0 -1
- package/dist/server/server/agent/providers/opencode-agent.js +0 -1649
- package/dist/server/server/agent/providers/opencode-agent.js.map +0 -1
- package/dist/server/server/agent/providers/pi-acp-agent.d.ts +0 -28
- package/dist/server/server/agent/providers/pi-acp-agent.d.ts.map +0 -1
- package/dist/server/server/agent/providers/pi-acp-agent.js +0 -302
- package/dist/server/server/agent/providers/pi-acp-agent.js.map +0 -1
|
@@ -0,0 +1,1017 @@
|
|
|
1
|
+
import { SACError as CLIError, ExitCode } from "../errors.js";
|
|
2
|
+
import { registerProvider } from "./store.js";
|
|
3
|
+
const TRANSITION_MODELS = [
|
|
4
|
+
'pixverse_v35_transition',
|
|
5
|
+
'pixverse_v4_transition',
|
|
6
|
+
'pixverse_v45_transition',
|
|
7
|
+
'pixverse_v5_transition',
|
|
8
|
+
'pixverse_v5_5_transition',
|
|
9
|
+
'pixverse_v5_6_transition',
|
|
10
|
+
'pixverse_v6_transition',
|
|
11
|
+
];
|
|
12
|
+
const I2V_MODELS = [
|
|
13
|
+
'pixverse_v3_5_i2v',
|
|
14
|
+
'pixverse_v4_i2v',
|
|
15
|
+
'pixverse_v4_5_i2v',
|
|
16
|
+
'pixverse_v5_i2v',
|
|
17
|
+
'pixverse_v5_5_i2v',
|
|
18
|
+
'pixverse_v5_6_i2v',
|
|
19
|
+
'pixverse_v6_i2v',
|
|
20
|
+
];
|
|
21
|
+
const T2V_MODELS = [
|
|
22
|
+
'pixverse_v3_5_t2v',
|
|
23
|
+
'pixverse_v4_t2v',
|
|
24
|
+
'pixverse_v4_5_t2v',
|
|
25
|
+
'pixverse_v5_t2v',
|
|
26
|
+
'pixverse_v5_5_t2v',
|
|
27
|
+
'pixverse_v5_6_t2v',
|
|
28
|
+
'pixverse_v6_t2v',
|
|
29
|
+
];
|
|
30
|
+
const FUSION_MODELS = [
|
|
31
|
+
'pixverse_v5_6_fusion',
|
|
32
|
+
];
|
|
33
|
+
const OPTIONAL_PROMPT_MODELS = new Set([
|
|
34
|
+
'pixverse_v35_transition',
|
|
35
|
+
'pixverse_v3_5_t2v',
|
|
36
|
+
'pixverse_v3_5_i2v',
|
|
37
|
+
'pixverse_v4_i2v',
|
|
38
|
+
'pixverse_v4_5_i2v',
|
|
39
|
+
'pixverse_v5_i2v',
|
|
40
|
+
'pixverse_v5_transition',
|
|
41
|
+
'pixverse_v45_transition',
|
|
42
|
+
'pixverse_v5_6_i2v',
|
|
43
|
+
'pixverse_v6_transition',
|
|
44
|
+
]);
|
|
45
|
+
const LEGACY_T2V_MODELS = new Set([
|
|
46
|
+
'pixverse_v3_5_t2v',
|
|
47
|
+
'pixverse_v4_t2v',
|
|
48
|
+
'pixverse_v4_5_t2v',
|
|
49
|
+
'pixverse_v5_t2v',
|
|
50
|
+
]);
|
|
51
|
+
const LEGACY_I2V_MODELS = new Set([
|
|
52
|
+
'pixverse_v3_5_i2v',
|
|
53
|
+
'pixverse_v4_i2v',
|
|
54
|
+
'pixverse_v4_5_i2v',
|
|
55
|
+
'pixverse_v5_i2v',
|
|
56
|
+
]);
|
|
57
|
+
const LEGACY_TRANSITION_MODELS = new Set([
|
|
58
|
+
'pixverse_v35_transition',
|
|
59
|
+
'pixverse_v4_transition',
|
|
60
|
+
'pixverse_v45_transition',
|
|
61
|
+
'pixverse_v5_transition',
|
|
62
|
+
]);
|
|
63
|
+
const V55_T2V_MODELS = new Set(['pixverse_v5_5_t2v']);
|
|
64
|
+
const V55_I2V_MODELS = new Set(['pixverse_v5_5_i2v']);
|
|
65
|
+
const V55_TRANSITION_MODELS = new Set(['pixverse_v5_5_transition']);
|
|
66
|
+
const V56_T2V_MODELS = new Set(['pixverse_v5_6_t2v']);
|
|
67
|
+
const V56_I2V_MODELS = new Set(['pixverse_v5_6_i2v']);
|
|
68
|
+
const V56_TRANSITION_MODELS = new Set(['pixverse_v5_6_transition']);
|
|
69
|
+
const V6_T2V_MODELS = new Set(['pixverse_v6_t2v']);
|
|
70
|
+
const V6_I2V_MODELS = new Set(['pixverse_v6_i2v']);
|
|
71
|
+
const V6_TRANSITION_MODELS = new Set(['pixverse_v6_transition']);
|
|
72
|
+
const QUALITYS = new Set(['360p', '540p', '720p', '1080p']);
|
|
73
|
+
const LEGACY_RATIOS = new Set(['16:9', '9:16', '1:1', '4:3', '3:4']);
|
|
74
|
+
const V6_RATIOS = new Set(['16:9', '4:3', '1:1', '3:4', '9:16', '2:3', '3:2', '21:9']);
|
|
75
|
+
const STYLES = new Set(['anime', '3d_animation', 'clay', 'comic', 'cyberpunk']);
|
|
76
|
+
const MOTION_MODES = new Set(['normal', 'fast']);
|
|
77
|
+
const CAMERA_MOVEMENTS = new Set(['zoom_in', 'zoom_out', 'pan_left', 'pan_right', 'tilt_up', 'tilt_down']);
|
|
78
|
+
const THINKING_TYPES = new Set(['enabled', 'disabled', 'auto']);
|
|
79
|
+
const REFERENCE_TYPES = new Set(['subject', 'background']);
|
|
80
|
+
function buildEnvelope(model, params) {
|
|
81
|
+
return {
|
|
82
|
+
model,
|
|
83
|
+
dash_scope: true,
|
|
84
|
+
moderation: true,
|
|
85
|
+
input: [{ params }],
|
|
86
|
+
metadata: {},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function maybeString(value) {
|
|
90
|
+
if (typeof value !== 'string' || value.length === 0)
|
|
91
|
+
return undefined;
|
|
92
|
+
return value;
|
|
93
|
+
}
|
|
94
|
+
function maybeStringArray(value) {
|
|
95
|
+
if (Array.isArray(value)) {
|
|
96
|
+
return value.filter((item) => typeof item === 'string' && item.length > 0);
|
|
97
|
+
}
|
|
98
|
+
if (typeof value === 'string' && value.length > 0)
|
|
99
|
+
return [value];
|
|
100
|
+
return [];
|
|
101
|
+
}
|
|
102
|
+
function escapeRegex(value) {
|
|
103
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
104
|
+
}
|
|
105
|
+
function promptContainsReference(prompt, refName) {
|
|
106
|
+
const pattern = new RegExp(`(^|\\s)@${escapeRegex(refName)}(?=$|\\s|[\\p{P}\\p{S}])`, 'u');
|
|
107
|
+
return pattern.test(prompt);
|
|
108
|
+
}
|
|
109
|
+
function parseInteger(model, value, flagName, options = {}) {
|
|
110
|
+
if (value === undefined)
|
|
111
|
+
return undefined;
|
|
112
|
+
if (typeof value !== 'number' || Number.isNaN(value) || !Number.isInteger(value)) {
|
|
113
|
+
throw new CLIError(`Model "${model}" requires --${flagName} to be an integer.`, ExitCode.USAGE);
|
|
114
|
+
}
|
|
115
|
+
if (options.min !== undefined && value < options.min) {
|
|
116
|
+
throw new CLIError(`Model "${model}" requires --${flagName} to be at least ${options.min}.`, ExitCode.USAGE);
|
|
117
|
+
}
|
|
118
|
+
if (options.max !== undefined && value > options.max) {
|
|
119
|
+
throw new CLIError(`Model "${model}" requires --${flagName} to be at most ${options.max}.`, ExitCode.USAGE);
|
|
120
|
+
}
|
|
121
|
+
return value;
|
|
122
|
+
}
|
|
123
|
+
function parseEnum(model, value, flagName, allowed) {
|
|
124
|
+
if (value === undefined)
|
|
125
|
+
return undefined;
|
|
126
|
+
if (typeof value !== 'string' || !allowed.has(value)) {
|
|
127
|
+
throw new CLIError(`Model "${model}" requires --${flagName} to be one of: ${Array.from(allowed).join(', ')}.`, ExitCode.USAGE);
|
|
128
|
+
}
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
function parseNonEmptyString(model, value, flagName) {
|
|
132
|
+
if (value === undefined)
|
|
133
|
+
return undefined;
|
|
134
|
+
if (typeof value !== 'string' || value.length === 0) {
|
|
135
|
+
throw new CLIError(`Model "${model}" requires --${flagName} to be a non-empty string.`, ExitCode.USAGE);
|
|
136
|
+
}
|
|
137
|
+
return value;
|
|
138
|
+
}
|
|
139
|
+
function assertUnsupported(model, value, flagName, hint) {
|
|
140
|
+
if (value === undefined)
|
|
141
|
+
return;
|
|
142
|
+
throw new CLIError(hint ?? `Model "${model}" does not support --${flagName}.`, ExitCode.USAGE);
|
|
143
|
+
}
|
|
144
|
+
function assertPixVerseCommonUnsupported(model, flags) {
|
|
145
|
+
const entries = [
|
|
146
|
+
['short', flags.short],
|
|
147
|
+
['size', flags.size],
|
|
148
|
+
['fps', flags.fps],
|
|
149
|
+
['frames', flags.frames],
|
|
150
|
+
['service-tier', flags.serviceTier],
|
|
151
|
+
['expires-after', flags.expiresAfter],
|
|
152
|
+
['payload', flags.payload],
|
|
153
|
+
['callback-url', flags.callbackUrl],
|
|
154
|
+
['off-peak', flags.offPeak],
|
|
155
|
+
['recommend-prompt', flags.recommendPrompt],
|
|
156
|
+
['enhance-prompt', flags.enhancePrompt],
|
|
157
|
+
['template', flags.template],
|
|
158
|
+
['template-params', flags.templateParams],
|
|
159
|
+
['language', flags.language],
|
|
160
|
+
['creative', flags.creative],
|
|
161
|
+
['add-subtitle', flags.addSubtitle],
|
|
162
|
+
['remove-audio', flags.removeAudio],
|
|
163
|
+
['watermark', flags.watermark],
|
|
164
|
+
['watermark-position', flags.watermarkPosition],
|
|
165
|
+
['watermark-url', flags.watermarkUrl],
|
|
166
|
+
['meta-data', flags.metaData],
|
|
167
|
+
['external-task-id', flags.externalTaskId],
|
|
168
|
+
['element-ids', flags.elementIds],
|
|
169
|
+
['effect-scene', flags.effectScene],
|
|
170
|
+
['character-orientation', flags.characterOrientation],
|
|
171
|
+
['keep-original-sound', flags.keepOriginalSound],
|
|
172
|
+
['video-refer-type', flags.videoReferType],
|
|
173
|
+
['lipsync-mode', flags.lipsyncMode],
|
|
174
|
+
['camera-fixed', flags.cameraFixed],
|
|
175
|
+
['return-last-frame', flags.returnLastFrame],
|
|
176
|
+
['draft', flags.draft],
|
|
177
|
+
['draft-task-id', flags.draftTaskId],
|
|
178
|
+
['reference-urls', flags.referenceUrls],
|
|
179
|
+
['video-url', flags.videoUrl],
|
|
180
|
+
['video-id', flags.videoId],
|
|
181
|
+
['mask-urls', flags.maskUrls],
|
|
182
|
+
['movement-amplitude', flags.movementAmplitude],
|
|
183
|
+
['mode', flags.mode],
|
|
184
|
+
['shot-type', flags.shotType],
|
|
185
|
+
['cfg-scale', flags.cfgScale],
|
|
186
|
+
['video-quality', flags.videoQuality],
|
|
187
|
+
['pe-fast-mode', flags.peFastMode],
|
|
188
|
+
['audio-id', flags.audioId],
|
|
189
|
+
['voice-language', flags.voiceLanguage],
|
|
190
|
+
['voice-speed', flags.voiceSpeed],
|
|
191
|
+
['bgm', flags.bgm],
|
|
192
|
+
['sound', flags.sound],
|
|
193
|
+
['audio-url', flags.audioUrl],
|
|
194
|
+
['sounds', flags.sounds],
|
|
195
|
+
['bitrate', flags.bitrate],
|
|
196
|
+
['extension-type', flags.extensionType],
|
|
197
|
+
['character-reference-url', flags.characterReferenceUrl],
|
|
198
|
+
['style-reference-url', flags.styleReferenceUrl],
|
|
199
|
+
['character-reference-weight', flags.characterReferenceWeight],
|
|
200
|
+
['style-reference-weight', flags.styleReferenceWeight],
|
|
201
|
+
];
|
|
202
|
+
for (const [flagName, value] of entries) {
|
|
203
|
+
assertUnsupported(model, value, flagName);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function collectImages(flags) {
|
|
207
|
+
const images = maybeStringArray(flags.imageUrls);
|
|
208
|
+
const imageUrl = maybeString(flags.imageUrl);
|
|
209
|
+
return imageUrl ? [imageUrl, ...images] : images;
|
|
210
|
+
}
|
|
211
|
+
function requireImageInputs(model, flags) {
|
|
212
|
+
const images = collectImages(flags);
|
|
213
|
+
if (images.length === 0) {
|
|
214
|
+
throw new CLIError(`Model "${model}" requires --image-url or --image-urls.`, ExitCode.USAGE);
|
|
215
|
+
}
|
|
216
|
+
return images;
|
|
217
|
+
}
|
|
218
|
+
function requireStartEndImages(model, flags) {
|
|
219
|
+
assertUnsupported(model, flags.imageUrls, 'image-urls');
|
|
220
|
+
const first = maybeString(flags.imageUrl);
|
|
221
|
+
const last = maybeString(flags.imageTailUrl);
|
|
222
|
+
if (!first || !last) {
|
|
223
|
+
throw new CLIError(`Model "${model}" requires both --image-url and --image-tail-url.`, ExitCode.USAGE);
|
|
224
|
+
}
|
|
225
|
+
return { first, last };
|
|
226
|
+
}
|
|
227
|
+
function assertDurationInSet(model, duration, allowed) {
|
|
228
|
+
if (duration === undefined)
|
|
229
|
+
return;
|
|
230
|
+
if (!allowed.includes(duration)) {
|
|
231
|
+
throw new CLIError(`Model "${model}" requires --duration to be one of: ${allowed.join(', ')}.`, ExitCode.USAGE);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function assertDurationRange(model, duration, min, max) {
|
|
235
|
+
if (duration === undefined)
|
|
236
|
+
return;
|
|
237
|
+
if (duration < min || duration > max) {
|
|
238
|
+
throw new CLIError(`Model "${model}" requires --duration to be between ${min} and ${max}.`, ExitCode.USAGE);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function validate1080pDuration(model, quality, duration) {
|
|
242
|
+
if (quality === '1080p' && duration === 10) {
|
|
243
|
+
throw new CLIError(`Model "${model}" does not support --duration 10 with --resolution 1080p.`, ExitCode.USAGE);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
function assertNoFusionFlags(model, flags) {
|
|
247
|
+
assertUnsupported(model, flags.referenceNames, 'reference-names');
|
|
248
|
+
assertUnsupported(model, flags.referenceTypes, 'reference-types');
|
|
249
|
+
}
|
|
250
|
+
function validateLegacyControls(model, flags, options = {}) {
|
|
251
|
+
if (options.allowAspectRatio) {
|
|
252
|
+
parseEnum(model, flags.aspectRatio, 'aspect-ratio', LEGACY_RATIOS);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
assertUnsupported(model, flags.aspectRatio, 'aspect-ratio');
|
|
256
|
+
}
|
|
257
|
+
parseEnum(model, flags.resolution, 'resolution', QUALITYS);
|
|
258
|
+
parseEnum(model, flags.motionMode, 'motion-mode', MOTION_MODES);
|
|
259
|
+
parseEnum(model, flags.cameraMovement, 'camera-movement', CAMERA_MOVEMENTS);
|
|
260
|
+
parseInteger(model, flags.seed, 'seed', { min: 0, max: 2147483647 });
|
|
261
|
+
parseInteger(model, flags.templateId, 'template-id', { min: 0 });
|
|
262
|
+
if (options.allowAudioControls) {
|
|
263
|
+
if (flags.soundEffect !== undefined) {
|
|
264
|
+
if (flags.soundEffect !== true) {
|
|
265
|
+
throw new CLIError(`Model "${model}" only accepts --sound-effect as a boolean flag.`, ExitCode.USAGE);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
parseNonEmptyString(model, flags.soundEffectPrompt, 'sound-effect-prompt');
|
|
269
|
+
if (flags.soundEffectPrompt !== undefined && flags.soundEffect !== true) {
|
|
270
|
+
throw new CLIError(`Model "${model}" requires --sound-effect when using --sound-effect-prompt.`, ExitCode.USAGE);
|
|
271
|
+
}
|
|
272
|
+
if (flags.lipSync !== undefined) {
|
|
273
|
+
if (flags.lipSync !== true) {
|
|
274
|
+
throw new CLIError(`Model "${model}" only accepts --lip-sync as a boolean flag.`, ExitCode.USAGE);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
parseNonEmptyString(model, flags.ttsText, 'tts-text');
|
|
278
|
+
parseNonEmptyString(model, flags.voiceId, 'voice-id');
|
|
279
|
+
if ((flags.ttsText !== undefined || flags.voiceId !== undefined) && flags.lipSync !== true) {
|
|
280
|
+
throw new CLIError(`Model "${model}" requires --lip-sync when using --tts-text or --voice-id.`, ExitCode.USAGE);
|
|
281
|
+
}
|
|
282
|
+
if (flags.lipSync === true && flags.ttsText === undefined) {
|
|
283
|
+
throw new CLIError(`Model "${model}" requires --tts-text when using --lip-sync.`, ExitCode.USAGE);
|
|
284
|
+
}
|
|
285
|
+
assertUnsupported(model, flags.audio, 'audio');
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
assertUnsupported(model, flags.soundEffect, 'sound-effect');
|
|
289
|
+
assertUnsupported(model, flags.soundEffectPrompt, 'sound-effect-prompt');
|
|
290
|
+
assertUnsupported(model, flags.lipSync, 'lip-sync');
|
|
291
|
+
assertUnsupported(model, flags.ttsText, 'tts-text');
|
|
292
|
+
assertUnsupported(model, flags.voiceId, 'voice-id');
|
|
293
|
+
assertUnsupported(model, flags.audio, 'audio');
|
|
294
|
+
}
|
|
295
|
+
assertUnsupported(model, flags.style, 'style');
|
|
296
|
+
assertUnsupported(model, flags.multiShot, 'multi-shot');
|
|
297
|
+
assertUnsupported(model, flags.thinkingType, 'thinking-type');
|
|
298
|
+
}
|
|
299
|
+
function parsePixVerseAudioFlag(model, value) {
|
|
300
|
+
if (value === undefined)
|
|
301
|
+
return undefined;
|
|
302
|
+
if (value !== true) {
|
|
303
|
+
throw new CLIError(`Model "${model}" only accepts --audio as a boolean flag.`, ExitCode.USAGE);
|
|
304
|
+
}
|
|
305
|
+
return true;
|
|
306
|
+
}
|
|
307
|
+
function parsePixVerseMultiShotFlag(model, value) {
|
|
308
|
+
if (value === undefined)
|
|
309
|
+
return undefined;
|
|
310
|
+
if (value !== true) {
|
|
311
|
+
throw new CLIError(`Model "${model}" only accepts --multi-shot as a boolean flag.`, ExitCode.USAGE);
|
|
312
|
+
}
|
|
313
|
+
return true;
|
|
314
|
+
}
|
|
315
|
+
function applyPromptlessAudioControls(model, params, flags) {
|
|
316
|
+
assertUnsupported(model, flags.soundEffect, 'sound-effect');
|
|
317
|
+
const soundEffectPrompt = parseNonEmptyString(model, flags.soundEffectPrompt, 'sound-effect-prompt');
|
|
318
|
+
if (soundEffectPrompt)
|
|
319
|
+
params['sound_effect_content'] = soundEffectPrompt;
|
|
320
|
+
assertUnsupported(model, flags.lipSync, 'lip-sync');
|
|
321
|
+
const ttsText = parseNonEmptyString(model, flags.ttsText, 'tts-text');
|
|
322
|
+
if (ttsText)
|
|
323
|
+
params['lip_sync_tts_content'] = ttsText;
|
|
324
|
+
const voiceId = parseNonEmptyString(model, flags.voiceId, 'voice-id');
|
|
325
|
+
if (voiceId && !ttsText) {
|
|
326
|
+
throw new CLIError(`Model "${model}" requires --tts-text when using --voice-id.`, ExitCode.USAGE);
|
|
327
|
+
}
|
|
328
|
+
if (voiceId)
|
|
329
|
+
params['lip_sync_tts_speaker_id'] = voiceId;
|
|
330
|
+
}
|
|
331
|
+
function applyModernAudioControls(model, params, flags, options) {
|
|
332
|
+
if (options.allowSoundSwitch) {
|
|
333
|
+
if (flags.soundEffect !== undefined) {
|
|
334
|
+
if (flags.soundEffect !== true) {
|
|
335
|
+
throw new CLIError(`Model "${model}" only accepts --sound-effect as a boolean flag.`, ExitCode.USAGE);
|
|
336
|
+
}
|
|
337
|
+
params['sound_effect_switch'] = true;
|
|
338
|
+
}
|
|
339
|
+
const soundEffectPrompt = parseNonEmptyString(model, flags.soundEffectPrompt, 'sound-effect-prompt');
|
|
340
|
+
if (soundEffectPrompt) {
|
|
341
|
+
if (flags.soundEffect !== true) {
|
|
342
|
+
throw new CLIError(`Model "${model}" requires --sound-effect when using --sound-effect-prompt.`, ExitCode.USAGE);
|
|
343
|
+
}
|
|
344
|
+
params['sound_effect_content'] = soundEffectPrompt;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
assertUnsupported(model, flags.soundEffect, 'sound-effect');
|
|
349
|
+
applyPromptlessAudioControls(model, params, { ...flags, lipSync: flags.lipSync, ttsText: flags.ttsText, voiceId: flags.voiceId, soundEffectPrompt: flags.soundEffectPrompt });
|
|
350
|
+
}
|
|
351
|
+
if (options.allowLipSyncSwitch) {
|
|
352
|
+
if (flags.lipSync !== undefined) {
|
|
353
|
+
if (flags.lipSync !== true) {
|
|
354
|
+
throw new CLIError(`Model "${model}" only accepts --lip-sync as a boolean flag.`, ExitCode.USAGE);
|
|
355
|
+
}
|
|
356
|
+
params['lip_sync_switch'] = true;
|
|
357
|
+
}
|
|
358
|
+
const ttsText = parseNonEmptyString(model, flags.ttsText, 'tts-text');
|
|
359
|
+
const voiceId = parseNonEmptyString(model, flags.voiceId, 'voice-id');
|
|
360
|
+
if ((ttsText !== undefined || voiceId !== undefined) && flags.lipSync !== true) {
|
|
361
|
+
throw new CLIError(`Model "${model}" requires --lip-sync when using --tts-text or --voice-id.`, ExitCode.USAGE);
|
|
362
|
+
}
|
|
363
|
+
if (flags.lipSync === true && ttsText === undefined) {
|
|
364
|
+
throw new CLIError(`Model "${model}" requires --tts-text when using --lip-sync.`, ExitCode.USAGE);
|
|
365
|
+
}
|
|
366
|
+
if (ttsText)
|
|
367
|
+
params['lip_sync_tts_content'] = ttsText;
|
|
368
|
+
if (voiceId)
|
|
369
|
+
params['lip_sync_tts_speaker_id'] = voiceId;
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
assertUnsupported(model, flags.lipSync, 'lip-sync');
|
|
373
|
+
const ttsText = parseNonEmptyString(model, flags.ttsText, 'tts-text');
|
|
374
|
+
const voiceId = parseNonEmptyString(model, flags.voiceId, 'voice-id');
|
|
375
|
+
if (voiceId && !ttsText) {
|
|
376
|
+
throw new CLIError(`Model "${model}" requires --tts-text when using --voice-id.`, ExitCode.USAGE);
|
|
377
|
+
}
|
|
378
|
+
if (ttsText)
|
|
379
|
+
params['lip_sync_tts_content'] = ttsText;
|
|
380
|
+
if (voiceId)
|
|
381
|
+
params['lip_sync_tts_speaker_id'] = voiceId;
|
|
382
|
+
}
|
|
383
|
+
if (options.allowAudio) {
|
|
384
|
+
const audio = parsePixVerseAudioFlag(model, flags.audio);
|
|
385
|
+
if (audio !== undefined)
|
|
386
|
+
params['generate_audio_switch'] = audio;
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
assertUnsupported(model, flags.audio, 'audio');
|
|
390
|
+
}
|
|
391
|
+
if (options.allowMultiShot) {
|
|
392
|
+
const multiShot = parsePixVerseMultiShotFlag(model, flags.multiShot);
|
|
393
|
+
if (multiShot !== undefined)
|
|
394
|
+
params['generate_multi_clip_switch'] = multiShot;
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
assertUnsupported(model, flags.multiShot, 'multi-shot');
|
|
398
|
+
}
|
|
399
|
+
if (options.allowThinking) {
|
|
400
|
+
const thinkingType = parseEnum(model, flags.thinkingType, 'thinking-type', THINKING_TYPES);
|
|
401
|
+
if (thinkingType)
|
|
402
|
+
params['thinking_type'] = thinkingType;
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
assertUnsupported(model, flags.thinkingType, 'thinking-type');
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
function buildLegacyTransitionBody(model, prompt, flags) {
|
|
409
|
+
assertPixVerseCommonUnsupported(model, flags);
|
|
410
|
+
assertNoFusionFlags(model, flags);
|
|
411
|
+
const { first, last } = requireStartEndImages(model, flags);
|
|
412
|
+
const duration = parseInteger(model, flags.duration, 'duration');
|
|
413
|
+
if (model === 'pixverse_v5_transition') {
|
|
414
|
+
assertDurationInSet(model, duration, [5]);
|
|
415
|
+
}
|
|
416
|
+
else if (model === 'pixverse_v45_transition') {
|
|
417
|
+
assertDurationInSet(model, duration, [5, 8]);
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
assertDurationInSet(model, duration, [5, 8]);
|
|
421
|
+
}
|
|
422
|
+
assertUnsupported(model, flags.aspectRatio, 'aspect-ratio');
|
|
423
|
+
assertUnsupported(model, flags.cameraMovement, 'camera-movement');
|
|
424
|
+
assertUnsupported(model, flags.negativePrompt, 'negative-prompt');
|
|
425
|
+
assertUnsupported(model, flags.templateId, 'template-id');
|
|
426
|
+
validateLegacyControls(model, flags, { allowAudioControls: true });
|
|
427
|
+
const params = {
|
|
428
|
+
first_frame_image: first,
|
|
429
|
+
last_frame_image: last,
|
|
430
|
+
};
|
|
431
|
+
if (prompt)
|
|
432
|
+
params['prompt'] = prompt;
|
|
433
|
+
if (duration !== undefined)
|
|
434
|
+
params['duration'] = duration;
|
|
435
|
+
const quality = parseEnum(model, flags.resolution, 'resolution', QUALITYS);
|
|
436
|
+
if (quality)
|
|
437
|
+
params['quality'] = quality;
|
|
438
|
+
const motionMode = parseEnum(model, flags.motionMode, 'motion-mode', MOTION_MODES);
|
|
439
|
+
if (motionMode)
|
|
440
|
+
params['motion_mode'] = motionMode;
|
|
441
|
+
const seed = parseInteger(model, flags.seed, 'seed', { min: 0, max: 2147483647 });
|
|
442
|
+
if (seed !== undefined)
|
|
443
|
+
params['seed'] = seed;
|
|
444
|
+
if (flags.soundEffect === true)
|
|
445
|
+
params['sound_effect_switch'] = true;
|
|
446
|
+
const soundEffectPrompt = parseNonEmptyString(model, flags.soundEffectPrompt, 'sound-effect-prompt');
|
|
447
|
+
if (soundEffectPrompt)
|
|
448
|
+
params['sound_effect_content'] = soundEffectPrompt;
|
|
449
|
+
if (flags.lipSync === true)
|
|
450
|
+
params['lip_sync_tts_switch'] = true;
|
|
451
|
+
const ttsText = parseNonEmptyString(model, flags.ttsText, 'tts-text');
|
|
452
|
+
if (ttsText)
|
|
453
|
+
params['lip_sync_tts_content'] = ttsText;
|
|
454
|
+
const voiceId = parseNonEmptyString(model, flags.voiceId, 'voice-id');
|
|
455
|
+
if (voiceId)
|
|
456
|
+
params['lip_sync_tts_speaker_id'] = voiceId;
|
|
457
|
+
return buildEnvelope(model, params);
|
|
458
|
+
}
|
|
459
|
+
function buildLegacyI2VBody(model, prompt, flags) {
|
|
460
|
+
assertPixVerseCommonUnsupported(model, flags);
|
|
461
|
+
assertNoFusionFlags(model, flags);
|
|
462
|
+
assertUnsupported(model, flags.imageTailUrl, 'image-tail-url');
|
|
463
|
+
const images = requireImageInputs(model, flags);
|
|
464
|
+
const duration = parseInteger(model, flags.duration, 'duration');
|
|
465
|
+
assertDurationInSet(model, duration, [5, 8]);
|
|
466
|
+
validateLegacyControls(model, flags, { allowAudioControls: true });
|
|
467
|
+
const params = {
|
|
468
|
+
img_id: images[0],
|
|
469
|
+
};
|
|
470
|
+
if (images.length > 1)
|
|
471
|
+
params['img_ids'] = images;
|
|
472
|
+
if (prompt)
|
|
473
|
+
params['prompt'] = prompt;
|
|
474
|
+
if (duration !== undefined)
|
|
475
|
+
params['duration'] = duration;
|
|
476
|
+
const quality = parseEnum(model, flags.resolution, 'resolution', QUALITYS);
|
|
477
|
+
if (quality)
|
|
478
|
+
params['quality'] = quality;
|
|
479
|
+
const motionMode = parseEnum(model, flags.motionMode, 'motion-mode', MOTION_MODES);
|
|
480
|
+
if (motionMode)
|
|
481
|
+
params['motion_mode'] = motionMode;
|
|
482
|
+
const cameraMovement = parseEnum(model, flags.cameraMovement, 'camera-movement', CAMERA_MOVEMENTS);
|
|
483
|
+
if (cameraMovement)
|
|
484
|
+
params['camera_movement'] = cameraMovement;
|
|
485
|
+
const negativePrompt = maybeString(flags.negativePrompt);
|
|
486
|
+
if (negativePrompt)
|
|
487
|
+
params['negative_prompt'] = negativePrompt;
|
|
488
|
+
const seed = parseInteger(model, flags.seed, 'seed', { min: 0, max: 2147483647 });
|
|
489
|
+
if (seed !== undefined)
|
|
490
|
+
params['seed'] = seed;
|
|
491
|
+
const templateId = parseInteger(model, flags.templateId, 'template-id', { min: 0 });
|
|
492
|
+
if (templateId !== undefined)
|
|
493
|
+
params['template_id'] = templateId;
|
|
494
|
+
if (flags.soundEffect === true)
|
|
495
|
+
params['sound_effect_switch'] = true;
|
|
496
|
+
const soundEffectPrompt = parseNonEmptyString(model, flags.soundEffectPrompt, 'sound-effect-prompt');
|
|
497
|
+
if (soundEffectPrompt)
|
|
498
|
+
params['sound_effect_content'] = soundEffectPrompt;
|
|
499
|
+
if (flags.lipSync === true)
|
|
500
|
+
params['lip_sync_tts_switch'] = true;
|
|
501
|
+
const ttsText = parseNonEmptyString(model, flags.ttsText, 'tts-text');
|
|
502
|
+
if (ttsText)
|
|
503
|
+
params['lip_sync_tts_content'] = ttsText;
|
|
504
|
+
const voiceId = parseNonEmptyString(model, flags.voiceId, 'voice-id');
|
|
505
|
+
if (voiceId)
|
|
506
|
+
params['lip_sync_tts_speaker_id'] = voiceId;
|
|
507
|
+
return buildEnvelope(model, params);
|
|
508
|
+
}
|
|
509
|
+
function buildLegacyT2VBody(model, prompt, flags) {
|
|
510
|
+
assertPixVerseCommonUnsupported(model, flags);
|
|
511
|
+
assertNoFusionFlags(model, flags);
|
|
512
|
+
assertUnsupported(model, flags.imageUrl, 'image-url');
|
|
513
|
+
assertUnsupported(model, flags.imageTailUrl, 'image-tail-url');
|
|
514
|
+
assertUnsupported(model, flags.imageUrls, 'image-urls');
|
|
515
|
+
const duration = parseInteger(model, flags.duration, 'duration');
|
|
516
|
+
assertDurationInSet(model, duration, [5, 8]);
|
|
517
|
+
validateLegacyControls(model, flags, { allowAspectRatio: true });
|
|
518
|
+
const params = {};
|
|
519
|
+
if (prompt)
|
|
520
|
+
params['prompt'] = prompt;
|
|
521
|
+
const aspectRatio = parseEnum(model, flags.aspectRatio, 'aspect-ratio', LEGACY_RATIOS);
|
|
522
|
+
if (aspectRatio)
|
|
523
|
+
params['aspect_ratio'] = aspectRatio;
|
|
524
|
+
if (duration !== undefined)
|
|
525
|
+
params['duration'] = duration;
|
|
526
|
+
const quality = parseEnum(model, flags.resolution, 'resolution', QUALITYS);
|
|
527
|
+
if (quality)
|
|
528
|
+
params['quality'] = quality;
|
|
529
|
+
const negativePrompt = maybeString(flags.negativePrompt);
|
|
530
|
+
if (negativePrompt)
|
|
531
|
+
params['negative_prompt'] = negativePrompt;
|
|
532
|
+
const motionMode = parseEnum(model, flags.motionMode, 'motion-mode', MOTION_MODES);
|
|
533
|
+
if (motionMode)
|
|
534
|
+
params['motion_mode'] = motionMode;
|
|
535
|
+
const cameraMovement = parseEnum(model, flags.cameraMovement, 'camera-movement', CAMERA_MOVEMENTS);
|
|
536
|
+
if (cameraMovement)
|
|
537
|
+
params['camera_movement'] = cameraMovement;
|
|
538
|
+
const seed = parseInteger(model, flags.seed, 'seed', { min: 0, max: 2147483647 });
|
|
539
|
+
if (seed !== undefined)
|
|
540
|
+
params['seed'] = seed;
|
|
541
|
+
const templateId = parseInteger(model, flags.templateId, 'template-id', { min: 0 });
|
|
542
|
+
if (templateId !== undefined)
|
|
543
|
+
params['template_id'] = templateId;
|
|
544
|
+
return buildEnvelope(model, params);
|
|
545
|
+
}
|
|
546
|
+
function buildV55T2VBody(model, prompt, flags) {
|
|
547
|
+
assertPixVerseCommonUnsupported(model, flags);
|
|
548
|
+
assertNoFusionFlags(model, flags);
|
|
549
|
+
assertUnsupported(model, flags.imageUrl, 'image-url');
|
|
550
|
+
assertUnsupported(model, flags.imageTailUrl, 'image-tail-url');
|
|
551
|
+
assertUnsupported(model, flags.imageUrls, 'image-urls');
|
|
552
|
+
assertUnsupported(model, flags.motionMode, 'motion-mode');
|
|
553
|
+
assertUnsupported(model, flags.cameraMovement, 'camera-movement');
|
|
554
|
+
const duration = parseInteger(model, flags.duration, 'duration');
|
|
555
|
+
assertDurationInSet(model, duration, [5, 8, 10]);
|
|
556
|
+
const quality = parseEnum(model, flags.resolution, 'resolution', QUALITYS);
|
|
557
|
+
validate1080pDuration(model, quality, duration);
|
|
558
|
+
const params = { prompt };
|
|
559
|
+
const aspectRatio = parseEnum(model, flags.aspectRatio, 'aspect-ratio', LEGACY_RATIOS);
|
|
560
|
+
if (aspectRatio)
|
|
561
|
+
params['aspect_ratio'] = aspectRatio;
|
|
562
|
+
if (duration !== undefined)
|
|
563
|
+
params['duration'] = duration;
|
|
564
|
+
if (quality)
|
|
565
|
+
params['quality'] = quality;
|
|
566
|
+
const negativePrompt = maybeString(flags.negativePrompt);
|
|
567
|
+
if (negativePrompt)
|
|
568
|
+
params['negative_prompt'] = negativePrompt;
|
|
569
|
+
const seed = parseInteger(model, flags.seed, 'seed', { min: 0, max: 2147483647 });
|
|
570
|
+
if (seed !== undefined)
|
|
571
|
+
params['seed'] = seed;
|
|
572
|
+
const style = parseEnum(model, flags.style, 'style', STYLES);
|
|
573
|
+
if (style)
|
|
574
|
+
params['style'] = style;
|
|
575
|
+
const templateId = parseInteger(model, flags.templateId, 'template-id', { min: 0 });
|
|
576
|
+
if (templateId !== undefined)
|
|
577
|
+
params['template_id'] = templateId;
|
|
578
|
+
applyModernAudioControls(model, params, flags, {
|
|
579
|
+
allowSoundSwitch: false,
|
|
580
|
+
allowLipSyncSwitch: false,
|
|
581
|
+
allowAudio: true,
|
|
582
|
+
allowThinking: true,
|
|
583
|
+
allowMultiShot: true,
|
|
584
|
+
});
|
|
585
|
+
return buildEnvelope(model, params);
|
|
586
|
+
}
|
|
587
|
+
function buildV55I2VBody(model, prompt, flags) {
|
|
588
|
+
assertPixVerseCommonUnsupported(model, flags);
|
|
589
|
+
assertNoFusionFlags(model, flags);
|
|
590
|
+
assertUnsupported(model, flags.imageTailUrl, 'image-tail-url');
|
|
591
|
+
assertUnsupported(model, flags.motionMode, 'motion-mode');
|
|
592
|
+
assertUnsupported(model, flags.cameraMovement, 'camera-movement');
|
|
593
|
+
const images = requireImageInputs(model, flags);
|
|
594
|
+
const duration = parseInteger(model, flags.duration, 'duration');
|
|
595
|
+
assertDurationInSet(model, duration, [5, 8, 10]);
|
|
596
|
+
const quality = parseEnum(model, flags.resolution, 'resolution', QUALITYS);
|
|
597
|
+
validate1080pDuration(model, quality, duration);
|
|
598
|
+
const params = {
|
|
599
|
+
img_id: images[0],
|
|
600
|
+
};
|
|
601
|
+
if (images.length > 1)
|
|
602
|
+
params['img_ids'] = images;
|
|
603
|
+
params['prompt'] = prompt;
|
|
604
|
+
if (duration !== undefined)
|
|
605
|
+
params['duration'] = duration;
|
|
606
|
+
if (quality)
|
|
607
|
+
params['quality'] = quality;
|
|
608
|
+
const negativePrompt = maybeString(flags.negativePrompt);
|
|
609
|
+
if (negativePrompt)
|
|
610
|
+
params['negative_prompt'] = negativePrompt;
|
|
611
|
+
const seed = parseInteger(model, flags.seed, 'seed', { min: 0, max: 2147483647 });
|
|
612
|
+
if (seed !== undefined)
|
|
613
|
+
params['seed'] = seed;
|
|
614
|
+
const style = parseEnum(model, flags.style, 'style', STYLES);
|
|
615
|
+
if (style)
|
|
616
|
+
params['style'] = style;
|
|
617
|
+
const templateId = parseInteger(model, flags.templateId, 'template-id', { min: 0 });
|
|
618
|
+
if (templateId !== undefined)
|
|
619
|
+
params['template_id'] = templateId;
|
|
620
|
+
applyModernAudioControls(model, params, flags, {
|
|
621
|
+
allowSoundSwitch: false,
|
|
622
|
+
allowLipSyncSwitch: false,
|
|
623
|
+
allowAudio: true,
|
|
624
|
+
allowThinking: true,
|
|
625
|
+
allowMultiShot: true,
|
|
626
|
+
});
|
|
627
|
+
return buildEnvelope(model, params);
|
|
628
|
+
}
|
|
629
|
+
function buildV55TransitionBody(model, prompt, flags) {
|
|
630
|
+
assertPixVerseCommonUnsupported(model, flags);
|
|
631
|
+
assertNoFusionFlags(model, flags);
|
|
632
|
+
assertUnsupported(model, flags.motionMode, 'motion-mode');
|
|
633
|
+
assertUnsupported(model, flags.cameraMovement, 'camera-movement');
|
|
634
|
+
assertUnsupported(model, flags.aspectRatio, 'aspect-ratio');
|
|
635
|
+
assertUnsupported(model, flags.negativePrompt, 'negative-prompt');
|
|
636
|
+
assertUnsupported(model, flags.style, 'style');
|
|
637
|
+
assertUnsupported(model, flags.templateId, 'template-id');
|
|
638
|
+
assertUnsupported(model, flags.multiShot, 'multi-shot');
|
|
639
|
+
assertUnsupported(model, flags.thinkingType, 'thinking-type');
|
|
640
|
+
const { first, last } = requireStartEndImages(model, flags);
|
|
641
|
+
const duration = parseInteger(model, flags.duration, 'duration');
|
|
642
|
+
assertDurationInSet(model, duration, [5, 8, 10]);
|
|
643
|
+
const quality = parseEnum(model, flags.resolution, 'resolution', QUALITYS);
|
|
644
|
+
validate1080pDuration(model, quality, duration);
|
|
645
|
+
const params = {
|
|
646
|
+
prompt,
|
|
647
|
+
first_frame_image: first,
|
|
648
|
+
last_frame_image: last,
|
|
649
|
+
};
|
|
650
|
+
if (duration !== undefined)
|
|
651
|
+
params['duration'] = duration;
|
|
652
|
+
if (quality)
|
|
653
|
+
params['quality'] = quality;
|
|
654
|
+
const seed = parseInteger(model, flags.seed, 'seed', { min: 0, max: 2147483647 });
|
|
655
|
+
if (seed !== undefined)
|
|
656
|
+
params['seed'] = seed;
|
|
657
|
+
applyModernAudioControls(model, params, flags, {
|
|
658
|
+
allowSoundSwitch: false,
|
|
659
|
+
allowLipSyncSwitch: false,
|
|
660
|
+
allowAudio: true,
|
|
661
|
+
allowThinking: false,
|
|
662
|
+
allowMultiShot: false,
|
|
663
|
+
});
|
|
664
|
+
return buildEnvelope(model, params);
|
|
665
|
+
}
|
|
666
|
+
function buildV56T2VBody(model, prompt, flags) {
|
|
667
|
+
assertPixVerseCommonUnsupported(model, flags);
|
|
668
|
+
assertNoFusionFlags(model, flags);
|
|
669
|
+
assertUnsupported(model, flags.imageUrl, 'image-url');
|
|
670
|
+
assertUnsupported(model, flags.imageTailUrl, 'image-tail-url');
|
|
671
|
+
assertUnsupported(model, flags.imageUrls, 'image-urls');
|
|
672
|
+
assertUnsupported(model, flags.motionMode, 'motion-mode');
|
|
673
|
+
assertUnsupported(model, flags.cameraMovement, 'camera-movement');
|
|
674
|
+
const duration = parseInteger(model, flags.duration, 'duration');
|
|
675
|
+
assertDurationInSet(model, duration, [5, 8, 10]);
|
|
676
|
+
const quality = parseEnum(model, flags.resolution, 'resolution', QUALITYS);
|
|
677
|
+
validate1080pDuration(model, quality, duration);
|
|
678
|
+
const params = { prompt };
|
|
679
|
+
const aspectRatio = parseEnum(model, flags.aspectRatio, 'aspect-ratio', LEGACY_RATIOS);
|
|
680
|
+
if (aspectRatio)
|
|
681
|
+
params['aspect_ratio'] = aspectRatio;
|
|
682
|
+
if (duration !== undefined)
|
|
683
|
+
params['duration'] = duration;
|
|
684
|
+
if (quality)
|
|
685
|
+
params['quality'] = quality;
|
|
686
|
+
const negativePrompt = maybeString(flags.negativePrompt);
|
|
687
|
+
if (negativePrompt)
|
|
688
|
+
params['negative_prompt'] = negativePrompt;
|
|
689
|
+
const seed = parseInteger(model, flags.seed, 'seed', { min: 0, max: 2147483647 });
|
|
690
|
+
if (seed !== undefined)
|
|
691
|
+
params['seed'] = seed;
|
|
692
|
+
const templateId = parseInteger(model, flags.templateId, 'template-id', { min: 0 });
|
|
693
|
+
if (templateId !== undefined)
|
|
694
|
+
params['template_id'] = templateId;
|
|
695
|
+
const style = parseEnum(model, flags.style, 'style', STYLES);
|
|
696
|
+
if (style)
|
|
697
|
+
params['style'] = style;
|
|
698
|
+
applyModernAudioControls(model, params, flags, {
|
|
699
|
+
allowSoundSwitch: true,
|
|
700
|
+
allowLipSyncSwitch: true,
|
|
701
|
+
allowAudio: true,
|
|
702
|
+
allowThinking: true,
|
|
703
|
+
allowMultiShot: false,
|
|
704
|
+
});
|
|
705
|
+
return buildEnvelope(model, params);
|
|
706
|
+
}
|
|
707
|
+
function buildV56I2VBody(model, prompt, flags) {
|
|
708
|
+
assertPixVerseCommonUnsupported(model, flags);
|
|
709
|
+
assertNoFusionFlags(model, flags);
|
|
710
|
+
assertUnsupported(model, flags.imageTailUrl, 'image-tail-url');
|
|
711
|
+
assertUnsupported(model, flags.motionMode, 'motion-mode');
|
|
712
|
+
assertUnsupported(model, flags.cameraMovement, 'camera-movement');
|
|
713
|
+
assertUnsupported(model, flags.multiShot, 'multi-shot');
|
|
714
|
+
const images = requireImageInputs(model, flags);
|
|
715
|
+
const duration = parseInteger(model, flags.duration, 'duration');
|
|
716
|
+
assertDurationInSet(model, duration, [5, 8, 10]);
|
|
717
|
+
const quality = parseEnum(model, flags.resolution, 'resolution', QUALITYS);
|
|
718
|
+
validate1080pDuration(model, quality, duration);
|
|
719
|
+
const params = {
|
|
720
|
+
img_id: images[0],
|
|
721
|
+
};
|
|
722
|
+
if (images.length > 1)
|
|
723
|
+
params['img_ids'] = images;
|
|
724
|
+
if (prompt)
|
|
725
|
+
params['prompt'] = prompt;
|
|
726
|
+
if (duration !== undefined)
|
|
727
|
+
params['duration'] = duration;
|
|
728
|
+
if (quality)
|
|
729
|
+
params['quality'] = quality;
|
|
730
|
+
const negativePrompt = maybeString(flags.negativePrompt);
|
|
731
|
+
if (negativePrompt)
|
|
732
|
+
params['negative_prompt'] = negativePrompt;
|
|
733
|
+
const seed = parseInteger(model, flags.seed, 'seed', { min: 0, max: 2147483647 });
|
|
734
|
+
if (seed !== undefined)
|
|
735
|
+
params['seed'] = seed;
|
|
736
|
+
const templateId = parseInteger(model, flags.templateId, 'template-id', { min: 0 });
|
|
737
|
+
if (templateId !== undefined)
|
|
738
|
+
params['template_id'] = templateId;
|
|
739
|
+
const style = parseEnum(model, flags.style, 'style', STYLES);
|
|
740
|
+
if (style)
|
|
741
|
+
params['style'] = style;
|
|
742
|
+
applyModernAudioControls(model, params, flags, {
|
|
743
|
+
allowSoundSwitch: true,
|
|
744
|
+
allowLipSyncSwitch: true,
|
|
745
|
+
allowAudio: true,
|
|
746
|
+
allowThinking: true,
|
|
747
|
+
allowMultiShot: false,
|
|
748
|
+
});
|
|
749
|
+
return buildEnvelope(model, params);
|
|
750
|
+
}
|
|
751
|
+
function buildV56TransitionBody(model, prompt, flags) {
|
|
752
|
+
assertPixVerseCommonUnsupported(model, flags);
|
|
753
|
+
assertNoFusionFlags(model, flags);
|
|
754
|
+
assertUnsupported(model, flags.imageUrls, 'image-urls');
|
|
755
|
+
assertUnsupported(model, flags.aspectRatio, 'aspect-ratio');
|
|
756
|
+
assertUnsupported(model, flags.negativePrompt, 'negative-prompt');
|
|
757
|
+
assertUnsupported(model, flags.templateId, 'template-id');
|
|
758
|
+
assertUnsupported(model, flags.style, 'style');
|
|
759
|
+
assertUnsupported(model, flags.motionMode, 'motion-mode');
|
|
760
|
+
assertUnsupported(model, flags.cameraMovement, 'camera-movement');
|
|
761
|
+
assertUnsupported(model, flags.multiShot, 'multi-shot');
|
|
762
|
+
const { first, last } = requireStartEndImages(model, flags);
|
|
763
|
+
const duration = parseInteger(model, flags.duration, 'duration');
|
|
764
|
+
assertDurationInSet(model, duration, [5, 8, 10]);
|
|
765
|
+
const quality = parseEnum(model, flags.resolution, 'resolution', QUALITYS);
|
|
766
|
+
validate1080pDuration(model, quality, duration);
|
|
767
|
+
const params = {
|
|
768
|
+
prompt,
|
|
769
|
+
first_frame_img: first,
|
|
770
|
+
last_frame_img: last,
|
|
771
|
+
};
|
|
772
|
+
if (duration !== undefined)
|
|
773
|
+
params['duration'] = duration;
|
|
774
|
+
if (quality)
|
|
775
|
+
params['quality'] = quality;
|
|
776
|
+
const seed = parseInteger(model, flags.seed, 'seed', { min: 0, max: 2147483647 });
|
|
777
|
+
if (seed !== undefined)
|
|
778
|
+
params['seed'] = seed;
|
|
779
|
+
applyModernAudioControls(model, params, flags, {
|
|
780
|
+
allowSoundSwitch: true,
|
|
781
|
+
allowLipSyncSwitch: true,
|
|
782
|
+
allowAudio: true,
|
|
783
|
+
allowThinking: true,
|
|
784
|
+
allowMultiShot: false,
|
|
785
|
+
});
|
|
786
|
+
return buildEnvelope(model, params);
|
|
787
|
+
}
|
|
788
|
+
function buildV6T2VBody(model, prompt, flags) {
|
|
789
|
+
assertPixVerseCommonUnsupported(model, flags);
|
|
790
|
+
assertNoFusionFlags(model, flags);
|
|
791
|
+
assertUnsupported(model, flags.imageUrl, 'image-url');
|
|
792
|
+
assertUnsupported(model, flags.imageTailUrl, 'image-tail-url');
|
|
793
|
+
assertUnsupported(model, flags.imageUrls, 'image-urls');
|
|
794
|
+
assertUnsupported(model, flags.motionMode, 'motion-mode');
|
|
795
|
+
assertUnsupported(model, flags.cameraMovement, 'camera-movement');
|
|
796
|
+
assertUnsupported(model, flags.thinkingType, 'thinking-type');
|
|
797
|
+
const duration = parseInteger(model, flags.duration, 'duration');
|
|
798
|
+
assertDurationRange(model, duration, 1, 15);
|
|
799
|
+
const quality = parseEnum(model, flags.resolution, 'resolution', QUALITYS);
|
|
800
|
+
const params = { prompt };
|
|
801
|
+
const aspectRatio = parseEnum(model, flags.aspectRatio, 'aspect-ratio', V6_RATIOS);
|
|
802
|
+
if (aspectRatio)
|
|
803
|
+
params['aspect_ratio'] = aspectRatio;
|
|
804
|
+
if (duration !== undefined)
|
|
805
|
+
params['duration'] = duration;
|
|
806
|
+
if (quality)
|
|
807
|
+
params['quality'] = quality;
|
|
808
|
+
const negativePrompt = maybeString(flags.negativePrompt);
|
|
809
|
+
if (negativePrompt)
|
|
810
|
+
params['negative_prompt'] = negativePrompt;
|
|
811
|
+
const seed = parseInteger(model, flags.seed, 'seed', { min: 0, max: 2147483647 });
|
|
812
|
+
if (seed !== undefined)
|
|
813
|
+
params['seed'] = seed;
|
|
814
|
+
const templateId = parseInteger(model, flags.templateId, 'template-id', { min: 0 });
|
|
815
|
+
if (templateId !== undefined)
|
|
816
|
+
params['template_id'] = templateId;
|
|
817
|
+
const style = parseNonEmptyString(model, flags.style, 'style');
|
|
818
|
+
if (style)
|
|
819
|
+
params['style'] = style;
|
|
820
|
+
applyModernAudioControls(model, params, flags, {
|
|
821
|
+
allowSoundSwitch: true,
|
|
822
|
+
allowLipSyncSwitch: true,
|
|
823
|
+
allowAudio: true,
|
|
824
|
+
allowThinking: false,
|
|
825
|
+
allowMultiShot: true,
|
|
826
|
+
});
|
|
827
|
+
return buildEnvelope(model, params);
|
|
828
|
+
}
|
|
829
|
+
function buildV6I2VBody(model, prompt, flags) {
|
|
830
|
+
assertPixVerseCommonUnsupported(model, flags);
|
|
831
|
+
assertNoFusionFlags(model, flags);
|
|
832
|
+
assertUnsupported(model, flags.imageTailUrl, 'image-tail-url');
|
|
833
|
+
assertUnsupported(model, flags.aspectRatio, 'aspect-ratio', `Model "${model}" does not support --aspect-ratio; output ratio follows the input image.`);
|
|
834
|
+
assertUnsupported(model, flags.motionMode, 'motion-mode');
|
|
835
|
+
assertUnsupported(model, flags.cameraMovement, 'camera-movement');
|
|
836
|
+
assertUnsupported(model, flags.thinkingType, 'thinking-type');
|
|
837
|
+
const images = requireImageInputs(model, flags);
|
|
838
|
+
const duration = parseInteger(model, flags.duration, 'duration');
|
|
839
|
+
assertDurationRange(model, duration, 1, 15);
|
|
840
|
+
const quality = parseEnum(model, flags.resolution, 'resolution', QUALITYS);
|
|
841
|
+
const params = {
|
|
842
|
+
img_id: images[0],
|
|
843
|
+
};
|
|
844
|
+
if (images.length > 1)
|
|
845
|
+
params['img_ids'] = images;
|
|
846
|
+
params['prompt'] = prompt;
|
|
847
|
+
if (duration !== undefined)
|
|
848
|
+
params['duration'] = duration;
|
|
849
|
+
if (quality)
|
|
850
|
+
params['quality'] = quality;
|
|
851
|
+
const negativePrompt = maybeString(flags.negativePrompt);
|
|
852
|
+
if (negativePrompt)
|
|
853
|
+
params['negative_prompt'] = negativePrompt;
|
|
854
|
+
const seed = parseInteger(model, flags.seed, 'seed', { min: 0, max: 2147483647 });
|
|
855
|
+
if (seed !== undefined)
|
|
856
|
+
params['seed'] = seed;
|
|
857
|
+
const templateId = parseInteger(model, flags.templateId, 'template-id', { min: 0 });
|
|
858
|
+
if (templateId !== undefined)
|
|
859
|
+
params['template_id'] = templateId;
|
|
860
|
+
const style = parseNonEmptyString(model, flags.style, 'style');
|
|
861
|
+
if (style)
|
|
862
|
+
params['style'] = style;
|
|
863
|
+
applyModernAudioControls(model, params, flags, {
|
|
864
|
+
allowSoundSwitch: false,
|
|
865
|
+
allowLipSyncSwitch: false,
|
|
866
|
+
allowAudio: true,
|
|
867
|
+
allowThinking: false,
|
|
868
|
+
allowMultiShot: true,
|
|
869
|
+
});
|
|
870
|
+
return buildEnvelope(model, params);
|
|
871
|
+
}
|
|
872
|
+
function buildV6TransitionBody(model, prompt, flags) {
|
|
873
|
+
assertPixVerseCommonUnsupported(model, flags);
|
|
874
|
+
assertNoFusionFlags(model, flags);
|
|
875
|
+
assertUnsupported(model, flags.imageUrls, 'image-urls');
|
|
876
|
+
assertUnsupported(model, flags.motionMode, 'motion-mode');
|
|
877
|
+
assertUnsupported(model, flags.cameraMovement, 'camera-movement');
|
|
878
|
+
assertUnsupported(model, flags.multiShot, 'multi-shot');
|
|
879
|
+
assertUnsupported(model, flags.thinkingType, 'thinking-type');
|
|
880
|
+
const { first, last } = requireStartEndImages(model, flags);
|
|
881
|
+
const duration = parseInteger(model, flags.duration, 'duration');
|
|
882
|
+
assertDurationRange(model, duration, 1, 15);
|
|
883
|
+
const quality = parseEnum(model, flags.resolution, 'resolution', QUALITYS);
|
|
884
|
+
const params = {
|
|
885
|
+
first_frame_img: first,
|
|
886
|
+
last_frame_img: last,
|
|
887
|
+
};
|
|
888
|
+
if (prompt)
|
|
889
|
+
params['prompt'] = prompt;
|
|
890
|
+
if (duration !== undefined)
|
|
891
|
+
params['duration'] = duration;
|
|
892
|
+
if (quality)
|
|
893
|
+
params['quality'] = quality;
|
|
894
|
+
const negativePrompt = maybeString(flags.negativePrompt);
|
|
895
|
+
if (negativePrompt)
|
|
896
|
+
params['negative_prompt'] = negativePrompt;
|
|
897
|
+
const seed = parseInteger(model, flags.seed, 'seed', { min: 0, max: 2147483647 });
|
|
898
|
+
if (seed !== undefined)
|
|
899
|
+
params['seed'] = seed;
|
|
900
|
+
const templateId = parseInteger(model, flags.templateId, 'template-id', { min: 0 });
|
|
901
|
+
if (templateId !== undefined)
|
|
902
|
+
params['template_id'] = templateId;
|
|
903
|
+
const style = parseNonEmptyString(model, flags.style, 'style');
|
|
904
|
+
if (style)
|
|
905
|
+
params['style'] = style;
|
|
906
|
+
applyModernAudioControls(model, params, flags, {
|
|
907
|
+
allowSoundSwitch: true,
|
|
908
|
+
allowLipSyncSwitch: true,
|
|
909
|
+
allowAudio: true,
|
|
910
|
+
allowThinking: false,
|
|
911
|
+
allowMultiShot: false,
|
|
912
|
+
});
|
|
913
|
+
return buildEnvelope(model, params);
|
|
914
|
+
}
|
|
915
|
+
function buildFusionBody(model, prompt, flags) {
|
|
916
|
+
assertPixVerseCommonUnsupported(model, flags);
|
|
917
|
+
assertUnsupported(model, flags.imageTailUrl, 'image-tail-url');
|
|
918
|
+
assertUnsupported(model, flags.negativePrompt, 'negative-prompt');
|
|
919
|
+
assertUnsupported(model, flags.style, 'style');
|
|
920
|
+
assertUnsupported(model, flags.templateId, 'template-id');
|
|
921
|
+
assertUnsupported(model, flags.motionMode, 'motion-mode');
|
|
922
|
+
assertUnsupported(model, flags.cameraMovement, 'camera-movement');
|
|
923
|
+
assertUnsupported(model, flags.soundEffect, 'sound-effect');
|
|
924
|
+
assertUnsupported(model, flags.soundEffectPrompt, 'sound-effect-prompt');
|
|
925
|
+
assertUnsupported(model, flags.lipSync, 'lip-sync');
|
|
926
|
+
assertUnsupported(model, flags.ttsText, 'tts-text');
|
|
927
|
+
assertUnsupported(model, flags.voiceId, 'voice-id');
|
|
928
|
+
assertUnsupported(model, flags.multiShot, 'multi-shot');
|
|
929
|
+
assertUnsupported(model, flags.thinkingType, 'thinking-type');
|
|
930
|
+
const images = requireImageInputs(model, flags);
|
|
931
|
+
if (images.length < 1 || images.length > 3) {
|
|
932
|
+
throw new CLIError(`Model "${model}" requires 1-3 images via --image-url/--image-urls.`, ExitCode.USAGE);
|
|
933
|
+
}
|
|
934
|
+
const names = maybeStringArray(flags.referenceNames);
|
|
935
|
+
const types = maybeStringArray(flags.referenceTypes);
|
|
936
|
+
if (names.length !== images.length) {
|
|
937
|
+
throw new CLIError(`Model "${model}" requires --reference-names to match the number of input images.`, ExitCode.USAGE);
|
|
938
|
+
}
|
|
939
|
+
if (types.length !== images.length) {
|
|
940
|
+
throw new CLIError(`Model "${model}" requires --reference-types to match the number of input images.`, ExitCode.USAGE);
|
|
941
|
+
}
|
|
942
|
+
const duration = parseInteger(model, flags.duration, 'duration');
|
|
943
|
+
assertDurationInSet(model, duration, [5, 8, 10]);
|
|
944
|
+
const quality = parseEnum(model, flags.resolution, 'resolution', QUALITYS);
|
|
945
|
+
validate1080pDuration(model, quality, duration);
|
|
946
|
+
const aspectRatio = parseEnum(model, flags.aspectRatio, 'aspect-ratio', LEGACY_RATIOS);
|
|
947
|
+
if (!aspectRatio) {
|
|
948
|
+
throw new CLIError(`Model "${model}" requires --aspect-ratio.`, ExitCode.USAGE);
|
|
949
|
+
}
|
|
950
|
+
const imageReferences = images.map((imageUrl, index) => {
|
|
951
|
+
const type = parseEnum(model, types[index], 'reference-types', REFERENCE_TYPES);
|
|
952
|
+
const refName = parseNonEmptyString(model, names[index], 'reference-names');
|
|
953
|
+
if (!promptContainsReference(prompt, refName)) {
|
|
954
|
+
throw new CLIError(`Model "${model}" requires prompt references like @${refName} for every --reference-names value.`, ExitCode.USAGE);
|
|
955
|
+
}
|
|
956
|
+
return {
|
|
957
|
+
type,
|
|
958
|
+
image_url: imageUrl,
|
|
959
|
+
ref_name: refName,
|
|
960
|
+
};
|
|
961
|
+
});
|
|
962
|
+
const params = {
|
|
963
|
+
image_references: imageReferences,
|
|
964
|
+
prompt,
|
|
965
|
+
model: 'v5.6',
|
|
966
|
+
aspect_ratio: aspectRatio,
|
|
967
|
+
};
|
|
968
|
+
if (duration !== undefined)
|
|
969
|
+
params['duration'] = duration;
|
|
970
|
+
if (quality)
|
|
971
|
+
params['quality'] = quality;
|
|
972
|
+
const seed = parseInteger(model, flags.seed, 'seed', { min: 0, max: 2147483647 });
|
|
973
|
+
if (seed !== undefined)
|
|
974
|
+
params['seed'] = seed;
|
|
975
|
+
const audio = parsePixVerseAudioFlag(model, flags.audio);
|
|
976
|
+
if (audio !== undefined)
|
|
977
|
+
params['generate_audio_switch'] = audio;
|
|
978
|
+
return buildEnvelope(model, params);
|
|
979
|
+
}
|
|
980
|
+
registerProvider({
|
|
981
|
+
provider: 'pixverse',
|
|
982
|
+
category: 'video',
|
|
983
|
+
models: [...TRANSITION_MODELS, ...I2V_MODELS, ...T2V_MODELS, ...FUSION_MODELS],
|
|
984
|
+
requiresPrompt(model) {
|
|
985
|
+
return !OPTIONAL_PROMPT_MODELS.has(model);
|
|
986
|
+
},
|
|
987
|
+
buildBody(model, prompt, flags) {
|
|
988
|
+
if (LEGACY_TRANSITION_MODELS.has(model))
|
|
989
|
+
return buildLegacyTransitionBody(model, prompt, flags);
|
|
990
|
+
if (LEGACY_I2V_MODELS.has(model))
|
|
991
|
+
return buildLegacyI2VBody(model, prompt, flags);
|
|
992
|
+
if (LEGACY_T2V_MODELS.has(model))
|
|
993
|
+
return buildLegacyT2VBody(model, prompt, flags);
|
|
994
|
+
if (V55_T2V_MODELS.has(model))
|
|
995
|
+
return buildV55T2VBody(model, prompt, flags);
|
|
996
|
+
if (V55_I2V_MODELS.has(model))
|
|
997
|
+
return buildV55I2VBody(model, prompt, flags);
|
|
998
|
+
if (V55_TRANSITION_MODELS.has(model))
|
|
999
|
+
return buildV55TransitionBody(model, prompt, flags);
|
|
1000
|
+
if (V56_T2V_MODELS.has(model))
|
|
1001
|
+
return buildV56T2VBody(model, prompt, flags);
|
|
1002
|
+
if (V56_I2V_MODELS.has(model))
|
|
1003
|
+
return buildV56I2VBody(model, prompt, flags);
|
|
1004
|
+
if (V56_TRANSITION_MODELS.has(model))
|
|
1005
|
+
return buildV56TransitionBody(model, prompt, flags);
|
|
1006
|
+
if (V6_T2V_MODELS.has(model))
|
|
1007
|
+
return buildV6T2VBody(model, prompt, flags);
|
|
1008
|
+
if (V6_I2V_MODELS.has(model))
|
|
1009
|
+
return buildV6I2VBody(model, prompt, flags);
|
|
1010
|
+
if (V6_TRANSITION_MODELS.has(model))
|
|
1011
|
+
return buildV6TransitionBody(model, prompt, flags);
|
|
1012
|
+
if (FUSION_MODELS.includes(model))
|
|
1013
|
+
return buildFusionBody(model, prompt, flags);
|
|
1014
|
+
throw new CLIError(`Unsupported PixVerse model "${model}".`, ExitCode.USAGE);
|
|
1015
|
+
},
|
|
1016
|
+
});
|
|
1017
|
+
//# sourceMappingURL=pixverse.js.map
|