myagent-ai 1.15.55 → 1.15.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/start.js +54 -2
- package/web/ui/index.html +1 -1
package/package.json
CHANGED
package/start.js
CHANGED
|
@@ -376,12 +376,64 @@ function installDeps(venvPython, venvPip, pkgDir) {
|
|
|
376
376
|
console.log(" \x1b[32m[✓]\x1b[0m 依赖安装完成");
|
|
377
377
|
installed = true;
|
|
378
378
|
} catch (err) {
|
|
379
|
-
console.log(" \x1b[33m[!]\x1b[0m requirements.txt
|
|
379
|
+
console.log(" \x1b[33m[!]\x1b[0m requirements.txt 整体安装失败,逐个安装缺失依赖...");
|
|
380
380
|
console.log(` \x1b[90m[i]\x1b[0m 错误: ${err.message}`);
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
-
// 策略
|
|
384
|
+
// 策略2.5: 逐个安装缺失的包(当整体安装失败时)
|
|
385
|
+
if (!installed && missing.length > 0) {
|
|
386
|
+
console.log(` \x1b[90m[i]\x1b[0m 逐个安装 ${missing.length} 个缺失包...`);
|
|
387
|
+
// 构建反向映射: import名 → pip包名(含版本)
|
|
388
|
+
const importToPip = {};
|
|
389
|
+
try {
|
|
390
|
+
const lines = fs.readFileSync(reqFile, "utf8").split("\n");
|
|
391
|
+
for (const raw of lines) {
|
|
392
|
+
const line = raw.trim();
|
|
393
|
+
if (!line || line.startsWith("#")) continue;
|
|
394
|
+
const m = line.match(/^([a-zA-Z0-9_-]+)/);
|
|
395
|
+
if (m) {
|
|
396
|
+
const pipName = m[1].toLowerCase().replace(/-/g, "_");
|
|
397
|
+
const pipSpec = line.split(/[;#]/)[0].trim();
|
|
398
|
+
importToPip[pipName] = pipSpec;
|
|
399
|
+
// 特殊映射 (和 parseRequirements 中的 importMap 一致)
|
|
400
|
+
const specialMap = {
|
|
401
|
+
"beautifulsoup4": "bs4",
|
|
402
|
+
"py_getwindow": "pygetwindow",
|
|
403
|
+
"python_telegram_bot": "telegram",
|
|
404
|
+
"pillow": "PIL",
|
|
405
|
+
"psutil": "psutil",
|
|
406
|
+
"edge_tts": "edge_tts",
|
|
407
|
+
};
|
|
408
|
+
const importName = specialMap[pipName] || pipName;
|
|
409
|
+
importToPip[importName] = pipSpec;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
} catch (_) {}
|
|
413
|
+
|
|
414
|
+
let failCount = 0;
|
|
415
|
+
for (const mod of missing) {
|
|
416
|
+
try {
|
|
417
|
+
const pkgSpec = importToPip[mod] || mod;
|
|
418
|
+
execFileSync(venvPython, ["-m", "pip", "install", "--disable-pip-version-check", ...mirrorArgs, pkgSpec], {
|
|
419
|
+
encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 120000,
|
|
420
|
+
});
|
|
421
|
+
console.log(` \x1b[32m[✓]\x1b[0m ${mod} 安装成功`);
|
|
422
|
+
} catch (_) {
|
|
423
|
+
failCount++;
|
|
424
|
+
console.log(` \x1b[31m[✗]\x1b[0m ${mod} 安装失败`);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (failCount === 0) {
|
|
428
|
+
console.log(" \x1b[32m[✓]\x1b[0m 所有缺失依赖安装成功");
|
|
429
|
+
installed = true;
|
|
430
|
+
} else if (failCount < missing.length) {
|
|
431
|
+
console.log(` \x1b[33m[!]\x1b[0m ${missing.length - failCount}/${missing.length} 个依赖安装成功,${failCount} 个失败`);
|
|
432
|
+
installed = true; // 部分成功也算,核心依赖优先
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// 策略3: 直接按包名安装核心依赖(最终兜底)
|
|
385
437
|
if (!installed) {
|
|
386
438
|
try {
|
|
387
439
|
execFileSync(venvPython, ["-m", "pip", "install", "--quiet", "--disable-pip-version-check", ...mirrorArgs, ...CORE_PACKAGES], {
|
package/web/ui/index.html
CHANGED
|
@@ -38,7 +38,7 @@ body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;b
|
|
|
38
38
|
.sidebar{width:220px;background:var(--surface);border-right:1px solid var(--border);display:flex;flex-direction:column;flex-shrink:0}
|
|
39
39
|
.sidebar .logo{padding:20px;font-size:18px;font-weight:700;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:8px}
|
|
40
40
|
.sidebar .logo span{color:var(--primary)}
|
|
41
|
-
.nav{flex:1;padding:0 8px 8px;overflow
|
|
41
|
+
.nav{flex:1;padding:0 8px 8px;overflow:hidden;min-height:0;display:flex;flex-direction:column}
|
|
42
42
|
.nav-item{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:var(--radius);cursor:pointer;color:var(--text2);font-size:14px;transition:all .15s;margin-bottom:2px}
|
|
43
43
|
.nav-item:hover{background:var(--surface2);color:var(--text)}
|
|
44
44
|
.nav-item.active{background:var(--primary);color:#fff}
|