Skip to content

Unrestricted Open-source alternative to AI video platforms — Free AI image & video generation studio with 600+ models (Flux, Midjourney, Kling, Sora, Veo). No content filters. Self-hosted, MIT licensed.

fix: build design-agent, prevent local-ai startup crash, add AuthModal close button

Anil Matchaf02bb3094cd0
diff --git a/Dockerfile b/Dockerfile
index acca2a8b..e0e71c33 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -6,6 +6,7 @@ FROM base AS deps
COPY package*.json ./
COPY packages/Vibe-Workflow/packages/workflow-builder/package*.json ./packages/Vibe-Workflow/packages/workflow-builder/
COPY packages/Open-Poe-AI/packages/agents/package*.json ./packages/Open-Poe-AI/packages/agents/
+COPY packages/Open-AI-Design-Agent/packages/design-agent/package*.json ./packages/Open-AI-Design-Agent/packages/design-agent/
COPY packages/studio/package*.json ./packages/studio/
RUN npm install
diff --git a/electron/lib/localInference.js b/electron/lib/localInference.js
index fa74e7e1..d26ea6f6 100644
--- a/electron/lib/localInference.js
+++ b/electron/lib/localInference.js
@@ -20,19 +20,26 @@ const {
} = require('./localInferencePaths');
// ─── Paths ────────────────────────────────────────────────────────────────────
-const {
- dataDir: DATA_DIR,
- binDir: BIN_DIR,
- modelsDir: MODELS_DIR,
- tmpDir: TMP_DIR,
-} = resolveLocalAiPaths({ userDataPath: app.getPath('userData') });
-
-for (const dir of [BIN_DIR, MODELS_DIR, TMP_DIR]) {
- fs.mkdirSync(dir, { recursive: true });
+// Resolved lazily (from register(), after app.whenReady()) so a failure here
+// never crashes the process before a window exists — see #232.
+let DATA_DIR, BIN_DIR, MODELS_DIR, TMP_DIR;
+
+function ensureLocalAiPaths() {
+ if (BIN_DIR) return;
+ const resolved = resolveLocalAiPaths({ userDataPath: app.getPath('userData') });
+ DATA_DIR = resolved.dataDir;
+ BIN_DIR = resolved.binDir;
+ MODELS_DIR = resolved.modelsDir;
+ TMP_DIR = resolved.tmpDir;
+ BINARY_PATH = path.join(BIN_DIR, BINARY_NAME);
+
+ for (const dir of [BIN_DIR, MODELS_DIR, TMP_DIR]) {
+ fs.mkdirSync(dir, { recursive: true });
+ }
}
const BINARY_NAME = process.platform === 'win32' ? 'sd-cli.exe' : 'sd-cli';
-const BINARY_PATH = path.join(BIN_DIR, BINARY_NAME);
+let BINARY_PATH;
// ─── State ────────────────────────────────────────────────────────────────────
let activeProcess = null;
@@ -579,6 +586,7 @@ function getMainWindow() {
}
function register() {
+ ensureLocalAiPaths();
ipcMain.handle('local-ai:binary-status', () => getBinaryStatus());
ipcMain.handle('local-ai:download-binary', () => downloadBinary(getMainWindow()));
ipcMain.handle('local-ai:list-models', () => listModels());
diff --git a/electron/main.js b/electron/main.js
index 669f20ee..00a614a6 100644
--- a/electron/main.js
+++ b/electron/main.js
@@ -1,8 +1,17 @@
-const { app, BrowserWindow, shell } = require('electron');
+const { app, BrowserWindow, shell, dialog } = require('electron');
const path = require('path');
const { register: registerLocalInference } = require('./lib/localInference');
const { register: registerWan2gp } = require('./lib/wan2gpProvider');
+process.on('uncaughtException', (err) => {
+ console.error('Uncaught exception:', err);
+ try {
+ dialog.showErrorBox('Open Generative AI — Unexpected Error', err && err.stack ? err.stack : String(err));
+ } catch (_) {
+ // dialog unavailable this early; the console log above is the fallback
+ }
+});
+
// Ubuntu 24.04+ sets kernel.apparmor_restrict_unprivileged_userns=1 which
// blocks Chromium's user namespace sandbox. The .deb package ships an AppArmor
// profile that grants the permission cleanly. When running the AppImage on an
@@ -60,8 +69,17 @@ function createWindow() {
app.whenReady().then(() => {
createWindow();
- registerLocalInference();
- registerWan2gp();
+
+ try {
+ registerLocalInference();
+ registerWan2gp();
+ } catch (err) {
+ console.error('Failed to register local-ai/wan2gp handlers:', err);
+ dialog.showErrorBox(
+ 'Local AI features unavailable',
+ `Open Generative AI started, but local model support failed to initialize:\n\n${err.message}`
+ );
+ }
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
diff --git a/package.json b/package.json
index 27bb77d1..897862f5 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,8 @@
"build:studio": "npm run build -w studio",
"build:workflow": "npm run build -w workflow-builder",
"build:agent": "npm run build -w ai-agent",
- "build:packages": "npm run build:workflow && npm run build:agent && npm run build:studio",
+ "build:design": "npm run build -w design-agent",
+ "build:packages": "npm run build:workflow && npm run build:agent && npm run build:design && npm run build:studio",
"setup": "git submodule update --init --recursive && npm install && npm run build:packages",
"vite:dev": "vite",
"vite:build": "vite build",
diff --git a/src/components/AuthModal.js b/src/components/AuthModal.js
index f8fe8e86..3c48e6f8 100644
--- a/src/components/AuthModal.js
+++ b/src/components/AuthModal.js
@@ -5,9 +5,14 @@ export function AuthModal(onSuccess) {
overlay.className = 'fixed inset-0 z-[100] flex items-center justify-center bg-black/80 backdrop-blur-sm px-6';
const modal = document.createElement('div');
- modal.className = 'w-full max-w-md bg-panel-bg border border-white/10 rounded-3xl p-8 shadow-3xl animate-fade-in-up';
+ modal.className = 'relative w-full max-w-md bg-panel-bg border border-white/10 rounded-3xl p-8 shadow-3xl animate-fade-in-up';
modal.innerHTML = `
+ <button id="auth-modal-close-btn" type="button" aria-label="Close" class="absolute top-4 right-4 w-8 h-8 rounded-md text-white/40 hover:text-white hover:bg-white/10 transition-colors flex items-center justify-center">
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M18 6L6 18M6 6l12 12" />
+ </svg>
+ </button>
<div class="flex flex-col items-center text-center mb-8">
<div class="w-16 h-16 bg-primary/10 rounded-2xl flex items-center justify-center border border-primary/20 shadow-glow mb-6">
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="#22d3ee" stroke-width="2">
@@ -46,12 +51,28 @@ export function AuthModal(onSuccess) {
const input = modal.querySelector('#muapi-key-input');
const btn = modal.querySelector('#save-key-btn');
+ const closeBtn = modal.querySelector('#auth-modal-close-btn');
+
+ const close = () => {
+ document.removeEventListener('keydown', onKeydown);
+ if (overlay.parentNode) document.body.removeChild(overlay);
+ };
+
+ const onKeydown = (e) => {
+ if (e.key === 'Escape') close();
+ };
+ document.addEventListener('keydown', onKeydown);
+
+ closeBtn.onclick = close;
+ overlay.addEventListener('click', (e) => {
+ if (e.target === overlay) close();
+ });
btn.onclick = () => {
const key = input.value.trim();
if (key) {
localStorage.setItem('muapi_key', key);
- document.body.removeChild(overlay);
+ close();
if (onSuccess) onSuccess();
} else {
input.classList.add('border-red-500/50');