@vocalstack/payload 0.6.0 → 0.6.1
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/api.js +5 -1
- package/dist/endpoints/voices.js +2 -1
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -198,6 +198,9 @@ export class VocalStackAPI {
|
|
|
198
198
|
throw new VocalStackAPIError(res.status, body?.code ?? 'http_error', body?.message ?? `VocalStack answered ${res.status}`);
|
|
199
199
|
}
|
|
200
200
|
savedSpeaker(id) {
|
|
201
|
+
// An empty id would read GET /v1/speakers/, the list, as if it were one speaker.
|
|
202
|
+
if (!id)
|
|
203
|
+
return Promise.reject(new VocalStackAPIError(404, 'not_found', 'No such speaker.'));
|
|
201
204
|
return this.#speaker('GET', both(`/${encodeURIComponent(id)}`));
|
|
202
205
|
}
|
|
203
206
|
/** Save a speaker from a recorded sample (30 s or more), cloning their voice. Needs the speaker's permission. */
|
|
@@ -216,7 +219,8 @@ export class VocalStackAPI {
|
|
|
216
219
|
const { recordingId, speaker, transcriptionId, ...rest } = opts;
|
|
217
220
|
const common = { ...rest, consent: true, library: true };
|
|
218
221
|
return this.#speaker('POST', { speakers: transcriptionId ? '/v1/speakers/from-appearance' : undefined, voices: '/v1/voices/from-speaker' }, {
|
|
219
|
-
|
|
222
|
+
// The spans are times in this recording: name it, or the server takes the latest one the speaker is heard in.
|
|
223
|
+
body: (route) => (route === 'speakers' ? { ...common, appearance: speaker, recordingId, transcriptionId } : { ...common, recordingId, speaker }),
|
|
220
224
|
idempotencyKey,
|
|
221
225
|
});
|
|
222
226
|
}
|
package/dist/endpoints/voices.js
CHANGED
|
@@ -263,7 +263,8 @@ export function speakerEndpoints(config, options) {
|
|
|
263
263
|
if (!source)
|
|
264
264
|
return json({ error: 'That recording is not one of theirs.' }, 403);
|
|
265
265
|
try {
|
|
266
|
-
|
|
266
|
+
// A failed lookup is an error to show, not a reason to try the retired /v1/voices/from-speaker.
|
|
267
|
+
const transcriptionId = source.transcriptionId ?? (await api.job(source.recordingId)).transcriptionId;
|
|
267
268
|
const trial = await api.speakerFromAppearance({ draft: true, name: nameOf(req, doc), recordingId: source.recordingId, spans, speaker: body.speaker, transcriptionId }, `payload:${collection}:${id}:trial:${randomUUID()}`);
|
|
268
269
|
// The trial it replaces (other samples picked) is not wanted any more.
|
|
269
270
|
if (typeof body.replace === 'string' && body.replace !== trial.id)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vocalstack/payload",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "VocalStack for Payload CMS: transcribe audio, translate it into other languages and read it aloud, kept in your own database and storage.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|