myagent-ai 1.15.63 → 1.15.65
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/core/deps_checker.py +1 -2
- package/package.json +1 -1
- package/requirements.txt +0 -1
- package/start.js +33 -4
- package/web/api_server.py +10 -1
package/core/deps_checker.py
CHANGED
|
@@ -12,7 +12,7 @@ core/deps_checker.py - 自动依赖检测与安装
|
|
|
12
12
|
|
|
13
13
|
依赖映射:
|
|
14
14
|
核心功能: openai, aiohttp, requests
|
|
15
|
-
搜索技能:
|
|
15
|
+
搜索技能: bs4
|
|
16
16
|
系统技能: psutil
|
|
17
17
|
托盘功能: pystray, PIL
|
|
18
18
|
语音合成: edge_tts
|
|
@@ -62,7 +62,6 @@ DEPENDENCIES: List[DepInfo] = [
|
|
|
62
62
|
DepInfo("requests", "requests", "2.31.0", "core", "all"),
|
|
63
63
|
|
|
64
64
|
# ── 搜索技能 ──
|
|
65
|
-
DepInfo("duckduckgo_search", "duckduckgo-search", "6.0.0", "search", "all"),
|
|
66
65
|
DepInfo("bs4", "beautifulsoup4", "4.12.0", "search", "all"),
|
|
67
66
|
|
|
68
67
|
# ── 系统技能 ──
|
package/package.json
CHANGED
package/requirements.txt
CHANGED
package/start.js
CHANGED
|
@@ -171,7 +171,7 @@ function pipInstall(venvPython, pkgSpec, quiet) {
|
|
|
171
171
|
for (const getMirror of MIRRORS) {
|
|
172
172
|
try {
|
|
173
173
|
const mirrorArgs = getMirror();
|
|
174
|
-
const args = ["-m", "pip", "install", "--disable-pip-version-check"];
|
|
174
|
+
const args = ["-m", "pip", "install", "--disable-pip-version-check", "--prefer-binary"];
|
|
175
175
|
if (mirrorArgs.length) args.push(...mirrorArgs);
|
|
176
176
|
if (quiet) args.push("-q");
|
|
177
177
|
args.push(pkgSpec);
|
|
@@ -180,7 +180,6 @@ function pipInstall(venvPython, pkgSpec, quiet) {
|
|
|
180
180
|
});
|
|
181
181
|
return { ok: true, err: "" };
|
|
182
182
|
} catch (e) {
|
|
183
|
-
// 保留最后 5 行 stderr 作为错误信息
|
|
184
183
|
const raw = (e.stderr || "");
|
|
185
184
|
lastErr = raw.trim().split("\n").slice(-5).join("\n").trim() || e.message || "unknown error";
|
|
186
185
|
}
|
|
@@ -188,6 +187,35 @@ function pipInstall(venvPython, pkgSpec, quiet) {
|
|
|
188
187
|
return { ok: false, err: lastErr };
|
|
189
188
|
}
|
|
190
189
|
|
|
190
|
+
/**
|
|
191
|
+
* 尝试安装包(带依赖),如果失败则尝试 --no-deps(裸装)
|
|
192
|
+
* 用于处理 openai→jiter 这类"主包能装但子依赖编译失败"的情况
|
|
193
|
+
*/
|
|
194
|
+
function pipInstallWithFallback(venvPython, pkgSpec, quiet) {
|
|
195
|
+
// 正常安装
|
|
196
|
+
const r1 = pipInstall(venvPython, pkgSpec, quiet);
|
|
197
|
+
if (r1.ok) return r1;
|
|
198
|
+
|
|
199
|
+
// 回退: --no-deps 安装主包,跳过编译失败的子依赖
|
|
200
|
+
for (const getMirror of MIRRORS) {
|
|
201
|
+
try {
|
|
202
|
+
const mirrorArgs = getMirror();
|
|
203
|
+
const args = ["-m", "pip", "install", "--disable-pip-version-check", "--prefer-binary", "--no-deps"];
|
|
204
|
+
if (mirrorArgs.length) args.push(...mirrorArgs);
|
|
205
|
+
if (quiet) args.push("-q");
|
|
206
|
+
args.push(pkgSpec);
|
|
207
|
+
execFileSync(venvPython, args, {
|
|
208
|
+
encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 180000,
|
|
209
|
+
});
|
|
210
|
+
return { ok: true, err: "(--no-deps)" };
|
|
211
|
+
} catch (e) {
|
|
212
|
+
const raw = (e.stderr || "");
|
|
213
|
+
lastErr = raw.trim().split("\n").slice(-5).join("\n").trim() || e.message || "unknown error";
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return r1;
|
|
217
|
+
}
|
|
218
|
+
|
|
191
219
|
/**
|
|
192
220
|
* 从 requirements.txt 解析包列表
|
|
193
221
|
* @returns {string[]} 如 ["openai>=1.12.0", "aiohttp>=3.9.0", ...]
|
|
@@ -268,9 +296,10 @@ function installAllDeps(venvPython, pkgDir) {
|
|
|
268
296
|
const isCore = CORE_DEPS.includes(baseName);
|
|
269
297
|
process.stdout.write(` [${idx}/${total}] ${pkg} ... `);
|
|
270
298
|
|
|
271
|
-
const result = pipInstall(venvPython, pkg, true);
|
|
299
|
+
const result = isCore ? pipInstallWithFallback(venvPython, pkg, true) : pipInstall(venvPython, pkg, true);
|
|
272
300
|
if (result.ok) {
|
|
273
|
-
|
|
301
|
+
const note = result.err === "(--no-deps)" ? " \x1b[33m(部分子依赖跳过)\x1b[0m" : "";
|
|
302
|
+
console.log("\x1b[32m✓\x1b[0m" + note);
|
|
274
303
|
} else {
|
|
275
304
|
if (isCore) {
|
|
276
305
|
console.log("\x1b[31m✗\x1b[0m");
|
package/web/api_server.py
CHANGED
|
@@ -5559,7 +5559,16 @@ class ApiServer:
|
|
|
5559
5559
|
self._runner = web.AppRunner(self.app)
|
|
5560
5560
|
await self._runner.setup()
|
|
5561
5561
|
site = web.TCPSite(self._runner, host, port)
|
|
5562
|
-
|
|
5562
|
+
try:
|
|
5563
|
+
await site.start()
|
|
5564
|
+
except OSError as e:
|
|
5565
|
+
if e.errno == 98 or "address already in use" in str(e).lower():
|
|
5566
|
+
logger.error(f"端口 {port} 已被占用!")
|
|
5567
|
+
logger.error(f" 可能是上次的 MyAgent 还在运行,请先关闭后再启动")
|
|
5568
|
+
logger.error(f" 或者使用其他端口: myagent-ai web --port 8768")
|
|
5569
|
+
logger.error(f" 查看占用端口的进程: lsof -i :{port} 或 netstat -tlnp | grep {port}")
|
|
5570
|
+
raise SystemExit(1)
|
|
5571
|
+
raise
|
|
5563
5572
|
logger.info(f"管理后台: http://{host}:{port}/ui/")
|
|
5564
5573
|
|
|
5565
5574
|
async def stop(self):
|