myagent-ai 1.15.64 → 1.15.66

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.
@@ -12,7 +12,7 @@ core/deps_checker.py - 自动依赖检测与安装
12
12
 
13
13
  依赖映射:
14
14
  核心功能: openai, aiohttp, requests
15
- 搜索技能: duckduckgo_search, bs4
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
  # ── 系统技能 ──
@@ -77,7 +76,9 @@ DEPENDENCIES: List[DepInfo] = [
77
76
 
78
77
  # ── 语音识别 (STT) ──
79
78
  DepInfo("faster_whisper", "faster-whisper", "1.0.0", "stt", "all",
80
- note="本地语音识别引擎 (首次使用自动下载模型)"),
79
+ note="本地语音识别引擎 (需要 C++ 编译)"),
80
+ DepInfo("speech_recognition", "SpeechRecognition", "3.10.0", "stt", "all",
81
+ note="在线语音识别 (Google API,纯 Python 无需编译,Termux 兼容)"),
81
82
 
82
83
  # ── 浏览器自动化 (ChromeDev MCP) ──
83
84
  # Playwright 已移除,浏览器自动化统一使用 ChromeDevTools Protocol (MCP)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myagent-ai",
3
- "version": "1.15.64",
3
+ "version": "1.15.66",
4
4
  "description": "本地桌面端执行型AI助手 - Open Interpreter 风格 | Local Desktop Execution-Oriented AI Assistant",
5
5
  "main": "main.py",
6
6
  "bin": {
package/requirements.txt CHANGED
@@ -11,7 +11,6 @@ requests>=2.31.0
11
11
  # ============================================================
12
12
  # 技能系统 - 搜索
13
13
  # ============================================================
14
- duckduckgo-search>=6.0.0
15
14
  beautifulsoup4>=4.12.0
16
15
  psutil>=5.9.0
17
16
 
package/web/api_server.py CHANGED
@@ -1219,11 +1219,41 @@ class ApiServer:
1219
1219
  except Exception as e:
1220
1220
  logger.warning(f"vosk 转录失败: {e}")
1221
1221
 
1222
+ # ── 尝试 SpeechRecognition (Google Web Speech API, 纯 Python 无需编译) ──
1223
+ try:
1224
+ import speech_recognition as sr
1225
+ wav_buf = io.BytesIO(audio_data)
1226
+ try:
1227
+ audio_buf = io.BytesIO(audio_data)
1228
+ from pydub import AudioSegment
1229
+ seg = AudioSegment.from_file(audio_buf, format=audio_format or "webm")
1230
+ seg = seg.set_channels(1).set_frame_rate(16000).set_sample_width(2)
1231
+ seg.export(wav_buf, format="wav")
1232
+ except Exception:
1233
+ wav_buf = io.BytesIO(audio_data)
1234
+ wav_buf.seek(0)
1235
+ recognizer = sr.Recognizer()
1236
+ with sr.AudioFile(wav_buf) as source:
1237
+ audio = recognizer.record(source)
1238
+ text = recognizer.recognize_google(audio, language="zh-CN")
1239
+ if text:
1240
+ logger.info("SpeechRecognition (Google API) 转录成功")
1241
+ return web.json_response({"text": text, "engine": "speech_recognition"})
1242
+ except ImportError:
1243
+ logger.debug("SpeechRecognition 未安装,跳过")
1244
+ except sr.UnknownValueError:
1245
+ logger.debug("SpeechRecognition 无法识别音频内容")
1246
+ except sr.RequestError as e:
1247
+ logger.warning(f"SpeechRecognition API 请求失败: {e}")
1248
+ except Exception as e:
1249
+ logger.warning(f"SpeechRecognition 转录失败: {e}")
1250
+
1222
1251
  # ── 没有可用的 STT 引擎 ──
1223
1252
  return web.json_response({
1224
- "error": "未检测到本地 STT 引擎。请安装 faster-whisper(推荐)或 vosk:\n"
1225
- " pip install faster-whisper (首次使用会自动下载 tiny 模型 ~39MB)\n"
1226
- " pip install vosk",
1253
+ "error": "未检测到本地 STT 引擎。请安装以下任一引擎:\n"
1254
+ " pip install faster-whisper (推荐,离线,首次下载模型 ~39MB)\n"
1255
+ " pip install vosk (离线,需下载模型)\n"
1256
+ " pip install SpeechRecognition (在线,使用 Google API,无需编译)",
1227
1257
  "available": False,
1228
1258
  }, status=503)
1229
1259
 
@@ -5559,7 +5589,16 @@ class ApiServer:
5559
5589
  self._runner = web.AppRunner(self.app)
5560
5590
  await self._runner.setup()
5561
5591
  site = web.TCPSite(self._runner, host, port)
5562
- await site.start()
5592
+ try:
5593
+ await site.start()
5594
+ except OSError as e:
5595
+ if e.errno == 98 or "address already in use" in str(e).lower():
5596
+ logger.error(f"端口 {port} 已被占用!")
5597
+ logger.error(f" 可能是上次的 MyAgent 还在运行,请先关闭后再启动")
5598
+ logger.error(f" 或者使用其他端口: myagent-ai web --port 8768")
5599
+ logger.error(f" 查看占用端口的进程: lsof -i :{port} 或 netstat -tlnp | grep {port}")
5600
+ raise SystemExit(1)
5601
+ raise
5563
5602
  logger.info(f"管理后台: http://{host}:{port}/ui/")
5564
5603
 
5565
5604
  async def stop(self):