import {ChangeEvent, FormEvent, useState} from 'react'; import type { Voice, OpenAIVoice, AzureVoice } from '../../src/realtime/realtimeTypes'; type SettingsModalProps = { aiName: string; userName: string; userId: string; voice: Voice; aiStyle: string; language: string; isOpen: boolean; onClose: () => void; onSave: (settings: SettingsData) => void; } export type SettingsData = { userName: string; userId: string; aiName: string; language: string; aiMemorySelfModify: boolean; aiStyle: string; voice: Voice; } // Define voice lists const openaiVoices: OpenAIVoice[] = ['alloy', 'echo', 'shimmer', 'ash', 'ballad', 'coral', 'sage', 'verse']; const azureVoices: AzureVoice[] = ['amuch', 'dan', 'elan', 'marilyn', 'meadow', 'breeze', 'cove', 'ember', 'jupiter', 'alloy', 'echo', 'shimmer']; // Check if we're using Azure based on the environment variable const isAzure = import.meta.env.VITE_VOICE_PROVIDER === 'azure'; export const SettingsModal = ( {aiName, userName, userId, voice, aiStyle, language, isOpen, onClose, onSave}: SettingsModalProps ) => { const [formData, setFormData] = useState({ aiName, userName, userId, language, aiMemorySelfModify: false, aiStyle, voice }); const handleChange = (e: ChangeEvent) => { const { name, value, type } = e.target; setFormData({ ...formData, [name]: type === 'checkbox' ? (e.target as HTMLInputElement).checked : value }); }; const handleSubmit = (e: FormEvent) => { e.preventDefault(); onSave(formData); onClose(); }; return (
); }