feat: 添加可配置的命令前缀以避免与Claude Code冲突

引入可配置的COMMAND_PREFIX参数,默认设置为"//"以避免与Claude Code的"/"命令冲突
修改相关文件以支持新的命令前缀,包括配置解析、路由逻辑和命令处理
更新帮助文档和提示信息以反映新的命令前缀
This commit is contained in:
Yuyao Huang (Sam)
2026-03-30 00:11:41 +08:00
parent ed70588d95
commit a278ece348
5 changed files with 85 additions and 56 deletions
+4 -2
View File
@@ -76,9 +76,11 @@ async def route(user_id: str, chat_id: str, text: str) -> tuple[Optional[str], s
if len(online_nodes) == 1:
return online_nodes[0].node_id, "Only one node available"
if text.strip().startswith("/"):
from config import COMMAND_PREFIX
if text.strip().startswith(COMMAND_PREFIX):
cmd = text.strip().split()[0].lower()
if cmd in ("/nodes", "/node", "/help", "/h", "/?"):
meta_cmds = {COMMAND_PREFIX + s for s in ("nodes", "node", "help", "h", "?")}
if cmd in meta_cmds:
return "meta", "Meta command"
# Session commands: forward to active node directly (no LLM call needed)
active = registry.get_active_node(user_id)