@volley/recognition-client-sdk 0.1.294 → 0.1.296
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/index.js +26 -9
- package/dist/index.js.map +2 -2
- package/dist/simplified-vgf-recognition-client.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/recognition-client.spec.ts +37 -50
- package/src/simplified-vgf-recognition-client.spec.ts +142 -16
- package/src/simplified-vgf-recognition-client.ts +47 -16
package/dist/index.js
CHANGED
|
@@ -6040,9 +6040,29 @@ var SimplifiedVGFRecognitionClient = class {
|
|
|
6040
6040
|
const { onStateChange, initialState, ...clientConfig } = config;
|
|
6041
6041
|
this.stateChangeCallback = onStateChange;
|
|
6042
6042
|
if (initialState) {
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
clientConfig.
|
|
6043
|
+
if (initialState.transcriptionStatus === TranscriptionStatus.ABORTED || initialState.transcriptionStatus === TranscriptionStatus.FINALIZED) {
|
|
6044
|
+
const newUUID = crypto.randomUUID();
|
|
6045
|
+
if (clientConfig.logger) {
|
|
6046
|
+
clientConfig.logger("info", `Terminal session detected (${initialState.transcriptionStatus}), generating new UUID: ${newUUID}`);
|
|
6047
|
+
}
|
|
6048
|
+
this.state = {
|
|
6049
|
+
...initialState,
|
|
6050
|
+
audioUtteranceId: newUUID,
|
|
6051
|
+
// Reset status fields for fresh session
|
|
6052
|
+
transcriptionStatus: TranscriptionStatus.NOT_STARTED,
|
|
6053
|
+
startRecordingStatus: RecordingStatus.READY,
|
|
6054
|
+
// Clear previous session's transcript
|
|
6055
|
+
finalTranscript: void 0
|
|
6056
|
+
};
|
|
6057
|
+
clientConfig.audioUtteranceId = newUUID;
|
|
6058
|
+
if (onStateChange) {
|
|
6059
|
+
onStateChange(this.state);
|
|
6060
|
+
}
|
|
6061
|
+
} else {
|
|
6062
|
+
this.state = initialState;
|
|
6063
|
+
if (initialState.audioUtteranceId && !clientConfig.audioUtteranceId) {
|
|
6064
|
+
clientConfig.audioUtteranceId = initialState.audioUtteranceId;
|
|
6065
|
+
}
|
|
6046
6066
|
}
|
|
6047
6067
|
} else {
|
|
6048
6068
|
this.state = createVGFStateFromConfig(clientConfig);
|
|
@@ -6127,7 +6147,8 @@ var SimplifiedVGFRecognitionClient = class {
|
|
|
6127
6147
|
await this.client.stopRecording();
|
|
6128
6148
|
}
|
|
6129
6149
|
stopAbnormally() {
|
|
6130
|
-
|
|
6150
|
+
const clientState = this.client.getState();
|
|
6151
|
+
if (clientState === "stopping" /* STOPPING */ || clientState === "stopped" /* STOPPED */ || clientState === "failed" /* FAILED */) {
|
|
6131
6152
|
return;
|
|
6132
6153
|
}
|
|
6133
6154
|
this.isRecordingAudio = false;
|
|
@@ -6135,17 +6156,13 @@ var SimplifiedVGFRecognitionClient = class {
|
|
|
6135
6156
|
this.state = {
|
|
6136
6157
|
...this.state,
|
|
6137
6158
|
transcriptionStatus: TranscriptionStatus.ABORTED,
|
|
6138
|
-
finalTranscript: "",
|
|
6139
6159
|
startRecordingStatus: RecordingStatus.FINISHED,
|
|
6140
6160
|
finalRecordingTimestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6141
6161
|
finalTranscriptionTimestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
6142
6162
|
};
|
|
6143
6163
|
this.notifyStateChange();
|
|
6144
6164
|
}
|
|
6145
|
-
|
|
6146
|
-
if (clientState !== "stopped" /* STOPPED */ && clientState !== "failed" /* FAILED */) {
|
|
6147
|
-
this.client.stopAbnormally();
|
|
6148
|
-
}
|
|
6165
|
+
this.client.stopAbnormally();
|
|
6149
6166
|
}
|
|
6150
6167
|
// Pure delegation methods - no state logic
|
|
6151
6168
|
getAudioUtteranceId() {
|