Skip to content

Commit 2641501

Browse files
committed
use sounds
1 parent f309aff commit 2641501

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ export class Sound {
208208
public static readonly diffLineInserted = Sound.register({ fileName: 'diffLineInserted.mp3' });
209209
public static readonly diffLineDeleted = Sound.register({ fileName: 'diffLineDeleted.mp3' });
210210
public static readonly diffLineModified = Sound.register({ fileName: 'diffLineModified.mp3' });
211+
public static readonly chatRequestSent = Sound.register({ fileName: 'chatRequestSent.mp3' });
212+
public static readonly chatResponsePending = Sound.register({ fileName: 'chatResponsePending.mp3' });
211213

212214
private constructor(public readonly fileName: string) { }
213215
}
@@ -327,6 +329,18 @@ export class AudioCue {
327329
settingsKey: 'audioCues.diffLineModified'
328330
});
329331

332+
public static readonly chatRequestSent = AudioCue.register({
333+
name: localize('audioCues.chatRequestSent', 'Chat Request Sent'),
334+
sound: Sound.chatRequestSent,
335+
settingsKey: 'audioCues.chatRequestSent'
336+
});
337+
338+
public static readonly chatResponsePending = AudioCue.register({
339+
name: localize('audioCues.chatResponsePending', 'Chat Response Pending'),
340+
sound: Sound.chatResponsePending,
341+
settingsKey: 'audioCues.chatResponsePending'
342+
});
343+
330344
private constructor(
331345
public readonly sound: Sound,
332346
public readonly name: string,
Binary file not shown.
Binary file not shown.

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis
117117
'description': localize('audioCues.notebookCellFailed', "Plays a sound when a notebook cell execution fails."),
118118
...audioCueFeatureBase,
119119
},
120+
'audioCues.chatRequestSent': {
121+
'description': localize('audioCues.chatRequestSent', "Plays a sound when a chat request is made."),
122+
...audioCueFeatureBase
123+
},
124+
'audioCues.chatResponsePending': {
125+
'description': localize('audioCues.chatResponsePending', "Plays a sound on loop while the response is pending."),
126+
...audioCueFeatureBase
127+
}
120128
}
121129
});
122130

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,18 +390,18 @@ export class ChatWidget extends Disposable implements IChatWidget {
390390
this.instantiationService.invokeFunction(clearChatSession, this);
391391
return;
392392
}
393-
393+
await this.audioCueService.playAudioCue(AudioCue.chatRequestSent);
394394
const input = query ?? editorValue;
395-
const cue = this.audioCueService.playAudioCueLoop(AudioCue.break);
396395
const result = await this.chatService.sendRequest(this.viewModel.sessionId, input);
396+
const cue = this.audioCueService.playAudioCueLoop(AudioCue.chatResponsePending);
397397
if (result) {
398-
cue.dispose();
399398
this.inputPart.acceptInput(query);
400399
result.responseCompletePromise.then(() => {
401400
const responses = this.viewModel?.getItems().filter(isResponseVM);
402401
const lastResponse = responses?.[responses.length - 1];
403402
if (lastResponse) {
404403
const errorDetails = lastResponse.errorDetails ? ` ${lastResponse.errorDetails.message}` : '';
404+
cue.dispose();
405405
alert(lastResponse.response.value + errorDetails);
406406
}
407407
});

0 commit comments

Comments
 (0)