@charivo/stt 0.3.5 → 0.4.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/README.md +2 -3
- package/dist/index.d.mts +2 -62
- package/dist/index.d.ts +2 -62
- package/dist/index.js +0 -75
- package/dist/index.mjs +0 -6
- package/dist/openai/index.d.mts +3 -29
- package/dist/openai/index.d.ts +3 -29
- package/dist/openai/index.js +0 -2
- package/dist/openai/index.mjs +0 -1
- package/dist/remote/index.d.mts +3 -27
- package/dist/remote/index.d.ts +3 -27
- package/dist/remote/index.js +0 -2
- package/dist/remote/index.mjs +0 -1
- package/dist/web/index.d.mts +4 -44
- package/dist/web/index.d.ts +4 -44
- package/dist/web/index.js +15 -7
- package/dist/web/index.mjs +12 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,15 +18,14 @@ const sttManager = createSTTManager(
|
|
|
18
18
|
createRemoteSTTTranscriber({ apiEndpoint: "/api/stt" }),
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
await sttManager.start({ language: "
|
|
21
|
+
await sttManager.start({ language: "en" });
|
|
22
22
|
const text = await sttManager.stop();
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
## Exports
|
|
26
26
|
|
|
27
|
-
- `STTManagerImpl`
|
|
28
27
|
- `createSTTManager(transcriber)`
|
|
29
|
-
- `
|
|
28
|
+
- `isWebSTTSupported()` (from `@charivo/stt/web`) — SSR-safe check for Web Speech recognition support
|
|
30
29
|
|
|
31
30
|
## Event Bridge
|
|
32
31
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,68 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { STTTranscriber, STTManager } from '@charivo/core';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* STT Manager - Manages STT session state
|
|
5
|
-
*
|
|
6
|
-
* Simplified design: Delegates to STTTranscriber
|
|
7
|
-
* - STTTranscriber handles recording internally
|
|
8
|
-
* - Manager only handles event emission
|
|
9
|
-
* - Thin wrapper for consistent API
|
|
10
|
-
*/
|
|
11
|
-
declare class STTManagerImpl implements STTManager {
|
|
12
|
-
private sttTranscriber;
|
|
13
|
-
private eventEmitter?;
|
|
14
|
-
constructor(sttTranscriber: STTTranscriber);
|
|
15
|
-
/**
|
|
16
|
-
* Set event emitter for STT events
|
|
17
|
-
*/
|
|
18
|
-
setEventEmitter(eventEmitter: CharivoEventEmitter): void;
|
|
19
|
-
/**
|
|
20
|
-
* Start audio recording (delegates to transcriber)
|
|
21
|
-
*/
|
|
22
|
-
start(options?: STTOptions): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Stop audio recording and get transcription (delegates to transcriber)
|
|
25
|
-
*/
|
|
26
|
-
stop(): Promise<string>;
|
|
27
|
-
/**
|
|
28
|
-
* Check if currently recording (delegates to transcriber)
|
|
29
|
-
*/
|
|
30
|
-
isRecording(): boolean;
|
|
31
|
-
}
|
|
32
3
|
/**
|
|
33
4
|
* Helper function to create STT Manager
|
|
34
5
|
*/
|
|
35
6
|
declare function createSTTManager(sttTranscriber: STTTranscriber): STTManager;
|
|
36
7
|
|
|
37
|
-
|
|
38
|
-
* MediaRecorderHelper - Browser audio recording utility
|
|
39
|
-
*
|
|
40
|
-
* Handles MediaRecorder lifecycle:
|
|
41
|
-
* - Start/stop recording
|
|
42
|
-
* - Audio chunk collection
|
|
43
|
-
* - Stream cleanup
|
|
44
|
-
* - Blob generation
|
|
45
|
-
*/
|
|
46
|
-
declare class MediaRecorderHelper {
|
|
47
|
-
private mediaRecorder;
|
|
48
|
-
private audioChunks;
|
|
49
|
-
private recording;
|
|
50
|
-
/**
|
|
51
|
-
* Start audio recording from user's microphone
|
|
52
|
-
*/
|
|
53
|
-
start(): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Stop audio recording and return the recorded audio as a Blob
|
|
56
|
-
*/
|
|
57
|
-
stop(): Promise<Blob>;
|
|
58
|
-
/**
|
|
59
|
-
* Check if currently recording
|
|
60
|
-
*/
|
|
61
|
-
isRecording(): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Abort recording immediately without returning data
|
|
64
|
-
*/
|
|
65
|
-
abort(): void;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export { MediaRecorderHelper, STTManagerImpl, createSTTManager };
|
|
8
|
+
export { createSTTManager };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,68 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { STTTranscriber, STTManager } from '@charivo/core';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* STT Manager - Manages STT session state
|
|
5
|
-
*
|
|
6
|
-
* Simplified design: Delegates to STTTranscriber
|
|
7
|
-
* - STTTranscriber handles recording internally
|
|
8
|
-
* - Manager only handles event emission
|
|
9
|
-
* - Thin wrapper for consistent API
|
|
10
|
-
*/
|
|
11
|
-
declare class STTManagerImpl implements STTManager {
|
|
12
|
-
private sttTranscriber;
|
|
13
|
-
private eventEmitter?;
|
|
14
|
-
constructor(sttTranscriber: STTTranscriber);
|
|
15
|
-
/**
|
|
16
|
-
* Set event emitter for STT events
|
|
17
|
-
*/
|
|
18
|
-
setEventEmitter(eventEmitter: CharivoEventEmitter): void;
|
|
19
|
-
/**
|
|
20
|
-
* Start audio recording (delegates to transcriber)
|
|
21
|
-
*/
|
|
22
|
-
start(options?: STTOptions): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Stop audio recording and get transcription (delegates to transcriber)
|
|
25
|
-
*/
|
|
26
|
-
stop(): Promise<string>;
|
|
27
|
-
/**
|
|
28
|
-
* Check if currently recording (delegates to transcriber)
|
|
29
|
-
*/
|
|
30
|
-
isRecording(): boolean;
|
|
31
|
-
}
|
|
32
3
|
/**
|
|
33
4
|
* Helper function to create STT Manager
|
|
34
5
|
*/
|
|
35
6
|
declare function createSTTManager(sttTranscriber: STTTranscriber): STTManager;
|
|
36
7
|
|
|
37
|
-
|
|
38
|
-
* MediaRecorderHelper - Browser audio recording utility
|
|
39
|
-
*
|
|
40
|
-
* Handles MediaRecorder lifecycle:
|
|
41
|
-
* - Start/stop recording
|
|
42
|
-
* - Audio chunk collection
|
|
43
|
-
* - Stream cleanup
|
|
44
|
-
* - Blob generation
|
|
45
|
-
*/
|
|
46
|
-
declare class MediaRecorderHelper {
|
|
47
|
-
private mediaRecorder;
|
|
48
|
-
private audioChunks;
|
|
49
|
-
private recording;
|
|
50
|
-
/**
|
|
51
|
-
* Start audio recording from user's microphone
|
|
52
|
-
*/
|
|
53
|
-
start(): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Stop audio recording and return the recorded audio as a Blob
|
|
56
|
-
*/
|
|
57
|
-
stop(): Promise<Blob>;
|
|
58
|
-
/**
|
|
59
|
-
* Check if currently recording
|
|
60
|
-
*/
|
|
61
|
-
isRecording(): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Abort recording immediately without returning data
|
|
64
|
-
*/
|
|
65
|
-
abort(): void;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export { MediaRecorderHelper, STTManagerImpl, createSTTManager };
|
|
8
|
+
export { createSTTManager };
|
package/dist/index.js
CHANGED
|
@@ -20,8 +20,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
MediaRecorderHelper: () => MediaRecorderHelper,
|
|
24
|
-
STTManagerImpl: () => STTManagerImpl,
|
|
25
23
|
createSTTManager: () => createSTTManager
|
|
26
24
|
});
|
|
27
25
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -77,80 +75,7 @@ var STTManagerImpl = class {
|
|
|
77
75
|
function createSTTManager(sttTranscriber) {
|
|
78
76
|
return new STTManagerImpl(sttTranscriber);
|
|
79
77
|
}
|
|
80
|
-
|
|
81
|
-
// src/media-recorder-helper.ts
|
|
82
|
-
var MediaRecorderHelper = class {
|
|
83
|
-
mediaRecorder = null;
|
|
84
|
-
audioChunks = [];
|
|
85
|
-
recording = false;
|
|
86
|
-
/**
|
|
87
|
-
* Start audio recording from user's microphone
|
|
88
|
-
*/
|
|
89
|
-
async start() {
|
|
90
|
-
if (this.recording) {
|
|
91
|
-
throw new Error("Already recording");
|
|
92
|
-
}
|
|
93
|
-
const stream = await navigator.mediaDevices.getUserMedia({
|
|
94
|
-
audio: {
|
|
95
|
-
echoCancellation: true,
|
|
96
|
-
noiseSuppression: true,
|
|
97
|
-
autoGainControl: true
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
this.mediaRecorder = new MediaRecorder(stream);
|
|
101
|
-
this.audioChunks = [];
|
|
102
|
-
this.mediaRecorder.ondataavailable = (event) => {
|
|
103
|
-
if (event.data.size > 0) {
|
|
104
|
-
this.audioChunks.push(event.data);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
this.mediaRecorder.start();
|
|
108
|
-
this.recording = true;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Stop audio recording and return the recorded audio as a Blob
|
|
112
|
-
*/
|
|
113
|
-
async stop() {
|
|
114
|
-
if (!this.recording || !this.mediaRecorder) {
|
|
115
|
-
throw new Error("Not recording");
|
|
116
|
-
}
|
|
117
|
-
return new Promise((resolve, reject) => {
|
|
118
|
-
this.mediaRecorder.onstop = () => {
|
|
119
|
-
const audioBlob = new Blob(this.audioChunks, { type: "audio/webm" });
|
|
120
|
-
this.audioChunks = [];
|
|
121
|
-
this.mediaRecorder?.stream.getTracks().forEach((track) => track.stop());
|
|
122
|
-
this.mediaRecorder = null;
|
|
123
|
-
this.recording = false;
|
|
124
|
-
resolve(audioBlob);
|
|
125
|
-
};
|
|
126
|
-
this.mediaRecorder.onerror = (error) => {
|
|
127
|
-
this.recording = false;
|
|
128
|
-
reject(error);
|
|
129
|
-
};
|
|
130
|
-
this.mediaRecorder.stop();
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Check if currently recording
|
|
135
|
-
*/
|
|
136
|
-
isRecording() {
|
|
137
|
-
return this.recording;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Abort recording immediately without returning data
|
|
141
|
-
*/
|
|
142
|
-
abort() {
|
|
143
|
-
if (this.mediaRecorder) {
|
|
144
|
-
this.mediaRecorder.stream.getTracks().forEach((track) => track.stop());
|
|
145
|
-
this.mediaRecorder = null;
|
|
146
|
-
this.audioChunks = [];
|
|
147
|
-
this.recording = false;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
78
|
// Annotate the CommonJS export names for ESM import in node:
|
|
152
79
|
0 && (module.exports = {
|
|
153
|
-
MediaRecorderHelper,
|
|
154
|
-
STTManagerImpl,
|
|
155
80
|
createSTTManager
|
|
156
81
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MediaRecorderHelper
|
|
3
|
-
} from "./chunk-YUPKYMAU.mjs";
|
|
4
|
-
|
|
5
1
|
// src/stt-manager.ts
|
|
6
2
|
import {
|
|
7
3
|
toCharivoError
|
|
@@ -56,7 +52,5 @@ function createSTTManager(sttTranscriber) {
|
|
|
56
52
|
return new STTManagerImpl(sttTranscriber);
|
|
57
53
|
}
|
|
58
54
|
export {
|
|
59
|
-
MediaRecorderHelper,
|
|
60
|
-
STTManagerImpl,
|
|
61
55
|
createSTTManager
|
|
62
56
|
};
|
package/dist/openai/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { STTTranscriber
|
|
1
|
+
import { STTTranscriber } from '@charivo/core';
|
|
2
2
|
|
|
3
3
|
interface OpenAISTTConfig {
|
|
4
4
|
apiKey: string;
|
|
@@ -8,32 +8,6 @@ interface OpenAISTTConfig {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
type OpenAISTTTranscriberConfig = OpenAISTTConfig;
|
|
11
|
-
|
|
12
|
-
* OpenAI STT Transcriber - STT Transcriber using OpenAI Whisper
|
|
13
|
-
*
|
|
14
|
-
* For local development and testing environments. Not recommended for production due to security concerns.
|
|
15
|
-
* API key is exposed on the client side, so should only be used in server environments or for testing purposes.
|
|
16
|
-
*
|
|
17
|
-
* Handles recording internally using MediaRecorderHelper
|
|
18
|
-
*/
|
|
19
|
-
declare class OpenAISTTTranscriber implements STTTranscriber {
|
|
20
|
-
private provider;
|
|
21
|
-
private recorder;
|
|
22
|
-
private recordingOptions?;
|
|
23
|
-
constructor(config: OpenAISTTTranscriberConfig);
|
|
24
|
-
/**
|
|
25
|
-
* Start recording audio from microphone
|
|
26
|
-
*/
|
|
27
|
-
startRecording(options?: STTOptions): Promise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* Stop recording and transcribe audio to text
|
|
30
|
-
*/
|
|
31
|
-
stopRecording(): Promise<string>;
|
|
32
|
-
/**
|
|
33
|
-
* Check if currently recording
|
|
34
|
-
*/
|
|
35
|
-
isRecording(): boolean;
|
|
36
|
-
}
|
|
37
|
-
declare function createOpenAISTTTranscriber(config: OpenAISTTTranscriberConfig): OpenAISTTTranscriber;
|
|
11
|
+
declare function createOpenAISTTTranscriber(config: OpenAISTTTranscriberConfig): STTTranscriber;
|
|
38
12
|
|
|
39
|
-
export {
|
|
13
|
+
export { type OpenAISTTTranscriberConfig, createOpenAISTTTranscriber };
|
package/dist/openai/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { STTTranscriber
|
|
1
|
+
import { STTTranscriber } from '@charivo/core';
|
|
2
2
|
|
|
3
3
|
interface OpenAISTTConfig {
|
|
4
4
|
apiKey: string;
|
|
@@ -8,32 +8,6 @@ interface OpenAISTTConfig {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
type OpenAISTTTranscriberConfig = OpenAISTTConfig;
|
|
11
|
-
|
|
12
|
-
* OpenAI STT Transcriber - STT Transcriber using OpenAI Whisper
|
|
13
|
-
*
|
|
14
|
-
* For local development and testing environments. Not recommended for production due to security concerns.
|
|
15
|
-
* API key is exposed on the client side, so should only be used in server environments or for testing purposes.
|
|
16
|
-
*
|
|
17
|
-
* Handles recording internally using MediaRecorderHelper
|
|
18
|
-
*/
|
|
19
|
-
declare class OpenAISTTTranscriber implements STTTranscriber {
|
|
20
|
-
private provider;
|
|
21
|
-
private recorder;
|
|
22
|
-
private recordingOptions?;
|
|
23
|
-
constructor(config: OpenAISTTTranscriberConfig);
|
|
24
|
-
/**
|
|
25
|
-
* Start recording audio from microphone
|
|
26
|
-
*/
|
|
27
|
-
startRecording(options?: STTOptions): Promise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* Stop recording and transcribe audio to text
|
|
30
|
-
*/
|
|
31
|
-
stopRecording(): Promise<string>;
|
|
32
|
-
/**
|
|
33
|
-
* Check if currently recording
|
|
34
|
-
*/
|
|
35
|
-
isRecording(): boolean;
|
|
36
|
-
}
|
|
37
|
-
declare function createOpenAISTTTranscriber(config: OpenAISTTTranscriberConfig): OpenAISTTTranscriber;
|
|
11
|
+
declare function createOpenAISTTTranscriber(config: OpenAISTTTranscriberConfig): STTTranscriber;
|
|
38
12
|
|
|
39
|
-
export {
|
|
13
|
+
export { type OpenAISTTTranscriberConfig, createOpenAISTTTranscriber };
|
package/dist/openai/index.js
CHANGED
|
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/openai/index.ts
|
|
31
31
|
var openai_exports = {};
|
|
32
32
|
__export(openai_exports, {
|
|
33
|
-
OpenAISTTTranscriber: () => OpenAISTTTranscriber,
|
|
34
33
|
createOpenAISTTTranscriber: () => createOpenAISTTTranscriber
|
|
35
34
|
});
|
|
36
35
|
module.exports = __toCommonJS(openai_exports);
|
|
@@ -210,6 +209,5 @@ function createOpenAISTTTranscriber(config) {
|
|
|
210
209
|
}
|
|
211
210
|
// Annotate the CommonJS export names for ESM import in node:
|
|
212
211
|
0 && (module.exports = {
|
|
213
|
-
OpenAISTTTranscriber,
|
|
214
212
|
createOpenAISTTTranscriber
|
|
215
213
|
});
|
package/dist/openai/index.mjs
CHANGED
package/dist/remote/index.d.mts
CHANGED
|
@@ -1,32 +1,8 @@
|
|
|
1
|
-
import { STTTranscriber
|
|
1
|
+
import { STTTranscriber } from '@charivo/core';
|
|
2
2
|
|
|
3
3
|
interface RemoteSTTConfig {
|
|
4
4
|
apiEndpoint?: string;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
* Remote STT Transcriber - Uses remote server's STT API for transcription
|
|
8
|
-
*
|
|
9
|
-
* Processes STT on the server and receives transcribed text
|
|
10
|
-
* Handles recording internally using MediaRecorderHelper
|
|
11
|
-
*/
|
|
12
|
-
declare class RemoteSTTTranscriber implements STTTranscriber {
|
|
13
|
-
private apiEndpoint;
|
|
14
|
-
private recorder;
|
|
15
|
-
private recordingOptions?;
|
|
16
|
-
constructor(config?: RemoteSTTConfig);
|
|
17
|
-
/**
|
|
18
|
-
* Start recording audio from microphone
|
|
19
|
-
*/
|
|
20
|
-
startRecording(options?: STTOptions): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* Stop recording and transcribe audio to text using remote API
|
|
23
|
-
*/
|
|
24
|
-
stopRecording(): Promise<string>;
|
|
25
|
-
/**
|
|
26
|
-
* Check if currently recording
|
|
27
|
-
*/
|
|
28
|
-
isRecording(): boolean;
|
|
29
|
-
}
|
|
30
|
-
declare function createRemoteSTTTranscriber(config?: RemoteSTTConfig): RemoteSTTTranscriber;
|
|
6
|
+
declare function createRemoteSTTTranscriber(config?: RemoteSTTConfig): STTTranscriber;
|
|
31
7
|
|
|
32
|
-
export { type RemoteSTTConfig,
|
|
8
|
+
export { type RemoteSTTConfig, createRemoteSTTTranscriber };
|
package/dist/remote/index.d.ts
CHANGED
|
@@ -1,32 +1,8 @@
|
|
|
1
|
-
import { STTTranscriber
|
|
1
|
+
import { STTTranscriber } from '@charivo/core';
|
|
2
2
|
|
|
3
3
|
interface RemoteSTTConfig {
|
|
4
4
|
apiEndpoint?: string;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
* Remote STT Transcriber - Uses remote server's STT API for transcription
|
|
8
|
-
*
|
|
9
|
-
* Processes STT on the server and receives transcribed text
|
|
10
|
-
* Handles recording internally using MediaRecorderHelper
|
|
11
|
-
*/
|
|
12
|
-
declare class RemoteSTTTranscriber implements STTTranscriber {
|
|
13
|
-
private apiEndpoint;
|
|
14
|
-
private recorder;
|
|
15
|
-
private recordingOptions?;
|
|
16
|
-
constructor(config?: RemoteSTTConfig);
|
|
17
|
-
/**
|
|
18
|
-
* Start recording audio from microphone
|
|
19
|
-
*/
|
|
20
|
-
startRecording(options?: STTOptions): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* Stop recording and transcribe audio to text using remote API
|
|
23
|
-
*/
|
|
24
|
-
stopRecording(): Promise<string>;
|
|
25
|
-
/**
|
|
26
|
-
* Check if currently recording
|
|
27
|
-
*/
|
|
28
|
-
isRecording(): boolean;
|
|
29
|
-
}
|
|
30
|
-
declare function createRemoteSTTTranscriber(config?: RemoteSTTConfig): RemoteSTTTranscriber;
|
|
6
|
+
declare function createRemoteSTTTranscriber(config?: RemoteSTTConfig): STTTranscriber;
|
|
31
7
|
|
|
32
|
-
export { type RemoteSTTConfig,
|
|
8
|
+
export { type RemoteSTTConfig, createRemoteSTTTranscriber };
|
package/dist/remote/index.js
CHANGED
|
@@ -20,7 +20,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/remote/index.ts
|
|
21
21
|
var remote_exports = {};
|
|
22
22
|
__export(remote_exports, {
|
|
23
|
-
RemoteSTTTranscriber: () => RemoteSTTTranscriber,
|
|
24
23
|
createRemoteSTTTranscriber: () => createRemoteSTTTranscriber
|
|
25
24
|
});
|
|
26
25
|
module.exports = __toCommonJS(remote_exports);
|
|
@@ -173,6 +172,5 @@ function isAbortError(error) {
|
|
|
173
172
|
}
|
|
174
173
|
// Annotate the CommonJS export names for ESM import in node:
|
|
175
174
|
0 && (module.exports = {
|
|
176
|
-
RemoteSTTTranscriber,
|
|
177
175
|
createRemoteSTTTranscriber
|
|
178
176
|
});
|
package/dist/remote/index.mjs
CHANGED
package/dist/web/index.d.mts
CHANGED
|
@@ -1,46 +1,6 @@
|
|
|
1
|
-
import { STTTranscriber
|
|
1
|
+
import { STTTranscriber } from '@charivo/core';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* 브라우저 내장 음성 인식 기능을 사용
|
|
7
|
-
* 녹음 없이 실시간으로 음성을 텍스트로 변환
|
|
8
|
-
*
|
|
9
|
-
* 장점:
|
|
10
|
-
* - API 키 불필요
|
|
11
|
-
* - 무료
|
|
12
|
-
* - 실시간 인식
|
|
13
|
-
* - MediaRecorder 불필요 (마이크 직접 청취)
|
|
14
|
-
*
|
|
15
|
-
* 제약사항:
|
|
16
|
-
* - 브라우저 지원 필요 (Chrome, Edge 등)
|
|
17
|
-
* - 인터넷 연결 필요 (대부분의 브라우저에서)
|
|
18
|
-
*/
|
|
19
|
-
declare class WebSTTTranscriber implements STTTranscriber {
|
|
20
|
-
private recognition;
|
|
21
|
-
private recording;
|
|
22
|
-
private isSupported;
|
|
23
|
-
private resolveTranscription?;
|
|
24
|
-
private rejectTranscription?;
|
|
25
|
-
private finalTranscript;
|
|
26
|
-
constructor();
|
|
27
|
-
/**
|
|
28
|
-
* Start real-time speech recognition
|
|
29
|
-
*/
|
|
30
|
-
startRecording(options?: STTOptions): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Stop speech recognition and return transcription
|
|
33
|
-
*/
|
|
34
|
-
stopRecording(): Promise<string>;
|
|
35
|
-
/**
|
|
36
|
-
* Check if currently recording
|
|
37
|
-
*/
|
|
38
|
-
isRecording(): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Check if Web Speech API is supported in this browser
|
|
41
|
-
*/
|
|
42
|
-
isSupportedBrowser(): boolean;
|
|
43
|
-
}
|
|
44
|
-
declare function createWebSTTTranscriber(): WebSTTTranscriber;
|
|
3
|
+
declare function createWebSTTTranscriber(): STTTranscriber;
|
|
4
|
+
declare function isWebSTTSupported(): boolean;
|
|
45
5
|
|
|
46
|
-
export {
|
|
6
|
+
export { createWebSTTTranscriber, isWebSTTSupported };
|
package/dist/web/index.d.ts
CHANGED
|
@@ -1,46 +1,6 @@
|
|
|
1
|
-
import { STTTranscriber
|
|
1
|
+
import { STTTranscriber } from '@charivo/core';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* 브라우저 내장 음성 인식 기능을 사용
|
|
7
|
-
* 녹음 없이 실시간으로 음성을 텍스트로 변환
|
|
8
|
-
*
|
|
9
|
-
* 장점:
|
|
10
|
-
* - API 키 불필요
|
|
11
|
-
* - 무료
|
|
12
|
-
* - 실시간 인식
|
|
13
|
-
* - MediaRecorder 불필요 (마이크 직접 청취)
|
|
14
|
-
*
|
|
15
|
-
* 제약사항:
|
|
16
|
-
* - 브라우저 지원 필요 (Chrome, Edge 등)
|
|
17
|
-
* - 인터넷 연결 필요 (대부분의 브라우저에서)
|
|
18
|
-
*/
|
|
19
|
-
declare class WebSTTTranscriber implements STTTranscriber {
|
|
20
|
-
private recognition;
|
|
21
|
-
private recording;
|
|
22
|
-
private isSupported;
|
|
23
|
-
private resolveTranscription?;
|
|
24
|
-
private rejectTranscription?;
|
|
25
|
-
private finalTranscript;
|
|
26
|
-
constructor();
|
|
27
|
-
/**
|
|
28
|
-
* Start real-time speech recognition
|
|
29
|
-
*/
|
|
30
|
-
startRecording(options?: STTOptions): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Stop speech recognition and return transcription
|
|
33
|
-
*/
|
|
34
|
-
stopRecording(): Promise<string>;
|
|
35
|
-
/**
|
|
36
|
-
* Check if currently recording
|
|
37
|
-
*/
|
|
38
|
-
isRecording(): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Check if Web Speech API is supported in this browser
|
|
41
|
-
*/
|
|
42
|
-
isSupportedBrowser(): boolean;
|
|
43
|
-
}
|
|
44
|
-
declare function createWebSTTTranscriber(): WebSTTTranscriber;
|
|
3
|
+
declare function createWebSTTTranscriber(): STTTranscriber;
|
|
4
|
+
declare function isWebSTTSupported(): boolean;
|
|
45
5
|
|
|
46
|
-
export {
|
|
6
|
+
export { createWebSTTTranscriber, isWebSTTSupported };
|
package/dist/web/index.js
CHANGED
|
@@ -20,10 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/web/index.ts
|
|
21
21
|
var web_exports = {};
|
|
22
22
|
__export(web_exports, {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
createWebSTTTranscriber: () => createWebSTTTranscriber,
|
|
24
|
+
isWebSTTSupported: () => isWebSTTSupported
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(web_exports);
|
|
27
|
+
|
|
28
|
+
// src/web/web-stt-transcriber.ts
|
|
27
29
|
var WebSTTTranscriber = class {
|
|
28
30
|
recognition = null;
|
|
29
31
|
recording = false;
|
|
@@ -128,15 +130,21 @@ var WebSTTTranscriber = class {
|
|
|
128
130
|
return this.isSupported;
|
|
129
131
|
}
|
|
130
132
|
};
|
|
131
|
-
function createWebSTTTranscriber() {
|
|
132
|
-
return new WebSTTTranscriber();
|
|
133
|
-
}
|
|
134
133
|
function getSpeechRecognitionConstructor() {
|
|
134
|
+
if (typeof window === "undefined") return void 0;
|
|
135
135
|
const speechWindow = window;
|
|
136
136
|
return speechWindow.SpeechRecognition ?? speechWindow.webkitSpeechRecognition;
|
|
137
137
|
}
|
|
138
|
+
|
|
139
|
+
// src/web/index.ts
|
|
140
|
+
function createWebSTTTranscriber() {
|
|
141
|
+
return new WebSTTTranscriber();
|
|
142
|
+
}
|
|
143
|
+
function isWebSTTSupported() {
|
|
144
|
+
return !!getSpeechRecognitionConstructor();
|
|
145
|
+
}
|
|
138
146
|
// Annotate the CommonJS export names for ESM import in node:
|
|
139
147
|
0 && (module.exports = {
|
|
140
|
-
|
|
141
|
-
|
|
148
|
+
createWebSTTTranscriber,
|
|
149
|
+
isWebSTTSupported
|
|
142
150
|
});
|
package/dist/web/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/web/
|
|
1
|
+
// src/web/web-stt-transcriber.ts
|
|
2
2
|
var WebSTTTranscriber = class {
|
|
3
3
|
recognition = null;
|
|
4
4
|
recording = false;
|
|
@@ -103,14 +103,20 @@ var WebSTTTranscriber = class {
|
|
|
103
103
|
return this.isSupported;
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
|
-
function createWebSTTTranscriber() {
|
|
107
|
-
return new WebSTTTranscriber();
|
|
108
|
-
}
|
|
109
106
|
function getSpeechRecognitionConstructor() {
|
|
107
|
+
if (typeof window === "undefined") return void 0;
|
|
110
108
|
const speechWindow = window;
|
|
111
109
|
return speechWindow.SpeechRecognition ?? speechWindow.webkitSpeechRecognition;
|
|
112
110
|
}
|
|
111
|
+
|
|
112
|
+
// src/web/index.ts
|
|
113
|
+
function createWebSTTTranscriber() {
|
|
114
|
+
return new WebSTTTranscriber();
|
|
115
|
+
}
|
|
116
|
+
function isWebSTTSupported() {
|
|
117
|
+
return !!getSpeechRecognitionConstructor();
|
|
118
|
+
}
|
|
113
119
|
export {
|
|
114
|
-
|
|
115
|
-
|
|
120
|
+
createWebSTTTranscriber,
|
|
121
|
+
isWebSTTSupported
|
|
116
122
|
};
|