Skip to content

Commit b50ce76

Browse files
authored
voice - log errors (microsoft#208983)
1 parent c3d8708 commit b50ce76

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

src/vs/workbench/api/common/extHostTypes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4404,7 +4404,8 @@ export enum SpeechToTextStatus {
44044404
Started = 1,
44054405
Recognizing = 2,
44064406
Recognized = 3,
4407-
Stopped = 4
4407+
Stopped = 4,
4408+
Error = 5
44084409
}
44094410

44104411
export enum KeywordRecognitionStatus {

src/vs/workbench/contrib/speech/browser/speechService.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ export class SpeechService extends Disposable implements ISpeechService {
147147

148148
const sessionStart = Date.now();
149149
let sessionRecognized = false;
150+
let sessionError = false;
150151
let sessionContentLength = 0;
151152

152153
const disposables = new DisposableStore();
@@ -164,20 +165,23 @@ export class SpeechService extends Disposable implements ISpeechService {
164165
context: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Context of the session.' };
165166
sessionDuration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Duration of the session.' };
166167
sessionRecognized: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'If speech was recognized.' };
168+
sessionError: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'If speech resulted in error.' };
167169
sessionContentLength: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Length of the recognized text.' };
168170
sessionLanguage: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Configured language for the session.' };
169171
};
170172
type SpeechToTextSessionEvent = {
171173
context: string;
172174
sessionDuration: number;
173175
sessionRecognized: boolean;
176+
sessionError: boolean;
174177
sessionContentLength: number;
175178
sessionLanguage: string;
176179
};
177180
this.telemetryService.publicLog2<SpeechToTextSessionEvent, SpeechToTextSessionClassification>('speechToTextSession', {
178181
context,
179182
sessionDuration: Date.now() - sessionStart,
180183
sessionRecognized,
184+
sessionError,
181185
sessionContentLength,
182186
sessionLanguage: language
183187
});
@@ -211,6 +215,10 @@ export class SpeechService extends Disposable implements ISpeechService {
211215
case SpeechToTextStatus.Stopped:
212216
onSessionStoppedOrCanceled();
213217
break;
218+
case SpeechToTextStatus.Error:
219+
this.logService.error(`Speech provider error in speech to text session: ${e.text}`);
220+
sessionError = true;
221+
break;
214222
}
215223
}));
216224

src/vs/workbench/contrib/speech/common/speechService.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export enum SpeechToTextStatus {
2626
Started = 1,
2727
Recognizing = 2,
2828
Recognized = 3,
29-
Stopped = 4
29+
Stopped = 4,
30+
Error = 5
3031
}
3132

3233
export interface ISpeechToTextEvent {

src/vs/workbench/contrib/terminal/browser/terminalVoice.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ export class TerminalVoiceSession extends Disposable {
9797
}
9898
switch (e.status) {
9999
case SpeechToTextStatus.Started:
100-
// TODO: play start audio cue
101100
if (!this._decoration) {
102101
this._createDecoration();
103102
}
@@ -117,7 +116,6 @@ export class TerminalVoiceSession extends Disposable {
117116
}
118117
break;
119118
case SpeechToTextStatus.Stopped:
120-
// TODO: play stop audio cue
121119
this.stop();
122120
break;
123121
}

src/vscode-dts/vscode.proposed.speech.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ declare module 'vscode' {
1515
Started = 1,
1616
Recognizing = 2,
1717
Recognized = 3,
18-
Stopped = 4
18+
Stopped = 4,
19+
Error = 5
1920
}
2021

2122
export interface SpeechToTextEvent {

0 commit comments

Comments
 (0)