MCPcopy
hub / github.com/di-sukharev/opencommit / DeepseekEngine

Class DeepseekEngine

src/engine/deepseek.ts:10–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8export interface DeepseekConfig extends OpenAiConfig {}
9
10export class DeepseekEngine extends OpenAiEngine {
11 constructor(config: DeepseekConfig) {
12 // Call OpenAIEngine constructor with forced Deepseek baseURL
13 // Put baseURL first so user config can override it
14 super({
15 baseURL: 'https://api.deepseek.com/v1',
16 ...config
17 });
18 }
19
20 // Identical method from OpenAiEngine, re-implemented here
21 public generateCommitMessage = async (
22 messages: Array<OpenAI.Chat.Completions.ChatCompletionMessageParam>
23 ): Promise<string | null> => {
24 const params = {
25 model: this.config.model,
26 messages,
27 temperature: 0,
28 top_p: 0.1,
29 max_tokens: this.config.maxTokensOutput
30 };
31
32 try {
33 const REQUEST_TOKENS = messages
34 .map((msg) => tokenCount(msg.content as string) + 4)
35 .reduce((a, b) => a + b, 0);
36
37 if (
38 REQUEST_TOKENS >
39 this.config.maxTokensInput - this.config.maxTokensOutput
40 )
41 throw new Error(GenerateCommitMessageErrorEnum.tooMuchTokens);
42
43 const completion = await this.client.chat.completions.create(params);
44
45 const message = completion.choices[0].message;
46 let content = message?.content;
47 return removeContentTags(content, 'think');
48 } catch (error) {
49 throw normalizeEngineError(error, 'deepseek', this.config.model);
50 }
51 };
52}

Callers

nothing calls this directly

Calls 4

tokenCountFunction · 0.90
removeContentTagsFunction · 0.90
normalizeEngineErrorFunction · 0.90
createMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…