@storyteller-platform/ghost-story 0.1.4 → 0.1.6
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/{AudioFormat--LEggByS.d.ts → AudioFormat-BJuNZJlT.d.ts} +4 -0
- package/dist/{AudioFormat-Cq6sRKDj.d.cts → AudioFormat-CKxAQAj2.d.cts} +4 -0
- package/dist/api/APIOptions.d.cts +1 -1
- package/dist/api/APIOptions.d.ts +1 -1
- package/dist/api/Recognition.d.cts +1 -1
- package/dist/api/Recognition.d.ts +1 -1
- package/dist/audio/AudioConverter.d.cts +1 -1
- package/dist/audio/AudioConverter.d.ts +1 -1
- package/dist/audio/AudioFormat.d.cts +1 -1
- package/dist/audio/AudioFormat.d.ts +1 -1
- package/dist/audio/AudioSource.d.cts +1 -1
- package/dist/audio/AudioSource.d.ts +1 -1
- package/dist/audio/index.d.cts +1 -1
- package/dist/audio/index.d.ts +1 -1
- package/dist/cli/bin.cjs +14 -4
- package/dist/cli/bin.js +14 -4
- package/dist/cli/install.cjs +34 -7
- package/dist/cli/install.js +34 -7
- package/dist/convert.d.cts +1 -1
- package/dist/convert.d.ts +1 -1
- package/dist/fetch.cjs +35 -0
- package/dist/fetch.d.cts +9 -0
- package/dist/fetch.d.ts +9 -0
- package/dist/fetch.js +11 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/recognition/AmazonTranscribeSTT.d.cts +1 -1
- package/dist/recognition/AmazonTranscribeSTT.d.ts +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.cts +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts +1 -1
- package/dist/recognition/DeepgramSTT.cjs +8 -2
- package/dist/recognition/DeepgramSTT.d.cts +10 -2
- package/dist/recognition/DeepgramSTT.d.ts +10 -2
- package/dist/recognition/DeepgramSTT.js +8 -2
- package/dist/recognition/GoogleCloudSTT.d.cts +1 -1
- package/dist/recognition/GoogleCloudSTT.d.ts +1 -1
- package/dist/recognition/OpenAICloudSTT.d.cts +1 -1
- package/dist/recognition/OpenAICloudSTT.d.ts +1 -1
- package/dist/recognition/WhisperCppSTT.cjs +1 -1
- package/dist/recognition/WhisperCppSTT.d.cts +1 -1
- package/dist/recognition/WhisperCppSTT.d.ts +1 -1
- package/dist/recognition/WhisperCppSTT.js +1 -1
- package/dist/recognition/WhisperServerSTT.cjs +14 -3
- package/dist/recognition/WhisperServerSTT.d.cts +1 -1
- package/dist/recognition/WhisperServerSTT.d.ts +1 -1
- package/dist/recognition/WhisperServerSTT.js +14 -3
- package/package.json +2 -1
|
@@ -93,6 +93,10 @@ interface WhisperServerOptions {
|
|
|
93
93
|
temperature?: number;
|
|
94
94
|
apiKey?: string;
|
|
95
95
|
inputFormat?: AudioFormat;
|
|
96
|
+
/**
|
|
97
|
+
* timeout in milliseconds waiting for a response from the whisper server
|
|
98
|
+
*/
|
|
99
|
+
timeout?: number;
|
|
96
100
|
}
|
|
97
101
|
interface RecognitionResult$1 {
|
|
98
102
|
transcript: string;
|
|
@@ -93,6 +93,10 @@ interface WhisperServerOptions {
|
|
|
93
93
|
temperature?: number;
|
|
94
94
|
apiKey?: string;
|
|
95
95
|
inputFormat?: AudioFormat;
|
|
96
|
+
/**
|
|
97
|
+
* timeout in milliseconds waiting for a response from the whisper server
|
|
98
|
+
*/
|
|
99
|
+
timeout?: number;
|
|
96
100
|
}
|
|
97
101
|
interface RecognitionResult$1 {
|
|
98
102
|
transcript: string;
|
package/dist/api/APIOptions.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'node:fs';
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
export { Y as Audio, A as AudioInput, R as RecognitionEngine, a as RecognitionOptions, b as RecognitionResult, r as recognitionEngines, c as recognize } from '../AudioFormat-
|
|
3
|
+
export { Y as Audio, A as AudioInput, R as RecognitionEngine, a as RecognitionOptions, b as RecognitionResult, r as recognitionEngines, c as recognize } from '../AudioFormat-CKxAQAj2.cjs';
|
|
4
4
|
import '../config.cjs';
|
|
5
5
|
import '../utilities/Timeline.cjs';
|
|
6
6
|
import '../utilities/Timing.cjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'node:fs';
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
export { Y as Audio, A as AudioInput, R as RecognitionEngine, a as RecognitionOptions, b as RecognitionResult, r as recognitionEngines, c as recognize } from '../AudioFormat
|
|
3
|
+
export { Y as Audio, A as AudioInput, R as RecognitionEngine, a as RecognitionOptions, b as RecognitionResult, r as recognitionEngines, c as recognize } from '../AudioFormat-BJuNZJlT.js';
|
|
4
4
|
import '../config.js';
|
|
5
5
|
import '../utilities/Timeline.js';
|
|
6
6
|
import '../utilities/Timing.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as AudioFormat, f as AudioSource, R as RecognitionEngine } from '../AudioFormat-
|
|
1
|
+
import { d as AudioFormat, f as AudioSource, R as RecognitionEngine } from '../AudioFormat-CKxAQAj2.cjs';
|
|
2
2
|
import { Readable } from 'node:stream';
|
|
3
3
|
import { ConversionMode } from '../config.cjs';
|
|
4
4
|
import 'node:fs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as AudioFormat, f as AudioSource, R as RecognitionEngine } from '../AudioFormat
|
|
1
|
+
import { d as AudioFormat, f as AudioSource, R as RecognitionEngine } from '../AudioFormat-BJuNZJlT.js';
|
|
2
2
|
import { Readable } from 'node:stream';
|
|
3
3
|
import { ConversionMode } from '../config.js';
|
|
4
4
|
import 'node:fs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { P as AudioEncoding, d as AudioFormat, e as AudioFormatInfo, S as ServiceCapabilities, n as formatFromExtension, o as formatToExtension, s as getTargetFormat, u as needsConversion, w as serviceCapabilities } from '../AudioFormat-
|
|
1
|
+
export { P as AudioEncoding, d as AudioFormat, e as AudioFormatInfo, S as ServiceCapabilities, n as formatFromExtension, o as formatToExtension, s as getTargetFormat, u as needsConversion, w as serviceCapabilities } from '../AudioFormat-CKxAQAj2.cjs';
|
|
2
2
|
import 'node:fs';
|
|
3
3
|
import 'node:stream';
|
|
4
4
|
import '../config.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { P as AudioEncoding, d as AudioFormat, e as AudioFormatInfo, S as ServiceCapabilities, n as formatFromExtension, o as formatToExtension, s as getTargetFormat, u as needsConversion, w as serviceCapabilities } from '../AudioFormat
|
|
1
|
+
export { P as AudioEncoding, d as AudioFormat, e as AudioFormatInfo, S as ServiceCapabilities, n as formatFromExtension, o as formatToExtension, s as getTargetFormat, u as needsConversion, w as serviceCapabilities } from '../AudioFormat-BJuNZJlT.js';
|
|
2
2
|
import 'node:fs';
|
|
3
3
|
import 'node:stream';
|
|
4
4
|
import '../config.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'node:fs';
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
export { f as AudioSource, g as AudioSourceFromBuffer, h as AudioSourceFromFile, i as AudioSourceFromStream, j as RawAudioInput, k as audioSourceFromBuffer, l as audioSourceFromFile, m as audioSourceFromStream, p as getFormat, q as getFormatInfo, t as isAudioSource, v as normalizeToAudioSource, x as toBuffer, y as toFilePath, z as toReadStream } from '../AudioFormat-
|
|
3
|
+
export { f as AudioSource, g as AudioSourceFromBuffer, h as AudioSourceFromFile, i as AudioSourceFromStream, j as RawAudioInput, k as audioSourceFromBuffer, l as audioSourceFromFile, m as audioSourceFromStream, p as getFormat, q as getFormatInfo, t as isAudioSource, v as normalizeToAudioSource, x as toBuffer, y as toFilePath, z as toReadStream } from '../AudioFormat-CKxAQAj2.cjs';
|
|
4
4
|
import '../config.cjs';
|
|
5
5
|
import '../utilities/Timeline.cjs';
|
|
6
6
|
import '../utilities/Timing.cjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'node:fs';
|
|
2
2
|
import 'node:stream';
|
|
3
|
-
export { f as AudioSource, g as AudioSourceFromBuffer, h as AudioSourceFromFile, i as AudioSourceFromStream, j as RawAudioInput, k as audioSourceFromBuffer, l as audioSourceFromFile, m as audioSourceFromStream, p as getFormat, q as getFormatInfo, t as isAudioSource, v as normalizeToAudioSource, x as toBuffer, y as toFilePath, z as toReadStream } from '../AudioFormat
|
|
3
|
+
export { f as AudioSource, g as AudioSourceFromBuffer, h as AudioSourceFromFile, i as AudioSourceFromStream, j as RawAudioInput, k as audioSourceFromBuffer, l as audioSourceFromFile, m as audioSourceFromStream, p as getFormat, q as getFormatInfo, t as isAudioSource, v as normalizeToAudioSource, x as toBuffer, y as toFilePath, z as toReadStream } from '../AudioFormat-BJuNZJlT.js';
|
|
4
4
|
import '../config.js';
|
|
5
5
|
import '../utilities/Timeline.js';
|
|
6
6
|
import '../utilities/Timing.js';
|
package/dist/audio/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { P as AudioEncoding, d as AudioFormat, e as AudioFormatInfo, f as AudioSource, g as AudioSourceFromBuffer, h as AudioSourceFromFile, i as AudioSourceFromStream, j as RawAudioInput, S as ServiceCapabilities, k as audioSourceFromBuffer, l as audioSourceFromFile, m as audioSourceFromStream, n as formatFromExtension, o as formatToExtension, p as getFormat, q as getFormatInfo, s as getTargetFormat, t as isAudioSource, u as needsConversion, v as normalizeToAudioSource, w as serviceCapabilities, x as toBuffer, y as toFilePath, z as toReadStream } from '../AudioFormat-
|
|
1
|
+
export { P as AudioEncoding, d as AudioFormat, e as AudioFormatInfo, f as AudioSource, g as AudioSourceFromBuffer, h as AudioSourceFromFile, i as AudioSourceFromStream, j as RawAudioInput, S as ServiceCapabilities, k as audioSourceFromBuffer, l as audioSourceFromFile, m as audioSourceFromStream, n as formatFromExtension, o as formatToExtension, p as getFormat, q as getFormatInfo, s as getTargetFormat, t as isAudioSource, u as needsConversion, v as normalizeToAudioSource, w as serviceCapabilities, x as toBuffer, y as toFilePath, z as toReadStream } from '../AudioFormat-CKxAQAj2.cjs';
|
|
2
2
|
export { ConversionOptions, PrepareForServiceOptions, PreparedAudio, StreamForUploadOptions, StreamForUploadResult, convertToBuffer, convertToFile, convertToStream, createStreamForUpload, createStreamingConversion, getAudioDuration, prepareForService, prepareWavForService } from './AudioConverter.cjs';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:stream';
|
package/dist/audio/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { P as AudioEncoding, d as AudioFormat, e as AudioFormatInfo, f as AudioSource, g as AudioSourceFromBuffer, h as AudioSourceFromFile, i as AudioSourceFromStream, j as RawAudioInput, S as ServiceCapabilities, k as audioSourceFromBuffer, l as audioSourceFromFile, m as audioSourceFromStream, n as formatFromExtension, o as formatToExtension, p as getFormat, q as getFormatInfo, s as getTargetFormat, t as isAudioSource, u as needsConversion, v as normalizeToAudioSource, w as serviceCapabilities, x as toBuffer, y as toFilePath, z as toReadStream } from '../AudioFormat
|
|
1
|
+
export { P as AudioEncoding, d as AudioFormat, e as AudioFormatInfo, f as AudioSource, g as AudioSourceFromBuffer, h as AudioSourceFromFile, i as AudioSourceFromStream, j as RawAudioInput, S as ServiceCapabilities, k as audioSourceFromBuffer, l as audioSourceFromFile, m as audioSourceFromStream, n as formatFromExtension, o as formatToExtension, p as getFormat, q as getFormatInfo, s as getTargetFormat, t as isAudioSource, u as needsConversion, v as normalizeToAudioSource, w as serviceCapabilities, x as toBuffer, y as toFilePath, z as toReadStream } from '../AudioFormat-BJuNZJlT.js';
|
|
2
2
|
export { ConversionOptions, PrepareForServiceOptions, PreparedAudio, StreamForUploadOptions, StreamForUploadResult, convertToBuffer, convertToFile, convertToStream, createStreamForUpload, createStreamingConversion, getAudioDuration, prepareForService, prepareWavForService } from './AudioConverter.js';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:stream';
|
package/dist/cli/bin.cjs
CHANGED
|
@@ -24,6 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
));
|
|
25
25
|
var import_zli = require("@robingenz/zli");
|
|
26
26
|
var import_cli_progress = require("cli-progress");
|
|
27
|
+
var import_fs_extra = require("fs-extra");
|
|
27
28
|
var import_zod = require("zod");
|
|
28
29
|
var import_config = require("./config.cjs");
|
|
29
30
|
var import_install = require("./install.cjs");
|
|
@@ -194,7 +195,16 @@ const transcribeCommand = (0, import_zli.defineCommand)({
|
|
|
194
195
|
import_cli_progress.Presets.shades_classic
|
|
195
196
|
);
|
|
196
197
|
try {
|
|
197
|
-
|
|
198
|
+
let [inputPath] = args;
|
|
199
|
+
const path = await import("node:path");
|
|
200
|
+
inputPath = path.resolve(process.cwd(), inputPath);
|
|
201
|
+
let outputPath = options.output ? path.resolve(process.cwd(), options.output) : void 0;
|
|
202
|
+
if (outputPath && !path.extname(outputPath)) {
|
|
203
|
+
outputPath = `${outputPath}.json`;
|
|
204
|
+
}
|
|
205
|
+
if (outputPath) {
|
|
206
|
+
(0, import_fs_extra.ensureDirSync)(path.dirname(outputPath));
|
|
207
|
+
}
|
|
198
208
|
const result = await recognize(inputPath, {
|
|
199
209
|
engine: options.engine,
|
|
200
210
|
language: options.language,
|
|
@@ -219,14 +229,14 @@ const transcribeCommand = (0, import_zli.defineCommand)({
|
|
|
219
229
|
}
|
|
220
230
|
}
|
|
221
231
|
});
|
|
222
|
-
if (!
|
|
232
|
+
if (!outputPath) {
|
|
223
233
|
console.log(JSON.stringify(result, null, 2));
|
|
224
234
|
return;
|
|
225
235
|
}
|
|
226
236
|
const { writeFile } = await import("node:fs/promises");
|
|
227
|
-
await writeFile(
|
|
237
|
+
await writeFile(outputPath, JSON.stringify(result, null, 2));
|
|
228
238
|
console.log(`
|
|
229
|
-
Transcription written to ${
|
|
239
|
+
Transcription written to ${outputPath}`);
|
|
230
240
|
} finally {
|
|
231
241
|
if (!options.noProgress) {
|
|
232
242
|
progressBar.stop();
|
package/dist/cli/bin.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
processConfig
|
|
7
7
|
} from "@robingenz/zli";
|
|
8
8
|
import { Presets, SingleBar } from "cli-progress";
|
|
9
|
+
import { ensureDirSync } from "fs-extra";
|
|
9
10
|
import { z } from "zod";
|
|
10
11
|
import {
|
|
11
12
|
BUILD_VARIANTS,
|
|
@@ -193,7 +194,16 @@ const transcribeCommand = defineCommand({
|
|
|
193
194
|
Presets.shades_classic
|
|
194
195
|
);
|
|
195
196
|
try {
|
|
196
|
-
|
|
197
|
+
let [inputPath] = args;
|
|
198
|
+
const path = await import("node:path");
|
|
199
|
+
inputPath = path.resolve(process.cwd(), inputPath);
|
|
200
|
+
let outputPath = options.output ? path.resolve(process.cwd(), options.output) : void 0;
|
|
201
|
+
if (outputPath && !path.extname(outputPath)) {
|
|
202
|
+
outputPath = `${outputPath}.json`;
|
|
203
|
+
}
|
|
204
|
+
if (outputPath) {
|
|
205
|
+
ensureDirSync(path.dirname(outputPath));
|
|
206
|
+
}
|
|
197
207
|
const result = await recognize(inputPath, {
|
|
198
208
|
engine: options.engine,
|
|
199
209
|
language: options.language,
|
|
@@ -218,14 +228,14 @@ const transcribeCommand = defineCommand({
|
|
|
218
228
|
}
|
|
219
229
|
}
|
|
220
230
|
});
|
|
221
|
-
if (!
|
|
231
|
+
if (!outputPath) {
|
|
222
232
|
console.log(JSON.stringify(result, null, 2));
|
|
223
233
|
return;
|
|
224
234
|
}
|
|
225
235
|
const { writeFile } = await import("node:fs/promises");
|
|
226
|
-
await writeFile(
|
|
236
|
+
await writeFile(outputPath, JSON.stringify(result, null, 2));
|
|
227
237
|
console.log(`
|
|
228
|
-
Transcription written to ${
|
|
238
|
+
Transcription written to ${outputPath}`);
|
|
229
239
|
} finally {
|
|
230
240
|
if (!options.noProgress) {
|
|
231
241
|
progressBar.stop();
|
package/dist/cli/install.cjs
CHANGED
|
@@ -43,6 +43,8 @@ var import_node_os = __toESM(require("node:os"), 1);
|
|
|
43
43
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
44
44
|
var import_promises2 = require("node:stream/promises");
|
|
45
45
|
var import_node_zlib = require("node:zlib");
|
|
46
|
+
var import_chalk = __toESM(require("chalk"), 1);
|
|
47
|
+
var import_cli_progress = require("cli-progress");
|
|
46
48
|
var import_tar = require("tar");
|
|
47
49
|
var import_config = require("./config.cjs");
|
|
48
50
|
async function downloadFile(options) {
|
|
@@ -68,9 +70,27 @@ async function downloadFile(options) {
|
|
|
68
70
|
}
|
|
69
71
|
await (0, import_promises.mkdir)(import_node_path.default.dirname(destPath), { recursive: true });
|
|
70
72
|
const fileStream = (0, import_node_fs.createWriteStream)(destPath);
|
|
73
|
+
const progressBar = new import_cli_progress.SingleBar(
|
|
74
|
+
{
|
|
75
|
+
etaBuffer: 2,
|
|
76
|
+
hideCursor: null,
|
|
77
|
+
noTTYOutput: !process.stderr.isTTY,
|
|
78
|
+
autopadding: true,
|
|
79
|
+
format: `${import_chalk.default.yellow("{bar}")} | {percentage}% | {current}/{sum} MB | ({speed} MB/s)`
|
|
80
|
+
},
|
|
81
|
+
import_cli_progress.Presets.shades_classic
|
|
82
|
+
);
|
|
71
83
|
const reader = response.body.getReader();
|
|
72
84
|
let downloaded = 0;
|
|
73
|
-
let
|
|
85
|
+
let lastTime = Date.now();
|
|
86
|
+
let lastDownloaded = 0;
|
|
87
|
+
if (printOutput) {
|
|
88
|
+
progressBar.start(totalSize, 0, {
|
|
89
|
+
current: "0 MB",
|
|
90
|
+
sum: `${(totalSize / 1024 / 1024).toFixed(2)} MB`,
|
|
91
|
+
speed: 0
|
|
92
|
+
});
|
|
93
|
+
}
|
|
74
94
|
try {
|
|
75
95
|
while (true) {
|
|
76
96
|
const { done, value } = await reader.read();
|
|
@@ -81,18 +101,25 @@ async function downloadFile(options) {
|
|
|
81
101
|
fileStream.write(value);
|
|
82
102
|
onProgress == null ? void 0 : onProgress(downloaded, totalSize);
|
|
83
103
|
if (printOutput && totalSize > 0) {
|
|
84
|
-
const
|
|
104
|
+
const deltaTime = Date.now() - lastTime;
|
|
105
|
+
const shouldPrint = deltaTime > 1e3 || downloaded === totalSize;
|
|
85
106
|
if (shouldPrint) {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
107
|
+
const speed = (downloaded - lastDownloaded) / 1024 / 1024 / (deltaTime / 1e3);
|
|
108
|
+
lastTime = Date.now();
|
|
109
|
+
lastDownloaded = downloaded;
|
|
110
|
+
progressBar.update(downloaded, {
|
|
111
|
+
current: (downloaded / 1024 / 1024).toFixed(2),
|
|
112
|
+
sum: (totalSize / 1024 / 1024).toFixed(2),
|
|
113
|
+
speed: speed.toFixed(2)
|
|
114
|
+
});
|
|
91
115
|
}
|
|
92
116
|
}
|
|
93
117
|
}
|
|
94
118
|
} finally {
|
|
95
119
|
fileStream.end();
|
|
120
|
+
if (printOutput) {
|
|
121
|
+
progressBar.stop();
|
|
122
|
+
}
|
|
96
123
|
}
|
|
97
124
|
await new Promise((resolve, reject) => {
|
|
98
125
|
fileStream.on("finish", resolve);
|
package/dist/cli/install.js
CHANGED
|
@@ -9,6 +9,8 @@ import os from "node:os";
|
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { pipeline } from "node:stream/promises";
|
|
11
11
|
import { createGunzip } from "node:zlib";
|
|
12
|
+
import chalk from "chalk";
|
|
13
|
+
import { Presets, SingleBar } from "cli-progress";
|
|
12
14
|
import { extract } from "tar";
|
|
13
15
|
import {
|
|
14
16
|
MODEL_SIZES,
|
|
@@ -52,9 +54,27 @@ async function downloadFile(options) {
|
|
|
52
54
|
}
|
|
53
55
|
await mkdir(path.dirname(destPath), { recursive: true });
|
|
54
56
|
const fileStream = createWriteStream(destPath);
|
|
57
|
+
const progressBar = new SingleBar(
|
|
58
|
+
{
|
|
59
|
+
etaBuffer: 2,
|
|
60
|
+
hideCursor: null,
|
|
61
|
+
noTTYOutput: !process.stderr.isTTY,
|
|
62
|
+
autopadding: true,
|
|
63
|
+
format: `${chalk.yellow("{bar}")} | {percentage}% | {current}/{sum} MB | ({speed} MB/s)`
|
|
64
|
+
},
|
|
65
|
+
Presets.shades_classic
|
|
66
|
+
);
|
|
55
67
|
const reader = response.body.getReader();
|
|
56
68
|
let downloaded = 0;
|
|
57
|
-
let
|
|
69
|
+
let lastTime = Date.now();
|
|
70
|
+
let lastDownloaded = 0;
|
|
71
|
+
if (printOutput) {
|
|
72
|
+
progressBar.start(totalSize, 0, {
|
|
73
|
+
current: "0 MB",
|
|
74
|
+
sum: `${(totalSize / 1024 / 1024).toFixed(2)} MB`,
|
|
75
|
+
speed: 0
|
|
76
|
+
});
|
|
77
|
+
}
|
|
58
78
|
try {
|
|
59
79
|
while (true) {
|
|
60
80
|
const { done, value } = await reader.read();
|
|
@@ -65,18 +85,25 @@ async function downloadFile(options) {
|
|
|
65
85
|
fileStream.write(value);
|
|
66
86
|
onProgress == null ? void 0 : onProgress(downloaded, totalSize);
|
|
67
87
|
if (printOutput && totalSize > 0) {
|
|
68
|
-
const
|
|
88
|
+
const deltaTime = Date.now() - lastTime;
|
|
89
|
+
const shouldPrint = deltaTime > 1e3 || downloaded === totalSize;
|
|
69
90
|
if (shouldPrint) {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
91
|
+
const speed = (downloaded - lastDownloaded) / 1024 / 1024 / (deltaTime / 1e3);
|
|
92
|
+
lastTime = Date.now();
|
|
93
|
+
lastDownloaded = downloaded;
|
|
94
|
+
progressBar.update(downloaded, {
|
|
95
|
+
current: (downloaded / 1024 / 1024).toFixed(2),
|
|
96
|
+
sum: (totalSize / 1024 / 1024).toFixed(2),
|
|
97
|
+
speed: speed.toFixed(2)
|
|
98
|
+
});
|
|
75
99
|
}
|
|
76
100
|
}
|
|
77
101
|
}
|
|
78
102
|
} finally {
|
|
79
103
|
fileStream.end();
|
|
104
|
+
if (printOutput) {
|
|
105
|
+
progressBar.stop();
|
|
106
|
+
}
|
|
80
107
|
}
|
|
81
108
|
await new Promise((resolve, reject) => {
|
|
82
109
|
fileStream.on("finish", resolve);
|
package/dist/convert.d.cts
CHANGED
package/dist/convert.d.ts
CHANGED
package/dist/fetch.cjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var fetch_exports = {};
|
|
20
|
+
__export(fetch_exports, {
|
|
21
|
+
createTimeoutAgent: () => createTimeoutAgent
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(fetch_exports);
|
|
24
|
+
var import_undici = require("undici");
|
|
25
|
+
const createTimeoutAgent = (timeout) => new import_undici.Agent({
|
|
26
|
+
// 1 hour timeout lmao
|
|
27
|
+
headersTimeout: timeout,
|
|
28
|
+
bodyTimeout: timeout,
|
|
29
|
+
// connection shouldnt be that long
|
|
30
|
+
connectTimeout: 3e4
|
|
31
|
+
});
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
createTimeoutAgent
|
|
35
|
+
});
|
package/dist/fetch.d.cts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Agent } from 'undici';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* necessary bc there's a default timeout of 300 seconds for all `fetch` requests, which is
|
|
5
|
+
* often shorter than the time it takes for the whisper server to respond
|
|
6
|
+
*/
|
|
7
|
+
declare const createTimeoutAgent: (timeout: number) => Agent;
|
|
8
|
+
|
|
9
|
+
export { createTimeoutAgent };
|
package/dist/fetch.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Agent } from 'undici';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* necessary bc there's a default timeout of 300 seconds for all `fetch` requests, which is
|
|
5
|
+
* often shorter than the time it takes for the whisper server to respond
|
|
6
|
+
*/
|
|
7
|
+
declare const createTimeoutAgent: (timeout: number) => Agent;
|
|
8
|
+
|
|
9
|
+
export { createTimeoutAgent };
|
package/dist/fetch.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Agent } from "undici";
|
|
2
|
+
const createTimeoutAgent = (timeout) => new Agent({
|
|
3
|
+
// 1 hour timeout lmao
|
|
4
|
+
headersTimeout: timeout,
|
|
5
|
+
bodyTimeout: timeout,
|
|
6
|
+
// connection shouldnt be that long
|
|
7
|
+
connectTimeout: 3e4
|
|
8
|
+
});
|
|
9
|
+
export {
|
|
10
|
+
createTimeoutAgent
|
|
11
|
+
};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as AudioFormat, e as AudioFormatInfo, A as AudioInput, f as AudioSource, g as AudioSourceFromBuffer, h as AudioSourceFromFile, i as AudioSourceFromStream, L as Language, E as Languages, O as OpenAICloudSTTOptions, B as OpenAIResult, j as RawAudioInput, R as RecognitionEngine, a as RecognitionOptions, b as RecognitionResult, S as ServiceCapabilities, W as WhisperCppModelId, G as WhisperCppOptions, F as WhisperCppResult, K as WhisperServerOptions, J as WhisperServerResult, k as audioSourceFromBuffer, l as audioSourceFromFile, m as audioSourceFromStream, n as formatFromExtension, o as formatToExtension, p as getFormat, q as getFormatInfo, s as getTargetFormat, t as isAudioSource, u as needsConversion, v as normalizeToAudioSource, C as openaiInputPreference, r as recognitionEngines, c as recognize, D as recognizeOpenAI, I as recognizeWhisperCpp, N as recognizeWhisperServer, w as serviceCapabilities, x as toBuffer, y as toFilePath, z as toReadStream, H as whisperCppInputPreference, M as whisperServerInputPreference } from './AudioFormat-
|
|
1
|
+
export { d as AudioFormat, e as AudioFormatInfo, A as AudioInput, f as AudioSource, g as AudioSourceFromBuffer, h as AudioSourceFromFile, i as AudioSourceFromStream, L as Language, E as Languages, O as OpenAICloudSTTOptions, B as OpenAIResult, j as RawAudioInput, R as RecognitionEngine, a as RecognitionOptions, b as RecognitionResult, S as ServiceCapabilities, W as WhisperCppModelId, G as WhisperCppOptions, F as WhisperCppResult, K as WhisperServerOptions, J as WhisperServerResult, k as audioSourceFromBuffer, l as audioSourceFromFile, m as audioSourceFromStream, n as formatFromExtension, o as formatToExtension, p as getFormat, q as getFormatInfo, s as getTargetFormat, t as isAudioSource, u as needsConversion, v as normalizeToAudioSource, C as openaiInputPreference, r as recognitionEngines, c as recognize, D as recognizeOpenAI, I as recognizeWhisperCpp, N as recognizeWhisperServer, w as serviceCapabilities, x as toBuffer, y as toFilePath, z as toReadStream, H as whisperCppInputPreference, M as whisperServerInputPreference } from './AudioFormat-CKxAQAj2.cjs';
|
|
2
2
|
export { ConversionOptions, PreparedAudio, convertToBuffer, convertToFile, createStreamingConversion, prepareForService, prepareWavForService } from './audio/AudioConverter.cjs';
|
|
3
3
|
export { BUILD_VARIANTS, BuildVariant, RECOGNITION_ENGINES, WHISPER_CPP_VERSION, WHISPER_MODELS, WhisperModel, applyLegacyCpuFallback, detectPlatform, getConfiguredVariant, getInstallDir, getModelDir, getModelPath, getVadModelPath, getWhisperExecutablePath, getWhisperServerExecutablePath, isValidModel, resolveVariant } from './cli/config.cjs';
|
|
4
4
|
export { InstallBinaryOptions, InstallModelOptions, InstallVadModelOptions, ensureWhisperInstalled, installBinary, installModel, installVadModel } from './cli/install.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as AudioFormat, e as AudioFormatInfo, A as AudioInput, f as AudioSource, g as AudioSourceFromBuffer, h as AudioSourceFromFile, i as AudioSourceFromStream, L as Language, E as Languages, O as OpenAICloudSTTOptions, B as OpenAIResult, j as RawAudioInput, R as RecognitionEngine, a as RecognitionOptions, b as RecognitionResult, S as ServiceCapabilities, W as WhisperCppModelId, G as WhisperCppOptions, F as WhisperCppResult, K as WhisperServerOptions, J as WhisperServerResult, k as audioSourceFromBuffer, l as audioSourceFromFile, m as audioSourceFromStream, n as formatFromExtension, o as formatToExtension, p as getFormat, q as getFormatInfo, s as getTargetFormat, t as isAudioSource, u as needsConversion, v as normalizeToAudioSource, C as openaiInputPreference, r as recognitionEngines, c as recognize, D as recognizeOpenAI, I as recognizeWhisperCpp, N as recognizeWhisperServer, w as serviceCapabilities, x as toBuffer, y as toFilePath, z as toReadStream, H as whisperCppInputPreference, M as whisperServerInputPreference } from './AudioFormat
|
|
1
|
+
export { d as AudioFormat, e as AudioFormatInfo, A as AudioInput, f as AudioSource, g as AudioSourceFromBuffer, h as AudioSourceFromFile, i as AudioSourceFromStream, L as Language, E as Languages, O as OpenAICloudSTTOptions, B as OpenAIResult, j as RawAudioInput, R as RecognitionEngine, a as RecognitionOptions, b as RecognitionResult, S as ServiceCapabilities, W as WhisperCppModelId, G as WhisperCppOptions, F as WhisperCppResult, K as WhisperServerOptions, J as WhisperServerResult, k as audioSourceFromBuffer, l as audioSourceFromFile, m as audioSourceFromStream, n as formatFromExtension, o as formatToExtension, p as getFormat, q as getFormatInfo, s as getTargetFormat, t as isAudioSource, u as needsConversion, v as normalizeToAudioSource, C as openaiInputPreference, r as recognitionEngines, c as recognize, D as recognizeOpenAI, I as recognizeWhisperCpp, N as recognizeWhisperServer, w as serviceCapabilities, x as toBuffer, y as toFilePath, z as toReadStream, H as whisperCppInputPreference, M as whisperServerInputPreference } from './AudioFormat-BJuNZJlT.js';
|
|
2
2
|
export { ConversionOptions, PreparedAudio, convertToBuffer, convertToFile, createStreamingConversion, prepareForService, prepareWavForService } from './audio/AudioConverter.js';
|
|
3
3
|
export { BUILD_VARIANTS, BuildVariant, RECOGNITION_ENGINES, WHISPER_CPP_VERSION, WHISPER_MODELS, WhisperModel, applyLegacyCpuFallback, detectPlatform, getConfiguredVariant, getInstallDir, getModelDir, getModelPath, getVadModelPath, getWhisperExecutablePath, getWhisperServerExecutablePath, isValidModel, resolveVariant } from './cli/config.js';
|
|
4
4
|
export { InstallBinaryOptions, InstallModelOptions, InstallVadModelOptions, ensureWhisperInstalled, installBinary, installModel, installVadModel } from './cli/install.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as AudioFormat, j as RawAudioInput, f as AudioSource } from '../AudioFormat-
|
|
1
|
+
import { d as AudioFormat, j as RawAudioInput, f as AudioSource } from '../AudioFormat-CKxAQAj2.cjs';
|
|
2
2
|
import { Timeline } from '../utilities/Timeline.cjs';
|
|
3
3
|
import { Timing } from '../utilities/Timing.cjs';
|
|
4
4
|
import 'node:fs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as AudioFormat, j as RawAudioInput, f as AudioSource } from '../AudioFormat
|
|
1
|
+
import { d as AudioFormat, j as RawAudioInput, f as AudioSource } from '../AudioFormat-BJuNZJlT.js';
|
|
2
2
|
import { Timeline } from '../utilities/Timeline.js';
|
|
3
3
|
import { Timing } from '../utilities/Timing.js';
|
|
4
4
|
import 'node:fs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as SpeechSDK from 'microsoft-cognitiveservices-speech-sdk';
|
|
2
|
-
import { d as AudioFormat, j as RawAudioInput, f as AudioSource } from '../AudioFormat-
|
|
2
|
+
import { d as AudioFormat, j as RawAudioInput, f as AudioSource } from '../AudioFormat-CKxAQAj2.cjs';
|
|
3
3
|
import { Timeline } from '../utilities/Timeline.cjs';
|
|
4
4
|
import { Timing } from '../utilities/Timing.cjs';
|
|
5
5
|
import 'node:fs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as SpeechSDK from 'microsoft-cognitiveservices-speech-sdk';
|
|
2
|
-
import { d as AudioFormat, j as RawAudioInput, f as AudioSource } from '../AudioFormat
|
|
2
|
+
import { d as AudioFormat, j as RawAudioInput, f as AudioSource } from '../AudioFormat-BJuNZJlT.js';
|
|
3
3
|
import { Timeline } from '../utilities/Timeline.js';
|
|
4
4
|
import { Timing } from '../utilities/Timing.js';
|
|
5
5
|
import 'node:fs';
|
|
@@ -24,6 +24,7 @@ __export(DeepgramSTT_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(DeepgramSTT_exports);
|
|
25
25
|
var import_audio = require("../audio/index.cjs");
|
|
26
26
|
var import_config = require("../config.cjs");
|
|
27
|
+
var import_fetch = require("../fetch.cjs");
|
|
27
28
|
var import_ObjectUtilities = require("../utilities/ObjectUtilities.cjs");
|
|
28
29
|
const SERVICE_ID = "deepgram";
|
|
29
30
|
function formatToContentType(format) {
|
|
@@ -93,7 +94,8 @@ async function recognize(input, languageCode, timing, options, signal) {
|
|
|
93
94
|
// necessary because otherwise there's some excruciating type error when running `yarn check`
|
|
94
95
|
// from the root
|
|
95
96
|
body: uploadResult.stream,
|
|
96
|
-
signal: signal ?? null
|
|
97
|
+
signal: signal ?? null,
|
|
98
|
+
dispatcher: (0, import_fetch.createTimeoutAgent)(opts.timeout)
|
|
97
99
|
});
|
|
98
100
|
const conversionPromise = (_a2 = uploadResult.start) == null ? void 0 : _a2.call(uploadResult);
|
|
99
101
|
const resp = await fetchPromise;
|
|
@@ -187,7 +189,11 @@ function applyPunctuationToTimeline(timeline, transcript) {
|
|
|
187
189
|
const defaultDeepgramSTTOptions = {
|
|
188
190
|
apiKey: "",
|
|
189
191
|
model: "nova-3",
|
|
190
|
-
punctuate: true
|
|
192
|
+
punctuate: true,
|
|
193
|
+
timeout: 30 * 60 * 1e3,
|
|
194
|
+
// 30 minutes
|
|
195
|
+
inputFormat: void 0,
|
|
196
|
+
conversionMode: void 0
|
|
191
197
|
};
|
|
192
198
|
// Annotate the CommonJS export names for ESM import in node:
|
|
193
199
|
0 && (module.exports = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as RawAudioInput, f as AudioSource, d as AudioFormat } from '../AudioFormat-
|
|
1
|
+
import { j as RawAudioInput, f as AudioSource, d as AudioFormat } from '../AudioFormat-CKxAQAj2.cjs';
|
|
2
2
|
import { ConversionMode } from '../config.cjs';
|
|
3
3
|
import { TimelineEntry } from '../utilities/Timeline.cjs';
|
|
4
4
|
import { Timing } from '../utilities/Timing.cjs';
|
|
@@ -17,7 +17,15 @@ interface DeepgramSTTOptions {
|
|
|
17
17
|
punctuate: boolean;
|
|
18
18
|
inputFormat?: AudioFormat | undefined;
|
|
19
19
|
conversionMode?: ConversionMode | undefined;
|
|
20
|
+
timeout?: number;
|
|
20
21
|
}
|
|
21
|
-
declare const defaultDeepgramSTTOptions:
|
|
22
|
+
declare const defaultDeepgramSTTOptions: {
|
|
23
|
+
apiKey: string;
|
|
24
|
+
model: string;
|
|
25
|
+
punctuate: boolean;
|
|
26
|
+
timeout: number;
|
|
27
|
+
inputFormat: AudioFormat | undefined;
|
|
28
|
+
conversionMode: ConversionMode | undefined;
|
|
29
|
+
};
|
|
22
30
|
|
|
23
31
|
export { type DeepgramSTTOptions, defaultDeepgramSTTOptions, recognize };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as RawAudioInput, f as AudioSource, d as AudioFormat } from '../AudioFormat
|
|
1
|
+
import { j as RawAudioInput, f as AudioSource, d as AudioFormat } from '../AudioFormat-BJuNZJlT.js';
|
|
2
2
|
import { ConversionMode } from '../config.js';
|
|
3
3
|
import { TimelineEntry } from '../utilities/Timeline.js';
|
|
4
4
|
import { Timing } from '../utilities/Timing.js';
|
|
@@ -17,7 +17,15 @@ interface DeepgramSTTOptions {
|
|
|
17
17
|
punctuate: boolean;
|
|
18
18
|
inputFormat?: AudioFormat | undefined;
|
|
19
19
|
conversionMode?: ConversionMode | undefined;
|
|
20
|
+
timeout?: number;
|
|
20
21
|
}
|
|
21
|
-
declare const defaultDeepgramSTTOptions:
|
|
22
|
+
declare const defaultDeepgramSTTOptions: {
|
|
23
|
+
apiKey: string;
|
|
24
|
+
model: string;
|
|
25
|
+
punctuate: boolean;
|
|
26
|
+
timeout: number;
|
|
27
|
+
inputFormat: AudioFormat | undefined;
|
|
28
|
+
conversionMode: ConversionMode | undefined;
|
|
29
|
+
};
|
|
22
30
|
|
|
23
31
|
export { type DeepgramSTTOptions, defaultDeepgramSTTOptions, recognize };
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
serviceCapabilities
|
|
7
7
|
} from "../audio/index.js";
|
|
8
8
|
import { getConversionMode } from "../config.js";
|
|
9
|
+
import { createTimeoutAgent } from "../fetch.js";
|
|
9
10
|
import { extendDeep } from "../utilities/ObjectUtilities.js";
|
|
10
11
|
const SERVICE_ID = "deepgram";
|
|
11
12
|
function formatToContentType(format) {
|
|
@@ -75,7 +76,8 @@ async function recognize(input, languageCode, timing, options, signal) {
|
|
|
75
76
|
// necessary because otherwise there's some excruciating type error when running `yarn check`
|
|
76
77
|
// from the root
|
|
77
78
|
body: uploadResult.stream,
|
|
78
|
-
signal: signal ?? null
|
|
79
|
+
signal: signal ?? null,
|
|
80
|
+
dispatcher: createTimeoutAgent(opts.timeout)
|
|
79
81
|
});
|
|
80
82
|
const conversionPromise = (_a2 = uploadResult.start) == null ? void 0 : _a2.call(uploadResult);
|
|
81
83
|
const resp = await fetchPromise;
|
|
@@ -169,7 +171,11 @@ function applyPunctuationToTimeline(timeline, transcript) {
|
|
|
169
171
|
const defaultDeepgramSTTOptions = {
|
|
170
172
|
apiKey: "",
|
|
171
173
|
model: "nova-3",
|
|
172
|
-
punctuate: true
|
|
174
|
+
punctuate: true,
|
|
175
|
+
timeout: 30 * 60 * 1e3,
|
|
176
|
+
// 30 minutes
|
|
177
|
+
inputFormat: void 0,
|
|
178
|
+
conversionMode: void 0
|
|
173
179
|
};
|
|
174
180
|
export {
|
|
175
181
|
defaultDeepgramSTTOptions,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as AudioFormat, j as RawAudioInput, f as AudioSource } from '../AudioFormat-
|
|
1
|
+
import { d as AudioFormat, j as RawAudioInput, f as AudioSource } from '../AudioFormat-CKxAQAj2.cjs';
|
|
2
2
|
import { Timeline } from '../utilities/Timeline.cjs';
|
|
3
3
|
import { Timing } from '../utilities/Timing.cjs';
|
|
4
4
|
import 'node:fs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as AudioFormat, j as RawAudioInput, f as AudioSource } from '../AudioFormat
|
|
1
|
+
import { d as AudioFormat, j as RawAudioInput, f as AudioSource } from '../AudioFormat-BJuNZJlT.js';
|
|
2
2
|
import { Timeline } from '../utilities/Timeline.js';
|
|
3
3
|
import { Timing } from '../utilities/Timing.js';
|
|
4
4
|
import 'node:fs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Q as InputPreference, O as OpenAICloudSTTOptions, B as RecognitionResult, C as inputPreference, D as recognize } from '../AudioFormat-
|
|
1
|
+
export { Q as InputPreference, O as OpenAICloudSTTOptions, B as RecognitionResult, C as inputPreference, D as recognize } from '../AudioFormat-CKxAQAj2.cjs';
|
|
2
2
|
import '../utilities/Timeline.cjs';
|
|
3
3
|
import '../utilities/Timing.cjs';
|
|
4
4
|
import 'node:fs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Q as InputPreference, O as OpenAICloudSTTOptions, B as RecognitionResult, C as inputPreference, D as recognize } from '../AudioFormat
|
|
1
|
+
export { Q as InputPreference, O as OpenAICloudSTTOptions, B as RecognitionResult, C as inputPreference, D as recognize } from '../AudioFormat-BJuNZJlT.js';
|
|
2
2
|
import '../utilities/Timeline.js';
|
|
3
3
|
import '../utilities/Timing.js';
|
|
4
4
|
import 'node:fs';
|
|
@@ -319,7 +319,7 @@ function buildTranscribeArgs(options) {
|
|
|
319
319
|
"--print-progress",
|
|
320
320
|
options.language ? ["--language", options.language.toLowerCase()] : null,
|
|
321
321
|
options.flashAttention ? ["--flash-attn"] : null,
|
|
322
|
-
options.suppressNonSpeechTokens ? ["--suppress-nst"
|
|
322
|
+
options.suppressNonSpeechTokens ? ["--suppress-nst"] : null,
|
|
323
323
|
["--processors", String(options.processors)],
|
|
324
324
|
["--threads", String(options.threads)]
|
|
325
325
|
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { T as InputPreference, L as Language, E as Languages, F as RecognitionResult, W as WhisperCppModelId, G as WhisperCppOptions, V as ensureModelDownloaded, U as ensureWhisperCppInstalled, H as inputPreference, I as recognize } from '../AudioFormat-
|
|
1
|
+
export { T as InputPreference, L as Language, E as Languages, F as RecognitionResult, W as WhisperCppModelId, G as WhisperCppOptions, V as ensureModelDownloaded, U as ensureWhisperCppInstalled, H as inputPreference, I as recognize } from '../AudioFormat-CKxAQAj2.cjs';
|
|
2
2
|
import '../utilities/Timeline.cjs';
|
|
3
3
|
import '../utilities/Timing.cjs';
|
|
4
4
|
export { WhisperModel } from '../cli/config.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { T as InputPreference, L as Language, E as Languages, F as RecognitionResult, W as WhisperCppModelId, G as WhisperCppOptions, V as ensureModelDownloaded, U as ensureWhisperCppInstalled, H as inputPreference, I as recognize } from '../AudioFormat
|
|
1
|
+
export { T as InputPreference, L as Language, E as Languages, F as RecognitionResult, W as WhisperCppModelId, G as WhisperCppOptions, V as ensureModelDownloaded, U as ensureWhisperCppInstalled, H as inputPreference, I as recognize } from '../AudioFormat-BJuNZJlT.js';
|
|
2
2
|
import '../utilities/Timeline.js';
|
|
3
3
|
import '../utilities/Timing.js';
|
|
4
4
|
export { WhisperModel } from '../cli/config.js';
|
|
@@ -298,7 +298,7 @@ function buildTranscribeArgs(options) {
|
|
|
298
298
|
"--print-progress",
|
|
299
299
|
options.language ? ["--language", options.language.toLowerCase()] : null,
|
|
300
300
|
options.flashAttention ? ["--flash-attn"] : null,
|
|
301
|
-
options.suppressNonSpeechTokens ? ["--suppress-nst"
|
|
301
|
+
options.suppressNonSpeechTokens ? ["--suppress-nst"] : null,
|
|
302
302
|
["--processors", String(options.processors)],
|
|
303
303
|
["--threads", String(options.threads)]
|
|
304
304
|
];
|
|
@@ -25,12 +25,15 @@ module.exports = __toCommonJS(WhisperServerSTT_exports);
|
|
|
25
25
|
var import_node_fs = require("node:fs");
|
|
26
26
|
var import_node_path = require("node:path");
|
|
27
27
|
var import_audio = require("../audio/index.cjs");
|
|
28
|
+
var import_fetch = require("../fetch.cjs");
|
|
28
29
|
var import_WhisperTimeline = require("../utilities/WhisperTimeline.cjs");
|
|
29
30
|
const inputPreference = "file";
|
|
30
31
|
const defaultOptions = {
|
|
31
32
|
baseURL: "http://localhost:8080",
|
|
32
33
|
inferencePath: "/audio/transcriptions",
|
|
33
|
-
temperature: 0
|
|
34
|
+
temperature: 0,
|
|
35
|
+
timeout: 30 * 60 * 1e3
|
|
36
|
+
// 30 minutes
|
|
34
37
|
};
|
|
35
38
|
async function recognize(input, languageCode, timing, options) {
|
|
36
39
|
const opts = { ...defaultOptions, ...options };
|
|
@@ -61,8 +64,16 @@ async function recognize(input, languageCode, timing, options) {
|
|
|
61
64
|
if (opts.apiKey) {
|
|
62
65
|
headers["Authorization"] = `Bearer ${opts.apiKey}`;
|
|
63
66
|
}
|
|
64
|
-
const
|
|
65
|
-
|
|
67
|
+
const response = await timing.timeAsync(
|
|
68
|
+
"upload",
|
|
69
|
+
async () => fetch(url, {
|
|
70
|
+
method: "POST",
|
|
71
|
+
body: form,
|
|
72
|
+
headers,
|
|
73
|
+
dispatcher: (0, import_fetch.createTimeoutAgent)(opts.timeout)
|
|
74
|
+
// this is necessary because `tsc` from `/web` will cry and shit its pants
|
|
75
|
+
})
|
|
76
|
+
);
|
|
66
77
|
if (!response.ok) {
|
|
67
78
|
const text = await response.text();
|
|
68
79
|
throw new Error(`Whisper server error: ${response.status} ${text}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { X as InputPreference, J as RecognitionResult, K as WhisperServerOptions, M as inputPreference, N as recognize } from '../AudioFormat-
|
|
1
|
+
export { X as InputPreference, J as RecognitionResult, K as WhisperServerOptions, M as inputPreference, N as recognize } from '../AudioFormat-CKxAQAj2.cjs';
|
|
2
2
|
import '../utilities/Timeline.cjs';
|
|
3
3
|
import '../utilities/Timing.cjs';
|
|
4
4
|
import 'node:fs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { X as InputPreference, J as RecognitionResult, K as WhisperServerOptions, M as inputPreference, N as recognize } from '../AudioFormat
|
|
1
|
+
export { X as InputPreference, J as RecognitionResult, K as WhisperServerOptions, M as inputPreference, N as recognize } from '../AudioFormat-BJuNZJlT.js';
|
|
2
2
|
import '../utilities/Timeline.js';
|
|
3
3
|
import '../utilities/Timing.js';
|
|
4
4
|
import 'node:fs';
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
prepareWavForService,
|
|
8
8
|
toFilePath
|
|
9
9
|
} from "../audio/index.js";
|
|
10
|
+
import { createTimeoutAgent } from "../fetch.js";
|
|
10
11
|
import {
|
|
11
12
|
calculateWhisperSplits,
|
|
12
13
|
countProcessorBoundaries,
|
|
@@ -17,7 +18,9 @@ const inputPreference = "file";
|
|
|
17
18
|
const defaultOptions = {
|
|
18
19
|
baseURL: "http://localhost:8080",
|
|
19
20
|
inferencePath: "/audio/transcriptions",
|
|
20
|
-
temperature: 0
|
|
21
|
+
temperature: 0,
|
|
22
|
+
timeout: 30 * 60 * 1e3
|
|
23
|
+
// 30 minutes
|
|
21
24
|
};
|
|
22
25
|
async function recognize(input, languageCode, timing, options) {
|
|
23
26
|
const opts = { ...defaultOptions, ...options };
|
|
@@ -48,8 +51,16 @@ async function recognize(input, languageCode, timing, options) {
|
|
|
48
51
|
if (opts.apiKey) {
|
|
49
52
|
headers["Authorization"] = `Bearer ${opts.apiKey}`;
|
|
50
53
|
}
|
|
51
|
-
const
|
|
52
|
-
|
|
54
|
+
const response = await timing.timeAsync(
|
|
55
|
+
"upload",
|
|
56
|
+
async () => fetch(url, {
|
|
57
|
+
method: "POST",
|
|
58
|
+
body: form,
|
|
59
|
+
headers,
|
|
60
|
+
dispatcher: createTimeoutAgent(opts.timeout)
|
|
61
|
+
// this is necessary because `tsc` from `/web` will cry and shit its pants
|
|
62
|
+
})
|
|
63
|
+
);
|
|
53
64
|
if (!response.ok) {
|
|
54
65
|
const text = await response.text();
|
|
55
66
|
throw new Error(`Whisper server error: ${response.status} ${text}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyteller-platform/ghost-story",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "An easy-to-use speech toolset. Fork of the original echogarden project.",
|
|
5
5
|
"author": "Thomas F. K. Jorna",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"microsoft-cognitiveservices-speech-sdk": "~1.44.0",
|
|
77
77
|
"openai": "~4.103.0",
|
|
78
78
|
"tar": "^7.4.3",
|
|
79
|
+
"undici": "7.14.0",
|
|
79
80
|
"zod": "^3.25.0"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|