Skip to content

Commit 08417d4

Browse files
committed
Show voice feedback on omni input
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: be6b07e4-795c-42ba-88ef-329916399579
1 parent f54cd0a commit 08417d4

2 files changed

Lines changed: 27 additions & 4 deletions

File tree

src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3191,13 +3191,13 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
31913191
const isVoiceInputActive = derived(this, reader => focusedWidget.read(reader) === widget);
31923192
const isOmniInput = this.contextKeyService.getContextKeyValue<boolean>(ChatContextKeys.inChatInputWindow.key) === true;
31933193
const isVoiceSessionActive = derived(this, reader => {
3194-
if (!isVoiceInputActive.read(reader)) {
3195-
return false;
3196-
}
31973194
const omniInputActive = this.voiceSessionController.omniInputActive.read(reader);
31983195
if (omniInputActive) {
31993196
return isOmniInput;
32003197
}
3198+
if (!isVoiceInputActive.read(reader)) {
3199+
return false;
3200+
}
32013201
const target = this.voiceSessionController.targetSession.read(reader);
32023202
const hasDraftTarget = this.voiceSessionController.hasDraftTarget.read(reader);
32033203
const resource = widget.viewModel?.sessionResource;

src/vs/workbench/contrib/chat/test/browser/voiceClient/voiceGlow.test.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55

66
import assert from 'assert';
77
import { Color } from '../../../../../../base/common/color.js';
8+
import { toDisposable } from '../../../../../../base/common/lifecycle.js';
89
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../../base/test/common/utils.js';
910
import { ColorScheme } from '../../../../../../platform/theme/common/theme.js';
1011
import { IColorTheme } from '../../../../../../platform/theme/common/themeService.js';
1112
import { chatDictationActiveMicGlow, chatVoiceGlowBaseColor, chatVoiceSpeakingGlow } from '../../../common/widget/chatColors.js';
1213
import { resolveDictationMicAccent } from '../../../browser/speechToText/dictationMicGlow.js';
1314
import { isGlowingVoiceState, GlowThemeKind, resolveVoiceGlowColors, resolveVoiceRimAccent, VOICE_GLOW_SPEAKING_HUE_SHIFT } from '../../../browser/voiceClient/voiceGlow.js';
15+
import { createVoiceGlowController } from '../../../browser/voiceClient/voiceGlowController.js';
1416

1517
suite('VoiceGlow', () => {
16-
ensureNoDisposablesAreLeakedInTestSuite();
18+
const disposables = ensureNoDisposablesAreLeakedInTestSuite();
1719

1820
test('only the talking states glow', () => {
1921
const states = ['idle', 'listening', 'speaking', 'processing', 'error'] as const;
@@ -23,6 +25,27 @@ suite('VoiceGlow', () => {
2325
);
2426
});
2527

28+
test('renders in an auxiliary owner document', () => {
29+
const iframe = document.createElement('iframe');
30+
document.body.appendChild(iframe);
31+
disposables.add(toDisposable(() => iframe.remove()));
32+
33+
const target = iframe.contentDocument!.createElement('div');
34+
iframe.contentDocument!.body.appendChild(target);
35+
const controller = disposables.add(createVoiceGlowController(target));
36+
controller.render('listening', 0.5, false);
37+
38+
assert.deepStrictEqual({
39+
active: target.classList.contains('voice-active'),
40+
listening: target.classList.contains('voice-listening'),
41+
slots: target.querySelectorAll('.voice-glow-slot').length,
42+
}, {
43+
active: true,
44+
listening: true,
45+
slots: 2,
46+
});
47+
});
48+
2649
test('derives the speaking accent from the theme base color', () => {
2750
const base = Color.fromHex('#58A6FF');
2851
const colors = resolveVoiceGlowColors({ getColor: id => id === chatVoiceGlowBaseColor ? base : undefined });

0 commit comments

Comments
 (0)