feat(router): 在路由模式下仅处理特定命令
在路由模式下,本地仅处理路由相关命令(/nodes, /node, /help等),其他会话命令直接转发到节点。同时优化路由代理逻辑,对于会话命令直接转发到活跃节点,减少不必要的LLM调用。
This commit is contained in:
@@ -77,7 +77,14 @@ async def route(user_id: str, chat_id: str, text: str) -> tuple[Optional[str], s
|
||||
return online_nodes[0].node_id, "Only one node available"
|
||||
|
||||
if text.strip().startswith("/"):
|
||||
return "meta", "Meta command"
|
||||
cmd = text.strip().split()[0].lower()
|
||||
if cmd in ("/nodes", "/node", "/help", "/h", "/?"):
|
||||
return "meta", "Meta command"
|
||||
# Session commands: forward to active node directly (no LLM call needed)
|
||||
active = registry.get_active_node(user_id)
|
||||
if active:
|
||||
return active.node_id, "Forwarding command to active node"
|
||||
return online_nodes[0].node_id, "Forwarding command to first available node"
|
||||
|
||||
active_node = registry.get_active_node(user_id)
|
||||
active_node_id = active_node.node_id if active_node else None
|
||||
|
||||
Reference in New Issue
Block a user