Continue 编程

前前后后投入一周,毛也没折腾出来,用户社区极差,什么也查不到

放弃,磕别的去,有什么诀窍请继续捂好!

架构概览

系统架构总览

graph TB
    subgraph User-Layer["用户层"]
        VS[VS Code]
        JB[JetBrains IDE]
    end
    
    subgraph Plugin-Layer["Continue 插件层"]
        UI[UI 界面]
        CC[上下文管理]
        AC[自动补全引擎]
        CH[聊天模块]
    end
    
    subgraph Model-Layer["模型层"]
        LM[语言模型接口]
        EM[嵌入模型]
    end
    
    subgraph Provider-Layer["提供商层"]
        subgraph Cloud["云端服务"]
            OA[OpenAI]
            AN[Anthropic]
            GO[Google]
            GR[Groq]
        end
        subgraph Local["本地引擎"]
            OL[Ollama]
            LC[llama.cpp]
            LS[LM Studio]
        end
    end
    
    VS --> UI
    JB --> UI
    UI --> CC
    UI --> AC
    UI --> CH
    CC --> LM
    AC --> LM
    CH --> LM
    LM --> Cloud
    LM --> Local
    CC --> EM

数据流向图

sequenceDiagram
    participant U as 用户
    participant IDE as IDE 界面
    participant C as Continue 插件
    participant M as 模型接口
    participant P as 模型提供商
    
    U->>IDE: 输入代码/提问
    IDE->>C: 转发请求
    C->>C: 收集上下文
    C->>M: 发送请求
    M->>P: API 调用
    P-->>M: 返回响应
    M-->>C: 流式输出
    C-->>IDE: 渲染结果
    IDE-->>U: 显示回答

部署模式对比

graph LR
    subgraph Mode1["模式一:纯云端"]
        A1[IDE] --> B1[Continue]
        B1 --> C1[OpenAI/Anthropic]
    end
    
    subgraph Mode2["模式二:纯本地"]
        A2[IDE] --> B2[Continue]
        B2 --> C2[Ollama/llama.cpp]
    end
    
    subgraph Mode3["模式三:混合模式"]
        A3[IDE] --> B3[Continue]
        B3 --> C3a[云端 - 复杂任务]
        B3 --> C3b[本地 - 简单任务]
    end

快速开始

一分钟快速体验

flowchart TD
    A[安装 Continue 插件] --> B[选择模型提供商]
    B --> C{选择类型}
    C -->|云端 | D[配置 API Key]
    C -->|本地 | E[安装 Ollama]
    D --> F[开始使用]
    E --> G[pull 模型]
    G --> F

步骤 1: 安装插件

VS Code: Ctrl+Shift+X → 搜索 "Continue" → 安装
JetBrains: Settings → Plugins → 搜索 "Continue" → 安装

步骤 2: 配置模型

Ctrl+Shift+P > Continue: Open Settings
/home/at/.continue/config.yaml
----------------------------------------

部署与安装

系统要求

组件最低要求推荐配置
VS Code1.80.0+1.90.0+
JetBrains IDE2022.3+2024.1+
RAM8GB16GB+
GPUNVIDIA/Apple Silicon
磁盘空间2GB10GB+

插件安装流程

flowchart TB
    Start[开始] --> Platform{选择平台}
    
    Platform -->|VS Code| VSStep[扩展面板]
    VSStep --> VSSearch[搜索 Continue]
    VSSearch --> VSInstall[点击安装]
    
    Platform -->|JetBrains| JBStep[设置菜单]
    JBStep --> JBPlugins[Plugins 选项卡]
    JBPlugins --> JBSearch[Marketplace 搜索]
    JBSearch --> JBInstall[点击安装]
    
    VSInstall --> Restart[重启 IDE]
    JBInstall --> Restart
    Restart --> Config[配置模型]
    Config --> Done[完成]

配置详解

配置文件位置

IDE配置文件路径命令打开
VS Code/home/at/.continue/config.yamlContinue: Open Settings
JetBrains.continue/config.tsSettings → Continue

配置 - 默认

