voice - log errors (#208983)

This commit is contained in:
Benjamin Pasero 2024-03-28 09:11:38 +01:00 committed by GitHub
parent c3d8708d13
commit b50ce76b2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 5 deletions

View file

@ -4404,7 +4404,8 @@ export enum SpeechToTextStatus {
Started = 1, Started = 1,
Recognizing = 2, Recognizing = 2,
Recognized = 3, Recognized = 3,
Stopped = 4 Stopped = 4,
Error = 5
} }
export enum KeywordRecognitionStatus { export enum KeywordRecognitionStatus {

View file

@ -147,6 +147,7 @@ export class SpeechService extends Disposable implements ISpeechService {
const sessionStart = Date.now(); const sessionStart = Date.now();
let sessionRecognized = false; let sessionRecognized = false;
let sessionError = false;
let sessionContentLength = 0; let sessionContentLength = 0;
const disposables = new DisposableStore(); const disposables = new DisposableStore();
@ -164,6 +165,7 @@ export class SpeechService extends Disposable implements ISpeechService {
context: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Context of the session.' }; context: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Context of the session.' };
sessionDuration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Duration of the session.' }; sessionDuration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Duration of the session.' };
sessionRecognized: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'If speech was recognized.' }; sessionRecognized: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'If speech was recognized.' };
sessionError: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'If speech resulted in error.' };
sessionContentLength: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Length of the recognized text.' }; sessionContentLength: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Length of the recognized text.' };
sessionLanguage: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Configured language for the session.' }; sessionLanguage: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Configured language for the session.' };
}; };
@ -171,6 +173,7 @@ export class SpeechService extends Disposable implements ISpeechService {
context: string; context: string;
sessionDuration: number; sessionDuration: number;
sessionRecognized: boolean; sessionRecognized: boolean;
sessionError: boolean;
sessionContentLength: number; sessionContentLength: number;
sessionLanguage: string; sessionLanguage: string;
}; };
@ -178,6 +181,7 @@ export class SpeechService extends Disposable implements ISpeechService {
context, context,
sessionDuration: Date.now() - sessionStart, sessionDuration: Date.now() - sessionStart,
sessionRecognized, sessionRecognized,
sessionError,
sessionContentLength, sessionContentLength,
sessionLanguage: language sessionLanguage: language
}); });
@ -211,6 +215,10 @@ export class SpeechService extends Disposable implements ISpeechService {
case SpeechToTextStatus.Stopped: case SpeechToTextStatus.Stopped:
onSessionStoppedOrCanceled(); onSessionStoppedOrCanceled();
break; break;
case SpeechToTextStatus.Error:
this.logService.error(`Speech provider error in speech to text session: ${e.text}`);
sessionError = true;
break;
} }
})); }));

View file

@ -26,7 +26,8 @@ export enum SpeechToTextStatus {
Started = 1, Started = 1,
Recognizing = 2, Recognizing = 2,
Recognized = 3, Recognized = 3,
Stopped = 4 Stopped = 4,
Error = 5
} }
export interface ISpeechToTextEvent { export interface ISpeechToTextEvent {

View file

@ -97,7 +97,6 @@ export class TerminalVoiceSession extends Disposable {
} }
switch (e.status) { switch (e.status) {
case SpeechToTextStatus.Started: case SpeechToTextStatus.Started:
// TODO: play start audio cue
if (!this._decoration) { if (!this._decoration) {
this._createDecoration(); this._createDecoration();
} }
@ -117,7 +116,6 @@ export class TerminalVoiceSession extends Disposable {
} }
break; break;
case SpeechToTextStatus.Stopped: case SpeechToTextStatus.Stopped:
// TODO: play stop audio cue
this.stop(); this.stop();
break; break;
} }

View file

@ -15,7 +15,8 @@ declare module 'vscode' {
Started = 1, Started = 1,
Recognizing = 2, Recognizing = 2,
Recognized = 3, Recognized = 3,
Stopped = 4 Stopped = 4,
Error = 5
} }
export interface SpeechToTextEvent { export interface SpeechToTextEvent {