Skip to content

Commit 77e8f41

Browse files
Merge pull request #178 from skyline-GTRr32/feature/support-deepseek
Add DeepSeek Support to CodeBuddy
2 parents bae4760 + 71847cb commit 77e8f41

File tree

6 files changed

+767
-15
lines changed

6 files changed

+767
-15
lines changed

package.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@
173173
"Gemini",
174174
"Groq",
175175
"Anthropic",
176-
"XGrok"
176+
"XGrok",
177+
"Deepseek"
177178
],
178179
"default": "Groq",
179180
"description": "Select the Generative AI to use with code buddy"
@@ -242,6 +243,22 @@
242243
"default": null,
243244
"markdownDescription": "Enter your [Grok API Key](https://console.x.ai/)"
244245
},
246+
"deepseek.model": {
247+
"type": [
248+
"string",
249+
"null"
250+
],
251+
"default": "deepseek-chat",
252+
"markdownDescription": "Provide the name of the Deepseek model you want to use."
253+
},
254+
"deepseek.apiKey": {
255+
"type": [
256+
"string",
257+
"null"
258+
],
259+
"default": null,
260+
"markdownDescription": "Enter your Deepseek API Key"
261+
},
245262
"font.family": {
246263
"type": "string",
247264
"enum": [
@@ -329,10 +346,11 @@
329346
"jsdom": "^26.0.0",
330347
"markdown-it": "^14.1.0",
331348
"node-fetch": "^3.3.2",
349+
"openai": "^4.28.0",
332350
"prettier": "^3.2.5",
333351
"readable-stream": "^4.5.2",
334352
"simple-git": "^3.25.0",
335353
"sinon": "^17.0.1"
336354
},
337355
"license": "MIT"
338-
}
356+
}

src/application/constant.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,22 @@ export enum OLA_ACTIONS {
1414
generateCodeChart = "CodeBuddy.generateCodeChart",
1515
inlineChat = "CodeBuddy.inLineChat",
1616
}
17-
1817
export enum COMMON {
1918
GROQ_CHAT_HISTORY = "groqChatHistory",
2019
GEMINI_CHAT_HISTORY = "geminiChatHistory",
2120
ANTHROPIC_CHAT_HISTORY = "anthropicChatHistory",
21+
DEEPSEEK_CHAT_HISTORY = "deepseekChatHistory",
2222
USER_INPUT = "user-input",
2323
BOT = "bot",
2424
GEMINI_SNAPSHOT = "GeminiSnapshot",
2525
}
26-
2726
export const GROQ_CONFIG = {
2827
temperature: 0.1,
2928
max_tokens: 5024,
3029
top_p: 1,
3130
stream: false,
3231
stop: null,
3332
};
34-
3533
export const APP_CONFIG = {
3634
geminiKey: "google.gemini.apiKeys",
3735
geminiModel: "google.gemini.model",
@@ -42,32 +40,30 @@ export const APP_CONFIG = {
4240
anthropicApiKey: "anthropic.apiKey",
4341
grokApiKey: "grok.apiKey",
4442
grokModel: "grok.model",
43+
deepseekApiKey: "deepseek.apiKey",
44+
deepseekModel: "deepseek.model",
4545
};
46-
4746
export enum generativeAiModels {
4847
GEMINI = "Gemini",
4948
GROQ = "Groq",
5049
ANTHROPIC = "Anthropic",
5150
GROK = "XGrok",
51+
DEEPSEEK = "Deepseek",
5252
}
53-
5453
export const MEMORY_CACHE_OPTIONS = {
5554
sessionTTL: 24 * 60 * 60 * 1000,
5655
};
57-
5856
export type aIProviderConfig = {
5957
apiKey: string;
6058
model: string;
6159
providerName: string;
6260
};
63-
6461
export enum FSPROPS {
6562
SRC_DIRECTORY = "src",
6663
TS_FILE_PATTERN = "**/*.ts",
6764
TSCONFIG_FILE = "tsconfig.json",
6865
NODE_MODULES_PATTERN = "**/node_modules/**",
6966
}
70-
7167
export const EmbeddingsConfig = {
7268
batchSize: 5,
7369
maxRetries: 3,
@@ -126,24 +122,21 @@ export enum HTTP_STATUS_CODE {
126122
GATEWAY_TIMEOUT = 504,
127123
HTTP_VERSION_NOT_SUPPORTED = 505,
128124
}
129-
130125
export enum RequestHeader {
131126
AUTHORIZATION = "authorization",
132127
CONTENT_TYPE = "Content-Type",
133128
ACCEPT = "accept",
134129
CONNECTION = "connection",
135130
}
136-
137131
export enum HTTP_VERBS {
138132
GET = "GET",
139133
POST = "POST",
140134
PUT = "PUT",
141135
}
142-
143136
export const HTTPS_DEFAULT_TIMEOUT = 10000;
144137
export const generateQuerySting = (query: string) =>
145138
`q=${encodeURIComponent(query)}`;
146139
export enum WEB_SEARCH_CONFIG {
147140
baseUrl = "https://www.startpage.com/sp/search?",
148141
userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
149-
}
142+
}

src/extension.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { AnthropicWebViewProvider } from "./providers/anthropic";
2626
import { CodeActionsProvider } from "./providers/code-actions";
2727
import { GeminiWebViewProvider } from "./providers/gemini";
2828
import { GroqWebViewProvider } from "./providers/groq";
29+
import { DeepseekWebViewProvider } from "./providers/deepseek";
2930
import { FileUploader } from "./services/file-uploader";
3031
import { initializeGenerativeAiEnvironment } from "./services/generative-ai-model-manager";
3132
import { Credentials } from "./services/github-authentication";
@@ -40,6 +41,8 @@ const {
4041
anthropicModel,
4142
grokApiKey,
4243
grokModel,
44+
deepseekApiKey,
45+
deepseekModel,
4346
} = APP_CONFIG;
4447

4548
const logger = new Logger("extension");
@@ -214,6 +217,11 @@ export async function activate(context: vscode.ExtensionContext) {
214217
model: grokModel,
215218
webviewProviderClass: AnthropicWebViewProvider,
216219
},
220+
[generativeAiModels.DEEPSEEK]: {
221+
key: deepseekApiKey,
222+
model: deepseekModel,
223+
webviewProviderClass: DeepseekWebViewProvider,
224+
},
217225
};
218226
if (selectedGenerativeAiModel in modelConfigurations) {
219227
const modelConfig = modelConfigurations[selectedGenerativeAiModel];
@@ -241,4 +249,4 @@ export function deactivate(context: vscode.ExtensionContext) {
241249
quickFixCodeAction.dispose();
242250
agentEventEmmitter.dispose();
243251
context.subscriptions.forEach((subscription) => subscription.dispose());
244-
}
252+
}

0 commit comments

Comments
 (0)