import { createSlice, PayloadAction } from "@reduxjs/toolkit"; interface SettingsState { activeVoice: string; temperature: number; maxTokens: number; embeddingsText: string[]; silenceDuration: number; threshold: number; } const initialState: SettingsState = { activeVoice: "af", // Default voice temperature: 0.7, // Default temperature maxTokens: 500, // Default max tokens embeddingsText: [], // Empty by default silenceDuration: 0.8, threshold: 50, }; export const settingsSlice = createSlice({ name: "settings", initialState, reducers: { setActiveVoice: (state, action: PayloadAction) => { state.activeVoice = action.payload; }, setTemperature: (state, action: PayloadAction) => { state.temperature = action.payload; }, setSilenceDuration: (state, action: PayloadAction) => { state.silenceDuration = action.payload; }, setThreshold: (state, action: PayloadAction) => { state.threshold = action.payload; }, setMaxTokens: (state, action: PayloadAction) => { state.maxTokens = action.payload; }, }, }); export const { setActiveVoice, setTemperature, setMaxTokens, setSilenceDuration, setThreshold, } = settingsSlice.actions; export default settingsSlice.reducer;