myagent-ai 1.15.76 → 1.15.78

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myagent-ai",
3
- "version": "1.15.76",
3
+ "version": "1.15.78",
4
4
  "description": "本地桌面端执行型AI助手 - Open Interpreter 风格 | Local Desktop Execution-Oriented AI Assistant",
5
5
  "main": "main.py",
6
6
  "bin": {
package/start.js CHANGED
@@ -390,40 +390,53 @@ function cmdUpdate(pkgDir) {
390
390
  try { curVer = JSON.parse(fs.readFileSync(path.join(pkgDir, "package.json"), "utf8")).version || ""; } catch (_) {}
391
391
 
392
392
  console.log("");
393
- console.log(` \x1b[36mMyAgent 更新${curVer ? " v" + curVer : "到最新版"}\x1b[0m`);
393
+ console.log(` MyAgent 更新${curVer ? " v" + curVer : "到最新版"}`);
394
394
  console.log("");
395
395
 
396
- // 1. npm 升级全局包
396
+ // 1. npm 升级全局包(--force 确保跳过缓存)
397
397
  console.log(" 正在通过 npm 更新 myagent-ai ...");
398
398
  try {
399
- execFileSync("npm", ["install", "-g", PKG_NAME, "--prefer-online"], {
399
+ execFileSync("npm", ["install", "-g", PKG_NAME, "--prefer-online", "--force"], {
400
400
  encoding: "utf8", stdio: "inherit", timeout: 120000,
401
401
  });
402
402
  } catch (e) {
403
- console.error("\x1b[31mnpm 更新失败,请尝试手动运行: npm install -g myagent-ai@latest\x1b[0m");
403
+ console.error("npm 更新失败,请尝试手动运行: npm install -g myagent-ai@latest --force");
404
404
  process.exit(1);
405
405
  }
406
406
 
407
407
  // 2. 重新定位 pkgDir(npm 更新后路径可能变化)
408
408
  const newPkgDir = resolvePackageDir();
409
409
  if (!fs.existsSync(path.join(newPkgDir, "main.py"))) {
410
- console.error("\x1b[31m更新后找不到 main.py,请重新安装: npm install -g myagent-ai@latest\x1b[0m");
410
+ console.error("更新后找不到 main.py,请重新安装: npm install -g myagent-ai@latest");
411
411
  process.exit(1);
412
412
  }
413
413
 
414
414
  let newVer = "";
415
415
  try { newVer = JSON.parse(fs.readFileSync(path.join(newPkgDir, "package.json"), "utf8")).version || ""; } catch (_) {}
416
+
417
+ // 3. 如果版本变了,用新的 start.js 重新执行自身,确保运行最新代码
418
+ if (curVer && newVer && curVer !== newVer) {
419
+ const newStartJs = path.join(newPkgDir, "start.js");
420
+ if (fs.existsSync(newStartJs)) {
421
+ console.log(` 已下载 v${newVer},正在切换到新版本...`);
422
+ console.log("");
423
+ const { execSync } = require("child_process");
424
+ execSync(process.execPath + ' "' + newStartJs + '" update', {
425
+ stdio: "inherit", windowsHide: true, timeout: 30000,
426
+ });
427
+ return;
428
+ }
429
+ }
430
+
416
431
  markDepsInstalled(newVer);
417
432
 
418
433
  console.log("");
419
- if (curVer && newVer && curVer !== newVer) {
420
- console.log(` \x1b[32m✓ 更新完成 v${curVer} v${newVer}\x1b[0m`);
421
- } else if (newVer) {
422
- console.log(` \x1b[32m✓ 已是最新版 v${newVer}\x1b[0m`);
434
+ if (newVer) {
435
+ console.log(` ✓ 已是最新版 v${newVer}`);
423
436
  } else {
424
- console.log(" \x1b[32m✓ 更新完成\x1b[0m");
437
+ console.log(` ✓ 更新完成`);
425
438
  }
426
- console.log(" 运行 \x1b[36mmyagent-ai web\x1b[0m 启动");
439
+ console.log(` 运行 myagent-ai web 启动`);
427
440
  console.log("");
428
441
  }
429
442
 
@@ -1327,9 +1327,14 @@ async function sendMessage(opts) {
1327
1327
  document.getElementById('sendBtn').disabled = true;
1328
1328
  clearDraft();
1329
1329
 
1330
+ // 用户发消息后,强制滚到底部
1331
+ _userScrollLocked = false;
1332
+ scrollToBottom(true);
1333
+
1330
1334
  // Show typing
1331
1335
  state.isGenerating = true;
1332
1336
  showTypingIndicator();
1337
+ scrollToBottom(true);
1333
1338
  document.getElementById('sendBtn').style.display = 'none';
1334
1339
  document.getElementById('stopBtn').style.display = '';
1335
1340