mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-28 15:50:27 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f47af233f | ||
|
|
6aadc2402d | ||
|
|
eb937b29e4 | ||
|
|
f44aca9a2f | ||
|
|
c34812bc9c | ||
|
|
d93b430034 | ||
|
|
c91e1378cf | ||
|
|
cad567dc3f | ||
|
|
82c8de00d0 | ||
|
|
f17abccfdc | ||
|
|
35af50bb73 |
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -10,7 +10,7 @@ permissions: write-all
|
||||
|
||||
env:
|
||||
OPENROUTER_API_URL: https://91vip.futureppo.top/v1/chat/completions
|
||||
OPENROUTER_MODEL: "gemini-3-flash-preview"
|
||||
OPENROUTER_MODEL: "deepseek-v3.2-chat"
|
||||
RELEASE_NAME: "NapCat"
|
||||
|
||||
jobs:
|
||||
@@ -396,7 +396,7 @@ jobs:
|
||||
--arg system "$SYSTEM_PROMPT" \
|
||||
--arg user "$USER_CONTENT" \
|
||||
--arg model "$OPENROUTER_MODEL" \
|
||||
'{model: $model, messages:[{role:"system", content:$system},{role:"user", content:$user}], temperature:0.2, max_tokens:1500}')
|
||||
'{model: $model, messages:[{role:"system", content:$system},{role:"user", content:$user}], temperature:0.2, max_tokens:5000}')
|
||||
|
||||
echo "=== OpenRouter request body ==="
|
||||
echo "$BODY" | jq .
|
||||
|
||||
2
packages/napcat-core/external/napcat.json
vendored
2
packages/napcat-core/external/napcat.json
vendored
@@ -5,5 +5,5 @@
|
||||
"consoleLogLevel": "info",
|
||||
"packetBackend": "auto",
|
||||
"packetServer": "",
|
||||
"o3HookMode": 0
|
||||
"o3HookMode": 1
|
||||
}
|
||||
@@ -43,9 +43,13 @@ export async function NCoreInitFramework (
|
||||
const nativePacketHandler = new NativePacketHandler({ logger }); // 初始化 NativePacketHandler 用于后续使用
|
||||
const napi2nativeLoader = new Napi2NativeLoader({ logger }); // 初始化 Napi2NativeLoader 用于后续使用
|
||||
//console.log('[NapCat] [Napi2NativeLoader]', napi2nativeLoader.nativeExports.enableAllBypasses?.());
|
||||
const bypassEnabled = napi2nativeLoader.nativeExports.enableAllBypasses?.();
|
||||
if (bypassEnabled) {
|
||||
logger.log('[NapCat] Napi2NativeLoader: 已启用Bypass');
|
||||
if (process.env['NAPCAT_DISABLE_BYPASS'] !== '1') {
|
||||
const bypassEnabled = napi2nativeLoader.nativeExports.enableAllBypasses?.();
|
||||
if (bypassEnabled) {
|
||||
logger.log('[NapCat] Napi2NativeLoader: 已启用Bypass');
|
||||
}
|
||||
} else {
|
||||
logger.log('[NapCat] Napi2NativeLoader: Bypass已通过环境变量禁用');
|
||||
}
|
||||
// nativePacketHandler.onAll((packet) => {
|
||||
// console.log('[Packet]', packet.uin, packet.cmd, packet.hex_data);
|
||||
|
||||
BIN
packages/napcat-native/napi2native/ffmpeg.dll
Normal file
BIN
packages/napcat-native/napi2native/ffmpeg.dll
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -401,11 +401,17 @@ export async function NCoreInitShell () {
|
||||
await connectToNamedPipe(logger).catch(e => logger.logError('命名管道连接失败', e));
|
||||
}
|
||||
const wrapper = loadQQWrapper(basicInfoWrapper.QQMainPath, basicInfoWrapper.getFullQQVersion());
|
||||
|
||||
// wrapper.node 加载后立刻启用 Bypass
|
||||
const bypassEnabled = napi2nativeLoader.nativeExports.enableAllBypasses?.();
|
||||
if (bypassEnabled) {
|
||||
logger.log('[NapCat] Napi2NativeLoader: 已启用Bypass');
|
||||
if (process.env['NAPCAT_ENABLE_VERBOSE_LOG'] === '1') {
|
||||
napi2nativeLoader.nativeExports.setVerbose?.(true);
|
||||
}
|
||||
// wrapper.node 加载后立刻启用 Bypass(可通过环境变量禁用)
|
||||
if (process.env['NAPCAT_DISABLE_BYPASS'] !== '1') {
|
||||
const bypassEnabled = napi2nativeLoader.nativeExports.enableAllBypasses?.();
|
||||
if (bypassEnabled) {
|
||||
logger.log('[NapCat] Napi2NativeLoader: 已启用Bypass');
|
||||
}
|
||||
} else {
|
||||
logger.log('[NapCat] Napi2NativeLoader: Bypass已通过环境变量禁用');
|
||||
}
|
||||
|
||||
const o3Service = wrapper.NodeIO3MiscService.get();
|
||||
|
||||
@@ -113,6 +113,42 @@ function forceKillProcess (pid: number): void {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理进程树中的残留子进程(Electron 模式专用)
|
||||
* 排除当前主进程和新 worker 进程
|
||||
*/
|
||||
async function cleanupOrphanedProcesses (excludePids: number[]): Promise<void> {
|
||||
if (!isElectron) return;
|
||||
|
||||
try {
|
||||
// 使用 Electron 的 app.getAppMetrics() 获取所有相关进程
|
||||
// @ts-ignore - electron 运行时存在但类型声明可能缺失
|
||||
const electron = await import('electron');
|
||||
if (electron.app && typeof electron.app.getAppMetrics === 'function') {
|
||||
const metrics = electron.app.getAppMetrics();
|
||||
const mainPid = process.pid;
|
||||
|
||||
for (const metric of metrics) {
|
||||
const pid = metric.pid;
|
||||
// 排除主进程、新 worker 进程和明确排除的 PID
|
||||
if (pid === mainPid || excludePids.includes(pid)) {
|
||||
continue;
|
||||
}
|
||||
// 尝试终止残留进程
|
||||
try {
|
||||
process.kill(pid, 'SIGTERM');
|
||||
logger.log(`[NapCat] [Process] 已清理残留进程: PID ${pid} (${metric.type})`);
|
||||
} catch {
|
||||
// 进程可能已经不存在,忽略错误
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
// Electron API 不可用或出错,静默忽略
|
||||
logger.logDebug?.('[NapCat] [Process] 清理残留进程时出错:', error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重启 Worker 进程
|
||||
*/
|
||||
@@ -166,6 +202,13 @@ export async function restartWorker (secretKey?: string, port?: number): Promise
|
||||
|
||||
// 5. 启动新进程(重启模式不传递快速登录参数,传递密钥和端口)
|
||||
await startWorker(false, secretKey, port);
|
||||
|
||||
// 6. Electron 模式下清理可能残留的子进程
|
||||
if (isElectron && currentWorker?.pid) {
|
||||
const excludePids = [process.pid, currentWorker.pid];
|
||||
await cleanupOrphanedProcesses(excludePids);
|
||||
}
|
||||
|
||||
isRestarting = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user