Skip to content

🤖 Open-source, local-first alternative to Grok Bot, OpenAI dots and Claude Duet. Your own AI bots on any model: GPT, Claude, Gemini, Grok, DeepSeek, Kimi, GLM and 70+ more through one Modelflare key. Reach them in the app, WeChat or Feishu; they remember you, work in the background, run commands and use your computer. Pay per use.

fix(smoke): disable GPU under Xvfb; always quit after the smoke check

Marla51862b44ef3a
diff --git a/electron/main.ts b/electron/main.ts
index 39a2180..7e5859c 100644
--- a/electron/main.ts
+++ b/electron/main.ts
@@ -143,21 +143,24 @@ async function boot(): Promise<void> {
}
async function smoke(out: string): Promise<void> {
- const wc = win!.webContents;
- await new Promise<void>((r) => (wc.isLoading() ? wc.once("did-finish-load", () => r()) : r()));
- // 未连接 Modelflare 时是引导页,已连接时是对话页;两者都带 data-screen
- let screen = "";
- for (let i = 0; i < 50; i++) {
- screen = String(await wc.executeJavaScript("document.querySelector('[data-screen]')?.getAttribute('data-screen') || ''"));
- if (screen) break;
- await new Promise((r) => setTimeout(r, 200));
+ try {
+ const wc = win!.webContents;
+ await new Promise<void>((r) => (wc.isLoading() ? wc.once("did-finish-load", () => r()) : r()));
+ // 未连接 Modelflare 时是引导页,已连接时是对话页;两者都带 data-screen
+ let screen = "";
+ for (let i = 0; i < 50; i++) {
+ screen = String(await wc.executeJavaScript("document.querySelector('[data-screen]')?.getAttribute('data-screen') || ''"));
+ if (screen) break;
+ await new Promise((r) => setTimeout(r, 200));
+ }
+ const img = await wc.capturePage();
+ fs.writeFileSync(out, img.toPNG());
+ const status = await wc.executeJavaScript("fetch('/amb/api/status').then(r=>r.status)");
+ const magpie = await wc.executeJavaScript("fetch('/magpie/').then(r=>r.status)");
+ console.log(`SMOKE ${JSON.stringify({ hasUi: !!screen, screen, status, magpie, magpieState: core?.magpie?.state })}`);
+ } finally {
+ app.quit(); // 任何一步失败也退出,不让冒烟测试挂到超时
}
- const img = await wc.capturePage();
- fs.writeFileSync(out, img.toPNG());
- const status = await wc.executeJavaScript("fetch('/amb/api/status').then(r=>r.status)");
- const magpie = await wc.executeJavaScript("fetch('/magpie/').then(r=>r.status)");
- console.log(`SMOKE ${JSON.stringify({ hasUi: !!screen, screen, status, magpie, magpieState: core?.magpie?.state })}`);
- app.quit();
}
if (!app.requestSingleInstanceLock()) {
diff --git a/scripts/electron-smoke.mjs b/scripts/electron-smoke.mjs
index b28061b..21aab56 100644
--- a/scripts/electron-smoke.mjs
+++ b/scripts/electron-smoke.mjs
@@ -14,7 +14,8 @@ let cmd = exe ?? require("electron");
let args = exe ? [] : ["."];
if (process.platform === "linux") args.push("--no-sandbox");
if (process.platform === "linux" && !process.env.DISPLAY) {
- args = ["-a", "-s", "-screen 0 1400x900x24", cmd, ...args];
+ // Xvfb 没有 GPU:不关 GPU 时 capturePage 会报 UnknownVizError
+ args = ["-a", "-s", "-screen 0 1400x900x24", cmd, ...args, "--disable-gpu"];
cmd = "xvfb-run";
}
const r = spawnSync(cmd, args, { env: { ...process.env, AMB_DATA_DIR: dataDir, AMB_UI_PORT: "0", AMB_ELECTRON_SMOKE: shot }, encoding: "utf8", timeout: 120_000 });