Hello! How are you today?
- User
Assistant: Hello! How are you today? User: Assistant Name: Voice Settings: Speech Rate: Save Settings Clear History
<div class="context-menu" id="contextMenu"> <div class="menu-item" onclick="copyMessage()">Copy</div> <div class="menu-item" onclick="saveMessage()">Save to Memory</div> <div class="menu-item" onclick="deleteMessage()">Delete</div> </div> <script> class ChatManager { constructor() { this.chats = JSON.parse(localStorage.getItem('chats')) || []; this.currentChat = null; } newChat() { this.currentChat = { id: Date.now(), messages: [], timestamp: new Date().toISOString() }; this.chats.unshift(this.currentChat); this.save(); } saveMessage(message) { if(this.currentChat) { this.currentChat.messages.push(message); this.save(); } } save() { localStorage.setItem('chats', JSON.stringify(this.chats)); } exportChat(format = 'txt') { // Export implementation } clearHistory() { localStorage.removeItem('chats'); this.chats = []; } } class SettingsManager { constructor() { this.settings = JSON.parse(localStorage.getItem('settings')) || { voiceEnabled: true, recognitionEnabled: true, speechRate: 1, voiceName: '' }; } saveSettings() { localStorage.setItem('settings', JSON.stringify(this.settings)); } } const chatManager = new ChatManager(); const settingsManager = new SettingsManager(); // Initialize speech synthesis let voices = []; const synth = window.speechSynthesis; synth.onvoiceschanged = () => { voices = synth.getVoices(); populateVoiceList(); }; function populateVoiceList() { const voiceSelect = document.getElementById('voiceSelect'); voices.forEach(voice => { const option = document.createElement('option'); option.value = voice.name; option.textContent = voice.name; voiceSelect.appendChild(option); }); } // Message handling document.addEventListener('click', (e) => { if(e.target.closest('.message')) { showContextMenu(e); } }); function showContextMenu(e) { const menu = document.getElementById('contextMenu'); menu.style.display = 'block'; menu.style.left = ${e.pageX}px; menu.style.top = ${e.pageY}px; } function copyMessage() { // Copy implementation } // Event listenersAssistant:
- Assistant