kuzco-cli/gui/kuzco-gui.js

37 lines
902 B
JavaScript
Raw Normal View History

2024-03-09 02:15:01 -05:00
const { app, BrowserWindow, ipcMain } = require('electron');
const path = require('path');
const KuzcoCore = require('./kuzcoCore');
function createWindow() {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
nodeIntegration: false,
contextIsolation: true,
enableRemoteModule: false,
},
});
mainWindow.loadFile('index.html');
}
app.whenReady().then(() => {
createWindow();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});
const kuzcoCore = new KuzcoCore();
ipcMain.handle('send-prompt', async (event, prompt) => {
return await kuzcoCore.sendPrompt(prompt);
});