feat(router): 在路由模式下仅处理特定命令

在路由模式下,本地仅处理路由相关命令(/nodes, /node, /help等),其他会话命令直接转发到节点。同时优化路由代理逻辑,对于会话命令直接转发到活跃节点,减少不必要的LLM调用。
This commit is contained in:
Yuyao Huang (Sam)
2026-03-29 19:11:56 +08:00
parent c6e38026ec
commit 5a9fe871fe
2 changed files with 14 additions and 1 deletions
+6
View File
@@ -67,6 +67,12 @@ async def handle_command(user_id: str, text: str) -> Optional[str]:
cmd, args = parsed
logger.info("Command: %s args=%r user=...%s", cmd, args[:50], user_id[-8:])
# In ROUTER_MODE, only handle router-specific commands locally.
# Session commands (/status, /new, /close, etc.) fall through to node forwarding.
from config import ROUTER_MODE
if ROUTER_MODE and cmd not in ("/nodes", "/node", "/help", "/h", "/?"):
return None
set_current_user(user_id)
if cmd in ("/new", "/n"):