Notebook Intelligence

Notebook Intelligence

未知

简介

笔记本智能是 JupyterLab 的 AI 编码助手,支持多种 LLM 提供商,包括 GitHub Copilot 和本地模型。

安装

pip install notebook-intelligence

要求: JupyterLab >= 4.0.0

主要功能

  • 代码生成与内联聊天
  • 智能代码自动补全
  • 交互式聊天界面

配置设置

配置 LLM 提供商

  1. 访问"笔记本智能设置"对话框 (通过 JupyterLab 设置菜单或使用 /settings 命令)
  2. 选择所需的 LLM 提供商和模型

记住 GitHub Copilot 登录

# 启用令牌记忆
jupyter lab --NotebookIntelligence.github_access_token=remember

# 清除存储的令牌
jupyter lab --NotebookIntelligence.github_access_token=forget

配置文件

  • 用户配置: ~/.jupyter/nbi-config.json
  • 环境配置: <env-prefix>/share/jupyter/nbi-config.json

重要: 修改配置文件后需要重启 JupyterLab

MCP 服务器集成

添加 MCP 服务器到配置文件:

{
    "mcp": {
        "mcpServers": {
            "filesystem": {
                "command": "npx",
                "args": [
                    "-y",
                    "@modelcontextprotocol/server-filesystem",
                    "/path/to/directory"
                ]
            }
        }
    }
}

通过在聊天中使用 @mcp 访问 MCP 工具,或用 @mcp /info 获取工具信息。

了解更多

查看官方博客了解详细功能和高级用法。