diff --git a/index.js b/index.js index c80cc07..8fadf29 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ import fs from "node:fs"; import path from "path"; import config from "./model/config.js"; -import { buildNextJs, startNextJs } from "./start-nextjs.js"; +import { startNextJs } from "./utils/start-nextjs.js"; if (!global.segment) { global.segment = (await import("oicq")).segment } @@ -41,8 +41,7 @@ for (let i in files) { // 检查是否启动 webui if (isOpenWebUI) { - buildNextJs() - .then(() => startNextJs('start')) + startNextJs('dev') } export { apps }; diff --git a/server/app/r/api/bot/route.js b/server/app/r/api/bot/route.js index 9066032..35d92dc 100644 --- a/server/app/r/api/bot/route.js +++ b/server/app/r/api/bot/route.js @@ -1,7 +1,6 @@ import { REDIS_YUNZAI_WEBUI } from "../../../../../constants/constant.js"; import { redis } from "../../../../utils/redis.js"; - export async function GET(req, res) { const botInfo = JSON.parse(await redis.get(REDIS_YUNZAI_WEBUI)); diff --git a/start-nextjs.js b/utils/start-nextjs.js similarity index 92% rename from start-nextjs.js rename to utils/start-nextjs.js index 94181bf..5d4d3b2 100644 --- a/start-nextjs.js +++ b/utils/start-nextjs.js @@ -34,7 +34,7 @@ export const startNextJs = (mode = 'start') => { nextjsProcess = spawn('pnpm', ['run', script], { cwd: './plugins/rconsole-plugin', // 指定工作目录 - stdio: ['ignore', 'ignore', 'ignore', 'ipc'], // 继承父进程的标准输入输出 + stdio: 'ignore', shell: true, }); @@ -43,6 +43,9 @@ export const startNextJs = (mode = 'start') => { logger.error(`[R插件][Next.js监测],Next.js 进程发生异常 ${code}`); nextjsProcess = null; }); + nextjsProcess.on('error', (err) => { + logger.error(`[R插件][Next.js监测] 子进程错误: ${err.message}`); + }); }; // 捕获父进程退出信号