VSCode + Continue + Ollama 实现本地 AI 编程助手
在 Visual Studio Code 中集成 Continue 插件并结合本地 Ollama 服务,构建类似 Cursor 或 Copilot 的本地 AI 编程助手的方法。内容涵盖 Ollama 的安装、模型拉取及配置,Continue 插件的启用与索引设置,以及命令行工具的试用。此外还对比了 CODEX 等替代方案的配置方式,提供了完整的本地化代码辅助开发流程。

在 Visual Studio Code 中集成 Continue 插件并结合本地 Ollama 服务,构建类似 Cursor 或 Copilot 的本地 AI 编程助手的方法。内容涵盖 Ollama 的安装、模型拉取及配置,Continue 插件的启用与索引设置,以及命令行工具的试用。此外还对比了 CODEX 等替代方案的配置方式,提供了完整的本地化代码辅助开发流程。

组合 Visual Studio Code + Continue + Ollama 基本相当于 本地版 Cursor / Copilot,可以实现:

# 1. 安装 Ollama
# macOS: brew install ollama
# Linux: curl -fsSL https://ollama.com/install.sh | sh
# Windows: irm https://ollama.com/install.ps1 | iex 或直接去官网下载安装 https://ollama.com/download/windows
# 2. 拉取模型
ollama pull llama3.3
ollama pull qwen2.5:32b
# 3. 启动 Ollama 服务
ollama serve
# Windows 方法
ollama run llama2
ollama run gemma:2b
在 Ollama 里安装可用的模型,Ollama 官方提供多个参数规模:
| 模型 | 大小 | 下载体积 |
|---|---|---|
| 0.5B | 超轻量 | ~398MB |
| 1.5B | 轻量 | ~1GB |
| 3B | 中等 | ~2GB |
| 7B | 推荐 | ~4.7GB |
| 14B | 强 | ~9GB |
| 32B | 最强 | ~20GB |
C:\Users\audit>ollama run qwen2.5-coder:3b
pulling manifest
pulling 4a188102020e: 100% ▕██████████████████████████████████████████████████████████▏ 1.9 GB
pulling 66b9ea09bd5b: 100% ▕██████████████████████████████████████████████████████████▏ 68 B
pulling 1e65a503067: 100% ▕██████████████████████████████████████████████████████████▏ 1.6 KB
pulling 45fc3ea79a: 100% ▕██████████████████████████████████████████████████████████▏ 7.4 KB
pulling bb9eff3da: 100% ▕██████████████████████████████████████████████████████████▏ 487 B
verifying sha256 digest
writing manifest success
>>> 介绍一下
我是一个大型语言模型,由阿里云开发和提供。我的名字是 Qwen。我是阿里云自主研发的超大规模语言模型,基于大规模预训练数据和先进的算法,能够理解和生成自然语言文本。我可以回答问题、创作文章、撰写代码、提供编程帮助等。我的目标是提供高效、准确和流畅的语言交流服务。
>>> Send a message (/? for help)



还可安装运行在命令行的版本:

npm i -g @continuedev/cli && cn "Explore this repo and provide a concise summary of it's contents"
changed 93 packages in 30s
12 packages are looking for funding
run `npm fund` for details
How do you want to get started?
1. ⏩ Log in with Continue
2. 🔑 Enter your Anthropic API key
Enter choice (1):

发现一个更简单的应用,直接安装即可,可以少去上边的配置:

不知道是否我的配置原因,这个并不好用:


model = "gpt-5.3-codex"
model_reasoning_effort = "medium"
[windows]
sandbox = "elevated"
model = "qwen2.5:3b"
model_provider = "ollama"
model_reasoning_effort = "medium"
[windows]
sandbox = "elevated"
[model_providers.ollama]
name = "Ollama"
base_url = "http://localhost:11434"

ollama launch codex --model qwen3
# https://ollama.com/library/qwen3
pulling manifest
pulling a3de86cd1c13: 100% ▕██████████████████████████████████████████████████████████▏ 5.2 GB
pulling ae370d8f10: 100% ▕██████████████████████████████████████████████████████████▏ 1.7 KB
pulling d18a5cc14: 100% ▕██████████████████████████████████████████████████████████▏ 11 KB
pulling cff3f395ef3: 100% ▕██████████████████████████████████████████████████████████▏ 120 B
pulling 05a6d3084: 100% ▕██████████████████████████████████████████████████████████▏ 487 B
verifying sha256 digest
writing manifest success
Launching Codex with qwen3...
Error: codex is not installed, install with: npm install -g @openai/codex

微信公众号「极客日志」,在微信中扫描左侧二维码关注。展示文案:极客日志 zeeklog
生成新的随机RSA私钥和公钥pem证书。 在线工具,RSA密钥对生成器在线工具,online
基于 Mermaid.js 实时预览流程图、时序图等图表,支持源码编辑与即时渲染。 在线工具,Mermaid 预览与可视化编辑在线工具,online
将字符串编码和解码为其 Base64 格式表示形式即可。 在线工具,Base64 字符串编码/解码在线工具,online
将字符串、文件或图像转换为其 Base64 表示形式。 在线工具,Base64 文件转换器在线工具,online
将 Markdown(GFM)转为 HTML 片段,浏览器内 marked 解析;与 HTML 转 Markdown 互为补充。 在线工具,Markdown 转 HTML在线工具,online
将 HTML 片段转为 GitHub Flavored Markdown,支持标题、列表、链接、代码块与表格等;浏览器内处理,可链接预填。 在线工具,HTML 转 Markdown在线工具,online