From 0ec00f1da999da014370a12cfd0872586e1c034d Mon Sep 17 00:00:00 2001 From: Curtis Gray Date: Tue, 2 Apr 2024 17:41:47 -0400 Subject: [PATCH] Remove more redundant error correcting code Change "AI model" to AI --- services/wingman.cpp | 2 +- ux/package.json | 2 +- ux/tron/main.js | 107 ++++++++++--------------------------------- 3 files changed, 25 insertions(+), 86 deletions(-) diff --git a/services/wingman.cpp b/services/wingman.cpp index e8427d5..bd6371d 160000 --- a/services/wingman.cpp +++ b/services/wingman.cpp @@ -1 +1 @@ -Subproject commit e8427d5c59d248ab08266b2a2e1ccb6ef549d820 +Subproject commit bd6371dad1974f67279925f95c9b4ec15ad968fc diff --git a/ux/package.json b/ux/package.json index 047e0ac..f7fc7fa 100644 --- a/ux/package.json +++ b/ux/package.json @@ -1,7 +1,7 @@ { "name": "wingman", "description": "Wingman is the best way to run Llama AI locally.", - "version": "0.10.31", + "version": "0.10.32", "author": { "name": "Electric Curtis", "url": "https://x.com/electric_curtis" diff --git a/ux/tron/main.js b/ux/tron/main.js index 465f9e7..11795de 100644 --- a/ux/tron/main.js +++ b/ux/tron/main.js @@ -120,7 +120,6 @@ if (!gotTheLock) return { findPort, cancel }; }; - let wingmanProcessController = null; let nextJsServerProcessController = null; logger.log("info", "Starting Wingman Electron"); @@ -432,34 +431,22 @@ if (!gotTheLock) const output = data.toString(); tell(`[W] stdout: ${output}`); - // check for exit messages - if (WINGMAN_EXIT_MESSAGES.some(msg => output.includes(msg))) + // Server is ready: `96ad0fad-82da-43a9-a313-25f51ef90e7c` + if (output.includes("96ad0fad-82da-43a9-a313-25f51ef90e7c")) { - tell(`[W] stdout: Wingman exit detected with message: ${output}`); + isServerReady = true; + resolve({ + terminate: terminateWingman, + shutdown: shutdownWingman, + pid: subprocess.pid, + }); } - else - { - // Server is ready: `96ad0fad-82da-43a9-a313-25f51ef90e7c` - if (output.includes("96ad0fad-82da-43a9-a313-25f51ef90e7c")) - { - isServerReady = true; - resolve({ - terminate: terminateWingman, - shutdown: shutdownWingman, - pid: subprocess.pid, - }); - } - if (!isServerReady) - { - } - else + if (isServerReady) + { + if (mustShutdownForModelLoadingError(output) === true) { - if (mustShutdownForModelLoadingError(output) === true) - { - // await handleWingmanResetAndRestart(cwd, wingmanDir, nextDir); - await terminateAndRestartWingman(); - } + await terminateAndRestartWingman(); } } }); @@ -468,27 +455,18 @@ if (!gotTheLock) { if (!data) { etell(`[W] stderr: data is empty`); return; } const output = data.toString(); - // check for exit messages - if (WINGMAN_EXIT_MESSAGES.some(msg => output.includes(msg))) + if (mustShutdownForModelLoadingError(output) === true) { - tell(`[W] stderr: Wingman exit detected with message: ${output}`); - } - else + await terminateAndRestartWingman(); + } else { - if (mustShutdownForModelLoadingError(output) === true) - { - // await handleWingmanResetAndRestart(cwd, wingmanDir, nextDir); - await terminateAndRestartWingman(); - } else + if (output === ".") + { // this should be written directly to stderr + process.stderr.write(output); + } + else { - if (output === ".") - { // this should be written directly to stderr - process.stderr.write(output); - } - else - { - etell(`[W] stderr: ${output}`); - } + etell(`[W] stderr: ${output}`); } } }); @@ -514,7 +492,6 @@ if (!gotTheLock) { tell(`[W] close: process exited with code ${code}`); } - wingmanProcessController = null; removeProcessFromMap(subprocess.pid); }); @@ -579,22 +556,6 @@ if (!gotTheLock) } }); } - - if (!isServerReady) - { - // dyld error: `dyld: Symbol not found` - if (output.includes("dyld: Symbol not found")) - { - etell(`[UX] stdout: ${output}`); - reject(new Error('dyld: Symbol not found')); - } - // bad image error: `illegal hardware instruction` - if (output.includes("illegal hardware instruction")) - { - etell(`[UX] stdout: ${output}`); - reject(new Error('illegal hardware instruction')); - } - } }); child.stderr.on("data", (data) => @@ -687,11 +648,7 @@ if (!gotTheLock) { ipcMain.emit('report-error', null, error.toString()); }); - // APP_WINDOW.on('page-title-updated', function (e) - // { // prevent the window title from changing - // // TODO: this might be unnecessary after setting the title in NextJs app page - // e.preventDefault(); - // }); + APP_WINDOW.on("will-navigate", (e) => e.preventDefault()); APP_WINDOW.on("closed", () => { @@ -753,19 +710,13 @@ if (!gotTheLock) { dtell(`(start-wingman): Starting Wingman services...`); ensureNoOtherWingmanProcesses(true); - // if (wingmanProcessController) - // { - // etell('Wingman is already running... terminating existing process...'); - // await wingmanProcessController.terminate(); - // } launchWingmanExecutable(wingmanDir, nextDir) .then((controller) => { dtell(`(start-wingman): Wingman services started.`); if (firstTimeStartingWingman) { - wingmanProcessController = controller; - WINGMAN_SERVICE_PROCESS_MAP.set(`PID_${controller.pid}`, wingmanProcessController); + WINGMAN_SERVICE_PROCESS_MAP.set(`PID_${controller.pid}`, controller); dtell(`(start-wingman): WINGMAN_SERVICE_PROCESS_MAP has : ${WINGMAN_SERVICE_PROCESS_MAP.size} entries after adding PID_${controller.pid}`); dtell(`(start-wingman): Firing 'start-nextjs' event...`); ipcMain.emit("start-nextjs", WINGMAN_UI_PORT, nextDir); @@ -865,18 +816,6 @@ if (!gotTheLock) etell(`Error terminating Next.js server: ${error}`); } } - - // if (wingmanProcessController) - // { - // try - // { - // await wingmanProcessController.terminate(); - // // - // } catch (error) - // { - // etell(`Error terminating Wingman server: ${error}`); - // } - // } dtell(`(shutdownApp): Ensuring no other Wingman processes are running...`); await ensureNoOtherWingmanProcesses(); tell('All windows closed. Clean up complete.');