You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
由于公司加密锁,跨软件就copy不了.c或者.h文档。
导致不得不在arduinoIDE内部嵌入ai绕开加密。辅助编写程序。所以找到了这个插件。
由于deepseek比较便宜,就用deepseek,发现这个插件没有写。于是就当场写了一段。
首先找到下载的插件文件夹
在aiduino\extension\out\config里用vscode打开providerConfigs.js,在120行后插入以下代码就能接入deepseek了。
deepseek: {
name: 'DeepSeek',
icon: '🐋',
color: '#4D6BFE',
keyFile: '.aiduino-deepseek-api-key',
keyPrefix: 'sk-',
keyMinLength: 20,
hostname: 'api.deepseek.com',
apiKeyUrl: 'https://platform.deepseek.com/api_keys',
// 模型列表接口路径
path: '/v1/models',
// 模型列表接口请求头(DeepSeek 模型接口需要 Bearer 认证)
headers: (key) => ({ 'Authorization':
Bearer ${key}}),// 【新增】模型列表接口请求方法,标准 GET
method: 'GET',
// 从接口响应中提取模型数组
extractModels: (data) => data.data || [],
// 【优化】默认优先选中 deepseek-chat 主模型,匹配失败再取第一个
selectBest: (models) => models.find(m => m.id === 'deepseek-chat') || models[0],
// 接口异常时的兜底模型 ID
fallback: 'deepseek-chat',
modelDiscovery: {
enabled: true, // 【核心修改】启用动态模型发现,自动调用 /v1/models 接口
// 静态模型作为兜底:接口请求失败/网络异常时自动降级使用
staticModels: [
{ id: 'deepseek-chat', name: 'DeepSeek-V3', displayName: 'DeepSeek-V3' },
{ id: 'deepseek-reasoner', name: 'DeepSeek-R1', displayName: 'DeepSeek-R1' }
]
},
prices: {
input: 0.14 / 1000000, // $0.14 per 1M input tokens (DeepSeek-V3, 2026-07 官方定价)
output: 0.28 / 1000000 // $0.28 per 1M output tokens
},
apiConfig: {
apiPath: '/v1/chat/completions',
method: 'POST',
headers: (key) => ({
'Content-Type': 'application/json',
'Authorization':
Bearer ${key}}),
buildRequest: (modelId, prompt, systemPrompt) => ({
model: modelId,
messages: [
{ role: "system", content: systemPrompt || "You are a helpful assistant." },
{ role: "user", content: prompt }
],
max_tokens: 2000,
temperature: 0.7
}),
extractResponse: (data) => data.choices[0].message.content
}
},
All reactions