diff --git a/README_DE-DE.md b/README_DE-DE.md index 12d6d66399..23b4ca5e25 100644 --- a/README_DE-DE.md +++ b/README_DE-DE.md @@ -49,6 +49,7 @@ Auf großen Sprachmodellen (LLMs) basierende KI-Bots sind erstaunlich. Ihr Verha | [Tongyi Qianwen](http://tongyi.aliyun.com/) | Ja | Demnächst | | | [Vicuna 13B & 33B](https://lmsys.org/blog/2023-03-30-vicuna/) | Ja | Nein | Kein Login erforderlich | | [WizardLM 70B](https://github.com/nlpxucan/WizardLM) | Ja | Nein | | +| [xAI Grok](https://x.ai) | Nein | Ja | | | [YouChat](https://you.com/) | Ja | Nein | | | [You](https://you.com/) | Ja | Nein | | | [Zephyr](https://huggingface.co/spaces/HuggingFaceH4/zephyr-chat) | Ja | Nein | | diff --git a/README_ES-ES.md b/README_ES-ES.md index d0ca767b47..507d64f27f 100644 --- a/README_ES-ES.md +++ b/README_ES-ES.md @@ -57,6 +57,7 @@ Los usuarios típicos de ChatALL son: | [Tongyi Qianwen](http://tongyi.aliyun.com/) | Sì | Prossimamente | | | [Vicuna 13B & 33B](https://lmsys.org/blog/2023-03-30-vicuna/) | Sì | No | Nessun accesso richiesto | | [WizardLM 70B](https://github.com/nlpxucan/WizardLM) | Sì | No | | +| [xAI Grok](https://x.ai) | No | Sì | | | [YouChat](https://you.com/) | Sì | No | | | [You](https://you.com/) | Sì | No | | | [Zephyr](https://huggingface.co/spaces/HuggingFaceH4/zephyr-chat) | Sì | No | | diff --git a/README_FR-FR.md b/README_FR-FR.md index 99ef999da1..5e623b772b 100644 --- a/README_FR-FR.md +++ b/README_FR-FR.md @@ -49,6 +49,7 @@ Les robots d'intelligence artificielle basés sur les grands modèles de langage | [Tongyi Qianwen](http://tongyi.aliyun.com/) | Oui | Prochainement | | | [Vicuna 13B & 33B](https://lmsys.org/blog/2023-03-30-vicuna/) | Oui | Non | Pas besoin de compte ou de clé API | | [WizardLM 70B](https://github.com/nlpxucan/WizardLM) | Oui | Non | | +| [xAI Grok](https://x.ai) | Non | Oui | | | [YouChat](https://you.com/) | Oui | Non | | | [You](https://you.com/) | Oui | Non | | | [Zephyr](https://huggingface.co/spaces/HuggingFaceH4/zephyr-chat) | Oui | Non | | diff --git a/README_IT-IT.md b/README_IT-IT.md index 7eaf051f85..de61221e3b 100644 --- a/README_IT-IT.md +++ b/README_IT-IT.md @@ -57,6 +57,7 @@ Gli utenti tipici di ChatALL sono: | [Tongyi Qianwen](http://tongyi.aliyun.com/) | Sì | Prossimamente | | | [Vicuna 13B & 33B](https://lmsys.org/blog/2023-03-30-vicuna/) | Sì | No | Nessun accesso richiesto | | [WizardLM 70B](https://github.com/nlpxucan/WizardLM) | Sì | No | | +| [xAI Grok](https://x.ai) | No | Sì | | | [YouChat](https://you.com/) | Sì | No | | | [You](https://you.com/) | Sì | No | | | [Zephyr](https://huggingface.co/spaces/HuggingFaceH4/zephyr-chat) | Sì | No | | diff --git a/README_JA-JP.md b/README_JA-JP.md index 1826b595b4..9c8a0d3533 100644 --- a/README_JA-JP.md +++ b/README_JA-JP.md @@ -56,6 +56,7 @@ ChatALLのユーザーはこんな感じ: | [Tongyi Qianwen](http://tongyi.aliyun.com/) | はい | 近日登場 | | | [Vicuna 13B & 33B](https://lmsys.org/blog/2023-03-30-vicuna/) | はい | なし | ログイン不要 | | [WizardLM 70B](https://github.com/nlpxucan/WizardLM) | はい | なし | | +| [xAI Grok](https://x.ai) | いいえ | あり | | | [YouChat](https://you.com/) | はい | なし | | | [You](https://you.com/) | はい | なし | | | [Zephyr](https://huggingface.co/spaces/HuggingFaceH4/zephyr-chat) | はい | なし | | diff --git a/README_KO-KR.md b/README_KO-KR.md index 8250e72c72..c5078e70d0 100644 --- a/README_KO-KR.md +++ b/README_KO-KR.md @@ -57,6 +57,7 @@ ChatALL의 일반적인 사용자는 다음과 같습니다: | [Tongyi Qianwen](http://tongyi.aliyun.com/) | 예 | 근일 개봉 | | | [Vicuna 13B & 33B](https://lmsys.org/blog/2023-03-30-vicuna/) | 예 | 없음 | 로그인 필요 없음 | | [WizardLM 70B](https://github.com/nlpxucan/WizardLM) | 예 | 없음 | | +| [xAI Grok](https://x.ai) | 아니오 | 예 | | | [YouChat](https://you.com/) | 예 | 없음 | | | [You](https://you.com/) | 예 | 없음 | | | [Zephyr](https://huggingface.co/spaces/HuggingFaceH4/zephyr-chat) | 예 | 없음 | | diff --git a/README_RU-RU.md b/README_RU-RU.md index 443f99ad57..a4828c0802 100644 --- a/README_RU-RU.md +++ b/README_RU-RU.md @@ -57,6 +57,7 @@ | [Tongyi Qianwen](http://tongyi.aliyun.com/) | Да | Скоро будет | | | [Vicuna 13B & 33B](https://lmsys.org/blog/2023-03-30-vicuna/) | Да | Нет API | Вход в ученую запись не требуется | | [WizardLM 70B](https://github.com/nlpxucan/WizardLM) | Да | Нет | | +| [xAI Grok](https://x.ai) | Нет | Да | | | [YouChat](https://you.com/) | Да | Нет | | | [You](https://you.com/) | Да | Нет | | | [Zephyr](https://huggingface.co/spaces/HuggingFaceH4/zephyr-chat) | Да | Нет | | diff --git a/README_VI-VN.md b/README_VI-VN.md index a5a3572b72..0875f6e95e 100644 --- a/README_VI-VN.md +++ b/README_VI-VN.md @@ -49,6 +49,7 @@ Các Chat bots AI dựa trên Mô hình ngôn ngữ lớn (Large Language Models | [Tongyi Qianwen](http://tongyi.aliyun.com/) | Có | Sắp ra mắt | | | [Vicuna 13B & 33B](https://lmsys.org/blog/2023-03-30-vicuna/) | Có | Không có API | Không yêu cầu tài khoản | | [WizardLM 70B](https://github.com/nlpxucan/WizardLM) | Có | Không có | | +| [xAI Grok](https://x.ai) | Không | Có | | | [YouChat](https://you.com/) | Có | Không có | | | [You](https://you.com/) | Có | Không có | | | [Zephyr](https://huggingface.co/spaces/HuggingFaceH4/zephyr-chat) | Có | Không có | | diff --git a/README_ZH-CN.md b/README_ZH-CN.md index 9996f99bca..324547ecce 100644 --- a/README_ZH-CN.md +++ b/README_ZH-CN.md @@ -57,6 +57,7 @@ ChatALL 的典型用户是: | [通义千问](http://tongyi.aliyun.com/) | 支持 | 即将推出 | | | [Vicuna 13B 和 33B](https://lmsys.org/blog/2023-03-30-vicuna/) | 支持 | 无 API | 不需要帐号 | | [WizardLM 70B](https://github.com/nlpxucan/WizardLM) | 支持 | 无 API | | +| [xAI Grok](https://x.ai) | 否 | 支持 | | | [YouChat](https://you.com/) | 支持 | 无 | | | [You](https://you.com/) | 支持 | 无 API | | | [Zephyr](https://huggingface.co/spaces/HuggingFaceH4/zephyr-chat) | 支持 | 无 | | diff --git a/package-lock.json b/package-lock.json index 11e8a1d092..1d5d0d63e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "@langchain/google-genai": "^0.0.21", "@langchain/groq": "^0.1.2", "@langchain/openai": "^0.2.1", + "@langchain/xai": "^0.0.1", "@mdi/font": "^7.4.47", "@vueuse/rxjs": "^11.1.0", "async-lock": "^1.4.1", @@ -4577,6 +4578,39 @@ "node": ">=18" } }, + "node_modules/@langchain/xai": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@langchain/xai/-/xai-0.0.1.tgz", + "integrity": "sha512-F1/btq7+DzvyBFsCsShkt1MVUXIo52b4f6Ti2Eea0o/Oth/D2jfpnQmZLZ4rZHSGjxI0bRkS5zLyYveTbr+7yA==", + "license": "MIT", + "dependencies": { + "@langchain/openai": "~0.3.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@langchain/core": ">=0.2.21 <0.4.0" + } + }, + "node_modules/@langchain/xai/node_modules/@langchain/openai": { + "version": "0.3.14", + "resolved": "https://registry.npmjs.org/@langchain/openai/-/openai-0.3.14.tgz", + "integrity": "sha512-lNWjUo1tbvsss45IF7UQtMu1NJ6oUKvhgPYWXnX9f/d6OmuLu7D99HQ3Y88vLcUo9XjjOy417olYHignMduMjA==", + "license": "MIT", + "dependencies": { + "js-tiktoken": "^1.0.12", + "openai": "^4.71.0", + "zod": "^3.22.4", + "zod-to-json-schema": "^3.22.3" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@langchain/core": ">=0.2.26 <0.4.0" + } + }, "node_modules/@leichtgewicht/ip-codec": { "version": "2.0.4", "dev": true, @@ -17731,9 +17765,9 @@ } }, "node_modules/openai": { - "version": "4.66.1", - "resolved": "https://registry.npmjs.org/openai/-/openai-4.66.1.tgz", - "integrity": "sha512-+sSyV6VtGHerPb6Kfi76hrEOVt+wayvuw7GX/ky7rAR11kN6JVs4dgbtoaxzDXvAxc5dcQLuXeco54mBfOMoQQ==", + "version": "4.73.1", + "resolved": "https://registry.npmjs.org/openai/-/openai-4.73.1.tgz", + "integrity": "sha512-nWImDJBcUsqrhy7yJScXB4+iqjzbUEgzfA3un/6UnHFdwWhjX24oztj69Ped/njABfOdLcO/F7CeWTI5dt8Xmg==", "license": "Apache-2.0", "dependencies": { "@types/node": "^18.11.18", diff --git a/package.json b/package.json index ff2bd4b98f..85a5c255d3 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "@langchain/google-genai": "^0.0.21", "@langchain/groq": "^0.1.2", "@langchain/openai": "^0.2.1", + "@langchain/xai": "^0.0.1", "@mdi/font": "^7.4.47", "@vueuse/rxjs": "^11.1.0", "async-lock": "^1.4.1", diff --git a/public/bots/grok-2-logo.png b/public/bots/grok-2-logo.png new file mode 100644 index 0000000000..3718384fac Binary files /dev/null and b/public/bots/grok-2-logo.png differ diff --git a/public/bots/grok-beta-logo.png b/public/bots/grok-beta-logo.png new file mode 100644 index 0000000000..c39b32731b Binary files /dev/null and b/public/bots/grok-beta-logo.png differ diff --git a/src/bots/index.js b/src/bots/index.js index e978878537..a23e0f617a 100644 --- a/src/bots/index.js +++ b/src/bots/index.js @@ -80,6 +80,8 @@ import ClaudeAPI20Bot from "./anthropic/ClaudeAPI20Bot"; import ClaudeAPI21Bot from "./anthropic/ClaudeAPI21Bot"; import ClaudeAPISonnetBot from "./anthropic/ClaudeAPISonnetBot"; import ClaudeAPIHaikuBot from "./anthropic/ClaudeAPIHaikuBot"; +import GrokBetaAPIBot from "./xai/GrokBetaAPIBot"; +import Grok2APIBot from "./xai/Grok2APIBot"; const all = [ Qihoo360AIBrainBot.getInstance(), @@ -162,6 +164,8 @@ const all = [ Wizardlm70bBot.getInstance(), Zephyr7bBot.getInstance(), YouChatBot.getInstance(), + GrokBetaAPIBot.getInstance(), + Grok2APIBot.getInstance(), ]; const disabled = [ @@ -303,6 +307,8 @@ export const botTags = { bots.getBotByClassName("Llama38bGroqAPIBot"), bots.getBotByClassName("Llama370bGroqAPIBot"), bots.getBotByClassName("Mixtral8x7bGroqAPIBot"), + bots.getBotByClassName("GrokBetaAPIBot"), + bots.getBotByClassName("Grok2APIBot"), ], madeInChina: [ bots.getBotByClassName("Qihoo360AIBrainBot"), diff --git a/src/bots/xai/Grok2APIBot.js b/src/bots/xai/Grok2APIBot.js new file mode 100644 index 0000000000..9385b97797 --- /dev/null +++ b/src/bots/xai/Grok2APIBot.js @@ -0,0 +1,10 @@ +import xAIAPIBot from "./xAIAPIBot"; + +export default class Grok2APIBot extends xAIAPIBot { + static _className = "Grok2APIBot"; + static _logoFilename = "grok-2-logo.png"; + static _model = "grok-2-latest"; + constructor() { + super(); + } +} diff --git a/src/bots/xai/GrokBetaAPIBot.js b/src/bots/xai/GrokBetaAPIBot.js new file mode 100644 index 0000000000..6595dc2290 --- /dev/null +++ b/src/bots/xai/GrokBetaAPIBot.js @@ -0,0 +1,10 @@ +import xAIAPIBot from "./xAIAPIBot"; + +export default class GrokBetaAPIBot extends xAIAPIBot { + static _className = "GrokBetaAPIBot"; + static _logoFilename = "grok-beta-logo.png"; + static _model = "grok-beta"; + constructor() { + super(); + } +} diff --git a/src/bots/xai/xAIAPIBot.js b/src/bots/xai/xAIAPIBot.js new file mode 100644 index 0000000000..3858becbc5 --- /dev/null +++ b/src/bots/xai/xAIAPIBot.js @@ -0,0 +1,36 @@ +import LangChainBot from "../LangChainBot"; +import store from "@/store"; +import { ChatXAI } from "@langchain/xai"; + +export default class xAIAPIBot extends LangChainBot { + static _brandId = "xaiApi"; + static _className = "xAIAPIBot"; + + constructor() { + super(); + } + + async _checkAvailability() { + let available = false; + + if (store.state.xaiApi.apiKey) { + this.setupModel(); + available = true; + } + return available; + } + + _setupModel() { + const chatModel = new ChatXAI({ + apiKey: store.state.xaiApi.apiKey, + model: this.constructor._model ? this.constructor._model : "", + streaming: true, + }); + + return chatModel; + } + + getPastRounds() { + return store.state.xaiApi.pastRounds ? store.state.xaiApi.pastRounds : 5; + } +} diff --git a/src/bots/xai/xAIAPIBotSettings.vue b/src/bots/xai/xAIAPIBotSettings.vue new file mode 100644 index 0000000000..746ac9deec --- /dev/null +++ b/src/bots/xai/xAIAPIBotSettings.vue @@ -0,0 +1,65 @@ + + + diff --git a/src/components/BotSettings/xAIAPIBotSettings.vue b/src/components/BotSettings/xAIAPIBotSettings.vue new file mode 100644 index 0000000000..39ecc289ff --- /dev/null +++ b/src/components/BotSettings/xAIAPIBotSettings.vue @@ -0,0 +1,52 @@ + + + diff --git a/src/components/SettingsModal.vue b/src/components/SettingsModal.vue index c47aedf882..395bd47aa3 100644 --- a/src/components/SettingsModal.vue +++ b/src/components/SettingsModal.vue @@ -130,6 +130,7 @@ import KimiBotSettings from "./BotSettings/KimiBotSettings.vue"; import { resolveTheme, applyTheme, Mode } from "../theme"; import ClaudeAPIBotSettings from "./BotSettings/ClaudeAPIBotSettings.vue"; import GroqAPIBotSettings from "./BotSettings/GroqAPIBotSettings.vue"; +import xAIAPIBotSettings from "./BotSettings/xAIAPIBotSettings.vue"; const { ipcRenderer } = window.require("electron"); const { t: $t, locale } = useI18n(); @@ -170,6 +171,7 @@ const botSettings = [ { brand: "skyWork", component: SkyWorkBotSettings }, { brand: "spark", component: SparkBotSettings }, { brand: "wenxinQianfan", component: WenxinQianfanBotSettings }, + { brand: "xaiApi", component: xAIAPIBotSettings }, { brand: "youChat", component: YouChatBotSettings }, ]; diff --git a/src/i18n/locales/de.json b/src/i18n/locales/de.json index 5880f1136d..38c46d22e9 100644 --- a/src/i18n/locales/de.json +++ b/src/i18n/locales/de.json @@ -303,6 +303,11 @@ "gemma-7b-it": "Gemma 7b", "gemma2-9b-it": "Gemma2 9b" }, + "xaiApi": { + "name": "xAI API", + "grok-beta": "Grok Beta", + "grok-2-latest": "Grok-2" + }, "updates": { "updateAvailable": "Update verfügbar!", "currentVersion": "Ihre Version", diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 6a59e2b327..a5cad022d0 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -306,6 +306,11 @@ "gemma-7b-it": "Gemma 7b", "gemma2-9b-it": "Gemma2 9b" }, + "xaiApi": { + "name": "xAI API", + "grok-beta": "Grok Beta", + "grok-2-latest": "Grok-2" + }, "updates": { "updateAvailable": "Update Available!", "currentVersion": "Your Version", diff --git a/src/i18n/locales/es.json b/src/i18n/locales/es.json index cc04e6b180..5da4d9d7d9 100644 --- a/src/i18n/locales/es.json +++ b/src/i18n/locales/es.json @@ -303,6 +303,11 @@ "gemma-7b-it": "Gemma 7b", "gemma2-9b-it": "Gemma2 9b" }, + "xaiApi": { + "name": "xAI API", + "grok-beta": "Grok Beta", + "grok-2-latest": "Grok-2" + }, "updates": { "updateAvailable": "¡Hay una actualización disponible!", "currentVersion": "Su versión", diff --git a/src/i18n/locales/fr.json b/src/i18n/locales/fr.json index 370ea107ab..7d3d31a13b 100644 --- a/src/i18n/locales/fr.json +++ b/src/i18n/locales/fr.json @@ -303,6 +303,11 @@ "gemma-7b-it": "Gemma 7b", "gemma2-9b-it": "Gemma2 9b" }, + "xaiApi": { + "name": "xAI API", + "grok-beta": "Grok Beta", + "grok-2-latest": "Grok-2" + }, "updates": { "updateAvailable": "Mise à jour disponible !", "currentVersion": "Votre version", diff --git a/src/i18n/locales/it.json b/src/i18n/locales/it.json index 70b5383952..344ae0d1a7 100644 --- a/src/i18n/locales/it.json +++ b/src/i18n/locales/it.json @@ -305,6 +305,11 @@ "gemma-7b-it": "Gemma 7b", "gemma2-9b-it": "Gemma2 9b" }, + "xaiApi": { + "name": "xAI API", + "grok-beta": "Grok Beta", + "grok-2-latest": "Grok-2" + }, "updates": { "updateAvailable": "Aggiornamento disponibile!", "currentVersion": "La tua versione", diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index 8228df120a..e82ca57a3e 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -303,6 +303,11 @@ "gemma-7b-it": "Gemma 7b", "gemma2-9b-it": "Gemma2 9b" }, + "xaiApi": { + "name": "xAI API", + "grok-beta": "Grok Beta", + "grok-2-latest": "Grok-2" + }, "updates": { "updateAvailable": "新しいバージョンが利用可能です。", "currentVersion": "現バージョン", diff --git a/src/i18n/locales/ko.json b/src/i18n/locales/ko.json index c305d8b66f..f849a7f3f3 100644 --- a/src/i18n/locales/ko.json +++ b/src/i18n/locales/ko.json @@ -306,6 +306,11 @@ "gemma-7b-it": "Gemma 7b", "gemma2-9b-it": "Gemma2 9b" }, + "xaiApi": { + "name": "xAI API", + "grok-beta": "Grok Beta", + "grok-2-latest": "Grok-2" + }, "updates": { "updateAvailable": "업데이트 가능!", "currentVersion": "사용자 버전", diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json index c90adc2247..c42cecd14d 100644 --- a/src/i18n/locales/ru.json +++ b/src/i18n/locales/ru.json @@ -303,6 +303,11 @@ "gemma-7b-it": "Gemma 7b", "gemma2-9b-it": "Gemma2 9b" }, + "xaiApi": { + "name": "xAI API", + "grok-beta": "Grok Beta", + "grok-2-latest": "Grok-2" + }, "updates": { "updateAvailable": "Доступно обновление!", "currentVersion": "Ваша версия", diff --git a/src/i18n/locales/vi.json b/src/i18n/locales/vi.json index e1db6b3f56..054534fd1a 100644 --- a/src/i18n/locales/vi.json +++ b/src/i18n/locales/vi.json @@ -282,6 +282,11 @@ "gemma-7b-it": "Gemma 7b", "gemma2-9b-it": "Gemma2 9b" }, + "xaiApi": { + "name": "xAI API", + "grok-beta": "Grok Beta", + "grok-2-latest": "Grok-2" + }, "updates": { "updateAvailable": "Cập nhập mới đã có!", "currentVersion": "Phiên bản của bạn", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index 540aba40a4..cf506f2395 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -303,6 +303,11 @@ "gemma-7b-it": "Gemma 7b", "gemma2-9b-it": "Gemma2 9b" }, + "xaiApi": { + "name": "xAI API", + "grok-beta": "Grok Beta", + "grok-2-latest": "Grok-2" + }, "updates": { "updateAvailable": "有更新!", "currentVersion": "您当前的版本", diff --git a/src/i18n/locales/zhtw.json b/src/i18n/locales/zhtw.json index 87cecc416b..36b3e75a7b 100644 --- a/src/i18n/locales/zhtw.json +++ b/src/i18n/locales/zhtw.json @@ -303,6 +303,11 @@ "gemma-7b-it": "Gemma 7b", "gemma2-9b-it": "Gemma2 9b" }, + "xaiApi": { + "name": "xAI API", + "grok-beta": "Grok Beta", + "grok-2-latest": "Grok-2" + }, "updates": { "updateAvailable": "有新版可使用!", "currentVersion": "您目前的版本", diff --git a/src/store/index.js b/src/store/index.js index 85ff9b15f7..c48e1b5b1f 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -122,6 +122,10 @@ export default createStore({ phind: { model: "Phind Model", }, + xaiApi: { + apiKey: "", + pastRounds: 5, + }, currentChatIndex: 0, updateCounter: 0, theme: undefined, @@ -270,6 +274,9 @@ export default createStore({ setMistral(state, values) { state.mistral = { ...state.mistral, ...values }; }, + setXaiApi(state, values) { + state.xaiApi = { ...state.xaiApi, ...values }; + }, setLatestPromptIndex(state, promptIndex) { Chats.table.update(state.currentChatIndex, { latestPromptIndex: promptIndex,