mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 08:15:53 +00:00
fix: 修复 voice provider 的问题
This commit is contained in:
@@ -11,11 +11,24 @@ import { applySettingsChange } from '../utils/settings/applySettingsChange.js';
|
|||||||
import type { SettingSource } from '../utils/settings/constants.js';
|
import type { SettingSource } from '../utils/settings/constants.js';
|
||||||
import { createStore } from './store.js';
|
import { createStore } from './store.js';
|
||||||
|
|
||||||
// DCE: voice context is ant-only. External builds get a passthrough.
|
// DCE: voice context is ant-only. External builds get a noop provider that
|
||||||
|
// still wraps children in VoiceContext so useVoiceState never throws.
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
const VoiceProvider: (props: { children: React.ReactNode }) => React.ReactNode = feature('VOICE_MODE')
|
const VoiceProvider: (props: { children: React.ReactNode }) => React.ReactNode = feature('VOICE_MODE')
|
||||||
? require('../context/voice.js').VoiceProvider
|
? require('../context/voice.js').VoiceProvider
|
||||||
: ({ children }) => children;
|
: (() => {
|
||||||
|
const { VoiceContext } = require('../context/voice.js');
|
||||||
|
const noopStore = createStore({
|
||||||
|
voiceState: 'idle' as const,
|
||||||
|
voiceError: null as string | null,
|
||||||
|
voiceInterimTranscript: '',
|
||||||
|
voiceAudioLevels: [] as number[],
|
||||||
|
voiceWarmingUp: false,
|
||||||
|
});
|
||||||
|
return ({ children }: { children: React.ReactNode }) => (
|
||||||
|
<VoiceContext.Provider value={noopStore}>{children}</VoiceContext.Provider>
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||||
import { type AppState, type AppStateStore, getDefaultAppState } from './AppStateStore.js';
|
import { type AppState, type AppStateStore, getDefaultAppState } from './AppStateStore.js';
|
||||||
|
|||||||
Reference in New Issue
Block a user