38bf407c3a
核心修改: - GitHub: 零配置=公开仓库可读可搜,配置 gh/token 后=Fork、Issue、PR、Review 全部可用 - Reddit: 三层能力——Exa 搜索(免费)→代理读帖子→OAuth Bot 高级操作(发帖等) - 小红书: 必须配 Cookie,没有降级方案,明确说明 - B站: 本地可用/服务器需代理,区分清楚 - Twitter: 零配置可读推文,birdx+Cookie 解锁搜索发推 每个渠道的 check() 方法都改为自定义逻辑,精确反映当前环境的实际能力。
78 lines
2.6 KiB
Python
78 lines
2.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Environment health checker — powered by channels.
|
|
|
|
Each channel knows how to check itself. Doctor just collects the results.
|
|
"""
|
|
|
|
from typing import Dict
|
|
from agent_eyes.config import Config
|
|
from agent_eyes.channels import get_all_channels
|
|
|
|
|
|
def check_all(config: Config) -> Dict[str, dict]:
|
|
"""Check all channels and return status dict."""
|
|
results = {}
|
|
for ch in get_all_channels():
|
|
status, message = ch.check(config)
|
|
results[ch.name] = {
|
|
"status": status,
|
|
"name": ch.description,
|
|
"message": message,
|
|
"tier": ch.tier,
|
|
"backends": ch.backends,
|
|
}
|
|
return results
|
|
|
|
|
|
def format_report(results: Dict[str, dict]) -> str:
|
|
"""Format results as a readable text report."""
|
|
lines = []
|
|
lines.append("👁️ Agent Eyes 状态")
|
|
lines.append("=" * 40)
|
|
|
|
ok_count = sum(1 for r in results.values() if r["status"] == "ok")
|
|
total = len(results)
|
|
|
|
# Tier 0 — zero config
|
|
lines.append("")
|
|
lines.append("✅ 装好即用:")
|
|
for key, r in results.items():
|
|
if r["tier"] == 0:
|
|
if r["status"] == "ok":
|
|
lines.append(f" ✅ {r['name']} — {r['message']}")
|
|
elif r["status"] == "warn":
|
|
lines.append(f" ⚠️ {r['name']} — {r['message']}")
|
|
elif r["status"] in ("off", "error"):
|
|
lines.append(f" ❌ {r['name']} — {r['message']}")
|
|
|
|
# Tier 1 — needs free key
|
|
tier1 = {k: r for k, r in results.items() if r["tier"] == 1}
|
|
if tier1:
|
|
lines.append("")
|
|
lines.append("🔍 搜索(免费 Exa Key 即可解锁):")
|
|
for key, r in tier1.items():
|
|
if r["status"] == "ok":
|
|
lines.append(f" ✅ {r['name']}")
|
|
else:
|
|
lines.append(f" ⬜ {r['name']} — 注册 exa.ai 获取免费 Key,配置一下就能用")
|
|
|
|
# Tier 2 — optional setup
|
|
tier2 = {k: r for k, r in results.items() if r["tier"] == 2}
|
|
if tier2:
|
|
lines.append("")
|
|
lines.append("🔧 配置后可用:")
|
|
for key, r in tier2.items():
|
|
if r["status"] == "ok":
|
|
lines.append(f" ✅ {r['name']} — {r['message']}")
|
|
elif r["status"] == "warn":
|
|
lines.append(f" ⚠️ {r['name']} — {r['message']}")
|
|
else:
|
|
lines.append(f" ⬜ {r['name']} — {r['message']}")
|
|
|
|
lines.append("")
|
|
lines.append(f"状态:{ok_count}/{total} 个渠道可用")
|
|
if ok_count < total:
|
|
lines.append("运行 `agent-eyes setup` 解锁更多渠道")
|
|
|
|
return "\n".join(lines)
|