Commit 6cd9f893747a00be87a43500821d7d31b4402122
1 parent
06d4382c
feat(phoneuse): send_wechat_voice_tts 路由到 cgi 全合成路
send_voice_tts_via_hook 的最后一步从 send_voice_via_hook(SEND_VOICE_INTERNAL) 改为 send_voice_cgi_via_hook(SEND_VOICE_CGI)——让 Hermes 的 send_wechat_voice_tts MCP 工具(wechat-voice-sender skill 调的)走已验证的 uploadvoice cgi 全合成路: 音频上传+投递接收方+发送方本地已发送气泡。docstring 同步更新。 已 adb push 同步到设备 ~/.hermes/event_bus/(android_mcp.py + wechat_hook_send.py), 设备 wechat-image-sender skill 也更新为调 send_wechat_image MCP 工具(弃旧 ACTION_SEND UI 模拟)。设备文件权限修为 termux uid 可读(原 root:root 导致 MCP 子进程 import 失败)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Showing
2 changed files
with
9 additions
and
6 deletions
phoneuse/android_mcp.py
| @@ -928,7 +928,8 @@ def _build_server(): | @@ -928,7 +928,8 @@ def _build_server(): | ||
| 928 | 928 | ||
| 929 | Full pipeline (runs on-device): | 929 | Full pipeline (runs on-device): |
| 930 | text → edge-tts (MP3) → ffmpeg (16kHz PCM) → silk-wasm (SILK V3) | 930 | text → edge-tts (MP3) → ffmpeg (16kHz PCM) → silk-wasm (SILK V3) |
| 931 | - → SEND_VOICE_INTERNAL broadcast → WeChat DB insert (status=4, delivered) | 931 | + → SEND_VOICE_CGI (internal uploadvoice cgi): audio uploaded + delivered to |
| 932 | + recipient + sent bubble on the sender side. Verified end-to-end. | ||
| 932 | 933 | ||
| 933 | **DO NOT implement SILK encoding yourself.** This tool handles the entire | 934 | **DO NOT implement SILK encoding yourself.** This tool handles the entire |
| 934 | pipeline. Just pass the text you want spoken. | 935 | pipeline. Just pass the text you want spoken. |
phoneuse/wechat_hook_send.py
| @@ -472,7 +472,8 @@ def send_voice_tts_via_hook( | @@ -472,7 +472,8 @@ def send_voice_tts_via_hook( | ||
| 472 | """Generate TTS from *text* and send as WeChat voice message to *wxid*. | 472 | """Generate TTS from *text* and send as WeChat voice message to *wxid*. |
| 473 | 473 | ||
| 474 | End-to-end: edge-tts → ffmpeg (16kHz PCM) → silk-wasm (SILK V3) → | 474 | End-to-end: edge-tts → ffmpeg (16kHz PCM) → silk-wasm (SILK V3) → |
| 475 | - wechathook SEND_VOICE_INTERNAL broadcast → WeChat DB insert, status=4. | 475 | + wechathook SEND_VOICE_CGI (internal uploadvoice cgi): uploads the audio + delivers |
| 476 | + to the recipient AND inserts a sent bubble on the sender side. Verified end-to-end. | ||
| 476 | 477 | ||
| 477 | Args: | 478 | Args: |
| 478 | wxid: talker id (e.g. 'filehelper'). IMPORTANT: test only with 'filehelper'. | 479 | wxid: talker id (e.g. 'filehelper'). IMPORTANT: test only with 'filehelper'. |
| @@ -498,10 +499,11 @@ def send_voice_tts_via_hook( | @@ -498,10 +499,11 @@ def send_voice_tts_via_hook( | ||
| 498 | except Exception as e: | 499 | except Exception as e: |
| 499 | return {"status": "error", "error": f"TTS/SILK generation failed: {e}"} | 500 | return {"status": "error", "error": f"TTS/SILK generation failed: {e}"} |
| 500 | 501 | ||
| 501 | - # Delegate staging + broadcast to send_voice_via_hook (it handles both | ||
| 502 | - # on-device and off-device paths). Must call while tmp dir is still alive. | ||
| 503 | - result = send_voice_via_hook(wxid=wxid, silk_path=silk_path, | ||
| 504 | - duration_ms=duration_ms) | 502 | + # Delegate staging + broadcast to the fully-synthetic cgi sender (uploads audio |
| 503 | + # inline via the internal uploadvoice cgi + delivers to the recipient + inserts a | ||
| 504 | + # sent bubble). Must call while tmp dir is still alive. | ||
| 505 | + result = send_voice_cgi_via_hook(wxid=wxid, silk_path=silk_path, | ||
| 506 | + duration_ms=duration_ms) | ||
| 505 | result["tts_text"] = text[:100] | 507 | result["tts_text"] = text[:100] |
| 506 | result["tts_voice"] = voice | 508 | result["tts_voice"] = voice |
| 507 | return result | 509 | return result |