Skip to content

Commit 9cd42d9

Browse files
committed
add another cue
1 parent 660a322 commit 9cd42d9

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

src/vs/platform/audioCues/browser/audioCueService.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ export class Sound {
210210
public static readonly diffLineModified = Sound.register({ fileName: 'diffLineModified.mp3' });
211211
public static readonly chatRequestSent = Sound.register({ fileName: 'chatRequestSent.mp3' });
212212
public static readonly chatResponsePending = Sound.register({ fileName: 'chatResponsePending.mp3' });
213+
public static readonly chatResponseReceived = Sound.register({ fileName: 'chatResponseReceived.mp3' });
213214

214215
private constructor(public readonly fileName: string) { }
215216
}
@@ -341,6 +342,12 @@ export class AudioCue {
341342
settingsKey: 'audioCues.chatResponsePending'
342343
});
343344

345+
public static readonly chatResponseReceived = AudioCue.register({
346+
name: localize('audioCues.chatResponseReceived', 'Chat Response Received'),
347+
sound: Sound.chatResponseReceived,
348+
settingsKey: 'audioCues.chatResponseReceived'
349+
});
350+
344351
private constructor(
345352
public readonly sound: Sound,
346353
public readonly name: string,
Binary file not shown.

src/vs/workbench/contrib/audioCues/browser/audioCues.contribution.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis
124124
'audioCues.chatResponsePending': {
125125
'description': localize('audioCues.chatResponsePending', "Plays a sound on loop while the response is pending."),
126126
...audioCueFeatureBase
127+
},
128+
'audioCues.chatResponseReceived': {
129+
'description': localize('audioCues.chatResponseReceived', "Plays a sound on loop while the response has been received."),
130+
...audioCueFeatureBase
127131
}
128132
}
129133
});

src/vs/workbench/contrib/chat/browser/chatWidget.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,18 +390,20 @@ export class ChatWidget extends Disposable implements IChatWidget {
390390
this.instantiationService.invokeFunction(clearChatSession, this);
391391
return;
392392
}
393-
await this.audioCueService.playAudioCue(AudioCue.chatRequestSent);
393+
await this.audioCueService.playAudioCue(AudioCue.chatRequestSent, true);
394394
const input = query ?? editorValue;
395-
const result = await this.chatService.sendRequest(this.viewModel.sessionId, input);
396395
const cue = this.audioCueService.playAudioCueLoop(AudioCue.chatResponsePending);
396+
const result = await this.chatService.sendRequest(this.viewModel.sessionId, input);
397+
const audioCueService = this.audioCueService;
397398
if (result) {
398399
this.inputPart.acceptInput(query);
399-
result.responseCompletePromise.then(() => {
400+
result.responseCompletePromise.then(async () => {
401+
cue.dispose();
402+
audioCueService.playAudioCue(AudioCue.chatResponseReceived, true);
400403
const responses = this.viewModel?.getItems().filter(isResponseVM);
401404
const lastResponse = responses?.[responses.length - 1];
402405
if (lastResponse) {
403406
const errorDetails = lastResponse.errorDetails ? ` ${lastResponse.errorDetails.message}` : '';
404-
cue.dispose();
405407
alert(lastResponse.response.value + errorDetails);
406408
}
407409
});

0 commit comments

Comments
 (0)