将 CodeBuddy AI 集成到 Jupyter AI 的 provider 插件。
# 使用 conda(推荐)
conda create -n jupyter-ai python=3.12
conda activate jupyter-ai
# 或使用 venv
python3.12 -m venv venv
source venv/bin/activate # Linux/macOS
# venv\Scripts\activate # Windows
pip install jupyterlab jupyter-ai
cd jupyter-ai-codebuddy
pip install -e .
# 检查扩展是否正确加载
jupyter server extension list
# 应该看到以下输出:
# jupyter_ai enabled
# - Validating jupyter_ai...
# jupyter_ai x.x.x OK
jupyter lab
原因:jupyter-ai 扩展未安装或安装在不同的 Python 环境中。
解决方法:
确认当前使用的 Python 环境:
which python
which jupyter
确保 jupyter-ai 安装在运行 jupyter lab 的同一环境中:
# 查看 jupyter lab 使用的 Python
jupyter --path
# 在对应环境安装
pip install jupyter-ai
如果看到 Pydantic V1 functionality isn't compatible with Python 3.14 警告,建议使用 Python 3.12 环境。
如果通过 Homebrew 安装了 JupyterLab,需要在其对应的 Python 环境中安装扩展:
# 查找 Homebrew JupyterLab 的 Python
/opt/homebrew/Cellar/jupyterlab/*/libexec/bin/python -m pip install jupyter-ai
/opt/homebrew/Cellar/jupyterlab/*/libexec/bin/python -m pip install -e .
jupyter lab%load_ext jupyter_ai_magics
%%ai codebuddy:glm-4.7
请解释 Python 的装饰器是什么
| 模型名称 | 模型 ID |
|---|---|
| GLM-4.7 | glm-4.7 |
| GLM-4.6 | glm-4.6 |
| DeepSeek-V3.2 | deepseek-v3-2-volc |
| DeepSeek-V3.1 | deepseek-v3.1 |
| DeepSeek-V3 | deepseek-v3-0324 |
Provider 默认使用 CodeBuddy CLI 的登录认证,无需额外配置 API Key。
如需自定义,可设置环境变量:
export CODEBUDDY_API_KEY="your-api-key"
export CODEBUDDY_BASE_URL="custom-base-url"
# 克隆项目
git clone <repo-url>
cd jupyter-ai-codebuddy
# 安装开发依赖
pip install -e ".[dev]"
# 修改代码后需重启 JupyterLab
jupyter lab
MIT