refactor: remove conditional voice mode support from backend and frontend (#8597)

* revert changes that made voice mode conditional to the presence of webrtcvad

* refactor: lazy-load webrtcvad dependency

* refactor: remove try-except block and directly import voice_mode_router

* [autofix.ci] apply automated fixes

* feat: add LRU caching to voice activity detector initialization

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Gabriel Luiz Freitas Almeida 2025-06-18 09:23:31 -03:00 • committed by GitHub
commit 6ada07a61f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 22 additions and 46 deletions

View file

@ -21,7 +21,6 @@ export interface ConfigResponse {
webhook_polling_interval: number;
serialization_max_items_length: number;
event_delivery: EventDeliveryType;
voice_mode_enabled: boolean;
}
export const useGetConfig: useQueryFunctionType<undefined, ConfigResponse> = (
@ -45,9 +44,7 @@ export const useGetConfig: useQueryFunctionType<undefined, ConfigResponse> = (
(state) => state.setWebhookPollingInterval,
);
const setEventDelivery = useUtilityStore((state) => state.setEventDelivery);
const setVoiceModeEnabled = useFlowsManagerStore(
(state) => state.setVoiceModeEnabled,
);
const { query } = UseRequestProcessor();
const getConfigFn = async () => {
@ -69,7 +66,6 @@ export const useGetConfig: useQueryFunctionType<undefined, ConfigResponse> = (
data.webhook_polling_interval ?? DEFAULT_POLLING_INTERVAL,
);
setEventDelivery(data.event_delivery ?? EventDeliveryType.POLLING);
setVoiceModeEnabled(Boolean(data.voice_mode_enabled));
}
return data;
};

View file

@ -1,7 +1,6 @@
import ForwardedIconComponent from "@/components/common/genericIconComponent";
import { Button } from "@/components/ui/button";
import { ICON_STROKE_WIDTH } from "@/constants/constants";
import useFlowsManagerStore from "@/stores/flowsManagerStore";
import { useVoiceStore } from "@/stores/voiceStore";
interface VoiceButtonProps {
@ -12,13 +11,6 @@ const VoiceButton = ({ toggleRecording }: VoiceButtonProps) => {
const setNewSessionCloseVoiceAssistant = useVoiceStore(
(state) => state.setNewSessionCloseVoiceAssistant,
);
const voiceModeEnabled = useFlowsManagerStore(
(state) => state.voiceModeEnabled,
);
if (!voiceModeEnabled) {
return null;
}
return (
<>

View file

@ -17,8 +17,6 @@ const past = {};
const future = {};
const useFlowsManagerStore = create<FlowsManagerStoreType>((set, get) => ({
voiceModeEnabled: false,
setVoiceModeEnabled: (voiceModeEnabled: boolean) => set({ voiceModeEnabled }),
IOModalOpen: false,
setIOModalOpen: (IOModalOpen: boolean) => {
set({ IOModalOpen });

View file

@ -29,8 +29,6 @@ export type FlowsManagerStoreType = {
IOModalOpen: boolean;
setIOModalOpen: (IOModalOpen: boolean) => void;
resetStore: () => void;
voiceModeEnabled: boolean;
setVoiceModeEnabled: (voiceModeEnabled: boolean) => void;
};
export type UseUndoRedoOptions = {