feat(routing): ordered backend candidates + real-probing doctor
- backends is now an ordered candidate list (first = preferred); channels report the backend actually serving via active_backend, surfaced in the doctor text report and --json - new agent_reach/probe.py really executes upstream commands and tells apart missing / broken (stale venv shebang after a system Python upgrade) / timeout, with a reinstall prescription for broken installs - all 13 channels migrated off which()-only checks: fixes bilibili false-positive "bili-cli 可用" on broken shims, misleading xiaohongshu "连接失败", rdt OSError crashing doctor, mcporter breakage masquerading as "未配置" - twitter: 15s probe + 1 retry (flaky 10s timeout), broken twitter-cli now falls back to bird instead of aborting the check - doctor survives per-channel exceptions; config supports per-channel backend override (<channel>_backend / <CHANNEL>_BACKEND env) - fix skill install/uninstall crash on symlinked skill dirs (the "[Errno None] None" warning from shutil.rmtree on a symlink) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
"""Xiaoyuzhou Podcast (小宇宙播客) — transcribe podcasts via Groq Whisper API."""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
from agent_reach.config import Config
|
||||
from agent_reach.probe import probe_command
|
||||
from .base import Channel
|
||||
|
||||
|
||||
@@ -19,13 +19,21 @@ class XiaoyuzhouChannel(Channel):
|
||||
return "xiaoyuzhoufm.com" in d
|
||||
|
||||
def check(self, config=None):
|
||||
# Check ffmpeg
|
||||
if not shutil.which("ffmpeg"):
|
||||
self.active_backend = None
|
||||
|
||||
# Check ffmpeg — really execute it: a stale pip-installed ffmpeg shim
|
||||
# passes shutil.which() but cannot run
|
||||
probe = probe_command("ffmpeg", ["-version"], timeout=10, package="ffmpeg")
|
||||
if probe.status == "missing":
|
||||
return "off", (
|
||||
"需要 ffmpeg(音频转码和切片)。安装:\n"
|
||||
" Ubuntu/Debian: apt install -y ffmpeg\n"
|
||||
" macOS: brew install ffmpeg"
|
||||
)
|
||||
if not probe.ok:
|
||||
return "error", (
|
||||
"ffmpeg 无法执行,重装:brew install ffmpeg(macOS)/ apt install ffmpeg(Linux)"
|
||||
)
|
||||
|
||||
# Check script exists
|
||||
script = os.path.expanduser("~/.agent-reach/tools/xiaoyuzhou/transcribe.sh")
|
||||
@@ -51,4 +59,5 @@ class XiaoyuzhouChannel(Channel):
|
||||
" 2. 运行: agent-reach configure groq-key gsk_xxxxx"
|
||||
)
|
||||
|
||||
self.active_backend = "groq-whisper"
|
||||
return "ok", "完整可用(播客下载 + Whisper 转录)"
|
||||
|
||||
Reference in New Issue
Block a user