-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreload.js
More file actions
17 lines (15 loc) · 971 Bytes
/
preload.js
File metadata and controls
17 lines (15 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('nova', {
transcribe: (audioBuffer) => ipcRenderer.invoke('nova:transcribe', audioBuffer),
chat: (message) => ipcRenderer.invoke('nova:chat', message),
execute: (command) => ipcRenderer.invoke('nova:execute', command),
speak: (text) => ipcRenderer.invoke('nova:speak', text),
stopSpeaking: () => ipcRenderer.invoke('nova:stop-speaking'),
metrics: () => ipcRenderer.invoke('nova:metrics'),
checkConfig: () => ipcRenderer.invoke('nova:check-config'),
bootDiagnostics: () => ipcRenderer.invoke('nova:boot-diagnostics'),
onToggleListen: (callback) => ipcRenderer.on('nova:toggle-listen', callback),
onSpeakingStarted: (callback) => ipcRenderer.on('nova:speaking-started', callback),
onSpeakingEnded: (callback) => ipcRenderer.on('nova:speaking-ended', callback),
onThemeChange: (callback) => ipcRenderer.on('nova:theme', (_, theme) => callback(theme)),
});