🐞fix:暂时解决网络监控失效问题

This commit is contained in:
zhiyu1998 2024-11-23 00:14:59 +08:00
parent 8a6b9339e7
commit b77e67c6d6
3 changed files with 6 additions and 5 deletions

View File

@ -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 };

View File

@ -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));

View File

@ -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}`);
});
};
// 捕获父进程退出信号