@sogni-ai/sogni-client 5.35.0 → 5.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/Chat/_hostedToolsManifest.generated.js +82 -0
- package/dist/Chat/_hostedToolsManifest.generated.js.map +1 -1
- package/dist/Chat/modelRouting.d.ts +3 -0
- package/dist/Chat/modelRouting.js +5 -1
- package/dist/Chat/modelRouting.js.map +1 -1
- package/dist/Projects/createJobRequestMessage.js +15 -0
- package/dist/Projects/createJobRequestMessage.js.map +1 -1
- package/dist/Projects/index.d.ts +3 -0
- package/dist/Projects/index.js +19 -1
- package/dist/Projects/index.js.map +1 -1
- package/dist/Projects/types/ModelOptions.d.ts +23 -3
- package/dist/Projects/types/ModelOptions.js +39 -4
- package/dist/Projects/types/ModelOptions.js.map +1 -1
- package/dist/Projects/types/ModelTiersRaw.d.ts +29 -3
- package/dist/Projects/types/ModelTiersRaw.js.map +1 -1
- package/dist/Projects/types/index.d.ts +24 -0
- package/dist/Projects/types/index.js.map +1 -1
- package/dist/lib/validation.js +10 -5
- package/dist/lib/validation.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist-esm/Chat/_hostedToolsManifest.generated.js +82 -0
- package/dist-esm/Chat/_hostedToolsManifest.generated.js.map +1 -1
- package/dist-esm/Chat/modelRouting.js +5 -1
- package/dist-esm/Chat/modelRouting.js.map +1 -1
- package/dist-esm/Projects/createJobRequestMessage.js +15 -0
- package/dist-esm/Projects/createJobRequestMessage.js.map +1 -1
- package/dist-esm/Projects/index.js +19 -1
- package/dist-esm/Projects/index.js.map +1 -1
- package/dist-esm/Projects/types/ModelOptions.js +39 -4
- package/dist-esm/Projects/types/ModelOptions.js.map +1 -1
- package/dist-esm/Projects/types/ModelTiersRaw.js.map +1 -1
- package/dist-esm/Projects/types/index.js.map +1 -1
- package/dist-esm/lib/validation.js +10 -5
- package/dist-esm/lib/validation.js.map +1 -1
- package/dist-esm/version.js +1 -1
- package/package.json +2 -2
- package/src/Chat/_hostedToolsManifest.generated.ts +82 -0
- package/src/Chat/modelRouting.ts +5 -1
- package/src/Projects/createJobRequestMessage.ts +15 -0
- package/src/Projects/index.ts +18 -1
- package/src/Projects/types/ModelOptions.ts +57 -7
- package/src/Projects/types/ModelTiersRaw.ts +22 -3
- package/src/Projects/types/index.ts +24 -0
- package/src/lib/validation.ts +12 -7
- package/src/version.ts +1 -1
|
@@ -1537,6 +1537,21 @@ function applyAudioParams(
|
|
|
1537
1537
|
if (params.shift !== undefined) {
|
|
1538
1538
|
keyFrame.shift = params.shift;
|
|
1539
1539
|
}
|
|
1540
|
+
// Speech controls. sogni-socket rejects each of these for the audio models
|
|
1541
|
+
// that have no node for it, so they are passed through rather than filtered
|
|
1542
|
+
// by model id here - one less place for a new speech model to be forgotten.
|
|
1543
|
+
if (params.speaker !== undefined) {
|
|
1544
|
+
keyFrame.speaker = params.speaker;
|
|
1545
|
+
}
|
|
1546
|
+
if (params.instruct !== undefined) {
|
|
1547
|
+
keyFrame.instruct = params.instruct;
|
|
1548
|
+
}
|
|
1549
|
+
if (params.referenceText !== undefined) {
|
|
1550
|
+
keyFrame.referenceText = params.referenceText;
|
|
1551
|
+
}
|
|
1552
|
+
if (params.referenceAudio) {
|
|
1553
|
+
keyFrame.hasReferenceAudio = true;
|
|
1554
|
+
}
|
|
1540
1555
|
|
|
1541
1556
|
keyFrame.comfySampler = validateSampler(params.sampler, options);
|
|
1542
1557
|
keyFrame.comfyScheduler = validateScheduler(params.scheduler, options);
|
package/src/Projects/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
SupportedModel,
|
|
12
12
|
ImageProjectParams,
|
|
13
13
|
VideoProjectParams,
|
|
14
|
+
AudioProjectParams,
|
|
14
15
|
VideoEstimateRequest,
|
|
15
16
|
AudioEstimateRequest
|
|
16
17
|
} from './types/index.js';
|
|
@@ -1387,7 +1388,8 @@ class ProjectsApi extends ApiGroup<ProjectApiEvents> {
|
|
|
1387
1388
|
this._annotateVideoAssetContentTypes(request, normalizedData);
|
|
1388
1389
|
break;
|
|
1389
1390
|
case 'audio':
|
|
1390
|
-
|
|
1391
|
+
await this._processAudioAssets(project, normalizedData);
|
|
1392
|
+
this._annotateAudioAssetContentTypes(request, normalizedData);
|
|
1391
1393
|
break;
|
|
1392
1394
|
}
|
|
1393
1395
|
await this.client.socket.send('jobRequest', request);
|
|
@@ -1426,6 +1428,21 @@ class ProjectsApi extends ApiGroup<ProjectApiEvents> {
|
|
|
1426
1428
|
}
|
|
1427
1429
|
}
|
|
1428
1430
|
|
|
1431
|
+
/** Voice cloning is the only audio model that takes an upload. */
|
|
1432
|
+
private async _processAudioAssets(project: Project, data: AudioProjectParams) {
|
|
1433
|
+
if (data?.referenceAudio && data.referenceAudio !== true) {
|
|
1434
|
+
await this.uploadReferenceAudio(project.id, data.referenceAudio);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
private _annotateAudioAssetContentTypes(request: Record<string, any>, data: AudioProjectParams) {
|
|
1439
|
+
const keyFrame = request.keyFrames?.[0];
|
|
1440
|
+
if (!keyFrame) return;
|
|
1441
|
+
if (data.referenceAudio && data.referenceAudio !== true) {
|
|
1442
|
+
keyFrame.referenceAudioContentType = getFileContentType(data.referenceAudio);
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1429
1446
|
private async _processVideoAssets(project: Project, data: VideoProjectParams) {
|
|
1430
1447
|
const isMinimaxH3R2v = isMinimaxH3ReferenceModel(data.modelId);
|
|
1431
1448
|
if (data?.referenceImage && data.referenceImage !== true) {
|
|
@@ -53,10 +53,15 @@ export interface AudioModelOptions {
|
|
|
53
53
|
type: 'audio';
|
|
54
54
|
steps: NumRange;
|
|
55
55
|
guidance?: NumRange;
|
|
56
|
-
sampler
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
/** Music only. Speech models have no diffusion sampler. */
|
|
57
|
+
sampler?: Options<string>;
|
|
58
|
+
/** Music only. Speech models have no diffusion scheduler. */
|
|
59
|
+
scheduler?: Options<string>;
|
|
60
|
+
/** Music only. A speech render is as long as the script takes to read. */
|
|
61
|
+
duration?: NumRange;
|
|
62
|
+
/** Music only. */
|
|
59
63
|
bpm?: NumRange;
|
|
64
|
+
/** Music only. */
|
|
60
65
|
timesignature?: Options<string>;
|
|
61
66
|
language?: Options<string>;
|
|
62
67
|
keyscale?: Options<string>;
|
|
@@ -64,6 +69,16 @@ export interface AudioModelOptions {
|
|
|
64
69
|
promptStrength?: NumRange;
|
|
65
70
|
creativity?: NumRange;
|
|
66
71
|
shift?: NumRange;
|
|
72
|
+
/** Speech only. The preset voices this model can speak in. */
|
|
73
|
+
speaker?: Options<string>;
|
|
74
|
+
/** Speech only. Maximum length of the delivery direction, and whether it is required. */
|
|
75
|
+
instruct?: { maxLength: number; required: boolean };
|
|
76
|
+
/** Speech only. Maximum length of the reference recording's transcript. */
|
|
77
|
+
referenceText?: { maxLength: number };
|
|
78
|
+
/** Speech only. Whether a reference recording may be uploaded. */
|
|
79
|
+
acceptsReferenceAudio?: boolean;
|
|
80
|
+
/** Speech only. Whether a reference recording is mandatory (voice cloning). */
|
|
81
|
+
requiresReferenceAudio?: boolean;
|
|
67
82
|
}
|
|
68
83
|
|
|
69
84
|
export type ModelOptions = ImageModelOptions | VideoModelOptions | AudioModelOptions;
|
|
@@ -146,13 +161,48 @@ export function mapVideoTier(tier: VideoTier): VideoModelOptions {
|
|
|
146
161
|
}
|
|
147
162
|
|
|
148
163
|
export function mapAudioTier(tier: AudioTier): AudioModelOptions {
|
|
164
|
+
// `steps` is the only control both music and speech always declare. Everything
|
|
165
|
+
// else is set below when the tier declares it, so a speech model does not
|
|
166
|
+
// advertise a tempo or a sampler it will refuse, and a music tier keeps
|
|
167
|
+
// exactly the fields it had before speech existed.
|
|
149
168
|
const options: AudioModelOptions = {
|
|
150
169
|
type: 'audio',
|
|
151
|
-
steps: mapRange(tier.steps)
|
|
152
|
-
sampler: mapOptions(tier.comfySampler, samplerValueToAlias),
|
|
153
|
-
scheduler: mapOptions(tier.comfyScheduler, schedulerValueToAlias),
|
|
154
|
-
duration: mapRange(tier.duration)
|
|
170
|
+
steps: mapRange(tier.steps)
|
|
155
171
|
};
|
|
172
|
+
if (tier.comfySampler) {
|
|
173
|
+
options.sampler = mapOptions(tier.comfySampler, samplerValueToAlias);
|
|
174
|
+
}
|
|
175
|
+
if (tier.comfyScheduler) {
|
|
176
|
+
options.scheduler = mapOptions(tier.comfyScheduler, schedulerValueToAlias);
|
|
177
|
+
}
|
|
178
|
+
if (tier.duration) {
|
|
179
|
+
options.duration = mapRange(tier.duration);
|
|
180
|
+
}
|
|
181
|
+
if (tier.bpm) {
|
|
182
|
+
options.bpm = mapRange(tier.bpm);
|
|
183
|
+
}
|
|
184
|
+
if (tier.timesignature) {
|
|
185
|
+
options.timesignature = mapOptions(tier.timesignature);
|
|
186
|
+
}
|
|
187
|
+
if (tier.speaker) {
|
|
188
|
+
options.speaker = mapOptions(tier.speaker);
|
|
189
|
+
}
|
|
190
|
+
if (tier.instruct) {
|
|
191
|
+
options.instruct = {
|
|
192
|
+
maxLength: tier.instruct.maxLength,
|
|
193
|
+
required: tier.instruct.required === true
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
if (tier.referenceText) {
|
|
197
|
+
options.referenceText = { maxLength: tier.referenceText.maxLength };
|
|
198
|
+
}
|
|
199
|
+
if (tier.acceptInputAudio) {
|
|
200
|
+
options.acceptsReferenceAudio = true;
|
|
201
|
+
}
|
|
202
|
+
if (tier.requiresReferenceAudio) {
|
|
203
|
+
options.acceptsReferenceAudio = true;
|
|
204
|
+
options.requiresReferenceAudio = true;
|
|
205
|
+
}
|
|
156
206
|
if (tier.guidance) {
|
|
157
207
|
options.guidance = mapRange(tier.guidance);
|
|
158
208
|
}
|
|
@@ -94,14 +94,23 @@ export interface BooleanDefault {
|
|
|
94
94
|
default: boolean;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* An audio model tier.
|
|
99
|
+
*
|
|
100
|
+
* Music and speech share this shape but use disjoint halves of it. A music
|
|
101
|
+
* model composes for a requested duration with a diffusion sampler; a speech
|
|
102
|
+
* model reads a script for however long the words take and has no sampler, no
|
|
103
|
+
* step count and no tempo. Everything either family lacks is optional here, so
|
|
104
|
+
* a tier declares only the controls its model can actually honour.
|
|
105
|
+
*/
|
|
97
106
|
export interface AudioTier {
|
|
98
107
|
benchmark: Benchmark;
|
|
99
108
|
bpm?: NumericDefaults;
|
|
100
|
-
comfySampler
|
|
101
|
-
comfyScheduler
|
|
109
|
+
comfySampler?: StringDefaults;
|
|
110
|
+
comfyScheduler?: StringDefaults;
|
|
102
111
|
composerMode?: BooleanDefault;
|
|
103
112
|
creativity?: NumericDefaults;
|
|
104
|
-
duration
|
|
113
|
+
duration?: NumericDefaults;
|
|
105
114
|
guidance?: NumericDefaults;
|
|
106
115
|
keyscale?: StringDefaults;
|
|
107
116
|
language?: StringDefaults;
|
|
@@ -110,6 +119,16 @@ export interface AudioTier {
|
|
|
110
119
|
steps: NumericDefaults;
|
|
111
120
|
timesignature?: StringDefaults;
|
|
112
121
|
type: 'audio';
|
|
122
|
+
/** Speech: the preset voices this model can speak in. */
|
|
123
|
+
speaker?: StringDefaults;
|
|
124
|
+
/** Speech: whether the model takes a written direction for the delivery. */
|
|
125
|
+
instruct?: { maxLength: number; required?: boolean; description?: string };
|
|
126
|
+
/** Speech: whether the model takes a transcript of the reference recording. */
|
|
127
|
+
referenceText?: { maxLength: number; description?: string };
|
|
128
|
+
/** Speech: whether a reference recording may be uploaded. */
|
|
129
|
+
acceptInputAudio?: boolean;
|
|
130
|
+
/** Speech: whether a reference recording is mandatory (voice cloning). */
|
|
131
|
+
requiresReferenceAudio?: boolean;
|
|
113
132
|
}
|
|
114
133
|
|
|
115
134
|
export function isAudioTier(t: ModelTier): t is AudioTier {
|
|
@@ -876,6 +876,30 @@ export interface AudioProjectParams extends BaseProjectParams {
|
|
|
876
876
|
* Output audio format. Can be 'mp3', 'flac', or 'wav'. Defaults to 'mp3'.
|
|
877
877
|
*/
|
|
878
878
|
outputFormat?: AudioOutputFormat;
|
|
879
|
+
/**
|
|
880
|
+
* Speech only. Preset studio voice to speak in, for models that offer them
|
|
881
|
+
* (Qwen3-TTS CustomVoice: serena, vivian, uncle_fu, ryan, aiden, ono_anna,
|
|
882
|
+
* sohee, eric, dylan). Ignored by music models, which have no voice roster.
|
|
883
|
+
*/
|
|
884
|
+
speaker?: string;
|
|
885
|
+
/**
|
|
886
|
+
* Speech only. A written direction for the delivery. On Qwen3-TTS CustomVoice
|
|
887
|
+
* it restyles the chosen voice ("whispering, close to the mic") without
|
|
888
|
+
* changing who it is; on VoiceDesign it describes the voice to invent and is
|
|
889
|
+
* required.
|
|
890
|
+
*/
|
|
891
|
+
instruct?: string;
|
|
892
|
+
/**
|
|
893
|
+
* Speech only. The exact transcript of `referenceAudio`. Supplying it lets a
|
|
894
|
+
* voice clone condition on the recording itself rather than on the speaker
|
|
895
|
+
* embedding alone, which is markedly closer to the source.
|
|
896
|
+
*/
|
|
897
|
+
referenceText?: string;
|
|
898
|
+
/**
|
|
899
|
+
* Speech only. Three to thirty seconds of the voice to clone, as one person
|
|
900
|
+
* speaking cleanly. Required by Qwen3-TTS Voice Clone and unused elsewhere.
|
|
901
|
+
*/
|
|
902
|
+
referenceAudio?: InputMedia;
|
|
879
903
|
}
|
|
880
904
|
|
|
881
905
|
export type ProjectParams = ImageProjectParams | VideoProjectParams | AudioProjectParams;
|
package/src/lib/validation.ts
CHANGED
|
@@ -148,7 +148,8 @@ export function isComfyModel(modelId: string): boolean {
|
|
|
148
148
|
'rtx_vsr_',
|
|
149
149
|
'wan_',
|
|
150
150
|
'ace_step',
|
|
151
|
-
'minimax_music3'
|
|
151
|
+
'minimax_music3',
|
|
152
|
+
'qwen3_tts_'
|
|
152
153
|
];
|
|
153
154
|
return COMFY_PREFIXES.some((prefix) => modelId.startsWith(prefix));
|
|
154
155
|
}
|
|
@@ -194,13 +195,16 @@ function validateOption<T = unknown>(value: T, options: T[], errorMessage: strin
|
|
|
194
195
|
* Returns the validated value unchanged - sogni-socket handles normalization.
|
|
195
196
|
*/
|
|
196
197
|
export function validateSampler(value: string | undefined, options: ModelOptions) {
|
|
197
|
-
|
|
198
|
+
// A model with no sampler at all - a Qwen3-TTS speech model, say - offers no
|
|
199
|
+
// choice to validate, so a value here is dropped rather than rejected.
|
|
200
|
+
const sampler = options.sampler;
|
|
201
|
+
if (!sampler?.allowed.length || !value) {
|
|
198
202
|
return null;
|
|
199
203
|
}
|
|
200
204
|
return validateOption(
|
|
201
205
|
value,
|
|
202
|
-
|
|
203
|
-
`Invalid sampler ${value}. Must be one of "${
|
|
206
|
+
sampler.allowed,
|
|
207
|
+
`Invalid sampler ${value}. Must be one of "${sampler.allowed.join('", "')}".`
|
|
204
208
|
);
|
|
205
209
|
}
|
|
206
210
|
|
|
@@ -209,13 +213,14 @@ export function validateSampler(value: string | undefined, options: ModelOptions
|
|
|
209
213
|
* Returns the validated value unchanged - sogni-socket handles normalization.
|
|
210
214
|
*/
|
|
211
215
|
export function validateScheduler(value: string | undefined, options: ModelOptions) {
|
|
212
|
-
|
|
216
|
+
const scheduler = options.scheduler;
|
|
217
|
+
if (!scheduler?.allowed.length || !value) {
|
|
213
218
|
return null;
|
|
214
219
|
}
|
|
215
220
|
return validateOption(
|
|
216
221
|
value,
|
|
217
|
-
|
|
218
|
-
`Invalid scheduler ${value}. Must be one of "${
|
|
222
|
+
scheduler.allowed,
|
|
223
|
+
`Invalid scheduler ${value}. Must be one of "${scheduler.allowed.join('", "')}".`
|
|
219
224
|
);
|
|
220
225
|
}
|
|
221
226
|
|
package/src/version.ts
CHANGED