fix: Windows IP changed 192.168.1.16 -> 192.168.1.248 — update dashboard bridge URL, health checks, agents.yaml

This commit is contained in:
hmo
2026-08-12 16:07:46 +08:00
parent 4b838b5a6b
commit 44b77be525
4 changed files with 23 additions and 23 deletions
+14 -14
View File
@@ -22,7 +22,7 @@ TEMPLATES_DIR = _SCRIPT_DIR / "templates"
CONFIG_DIR = _PROJECT_DIR / "config"
LOGS_DIR = _GATEWAY_DIR / "logs"
TEMP_DIR = _GATEWAY_DIR / "temp"
XMPP_BRIDGE_URL = os.environ.get("XMPP_BRIDGE_URL", "http://192.168.1.16:5807")
XMPP_BRIDGE_URL = os.environ.get("XMPP_BRIDGE_URL", "http://192.168.1.248:5807")
EJABBERD_HOST = os.environ.get("EJABBERD_HOST", "192.168.1.246")
# On Linux (mohe), dashboard runs from systemd with different paths. Support explicit override.
@@ -102,7 +102,7 @@ def _default_agents():
return [
{
"id": "agent-001", "name": "R&D Assistant", "display_name": "xxm",
"jid": "xxm@yoin.fun", "platform": "windows", "host": "192.168.1.16",
"jid": "xxm@yoin.fun", "platform": "windows", "host": "192.168.1.248",
"bot_type": "xmpp", "provider": "volcengine",
"services": [{"type": "xmpp_bot", "port": 5807}],
},
@@ -286,7 +286,7 @@ def api_agents():
# --- Local process (Windows only) ---
local_pid = None
xmpp_connected = False
if platform == "windows" and host in ("192.168.1.16", "127.0.0.1", "localhost"):
if platform == "windows" and host in ("192.168.1.248", "127.0.0.1", "localhost"):
for proc in local_procs:
if "xmpp_bot.py" in proc.get("cmdline", ""):
local_pid = proc["pid"]
@@ -304,7 +304,7 @@ def api_agents():
status_reason = "无法检测 XMPP 状态"
elif xmpp_in_ejabberd is True:
status_reason = "OK"
if platform == "windows" and host in ("192.168.1.16", "127.0.0.1", "localhost"):
if platform == "windows" and host in ("192.168.1.248", "127.0.0.1", "localhost"):
if status_reason == "OK":
status_reason = "OK"
elif xmpp_connected:
@@ -358,7 +358,7 @@ def api_agents():
status = "online"
elif xmpp_in_ejabberd is False:
status = "offline"
elif platform == "windows" and host in ("192.168.1.16", "127.0.0.1", "localhost"):
elif platform == "windows" and host in ("192.168.1.248", "127.0.0.1", "localhost"):
if xmpp_connected:
status = "online"
elif local_pid:
@@ -392,7 +392,7 @@ def api_agents():
"message_count_5min": message_count,
"errors": 0,
"offline_checks": _offline_counter.get(agent_id, 0),
"restartable": (platform == "windows" and host in ("192.168.1.16", "127.0.0.1", "localhost")) or
"restartable": (platform == "windows" and host in ("192.168.1.248", "127.0.0.1", "localhost")) or
(platform == "linux" and host in LOCAL_LINUX_HOSTS),
"services": services,
})
@@ -418,7 +418,7 @@ def _try_auto_recover(agent):
return
# Windows local → subprocess
if platform != "windows" or host not in ("192.168.1.16", "127.0.0.1", "localhost"):
if platform != "windows" or host not in ("192.168.1.248", "127.0.0.1", "localhost"):
return
for svc in agent.get("services", []):
script_name = SCRIPT_NAMES.get(svc.get("type", ""))
@@ -561,7 +561,7 @@ PLATFORM_SERVICES = [
"host": "192.168.1.246", "port": 3001},
{"id": "article_processor", "name": "文章抓取服务 (5810)", "type": "wechat-fetch",
"desc": "fetches wechat article content + OCR (DrissionPage)",
"host": "192.168.1.16", "health_url": "http://192.168.1.16:5810/health"},
"host": "192.168.1.248", "health_url": "http://192.168.1.248:5810/health"},
]
@@ -798,7 +798,7 @@ def api_platform():
def api_article_processor_logs():
"""Proxy logs from article-processor service on Windows."""
try:
req = urllib.request.Request("http://192.168.1.16:5810/logs?lines=200")
req = urllib.request.Request("http://192.168.1.248:5810/logs?lines=200")
with urllib.request.urlopen(req, timeout=5) as resp:
data = json.loads(resp.read())
lines = data.get("lines", [])
@@ -948,7 +948,7 @@ def api_services():
"watchdog": True, "pid_lock": True, "type": "core", "depends_on": ["ejabberd"]}
services.append(svc1)
# article_processor (跨平台:通过 PLATFORM_SERVICES 中的 health_url)
ap_url = "http://192.168.1.16:5810/health"
ap_url = "http://192.168.1.248:5810/health"
svc2 = {"name": "article_processor", "port": 5810, "health": _health_status(ap_url),
"watchdog": True, "pid_lock": False, "type": "bridge", "depends_on": []}
services.append(svc2)
@@ -1455,7 +1455,7 @@ def api_usage_refresh():
log.info("usage: starting Kimi collector via SSH")
kimi_cmd = [
"ssh", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=10",
"-o", "BatchMode=yes", "hmo@192.168.1.16",
"-o", "BatchMode=yes", "hmo@192.168.1.248",
r'"C:\Users\hmo\AppData\Local\Programs\Python\Python310\python.exe" "D:\F\NewI\opencode\daily-workspace\projects\AgentsMeeting\gateway\scripts\usage_collector_kimi.py"'
]
proc2 = subprocess.run(kimi_cmd, capture_output=True, text=True, timeout=60)
@@ -1466,7 +1466,7 @@ def api_usage_refresh():
# 3. scp Kimi 结果回 246
scp_cmd = [
"scp", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=10",
"hmo@192.168.1.16:D:/F/NewI/opencode/daily-workspace/projects/AgentsMeeting/gateway/temp/usage_stats_kimi.json",
"hmo@192.168.1.248:D:/F/NewI/opencode/daily-workspace/projects/AgentsMeeting/gateway/temp/usage_stats_kimi.json",
str(TEMP_DIR / "usage_stats_kimi.json")
]
proc3 = subprocess.run(scp_cmd, capture_output=True, timeout=15)
@@ -1477,7 +1477,7 @@ def api_usage_refresh():
log.info("usage: starting SenseNova collector via SSH")
sn_cmd = [
"ssh", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=10",
"-o", "BatchMode=yes", "hmo@192.168.1.16",
"-o", "BatchMode=yes", "hmo@192.168.1.248",
r'"C:\Users\hmo\AppData\Local\Programs\Python\Python310\python.exe" "D:\F\NewI\opencode\daily-workspace\projects\AgentsMeeting\gateway\scripts\usage_collector_sensenova.py"'
]
proc4 = subprocess.run(sn_cmd, capture_output=True, text=True, timeout=90)
@@ -1486,7 +1486,7 @@ def api_usage_refresh():
log.warning(f"usage_sensenova stderr: {proc4.stderr[-300:]}")
scp4 = subprocess.run([
"scp", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=10",
"hmo@192.168.1.16:D:/F/NewI/opencode/daily-workspace/projects/AgentsMeeting/gateway/temp/usage_stats_sensenova.json",
"hmo@192.168.1.248:D:/F/NewI/opencode/daily-workspace/projects/AgentsMeeting/gateway/temp/usage_stats_sensenova.json",
str(TEMP_DIR / "usage_stats_sensenova.json")
], capture_output=True, timeout=15)
log.info(f"usage: SenseNova scp done (rc={scp4.returncode})")