revert: Windows now static IP 192.168.1.16 (was .248 DHCP) — restore .16 in configs

This commit is contained in:
hmo
2026-08-12 21:51:08 +08:00
parent f19f93931a
commit 936925c74f
4 changed files with 21 additions and 21 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ agents:
display_name: "小小莫" display_name: "小小莫"
jid: "xxm@yoin.fun" jid: "xxm@yoin.fun"
platform: windows platform: windows
host: "192.168.1.248" host: "192.168.1.16"
bot_type: xmpp bot_type: xmpp
provider: volcengine provider: volcengine
services: services:
+2 -2
View File
@@ -37,8 +37,8 @@ SERVICES = [
{"name": "hermes_gateway_mohe", "host": "127.0.0.1", "port": 8642, "health_url": "http://127.0.0.1:8642/v1/health", "depends_on": [], "desc": "莫荷 AI Gateway"}, {"name": "hermes_gateway_mohe", "host": "127.0.0.1", "port": 8642, "health_url": "http://127.0.0.1:8642/v1/health", "depends_on": [], "desc": "莫荷 AI Gateway"},
{"name": "hermes_gateway_zhiwei","host": "127.0.0.1", "port": 8643, "health_url": "http://127.0.0.1:8643/v1/health", "depends_on": [], "desc": "知微 AI Gateway"}, {"name": "hermes_gateway_zhiwei","host": "127.0.0.1", "port": 8643, "health_url": "http://127.0.0.1:8643/v1/health", "depends_on": [], "desc": "知微 AI Gateway"},
{"name": "wechat_bridge", "host": "127.0.0.1", "port": 3001, "health_url": None, "depends_on": [], "desc": "微信桥接 Docker"}, {"name": "wechat_bridge", "host": "127.0.0.1", "port": 3001, "health_url": None, "depends_on": [], "desc": "微信桥接 Docker"},
{"name": "xmpp_bot_xxm", "host": "192.168.1.248", "port": 5807, "health_url": "http://192.168.1.248:5807/health", "depends_on": ["ejabberd"],"desc": "小小莫 XMPP Bot"}, {"name": "xmpp_bot_xxm", "host": "192.168.1.16", "port": 5807, "health_url": "http://192.168.1.16:5807/health", "depends_on": ["ejabberd"],"desc": "小小莫 XMPP Bot"},
{"name": "article_processor", "host": "192.168.1.248", "port": 5810, "health_url": "http://192.168.1.248:5810/health", "depends_on": [], "desc": "文章抓取服务"}, {"name": "article_processor", "host": "192.168.1.16", "port": 5810, "health_url": "http://192.168.1.16:5810/health", "depends_on": [], "desc": "文章抓取服务"},
] ]
# ── 期望的定时任务(crontab 条目关键字)────────────────── # ── 期望的定时任务(crontab 条目关键字)──────────────────
+4 -4
View File
@@ -79,18 +79,18 @@ SERVICES = [
# === 远程服务(跨网 HTTP 检查)=== # === 远程服务(跨网 HTTP 检查)===
{ {
"name": "xmpp_bot_xxm", "name": "xmpp_bot_xxm",
"host": "192.168.1.248", "host": "192.168.1.16",
"port": 5807, "port": 5807,
"health_url": "http://192.168.1.248:5807/health", "health_url": "http://192.168.1.16:5807/health",
"fix_cmd": None, # 远程服务无法自动修复 "fix_cmd": None, # 远程服务无法自动修复
"remote": True, "remote": True,
"critical": True, "critical": True,
}, },
{ {
"name": "article_processor", "name": "article_processor",
"host": "192.168.1.248", "host": "192.168.1.16",
"port": 5810, "port": 5810,
"health_url": "http://192.168.1.248:5810/health", "health_url": "http://192.168.1.16:5810/health",
"fix_cmd": None, "fix_cmd": None,
"remote": True, "remote": True,
"critical": False, "critical": False,
+14 -14
View File
@@ -22,7 +22,7 @@ TEMPLATES_DIR = _SCRIPT_DIR / "templates"
CONFIG_DIR = _PROJECT_DIR / "config" CONFIG_DIR = _PROJECT_DIR / "config"
LOGS_DIR = _GATEWAY_DIR / "logs" LOGS_DIR = _GATEWAY_DIR / "logs"
TEMP_DIR = _GATEWAY_DIR / "temp" TEMP_DIR = _GATEWAY_DIR / "temp"
XMPP_BRIDGE_URL = os.environ.get("XMPP_BRIDGE_URL", "http://192.168.1.248:5807") XMPP_BRIDGE_URL = os.environ.get("XMPP_BRIDGE_URL", "http://192.168.1.16:5807")
EJABBERD_HOST = os.environ.get("EJABBERD_HOST", "192.168.1.246") EJABBERD_HOST = os.environ.get("EJABBERD_HOST", "192.168.1.246")
# On Linux (mohe), dashboard runs from systemd with different paths. Support explicit override. # On Linux (mohe), dashboard runs from systemd with different paths. Support explicit override.
@@ -102,7 +102,7 @@ def _default_agents():
return [ return [
{ {
"id": "agent-001", "name": "R&D Assistant", "display_name": "xxm", "id": "agent-001", "name": "R&D Assistant", "display_name": "xxm",
"jid": "xxm@yoin.fun", "platform": "windows", "host": "192.168.1.248", "jid": "xxm@yoin.fun", "platform": "windows", "host": "192.168.1.16",
"bot_type": "xmpp", "provider": "volcengine", "bot_type": "xmpp", "provider": "volcengine",
"services": [{"type": "xmpp_bot", "port": 5807}], "services": [{"type": "xmpp_bot", "port": 5807}],
}, },
@@ -286,7 +286,7 @@ def api_agents():
# --- Local process (Windows only) --- # --- Local process (Windows only) ---
local_pid = None local_pid = None
xmpp_connected = False xmpp_connected = False
if platform == "windows" and host in ("192.168.1.248", "127.0.0.1", "localhost"): if platform == "windows" and host in ("192.168.1.16", "127.0.0.1", "localhost"):
for proc in local_procs: for proc in local_procs:
if "xmpp_bot.py" in proc.get("cmdline", ""): if "xmpp_bot.py" in proc.get("cmdline", ""):
local_pid = proc["pid"] local_pid = proc["pid"]
@@ -304,7 +304,7 @@ def api_agents():
status_reason = "无法检测 XMPP 状态" status_reason = "无法检测 XMPP 状态"
elif xmpp_in_ejabberd is True: elif xmpp_in_ejabberd is True:
status_reason = "OK" status_reason = "OK"
if platform == "windows" and host in ("192.168.1.248", "127.0.0.1", "localhost"): if platform == "windows" and host in ("192.168.1.16", "127.0.0.1", "localhost"):
if status_reason == "OK": if status_reason == "OK":
status_reason = "OK" status_reason = "OK"
elif xmpp_connected: elif xmpp_connected:
@@ -358,7 +358,7 @@ def api_agents():
status = "online" status = "online"
elif xmpp_in_ejabberd is False: elif xmpp_in_ejabberd is False:
status = "offline" status = "offline"
elif platform == "windows" and host in ("192.168.1.248", "127.0.0.1", "localhost"): elif platform == "windows" and host in ("192.168.1.16", "127.0.0.1", "localhost"):
if xmpp_connected: if xmpp_connected:
status = "online" status = "online"
elif local_pid: elif local_pid:
@@ -392,7 +392,7 @@ def api_agents():
"message_count_5min": message_count, "message_count_5min": message_count,
"errors": 0, "errors": 0,
"offline_checks": _offline_counter.get(agent_id, 0), "offline_checks": _offline_counter.get(agent_id, 0),
"restartable": (platform == "windows" and host in ("192.168.1.248", "127.0.0.1", "localhost")) or "restartable": (platform == "windows" and host in ("192.168.1.16", "127.0.0.1", "localhost")) or
(platform == "linux" and host in LOCAL_LINUX_HOSTS), (platform == "linux" and host in LOCAL_LINUX_HOSTS),
"services": services, "services": services,
}) })
@@ -418,7 +418,7 @@ def _try_auto_recover(agent):
return return
# Windows local → subprocess # Windows local → subprocess
if platform != "windows" or host not in ("192.168.1.248", "127.0.0.1", "localhost"): if platform != "windows" or host not in ("192.168.1.16", "127.0.0.1", "localhost"):
return return
for svc in agent.get("services", []): for svc in agent.get("services", []):
script_name = SCRIPT_NAMES.get(svc.get("type", "")) script_name = SCRIPT_NAMES.get(svc.get("type", ""))
@@ -561,7 +561,7 @@ PLATFORM_SERVICES = [
"host": "192.168.1.246", "port": 3001}, "host": "192.168.1.246", "port": 3001},
{"id": "article_processor", "name": "文章抓取服务 (5810)", "type": "wechat-fetch", {"id": "article_processor", "name": "文章抓取服务 (5810)", "type": "wechat-fetch",
"desc": "fetches wechat article content + OCR (DrissionPage)", "desc": "fetches wechat article content + OCR (DrissionPage)",
"host": "192.168.1.248", "health_url": "http://192.168.1.248:5810/health"}, "host": "192.168.1.16", "health_url": "http://192.168.1.16:5810/health"},
] ]
@@ -810,7 +810,7 @@ def api_platform():
def api_article_processor_logs(): def api_article_processor_logs():
"""Proxy logs from article-processor service on Windows.""" """Proxy logs from article-processor service on Windows."""
try: try:
req = urllib.request.Request("http://192.168.1.248:5810/logs?lines=200") req = urllib.request.Request("http://192.168.1.16:5810/logs?lines=200")
with urllib.request.urlopen(req, timeout=5) as resp: with urllib.request.urlopen(req, timeout=5) as resp:
data = json.loads(resp.read()) data = json.loads(resp.read())
lines = data.get("lines", []) lines = data.get("lines", [])
@@ -960,7 +960,7 @@ def api_services():
"watchdog": True, "pid_lock": True, "type": "core", "depends_on": ["ejabberd"]} "watchdog": True, "pid_lock": True, "type": "core", "depends_on": ["ejabberd"]}
services.append(svc1) services.append(svc1)
# article_processor (跨平台:通过 PLATFORM_SERVICES 中的 health_url) # article_processor (跨平台:通过 PLATFORM_SERVICES 中的 health_url)
ap_url = "http://192.168.1.248:5810/health" ap_url = "http://192.168.1.16:5810/health"
svc2 = {"name": "article_processor", "port": 5810, "health": _health_status(ap_url), svc2 = {"name": "article_processor", "port": 5810, "health": _health_status(ap_url),
"watchdog": True, "pid_lock": False, "type": "bridge", "depends_on": []} "watchdog": True, "pid_lock": False, "type": "bridge", "depends_on": []}
services.append(svc2) services.append(svc2)
@@ -1467,7 +1467,7 @@ def api_usage_refresh():
log.info("usage: starting Kimi collector via SSH") log.info("usage: starting Kimi collector via SSH")
kimi_cmd = [ kimi_cmd = [
"ssh", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=10", "ssh", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=10",
"-o", "BatchMode=yes", "hmo@192.168.1.248", "-o", "BatchMode=yes", "hmo@192.168.1.16",
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"' 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) proc2 = subprocess.run(kimi_cmd, capture_output=True, text=True, timeout=60)
@@ -1478,7 +1478,7 @@ def api_usage_refresh():
# 3. scp Kimi 结果回 246 # 3. scp Kimi 结果回 246
scp_cmd = [ scp_cmd = [
"scp", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=10", "scp", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=10",
"hmo@192.168.1.248:D:/F/NewI/opencode/daily-workspace/projects/AgentsMeeting/gateway/temp/usage_stats_kimi.json", "hmo@192.168.1.16:D:/F/NewI/opencode/daily-workspace/projects/AgentsMeeting/gateway/temp/usage_stats_kimi.json",
str(TEMP_DIR / "usage_stats_kimi.json") str(TEMP_DIR / "usage_stats_kimi.json")
] ]
proc3 = subprocess.run(scp_cmd, capture_output=True, timeout=15) proc3 = subprocess.run(scp_cmd, capture_output=True, timeout=15)
@@ -1489,7 +1489,7 @@ def api_usage_refresh():
log.info("usage: starting SenseNova collector via SSH") log.info("usage: starting SenseNova collector via SSH")
sn_cmd = [ sn_cmd = [
"ssh", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=10", "ssh", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=10",
"-o", "BatchMode=yes", "hmo@192.168.1.248", "-o", "BatchMode=yes", "hmo@192.168.1.16",
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"' 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) proc4 = subprocess.run(sn_cmd, capture_output=True, text=True, timeout=90)
@@ -1498,7 +1498,7 @@ def api_usage_refresh():
log.warning(f"usage_sensenova stderr: {proc4.stderr[-300:]}") log.warning(f"usage_sensenova stderr: {proc4.stderr[-300:]}")
scp4 = subprocess.run([ scp4 = subprocess.run([
"scp", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=10", "scp", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=10",
"hmo@192.168.1.248:D:/F/NewI/opencode/daily-workspace/projects/AgentsMeeting/gateway/temp/usage_stats_sensenova.json", "hmo@192.168.1.16:D:/F/NewI/opencode/daily-workspace/projects/AgentsMeeting/gateway/temp/usage_stats_sensenova.json",
str(TEMP_DIR / "usage_stats_sensenova.json") str(TEMP_DIR / "usage_stats_sensenova.json")
], capture_output=True, timeout=15) ], capture_output=True, timeout=15)
log.info(f"usage: SenseNova scp done (rc={scp4.returncode})") log.info(f"usage: SenseNova scp done (rc={scp4.returncode})")