mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat(frontend): hands-free voice conversation mode in the composer
The mic opens a voice loop that listens, sends on end of speech, reads each completed reply and reopens the mic when the agent is idle. The phase reducer, pause options and voice-mode instruction move to the shared package. TTS gains per-message completion and pause/resume. The old tap-and-drag recorder, its strip and its CSS are removed.
This commit is contained in:
1 parent
80ef211a94
commit
5d8b2c9445
34 files changed
+4876
-1302
No files matched your search
@@ -4,7 +4,7 @@ import { render, screen, fireEvent, act, waitFor } from '@testing-library/react'
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { PromptInput, type PromptInputHandle } from './PromptInput'
|
||||
import { BUILTIN_COMMANDS } from '@/lib/builtinCommands'
|
||||
import { createCommandActionsMock, stubMatchMedia } from '@/test/test-utils'
|
||||
import { createCommandActionsMock, stubMatchMedia, createVoiceConversationControllerMock } from '@/test/test-utils'
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
runCommand: vi.fn(),
|
||||
@@ -24,6 +24,7 @@ const mocks = vi.hoisted(() => ({
|
||||
dismiss: vi.fn(),
|
||||
},
|
||||
useSTT: vi.fn(),
|
||||
useVoiceConversation: vi.fn(),
|
||||
useMobile: vi.fn(),
|
||||
useCommands: vi.fn(),
|
||||
useFileSearch: vi.fn(),
|
||||
@@ -57,7 +58,11 @@ vi.mock('@/hooks/useOpenCode', async () => {
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('@/hooks/useSTT', () => ({ useSTT: mocks.useSTT }))
|
||||
vi.mock('@/hooks/useSTT', () => ({
|
||||
useSTT: mocks.useSTT,
|
||||
useSttAvailability: () => ({ isEnabled: true, isSupported: true }),
|
||||
}))
|
||||
vi.mock('@/hooks/useVoiceConversation', () => ({ useVoiceConversation: mocks.useVoiceConversation }))
|
||||
vi.mock('@/hooks/useMobile', () => ({ useMobile: mocks.useMobile }))
|
||||
vi.mock('@/hooks/useCommands', () => ({ useCommands: mocks.useCommands }))
|
||||
vi.mock('@/hooks/useFileSearch', () => ({ useFileSearch: mocks.useFileSearch }))
|
||||
@@ -142,6 +147,9 @@ describe('PromptInput command submission', () => {
|
||||
const defaultProps = {
|
||||
directory: '/test',
|
||||
sessionID: 'test-session',
|
||||
messages: [],
|
||||
pending: [],
|
||||
transcriptStatus: 'idle' as const,
|
||||
showScrollButton: false,
|
||||
isSessionActive: false,
|
||||
isStreamingResponse: false,
|
||||
@@ -169,6 +177,7 @@ describe('PromptInput command submission', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
mocks.useVoiceConversation.mockReturnValue(createVoiceConversationControllerMock())
|
||||
mocks.runCommand.mockResolvedValue(undefined)
|
||||
mocks.switchSessionModel.mockResolvedValue(undefined)
|
||||
mocks.switchSessionAgent.mockResolvedValue(undefined)
|
||||
|
||||
Reference in new issue
Block a user