From 2d903130dae6ee2452c9121ac14d7908883d64a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=8E=E4=BD=95=E5=BC=80=E5=A7=8B123?= <64304674+yeahhe365@users.noreply.github.com> Date: Mon, 12 Jan 2026 17:15:21 +0800 Subject: [PATCH] 1 --- .DS_Store | Bin 6148 -> 6148 bytes prisma/config.ts | 6 ++++++ prisma/services/deepThink/openaiClient.ts | 17 ++++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.DS_Store b/.DS_Store index b963966d636f508681f767f5f9e38c6d1ef41dcf..cc36e270581376ad7079a16294c65ba6a648ea29 100644 GIT binary patch delta 28 icmZoMXffE($;i5wfq@}nav!5PYc-ISzWEfRl^6hc>j%pK delta 28 icmZoMXffE($;kSWfq}tcav!5PYZQ>xz4;WQl^6heX$Rr} diff --git a/prisma/config.ts b/prisma/config.ts index 5f0d9bd..78ce52b 100644 --- a/prisma/config.ts +++ b/prisma/config.ts @@ -14,6 +14,12 @@ export const MODELS: { value: ModelOption; label: string; desc: string; provider desc: 'Deep reasoning, complex tasks, higher intelligence.', provider: 'google' }, + { + value: 'deepseek-reasoner', + label: 'DeepSeek R1', + desc: 'State-of-the-art open reasoning model.', + provider: 'deepseek' + }, { value: 'custom', label: 'Custom Model', diff --git a/prisma/services/deepThink/openaiClient.ts b/prisma/services/deepThink/openaiClient.ts index 5f7c9a3..f45f9e6 100644 --- a/prisma/services/deepThink/openaiClient.ts +++ b/prisma/services/deepThink/openaiClient.ts @@ -65,7 +65,15 @@ export const generateContent = async ( try { const response = await withRetry(() => ai.chat.completions.create(requestOptions)); - const content = response.choices[0]?.message?.content || ''; + const message = response.choices[0]?.message; + const content = message?.content || ''; + + // Check for DeepSeek native reasoning field + const reasoningContent = (message as any)?.reasoning_content; + + if (reasoningContent && config.thinkingConfig?.includeThoughts) { + return { text: content, thought: reasoningContent }; + } if (config.thinkingConfig?.includeThoughts) { const { thought, text } = parseThinkingTokens(content); @@ -112,6 +120,13 @@ export async function* generateContentStream( for await (const chunk of (stream as any)) { const delta = chunk.choices[0]?.delta?.content || ''; + // Support DeepSeek native reasoning field + const reasoningDelta = (chunk.choices[0]?.delta as any)?.reasoning_content || ''; + + // If we have native reasoning content, yield it immediately as thought + if (reasoningDelta) { + yield { text: '', thought: reasoningDelta }; + } if (!delta) continue;