- Add backend/run_server.py entry point for embedded deployment - Add backend/build.py PyInstaller script for backend packaging - Modify config.py to support frozen executable paths - Extend client/config.json with backend configuration section - Add backend sidecar management in Electron main process - Add Whisper model download progress reporting - Update build-client.bat with --embedded-backend flag - Update DEPLOYMENT.md with all-in-one deployment documentation This enables packaging frontend and backend into a single executable for simplified enterprise deployment. Backward compatible with existing separate deployment mode (backend.embedded: false). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
44 lines
1.6 KiB
JavaScript
44 lines
1.6 KiB
JavaScript
const { contextBridge, ipcRenderer } = require("electron");
|
|
|
|
contextBridge.exposeInMainWorld("electronAPI", {
|
|
// App configuration (loaded from config.json)
|
|
getConfig: () => ipcRenderer.invoke("get-config"),
|
|
|
|
// Navigation
|
|
navigate: (page) => ipcRenderer.invoke("navigate", page),
|
|
|
|
// Sidecar status (Whisper transcriber)
|
|
getSidecarStatus: () => ipcRenderer.invoke("get-sidecar-status"),
|
|
|
|
// Backend status (FastAPI server)
|
|
getBackendStatus: () => ipcRenderer.invoke("get-backend-status"),
|
|
|
|
// === Streaming Mode APIs ===
|
|
startRecordingStream: () => ipcRenderer.invoke("start-recording-stream"),
|
|
streamAudioChunk: (base64Audio) => ipcRenderer.invoke("stream-audio-chunk", base64Audio),
|
|
stopRecordingStream: () => ipcRenderer.invoke("stop-recording-stream"),
|
|
|
|
// Streaming events
|
|
onTranscriptionSegment: (callback) => {
|
|
ipcRenderer.on("transcription-segment", (event, segment) => callback(segment));
|
|
},
|
|
onStreamStarted: (callback) => {
|
|
ipcRenderer.on("stream-started", (event, data) => callback(data));
|
|
},
|
|
onStreamStopped: (callback) => {
|
|
ipcRenderer.on("stream-stopped", (event, data) => callback(data));
|
|
},
|
|
|
|
// Model download progress events
|
|
onModelDownloadProgress: (callback) => {
|
|
ipcRenderer.on("model-download-progress", (event, progress) => callback(progress));
|
|
},
|
|
|
|
// === Legacy File-based APIs (fallback) ===
|
|
saveAudioFile: (arrayBuffer) => ipcRenderer.invoke("save-audio-file", arrayBuffer),
|
|
transcribeAudio: (filePath) => ipcRenderer.invoke("transcribe-audio", filePath),
|
|
onTranscriptionResult: (callback) => {
|
|
ipcRenderer.on("transcription-result", (event, text) => callback(text));
|
|
},
|
|
});
|