一、安装Continue插件
在 VScode 应用商店搜索 Continue – open-source AI code agent 安装插件
二、新建node项目(以项目名字 openAPI 为例,目录为 D:/openAPI)
1、新建项目文件夹 openAPI ,在该项目文件夹下打开cmd终端,输入
npm init -y
npm install axios
2、在项目下新建 generate-config.js 文件
const axios = require('axios');
const fs = require('fs');
const path = require('path');
// 代理API地址
const apiBaseUrl = 'https://modelapi.com/v1'; //替换为你的API地址
const apiKey = 'sk-modelkey';//替换为你的API密钥
// Continue 配置文件地址
const outputPath = 'C:\\Users\\feiyang\\.continue\\config.yaml'; //替换为你的Continue 配置文件地址
// 获取模型列表
async function getModels() {
try {
const response = await axios.get(`${apiBaseUrl}/models`, {
headers: {
Authorization: `Bearer ${apiKey}`,
},
timeout: 20000,
});
// 获取模型数据
const models = response.data.data || [];
if (!Array.isArray(models) || models.length === 0) {
console.log('没有获取到模型列表');
return;
}
// 生成配置内容
const config = {
name: 'Local Config',
version: '1.0.0',
schema: 'v1',
models: models.map((model) => ({
name: model.id,
provider: 'openai',
model: model.id,
apiBase: apiBaseUrl,
apiKey: apiKey,
useResponsesApi: false,
})),
};
// 确保目录存在
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
// 直接覆盖 Continue 配置文件
fs.writeFileSync(outputPath, generateYaml(config), 'utf8');
console.log(`Continue 配置文件已生成并覆盖:${outputPath}`);
console.log(`共写入 ${config.models.length} 个模型`);
} catch (error) {
console.error('获取模型列表时出错:');
if (error.response) {
console.error('状态码:', error.response.status);
console.error('返回内容:', error.response.data);
} else {
console.error(error.message);
}
}
}
// 生成 YAML 配置内容
function generateYaml(config) {
let yaml = `name: ${config.name}\nversion: ${config.version}\nschema: ${config.schema}\n\nmodels:\n`;
config.models.forEach((model, index) => {
yaml += ` - name: ${model.name}\n`;
yaml += ` provider: ${model.provider}\n`;
yaml += ` model: ${model.model}\n`;
yaml += ` apiBase: ${model.apiBase}\n`;
yaml += ` apiKey: ${model.apiKey}\n`;
yaml += ` useResponsesApi: ${model.useResponsesApi}\n`;
// 最后一项后面不再额外补空行
if (index !== config.models.length - 1) {
yaml += ``;
}
});
return yaml;
}
// 执行获取模型并生成配置文件
getModels();
3、运行项目
node D:\openAPI\generate-config.js
就可以生成Continue的配置文件并替换Continue原有配置文件
这样就可以自动生成配置文件,不需要一个个去配置模型
三、在windows任何位置终端下更新配置文件(可选)
在项目文件夹新建bin目录 名字随意,再在该文件目录下新建upm.bat 文件,名字随意尽量简短
@echo off
node D:\openAPI\generate-config.js
timeout /t 2 /nobreak >nul
在upm.bat里面添加以上代码
将D:\openAPI\bin 添加到windows环境变量的path
打开一个新的cmd终端输入 upm 就可以更新Continue的配置文件了。
Good examples turn abstract instructions into decisions that readers can evaluate, which is why they remain central to teaching, product design, public policy, and technical documentation. A strong illustration does more than repeat a rule: it identifies the relevant conditions, shows the process in sequence, and makes clear why one outcome follows from another. In classroom assessment, a short test built around a realistic case measures whether students can transfer a principle to new facts rather than merely recall its definition. The surrounding explanation should then distinguish essential details from distracting ones, since learners often mistake familiar wording for genuine understanding. Comparisons are especially effective when they place a successful approach beside a plausible but flawed alternative and explain the difference without oversimplifying it. Used with restraint, concrete illustrations improve clarity while leaving enough complexity for readers to apply the underlying idea independently.