51 lines
2.1 KiB
JSON
51 lines
2.1 KiB
JSON
{
|
||
"module": "api_proxy",
|
||
"version": "1.0",
|
||
"purpose": "API Proxy 运行在 Windows (192.168.1.16:8787),为 VolcEngine(火山引擎)等外部 API 提供代理转发、重试和降级能力。",
|
||
"ui_location": "Infrastructure tab → Platform → API Proxy",
|
||
|
||
"human_help": {
|
||
"title": "API Proxy(API 代理 :8787)",
|
||
"description": [
|
||
"API Proxy 是一个轻量级反向代理,专门用于转发 VolcEngine(火山引擎)DeepSeek API 的请求。",
|
||
"主要功能:",
|
||
"• 请求代理——将内部请求转发到 VolcEngine 端点",
|
||
"• 自动重试——遇到网络抖动时自动重试",
|
||
"• 失败降级——主 API 不可用时自动切换到备用端点",
|
||
"简单说:它就是 AI API 的'中间人',保证请求能发出去、失败能重来。"
|
||
],
|
||
"usage": [
|
||
"监控状态:在 Infrastructure → Platform 下查看状态指示灯",
|
||
"如果状态为 stopped:AI 请求会直接失败",
|
||
"需要先确认 WeChat Bridge 正常运行"
|
||
],
|
||
"troubleshooting": [
|
||
"如果 API Proxy 停止:检查 Windows 上 api_proxy.py 进程是否在运行",
|
||
"排障命令:检查端口 8787 是否监听",
|
||
"重试策略:超时 5s,最多重试 2 次,失败后尝试备用端点"
|
||
],
|
||
"related": "WeChat Bridge(依赖 API Proxy 访问 AI)、Ejabberd(底层通信)"
|
||
},
|
||
|
||
"ai_spec": {
|
||
"apis": [
|
||
{"method": "POST", "path": "/v1/chat/completions", "returns": "OpenAI 兼容的 chat completion 响应"},
|
||
{"method": "GET", "path": "/health", "returns": "{ok, status}"}
|
||
],
|
||
"dependencies": [
|
||
"依赖 VolcEngine(火山引擎)API 可用",
|
||
"依赖 Windows 网络连通性"
|
||
],
|
||
"constraints": [
|
||
"仅用于 AI 模型 API 调用,不代理其他流量",
|
||
"重试策略:5s 超时 + 2 次重试 + 备用端点自动切换",
|
||
"端口 8787 在 Windows 上监听"
|
||
],
|
||
"related_files": [
|
||
"gateway/scripts/api_proxy.py — 实际运行脚本",
|
||
"gateway/scripts/templates/dashboard.html — fI() 状态展示",
|
||
"gateway/scripts/specs/api_proxy.json — 本 spec 文件"
|
||
]
|
||
}
|
||
}
|