diff --git a/README.md b/README.md index 00b3e859a3..e252d6824f 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ Typical users of ChatALL are: | [Cohere Command R Models](https://cohere.com/command) | No | Yes | | | [Copilot](https://copilot.microsoft.com/) | Yes | No API | | | [Dedao Learning Assistant](https://ai.dedao.cn/) | Coming soon | No API | | +| [DeepSeek](https://chat.deepseek.com/) | Coming soon | Yes | | | [Falcon 180B](https://huggingface.co/tiiuae/falcon-180B-chat) | Yes | No API | | | [Gemini](https://gemini.google.com/) | Yes | Yes | | | [Gemma 2B & 7B](https://blog.google/technology/developers/gemma-open-models/) | Yes | No API | | diff --git a/public/bots/deepseek.svg b/public/bots/deepseek.svg new file mode 100644 index 0000000000..a76ba1b10b --- /dev/null +++ b/public/bots/deepseek.svg @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/src/bots/deepseek/DeepSeekAPIBot.js b/src/bots/deepseek/DeepSeekAPIBot.js new file mode 100644 index 0000000000..ef24f3e5e3 --- /dev/null +++ b/src/bots/deepseek/DeepSeekAPIBot.js @@ -0,0 +1,40 @@ +import LangChainBot from "../LangChainBot"; +import { ChatOpenAI } from "@langchain/openai"; +import store from "@/store"; + +export default class DeepSeekAPIBot extends LangChainBot { + static _brandId = "deepSeekApi"; // Brand id of the bot, should be unique. Used in i18n. + static _className = "DeepSeekAPIBot"; + static _logoFilename = "deepseek.svg"; + + constructor() { + super(); + } + + async _checkAvailability() { + let available = false; + + if (store.state.deepSeekApi.apiKey) { + this.setupModel(); + available = true; + } + return available; + } + + _setupModel() { + const chatModel = new ChatOpenAI({ + configuration: { + basePath: "https://api.deepseek.com/v1", + }, + openAIApiKey: store.state.deepSeekApi.apiKey, + modelName: this.constructor._model ? this.constructor._model : "", + temperature: store.state.deepSeekApi.temperature, + streaming: true, + }); + return chatModel; + } + + getPastRounds() { + return store.state.deepSeekApi.pastRounds; + } +} diff --git a/src/bots/deepseek/DeepSeekAPIChatBot.js b/src/bots/deepseek/DeepSeekAPIChatBot.js new file mode 100644 index 0000000000..d1622aff2e --- /dev/null +++ b/src/bots/deepseek/DeepSeekAPIChatBot.js @@ -0,0 +1,10 @@ +import DeepSeekAPIBot from "./DeepSeekAPIBot"; + +export default class DeepSeekAPIChatBot extends DeepSeekAPIBot { + static _className = "DeepSeekAPIChatBot"; + static _model = "deepseek-chat"; + + constructor() { + super(); + } +} diff --git a/src/bots/deepseek/DeepSeekAPICoderBot.js b/src/bots/deepseek/DeepSeekAPICoderBot.js new file mode 100644 index 0000000000..ea1f66467c --- /dev/null +++ b/src/bots/deepseek/DeepSeekAPICoderBot.js @@ -0,0 +1,10 @@ +import DeepSeekAPIBot from "./DeepSeekAPIBot"; + +export default class DeepSeekAPICoderBot extends DeepSeekAPIBot { + static _className = "DeepSeekAPICoderBot"; + static _model = "deepseek-coder"; + + constructor() { + super(); + } +} diff --git a/src/bots/index.js b/src/bots/index.js index ffbcbca807..fde1f7d907 100644 --- a/src/bots/index.js +++ b/src/bots/index.js @@ -85,6 +85,8 @@ import ClaudeAPISonnetBot from "./anthropic/ClaudeAPISonnetBot"; import ClaudeAPI35SonnetBot from "./anthropic/ClaudeAPI35SonnetBot"; import ClaudeAPIHaikuBot from "./anthropic/ClaudeAPIHaikuBot"; import ClaudeAPIInstant12Bot from "./anthropic/ClaudeAPIInstant12Bot"; +import DeepSeekAPICoderBot from "./deepseek/DeepSeekAPICoderBot"; +import DeepSeekAPIChatBot from "./deepseek/DeepSeekAPIChatBot"; const all = [ Qihoo360AIBrainBot.getInstance(), @@ -172,6 +174,8 @@ const all = [ Wizardlm70bBot.getInstance(), Zephyr7bBot.getInstance(), YouChatBot.getInstance(), + DeepSeekAPICoderBot.getInstance(), + DeepSeekAPIChatBot.getInstance(), ]; const disabled = [ @@ -289,6 +293,8 @@ export const botTags = { bots.getBotByClassName("Gemma7bItBot"), bots.getBotByClassName("Claude3SonnetBot"), bots.getBotByClassName("Claude3OpusBot"), + bots.getBotByClassName("DeepSeekAPICoderBot"), + bots.getBotByClassName("DeepSeekAPIChatBot"), ], api: [ bots.getBotByClassName("GeminiAPIBot"), @@ -319,6 +325,8 @@ export const botTags = { bots.getBotByClassName("Llama38bGroqAPIBot"), bots.getBotByClassName("Llama370bGroqAPIBot"), bots.getBotByClassName("Mixtral8x7bGroqAPIBot"), + bots.getBotByClassName("DeepSeekAPICoderBot"), + bots.getBotByClassName("DeepSeekAPIChatBot"), ], madeInChina: [ bots.getBotByClassName("Qihoo360AIBrainBot"), @@ -334,6 +342,8 @@ export const botTags = { bots.getBotByClassName("ChatGLM6bBot"), bots.getBotByClassName("ChatGLM36bBot"), bots.getBotByClassName("KimiBot"), + bots.getBotByClassName("DeepSeekAPICoderBot"), + bots.getBotByClassName("DeepSeekAPIChatBot"), ], }; export default bots; diff --git a/src/components/BotSettings/DeepSeekAPIBotSettings.vue b/src/components/BotSettings/DeepSeekAPIBotSettings.vue new file mode 100644 index 0000000000..7f74fc1d07 --- /dev/null +++ b/src/components/BotSettings/DeepSeekAPIBotSettings.vue @@ -0,0 +1,63 @@ + + + diff --git a/src/components/SettingsModal.vue b/src/components/SettingsModal.vue index c47aedf882..760b85bd35 100644 --- a/src/components/SettingsModal.vue +++ b/src/components/SettingsModal.vue @@ -126,6 +126,7 @@ import ClaudeAIBotSettings from "./BotSettings/ClaudeAIBotSettings.vue"; import ChatGLMBotSettings from "./BotSettings/ChatGLMBotSettings.vue"; import CohereAPIBotSettings from "./BotSettings/CohereAPIBotSettings.vue"; import KimiBotSettings from "./BotSettings/KimiBotSettings.vue"; +import DeepSeekAPIBotSettings from "./BotSettings/DeepSeekAPIBotSettings.vue"; import { resolveTheme, applyTheme, Mode } from "../theme"; import ClaudeAPIBotSettings from "./BotSettings/ClaudeAPIBotSettings.vue"; @@ -152,6 +153,7 @@ const botSettings = [ { brand: "claudeAi", component: ClaudeAIBotSettings }, { brand: "claudeApi", component: ClaudeAPIBotSettings }, { brand: "cohereApi", component: CohereAPIBotSettings }, + { brand: "deepSeekApi", component: DeepSeekAPIBotSettings }, { brand: "falcon", component: Falcon180bBotSettings }, { brand: "geminiApi", component: GeminiAPIBotSettings }, { brand: "gradio", component: GradioAppBotSettings }, diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index d6db59f9b2..8041f82b94 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -243,6 +243,11 @@ "temperature0": "More deterministic", "temperature2": "More random" }, + "deepSeekApi": { + "name": "DeepSeek API", + "deepseek-chat": "deepseek-chat", + "deepseek-coder": "deepseek-coder" + }, "poe": { "name": "Poe", "a2": "Claude-instant", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index 5e2d488e33..65c614ae62 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -243,6 +243,11 @@ "temperature0": "更具确定性", "temperature2": "更具随机性" }, + "deepSeekApi": { + "name": "DeepSeek API", + "deepseek-chat": "deepseek-chat", + "deepseek-coder": "deepseek-coder" + }, "poe": { "name": "Poe", "a2": "Claude-instant", diff --git a/src/store/index.js b/src/store/index.js index 85ff9b15f7..5e899c25b2 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -45,6 +45,11 @@ export default createStore({ temperature: 0.8, pastRounds: 5, }, + deepSeekApi: { + apiKey: "", + temperature: 1.0, + pastRounds: 10, + }, openaiApi: { apiKey: "", temperature: 1, @@ -213,6 +218,9 @@ export default createStore({ setChatgpt(state, refreshCycle) { state.chatgpt.refreshCycle = refreshCycle; }, + setDeepSeekApi(state, values) { + state.deepSeekApi = { ...state.deepSeekApi, ...values }; + }, setGeminiApi(state, values) { state.geminiApi = { ...state.geminiApi, ...values }; },