name: Local Config
version: 1.0.0
schema: v1
models:
  - name: Llama 3.1 8B
    provider: ollama
    model: llama3.1:8b
    roles:
      - chat
      - edit
      - apply
  - name: Qwen2.5-Coder 1.5B
    provider: ollama
    model: qwen2.5-coder:1.5b-base
    roles:
      - autocomplete
  - name: Nomic Embed
    provider: ollama
    model: nomic-embed-text:latest
    roles:
      - embed

配置 -v100+4060

  • C:\Users\cat\.continue\config.yaml
name: Local Config - LM Studio
version: 1.0.0
schema: v1

models:
  - name: "4060-Qwen3.5-4b-claude"
    provider: "openai"
    model: "4060-Qwen3.5-4b-claude"
    apiBase: "https://4060.atibm.com/v1"
    apiKey: "xxxxxxx" # LMS 没有apiKey也需要设个虽易值
    roles: [chat, edit, apply]

  - name: "4060-Qwen3.5-4b-python"
    provider: "openai"
    model: "4060-Qwen3.5-4b-python" 
    apiBase: "https://4060.atibm.com/v1"
    apiKey: "xxxxxxxx"
    roles: [autocomplete]
    defaultCompletionOptions:
      temperature: 0
      stream: true
      contextLength: 1024
      maxTokens: 512

  - name: "CPU-nomic-embed"
    provider: "openai"
    model: "CPU-nomic-embed"
    apiBase: "https://4060.atibm.com/v1"
    apiKey: "xxxxxxxxxxxx"
    roles: [embed]

操作命令速查

IDE 命令

功能VS CodeJetBrains
打开 ContinueCtrl+PContinueCmd+Shift+AContinue
编辑配置Continue: Edit Settings JSONSettings → Continue
解释选中代码Continue: Explain Selection右键 → Continue → Explain
生成测试Continue: Test Selection右键 → Continue → Test
生成文档Continue: Document Selection右键 → Continue → Doc
切换模型侧边栏顶部下拉侧边栏顶部下拉

聊天命令(Slash Commands)

命令说明示例
/diff显示差异/diff
/terse简洁回答/terse 解释这个
/describe描述代码/describe
/tests生成测试/tests
/teach教学模式/teach React Hooks
/mc自定义命令/mc explain

上下文命令(Context Commands)

命令说明
@Files添加文件到上下文
@Codebase搜索整个代码库
@Folder添加文件夹
@GitGit 相关信息
@Terminal终端输出
@Docs文档搜索
@URL添加网页内容

键盘快捷键

graph TB
    subgraph VS-Code["VS Code 快捷键"]
        K1[Ctrl+Enter] --> S1[发送消息]
        K2[Ctrl+Shift+P] --> S2[命令面板]
        K3[Tab] --> S3[接受补全]
        K4[Alt+] --> S4[下一个建议]
    end
    
    subgraph JetBrains["JetBrains 快捷键"]
        K5[Ctrl+Enter] --> S5[发送消息]
        K6[Ctrl+Shift+A] --> S6[查找动作]
        K7[Tab] --> S7[接受补全]
        K8[Alt+Down] --> S8[下一个建议]
    end

FAQ 常见问题

Q1: 如何选择云端还是本地?

flowchart TD
    A{需求分析}
    A -->|需要高质量 | B[云端 GPT-4o/Claude]
    A -->|需要隐私 | C[本地模型]
    A -->|需要低成本 | C
    A -->|需要离线 | C
    A -->|混合需求 | D[混合模式]

Q2: 如何切换模型?

在 Continue 侧边栏顶部点击当前模型名称,选择其他模型。

Q3: 如何添加自定义模型?

{
  "models": [{
    "title": "My Custom Model",
    "provider": "openai",
    "model": "your-model",
    "apiKey": "your-key",
    "apiBase": "https://your-endpoint.com"
  }]
}

Q4: 如何禁用自动补全?

{
  "tabAutocompleteEnabled": false
}

Q5: 如何重置配置?

rm ~/.continue/config.json
# 重启 IDE