From 588e68e93e3dbe77cba477eeef5a9d288a60f323 Mon Sep 17 00:00:00 2001 From: ItzCrazyKns <95534749+ItzCrazyKns@users.noreply.github.com> Date: Sun, 6 Apr 2025 13:37:43 +0530 Subject: [PATCH] feat(providers): add deepseek provider --- sample.config.toml | 3 +++ src/app/api/config/route.ts | 5 ++++ src/app/settings/page.tsx | 20 ++++++++++++++++ src/lib/config.ts | 5 ++++ src/lib/providers/deepseek.ts | 44 +++++++++++++++++++++++++++++++++++ src/lib/providers/index.ts | 2 ++ 6 files changed, 79 insertions(+) create mode 100644 src/lib/providers/deepseek.ts diff --git a/sample.config.toml b/sample.config.toml index 691b964..980e99d 100644 --- a/sample.config.toml +++ b/sample.config.toml @@ -22,5 +22,8 @@ MODEL_NAME = "" [MODELS.OLLAMA] API_URL = "" # Ollama API URL - http://host.docker.internal:11434 +[MODELS.DEEPSEEK] +API_KEY = "" + [API_ENDPOINTS] SEARXNG = "" # SearxNG API URL - http://localhost:32768 \ No newline at end of file diff --git a/src/app/api/config/route.ts b/src/app/api/config/route.ts index 871bb21..39c1f84 100644 --- a/src/app/api/config/route.ts +++ b/src/app/api/config/route.ts @@ -7,6 +7,7 @@ import { getGroqApiKey, getOllamaApiEndpoint, getOpenaiApiKey, + getDeepseekApiKey, updateConfig, } from '@/lib/config'; import { @@ -53,6 +54,7 @@ export const GET = async (req: Request) => { config['anthropicApiKey'] = getAnthropicApiKey(); config['groqApiKey'] = getGroqApiKey(); config['geminiApiKey'] = getGeminiApiKey(); + config['deepseekApiKey'] = getDeepseekApiKey(); config['customOpenaiApiUrl'] = getCustomOpenaiApiUrl(); config['customOpenaiApiKey'] = getCustomOpenaiApiKey(); config['customOpenaiModelName'] = getCustomOpenaiModelName(); @@ -88,6 +90,9 @@ export const POST = async (req: Request) => { OLLAMA: { API_URL: config.ollamaApiUrl, }, + DEEPSEEK: { + API_KEY: config.deepseekApiKey, + }, CUSTOM_OPENAI: { API_URL: config.customOpenaiApiUrl, API_KEY: config.customOpenaiApiKey, diff --git a/src/app/settings/page.tsx b/src/app/settings/page.tsx index 8e1c45a..8eee9a4 100644 --- a/src/app/settings/page.tsx +++ b/src/app/settings/page.tsx @@ -20,6 +20,7 @@ interface SettingsType { anthropicApiKey: string; geminiApiKey: string; ollamaApiUrl: string; + deepseekApiKey: string; customOpenaiApiKey: string; customOpenaiApiUrl: string; customOpenaiModelName: string; @@ -838,6 +839,25 @@ const Page = () => { onSave={(value) => saveConfig('geminiApiKey', value)} /> + +
+ Deepseek API Key +
+ { + setConfig((prev) => ({ + ...prev!, + deepseekApiKey: e.target.value, + })); + }} + onSave={(value) => saveConfig('deepseekApiKey', value)} + /> +