mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
voice - better tracking of status (#208808)
This commit is contained in:
parent
9d8c22a86c
commit
12b7fd98c3
|
@ -249,7 +249,7 @@ export class EditorDictation extends Disposable implements IEditorContribution {
|
|||
const cts = new CancellationTokenSource();
|
||||
disposables.add(toDisposable(() => cts.dispose(true)));
|
||||
|
||||
const session = await this.speechService.createSpeechToTextSession(cts.token);
|
||||
const session = await this.speechService.createSpeechToTextSession(cts.token, 'editor');
|
||||
disposables.add(session.onDidChange(e => {
|
||||
if (cts.token.isCancellationRequested) {
|
||||
return;
|
||||
|
|
|
@ -147,6 +147,7 @@ export class SpeechService extends Disposable implements ISpeechService {
|
|||
|
||||
const sessionStart = Date.now();
|
||||
let sessionRecognized = false;
|
||||
let sessionContentLength = 0;
|
||||
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
|
@ -163,16 +164,22 @@ export class SpeechService extends Disposable implements ISpeechService {
|
|||
context: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Context 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.' };
|
||||
sessionContentLength: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Length of the recognized text.' };
|
||||
sessionLanguage: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Configured language for the session.' };
|
||||
};
|
||||
type SpeechToTextSessionEvent = {
|
||||
context: string;
|
||||
sessionDuration: number;
|
||||
sessionRecognized: boolean;
|
||||
sessionContentLength: number;
|
||||
sessionLanguage: string;
|
||||
};
|
||||
this.telemetryService.publicLog2<SpeechToTextSessionEvent, SpeechToTextSessionClassification>('speechToTextSession', {
|
||||
context,
|
||||
sessionDuration: Date.now() - sessionStart,
|
||||
sessionRecognized
|
||||
sessionRecognized,
|
||||
sessionContentLength,
|
||||
sessionLanguage: language
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -194,9 +201,13 @@ export class SpeechService extends Disposable implements ISpeechService {
|
|||
}
|
||||
break;
|
||||
case SpeechToTextStatus.Recognizing:
|
||||
case SpeechToTextStatus.Recognized:
|
||||
sessionRecognized = true;
|
||||
break;
|
||||
case SpeechToTextStatus.Recognized:
|
||||
if (typeof e.text === 'string') {
|
||||
sessionContentLength += e.text.length;
|
||||
}
|
||||
break;
|
||||
case SpeechToTextStatus.Stopped:
|
||||
onSessionStoppedOrCanceled();
|
||||
break;
|
||||
|
|
|
@ -89,7 +89,7 @@ export class TerminalVoiceSession extends Disposable {
|
|||
}, voiceTimeout));
|
||||
this._cancellationTokenSource = new CancellationTokenSource();
|
||||
this._register(toDisposable(() => this._cancellationTokenSource?.dispose(true)));
|
||||
const session = await this._speechService.createSpeechToTextSession(this._cancellationTokenSource?.token);
|
||||
const session = await this._speechService.createSpeechToTextSession(this._cancellationTokenSource?.token, 'terminal');
|
||||
|
||||
this._disposables.add(session.onDidChange((e) => {
|
||||
if (this._cancellationTokenSource?.token.isCancellationRequested) {
|
||||
|
|
Loading…
Reference in a new issue