Skip to content

Commit 5da4dc7

Browse files
committed
fix deepseek streaming issue + add free deep seek chat model
1 parent 1072c6f commit 5da4dc7

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/modules/llms/api/deepseek.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,15 @@ export const deepSeekStreamCompletion = async (
3737
const data = {
3838
model,
3939
stream: true,
40-
system: parameters.system,
4140
max_tokens: limitTokens ? parameters.max_tokens : undefined,
42-
messages: prepareConversation(conversation, model, ctx) // .map(m => { return { content: m.content, role: m.role } })
41+
messages: prepareConversation(conversation, model, ctx)
4342
}
4443
let wordCount = 0
4544
let wordCountMinimum = 2
4645
const url = `${API_ENDPOINT}/deepseek/completions`
4746
if (!ctx.chat?.id) {
4847
throw new Error('Context chat id should not be empty after openAI streaming')
4948
}
50-
5149
const response: AxiosResponse = await axios.post(url, data, headersStream)
5250

5351
const completionStream: Readable = response.data
@@ -98,7 +96,7 @@ export const deepSeekStreamCompletion = async (
9896
}
9997
}
10098
completion = completion.replaceAll('...', '')
101-
await ctx.api
99+
completion !== '' && await ctx.api
102100
.editMessageText(ctx.chat?.id, msgId, completion)
103101
.catch((e: any) => {
104102
if (e instanceof GrammyError) {

src/modules/llms/utils/llmsData.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,18 +210,18 @@ export const llmData: LLMData = {
210210
chargeType: 'TOKEN',
211211
stream: false
212212
},
213-
deepSeek: {
213+
'deepseek-chat-free': {
214214
provider: 'deepseek',
215-
name: 'gpt-35-turbo',
216-
fullName: 'GPT-3.5 Turbo',
215+
name: 'deepseek-chat-free',
216+
fullName: 'deepseek-chat',
217217
botName: 'deepSeekBot',
218-
version: 'gpt-3.5-turbo',
218+
version: 'deepseek-chat',
219219
commands: ['ds'],
220220
prefix: ['ds. '],
221-
apiSpec: 'https://docs.x.ai/api#introduction',
222-
inputPrice: 0.005,
223-
outputPrice: 0.015,
224-
maxContextTokens: 131072,
221+
apiSpec: 'https://www.deepseek.com/',
222+
inputPrice: 0,
223+
outputPrice: 0,
224+
maxContextTokens: 163840,
225225
chargeType: 'TOKEN',
226226
stream: true
227227
}

0 commit comments

Comments
 (0)