From a04c364f0442b01ef087899ca355687fddca5e47 Mon Sep 17 00:00:00 2001 From: Arvin Xu Date: Fri, 15 Mar 2024 23:54:29 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20support=20groq=20as=20a=20m?= =?UTF-8?q?odel=20provider=20(#1569)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨ feat: support model provider groq (#1562) * add Groq localization (#1570) * 🐛 fix: fix groq logo and document * 🌐 style: add i18n --------- Co-authored-by: Jiaqi Cai <45190310+jcdiv47@users.noreply.github.com> Co-authored-by: PedroZ --- .env.example | 16 ++-- .../environment-variables/model-provider.mdx | 11 ++- .../model-provider.zh-CN.mdx | 11 ++- locales/ar/common.json | 1 + locales/ar/error.json | 6 ++ locales/ar/setting.json | 8 ++ locales/de-DE/common.json | 1 + locales/de-DE/error.json | 6 ++ locales/de-DE/setting.json | 8 ++ locales/en-US/common.json | 1 + locales/en-US/error.json | 6 ++ locales/en-US/setting.json | 8 ++ locales/es-ES/common.json | 1 + locales/es-ES/error.json | 6 ++ locales/es-ES/setting.json | 8 ++ locales/fr-FR/common.json | 1 + locales/fr-FR/error.json | 6 ++ locales/fr-FR/setting.json | 8 ++ locales/it-IT/common.json | 1 + locales/it-IT/error.json | 6 ++ locales/it-IT/setting.json | 8 ++ locales/ja-JP/common.json | 1 + locales/ja-JP/error.json | 6 ++ locales/ja-JP/setting.json | 8 ++ locales/ko-KR/common.json | 1 + locales/ko-KR/error.json | 6 ++ locales/ko-KR/setting.json | 8 ++ locales/nl-NL/common.json | 1 + locales/nl-NL/error.json | 6 ++ locales/nl-NL/setting.json | 8 ++ locales/pl-PL/common.json | 1 + locales/pl-PL/error.json | 6 ++ locales/pl-PL/setting.json | 8 ++ locales/pt-BR/common.json | 1 + locales/pt-BR/error.json | 6 ++ locales/pt-BR/setting.json | 8 ++ locales/ru-RU/common.json | 1 + locales/ru-RU/error.json | 6 ++ locales/ru-RU/setting.json | 8 ++ locales/tr-TR/common.json | 1 + locales/tr-TR/error.json | 6 ++ locales/tr-TR/setting.json | 8 ++ locales/vi-VN/common.json | 1 + locales/vi-VN/error.json | 6 ++ locales/vi-VN/setting.json | 8 ++ locales/zh-CN/common.json | 1 + locales/zh-CN/error.json | 6 ++ locales/zh-CN/setting.json | 8 ++ locales/zh-TW/common.json | 1 + locales/zh-TW/error.json | 6 ++ locales/zh-TW/setting.json | 8 ++ src/app/api/chat/[provider]/agentRuntime.ts | 17 +++- src/app/api/config/route.ts | 2 + src/app/api/errorResponse.ts | 3 + src/app/settings/llm/Groq/index.tsx | 47 +++++++++++ src/app/settings/llm/index.tsx | 2 + src/components/ModelProviderIcon/index.tsx | 5 ++ src/config/modelProviders/groq.ts | 24 ++++++ src/config/modelProviders/index.ts | 3 + src/config/server/provider.ts | 14 +++- src/const/settings.ts | 4 + .../Conversation/Error/APIKeyForm/Groq.tsx | 60 ++++++++++++++ .../Conversation/Error/APIKeyForm/index.tsx | 5 ++ src/features/Conversation/Error/index.tsx | 1 + .../components/ChatItem/index.tsx | 3 +- src/libs/agent-runtime/error.ts | 3 + src/libs/agent-runtime/groq/index.ts | 78 +++++++++++++++++++ src/libs/agent-runtime/index.ts | 1 + src/libs/agent-runtime/types/type.ts | 1 + src/locales/default/common.ts | 1 + src/locales/default/error.ts | 7 ++ src/locales/default/setting.ts | 8 ++ src/services/_auth.ts | 6 +- .../settings/selectors/modelProvider.ts | 19 +++-- src/types/settings/modelProvider.ts | 6 ++ 75 files changed, 577 insertions(+), 21 deletions(-) create mode 100644 src/app/settings/llm/Groq/index.tsx create mode 100644 src/config/modelProviders/groq.ts create mode 100644 src/features/Conversation/Error/APIKeyForm/Groq.tsx create mode 100644 src/libs/agent-runtime/groq/index.ts diff --git a/.env.example b/.env.example index 149cc8e863fd..f157d0d03694 100644 --- a/.env.example +++ b/.env.example @@ -73,19 +73,25 @@ OPENAI_API_KEY=sk-xxxxxxxxx ########### Mistral AI Service ########## ######################################## -#MISTRAL_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx +# MISTRAL_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx ######################################## -######### Perplexity Service ########## +######### Perplexity Service ########### ######################################## -#PERPLEXITY_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx +# PERPLEXITY_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx ######################################## -######### Anthropic Service ########## +######### Anthropic Service ############ ######################################## -#ANTHROPIC_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx +# ANTHROPIC_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + +######################################## +############ Groq Service ############## +######################################## + +# GROQ_API_KEY=gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx ######################################## ############ Market Service ############ diff --git a/docs/self-hosting/environment-variables/model-provider.mdx b/docs/self-hosting/environment-variables/model-provider.mdx index a4c97bd90a10..e04bc83cf499 100644 --- a/docs/self-hosting/environment-variables/model-provider.mdx +++ b/docs/self-hosting/environment-variables/model-provider.mdx @@ -1,5 +1,3 @@ -import { Callout } from 'nextra/components'; - # Model Service Providers When deploying LobeChat, a rich set of environment variables related to model service providers is provided, allowing you to easily define the model service providers to be enabled in LobeChat. @@ -163,6 +161,15 @@ When using the `turn` mode, the API Keys will be retrieved in a round-robin mann - Default: - - Example: `sk-ant-apixx-xxxxxxxxx-xxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxx` +## Groq AI + +### `GROQ_API_KEY` + +- Type: Required +- Description: This is the API key you applied from Groq AI +- Default: - +- Example: `gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx` + ## Mistral AI ### `MISTRAL_API_KEY` diff --git a/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx b/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx index 5f301b1cd331..1fa10f70a6e9 100644 --- a/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx +++ b/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx @@ -1,5 +1,3 @@ -import { Callout } from 'nextra/components'; - # 模型服务商 LobeChat 在部署时提供了丰富的模型服务商相关的环境变量,你可以使用这些环境变量轻松定义需要在 LobeChat 中开启的模型服务商。 @@ -170,4 +168,13 @@ LobeChat 在部署时提供了丰富的模型服务商相关的环境变量, - 默认值:- - 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=` +## Groq AI + +### `GROQ_API_KEY` + +- 类型:必选 +- 描述:这是你在 Groq AI 服务中申请的 API 密钥 +- 默认值:- +- 示例:`gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx` + [azure-api-verion-url]: https://docs.microsoft.com/zh-cn/azure/developer/javascript/api-reference/es-modules/azure-sdk/ai-translation/translationconfiguration?view=azure-node-latest#api-version diff --git a/locales/ar/common.json b/locales/ar/common.json index 3d26f3443aa2..f9788ed9d097 100644 --- a/locales/ar/common.json +++ b/locales/ar/common.json @@ -104,6 +104,7 @@ "azure": "أزور", "bedrock": "بيدروك لأمازون ويب سيرفيس", "google": "جوجل", + "groq": "Groq", "mistral": "Mistral AI", "moonshot": "مونشوت الذكاء الاصطناعي", "ollama": "أولاما", diff --git a/locales/ar/error.json b/locales/ar/error.json index a599d6672f2a..3b43b30a79cb 100644 --- a/locales/ar/error.json +++ b/locales/ar/error.json @@ -38,11 +38,13 @@ "AzureBizError": "حدث خطأ في طلب خدمة Azure AI، يرجى التحقق من المعلومات التالية أو إعادة المحاولة", "BedrockBizError": "حدث خطأ في طلب خدمة Bedrock، يرجى التحقق من المعلومات التالية أو إعادة المحاولة", "GoogleBizError": "حدث خطأ في طلب خدمة Google، يرجى التحقق من المعلومات التالية أو إعادة المحاولة", + "GroqBizError": "حدث خطأ في خدمة Groq ، يرجى التحقق من المعلومات التالية أو إعادة المحاولة", "InvalidAccessCode": "كلمة المرور غير صحيحة أو فارغة، يرجى إدخال كلمة مرور الوصول الصحيحة أو إضافة مفتاح API مخصص", "InvalidAnthropicAPIKey": "مفتاح Anthropic API غير صحيح أو فارغ، يرجى التحقق من مفتاح Anthropic API وإعادة المحاولة", "InvalidAzureAPIKey": "مفتاح Azure API غير صحيح أو فارغ، يرجى التحقق من مفتاح Azure API وإعادة المحاولة", "InvalidBedrockCredentials": "فشلت مصادقة Bedrock، يرجى التحقق من AccessKeyId/SecretAccessKey وإعادة المحاولة", "InvalidGoogleAPIKey": "مفتاح Google API غير صحيح أو فارغ، يرجى التحقق من مفتاح Google API وإعادة المحاولة", + "InvalidGroqAPIKey": "مفتاح Groq API غير صحيح أو فارغ، يرجى التحقق من مفتاح Groq API وإعادة المحاولة", "InvalidMistralAPIKey": "مفتاح Mistral AI API غير صحيح أو فارغ، يرجى التحقق من مفتاح Mistral API وإعادة المحاولة", "InvalidMoonshotAPIKey": "مفتاح API لـ Moonshot AI غير صحيح أو فارغ، يرجى التحقق من مفتاح API لـ Moonshot وإعادة المحاولة", "InvalidOllamaArgs": "تكوين Ollama غير صحيح، يرجى التحقق من تكوين Ollama وإعادة المحاولة", @@ -91,6 +93,10 @@ "description": "أدخل مفتاح Google API الخاص بك لبدء الجلسة. لن يقوم التطبيق بتسجيل مفتاح الواجهة البرمجية الخاص بك", "title": "استخدام مفتاح Google API المخصص" }, + "Groq": { + "description": "قم بإدخال مفتاح API الخاص بك لـ Groq للبدء في الجلسة. لن يتم تسجيل مفتاح الخاص بك من قبل التطبيق", + "title": "استخدام مفتاح API الخاص بـ Groq المخصص" + }, "Mistral": { "description": "أدخل مفتاح Mistral AI API الخاص بك لبدء الجلسة. لن يتم تسجيل مفتاح الواجهة البرمجية الخاص بك من قبل التطبيق", "title": "استخدام مفتاح Mistral AI API المخصص" diff --git a/locales/ar/setting.json b/locales/ar/setting.json index 10d7ce6fbe18..50053e9245a8 100644 --- a/locales/ar/setting.json +++ b/locales/ar/setting.json @@ -99,6 +99,14 @@ "title": "مفتاح واجهة برمجة التطبيقات" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "أدخل مفتاح API الخاص بـ Groq", + "placeholder": "مفتاح API Groq", + "title": "مفتاح API" + } + }, "Mistral": { "title": "Mistral AI", "token": { diff --git a/locales/de-DE/common.json b/locales/de-DE/common.json index 6bb6c60ecfab..8a6fd8fd83a3 100644 --- a/locales/de-DE/common.json +++ b/locales/de-DE/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "groq": "Groq", "mistral": "Mistral KI", "moonshot": "Moonshot KI", "ollama": "Ollama", diff --git a/locales/de-DE/error.json b/locales/de-DE/error.json index 9acc70accfc7..ca93a7c6e495 100644 --- a/locales/de-DE/error.json +++ b/locales/de-DE/error.json @@ -38,11 +38,13 @@ "AzureBizError": "Es ist ein Fehler bei der Anforderung des Azure AI-Dienstes aufgetreten. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.", "BedrockBizError": "Es ist ein Fehler bei der Anforderung des Bedrock-Dienstes aufgetreten. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.", "GoogleBizError": "Es ist ein Fehler bei der Anforderung des Google-Dienstes aufgetreten. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.", + "GroqBizError": "Die Anfrage an den Groq-Dienst ist fehlgeschlagen. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.", "InvalidAccessCode": "Das Passwort ist ungültig oder leer. Bitte geben Sie das richtige Zugangspasswort ein oder fügen Sie einen benutzerdefinierten API-Schlüssel hinzu.", "InvalidAnthropicAPIKey": "Ungültiger oder leerer Anthropic API-Schlüssel. Bitte überprüfen Sie den Anthropic API-Schlüssel und versuchen Sie es erneut.", "InvalidAzureAPIKey": "Der Azure API-Schlüssel ist ungültig oder leer. Bitte überprüfen Sie den Azure API-Schlüssel und versuchen Sie es erneut.", "InvalidBedrockCredentials": "Die Bedrock-Authentifizierung ist fehlgeschlagen. Bitte überprüfen Sie AccessKeyId/SecretAccessKey und versuchen Sie es erneut.", "InvalidGoogleAPIKey": "Der Google API-Schlüssel ist ungültig oder leer. Bitte überprüfen Sie den Google API-Schlüssel und versuchen Sie es erneut.", + "InvalidGroqAPIKey": "Der Groq API-Schlüssel ist ungültig oder leer. Bitte überprüfen Sie den Groq API-Schlüssel und versuchen Sie es erneut.", "InvalidMistralAPIKey": "Der Mistral AI-API-Schlüssel ist ungültig oder leer. Bitte überprüfen Sie den Mistral-API-Schlüssel und versuchen Sie es erneut.", "InvalidMoonshotAPIKey": "Ungültiger oder leerer Moonshot AI API-Schlüssel. Bitte überprüfen Sie den Moonshot API-Schlüssel und versuchen Sie es erneut.", "InvalidOllamaArgs": "Ollama-Konfiguration ist ungültig. Bitte überprüfen Sie die Ollama-Konfiguration und versuchen Sie es erneut.", @@ -91,6 +93,10 @@ "description": "Geben Sie Ihren Google API-Schlüssel ein, um die Sitzung zu starten. Die Anwendung speichert Ihren API-Schlüssel nicht.", "title": "Verwenden von benutzerdefinierten Google API-Schlüssel" }, + "Groq": { + "description": "Geben Sie Ihren individuellen Groq-API-Schlüssel ein, um die Sitzung zu starten. Die Anwendung speichert Ihren API-Schlüssel nicht.", + "title": "Verwenden Sie einen benutzerdefinierten Groq-API-Schlüssel" + }, "Mistral": { "description": "Geben Sie Ihren eigenen Mistral AI-API-Schlüssel ein, um die Sitzung zu starten. Die App speichert Ihren API-Schlüssel nicht.", "title": "Verwenden Sie einen benutzerdefinierten Mistral AI-API-Schlüssel" diff --git a/locales/de-DE/setting.json b/locales/de-DE/setting.json index 91453e7a8a5d..e8045600a67e 100644 --- a/locales/de-DE/setting.json +++ b/locales/de-DE/setting.json @@ -99,6 +99,14 @@ "title": "API-Schlüssel" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "Geben Sie den API-Schlüssel von Groq ein", + "placeholder": "Groq API-Schlüssel", + "title": "API-Schlüssel" + } + }, "Mistral": { "title": "Mistral KI", "token": { diff --git a/locales/en-US/common.json b/locales/en-US/common.json index 03b4f7f4982a..8d4e1b0a034e 100644 --- a/locales/en-US/common.json +++ b/locales/en-US/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "groq": "Groq", "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "Ollama", diff --git a/locales/en-US/error.json b/locales/en-US/error.json index 05c9e3d03757..5ded129e49ce 100644 --- a/locales/en-US/error.json +++ b/locales/en-US/error.json @@ -38,11 +38,13 @@ "AzureBizError": "Error requesting Azure AI service. Please troubleshoot or retry based on the following information.", "BedrockBizError": "Error requesting Bedrock service. Please troubleshoot or retry based on the following information.", "GoogleBizError": "Error requesting Google service. Please troubleshoot or retry based on the following information.", + "GroqBizError": "Error occurred while requesting Groq service. Please troubleshoot based on the following information or retry.", "InvalidAccessCode": "Invalid access code or empty. Please enter the correct access code or add a custom API Key.", "InvalidAnthropicAPIKey": "The Anthropic API Key is incorrect or empty. Please check the Anthropic API Key and retry.", "InvalidAzureAPIKey": "Azure API Key is incorrect or empty. Please check the Azure API Key and retry.", "InvalidBedrockCredentials": "Bedrock authentication failed. Please check the AccessKeyId/SecretAccessKey and retry.", "InvalidGoogleAPIKey": "Google API Key is incorrect or empty. Please check the Google API Key and retry.", + "InvalidGroqAPIKey": "Groq API Key is incorrect or empty. Please check the Groq API Key and retry.", "InvalidMistralAPIKey": "Incorrect or empty Mistral AI API Key. Please check your Mistral API Key and try again.", "InvalidMoonshotAPIKey": "The Moonshot AI API Key is incorrect or empty, please check the Moonshot API Key and try again.", "InvalidOllamaArgs": "Invalid Ollama configuration, please check Ollama configuration and try again", @@ -91,6 +93,10 @@ "description": "Enter your Google API Key to start the session. The app will not store your API Key.", "title": "Use custom Google API Key" }, + "Groq": { + "description": "Enter your Groq API Key to start the session. The application will not store your API Key.", + "title": "Use Custom Groq API Key" + }, "Mistral": { "description": "Enter your Mistral AI API Key to start the session. The application will not store your API Key.", "title": "Use Custom Mistral AI API Key" diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json index fb5d9e177927..5a8b460acaf4 100644 --- a/locales/en-US/setting.json +++ b/locales/en-US/setting.json @@ -99,6 +99,14 @@ "title": "API Key" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "Enter the API Key from Groq", + "placeholder": "Groq API Key", + "title": "API Key" + } + }, "Mistral": { "title": "Mistral AI", "token": { diff --git a/locales/es-ES/common.json b/locales/es-ES/common.json index d6f64b2738f2..234052b47e23 100644 --- a/locales/es-ES/common.json +++ b/locales/es-ES/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "groq": "Groq", "mistral": "Mistral IA", "moonshot": "Moonshot IA", "ollama": "Ollama", diff --git a/locales/es-ES/error.json b/locales/es-ES/error.json index 164fc59fbb8e..3cae64f0d0f3 100644 --- a/locales/es-ES/error.json +++ b/locales/es-ES/error.json @@ -38,11 +38,13 @@ "AzureBizError": "Se produjo un error al solicitar el servicio de Azure AI, por favor, verifica la siguiente información o inténtalo de nuevo", "BedrockBizError": "Se produjo un error al solicitar el servicio de Bedrock, por favor, verifica la siguiente información o inténtalo de nuevo", "GoogleBizError": "Se produjo un error al solicitar el servicio de Google, por favor, verifica la siguiente información o inténtalo de nuevo", + "GroqBizError": "Se produjo un error al solicitar el servicio Groq. Por favor, revise la siguiente información o inténtelo de nuevo", "InvalidAccessCode": "La contraseña no es válida o está vacía. Por favor, introduce una contraseña de acceso válida o añade una clave API personalizada", "InvalidAnthropicAPIKey": "La clave de API de Anthropic es incorrecta o está vacía. Por favor, revisa la clave de API de Anthropic e inténtalo de nuevo.", "InvalidAzureAPIKey": "La clave de API de Azure es incorrecta o está vacía, por favor, verifica la clave de API de Azure e inténtalo de nuevo", "InvalidBedrockCredentials": "La autenticación de Bedrock no se ha completado con éxito, por favor, verifica AccessKeyId/SecretAccessKey e inténtalo de nuevo", "InvalidGoogleAPIKey": "La clave de API de Google es incorrecta o está vacía, por favor, verifica la clave de API de Google e inténtalo de nuevo", + "InvalidGroqAPIKey": "La clave de API de Groq es incorrecta o está vacía. Por favor, revisa la clave de API de Groq e inténtalo de nuevo.", "InvalidMistralAPIKey": "La clave de API de Mistral AI es incorrecta o está vacía. Por favor, revise la clave de API de Mistral y vuelva a intentarlo.", "InvalidMoonshotAPIKey": "La clave de API de Moonshot AI no es válida o está vacía. Por favor, revise la clave de API de Moonshot e inténtelo de nuevo.", "InvalidOllamaArgs": "La configuración de Ollama no es válida, por favor revisa la configuración de Ollama e inténtalo de nuevo", @@ -91,6 +93,10 @@ "description": "Ingresa tu clave de API de Google para comenzar la sesión. La aplicación no guardará tu clave de API", "title": "Usar clave de API personalizada de Google" }, + "Groq": { + "description": "Ingresa tu clave de API de Groq para comenzar la sesión. La aplicación no almacenará tu clave de API", + "title": "Usar clave de API personalizada de Groq" + }, "Mistral": { "description": "Ingrese su clave de API de Mistral AI para comenzar la sesión. La aplicación no almacenará su clave de API.", "title": "Usar clave de API personalizada de Mistral AI" diff --git a/locales/es-ES/setting.json b/locales/es-ES/setting.json index 5b9e0f69df8d..9024909a5384 100644 --- a/locales/es-ES/setting.json +++ b/locales/es-ES/setting.json @@ -99,6 +99,14 @@ "title": "Clave API" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "Ingresa la clave API de Groq", + "placeholder": "Clave API de Groq", + "title": "Clave API" + } + }, "Mistral": { "title": "Mistral AI", "token": { diff --git a/locales/fr-FR/common.json b/locales/fr-FR/common.json index 2cd25d4892e3..0af6f15b1f5c 100644 --- a/locales/fr-FR/common.json +++ b/locales/fr-FR/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "groq": "Groq", "mistral": "Mistral AI", "moonshot": "Moonshot IA", "ollama": "Ollama", diff --git a/locales/fr-FR/error.json b/locales/fr-FR/error.json index c30bb1db65ae..adec5b461b9f 100644 --- a/locales/fr-FR/error.json +++ b/locales/fr-FR/error.json @@ -38,11 +38,13 @@ "AzureBizError": "Erreur lors de la demande de service Azure AI, veuillez vérifier les informations ci-dessous ou réessayer", "BedrockBizError": "Erreur lors de la demande de service Bedrock, veuillez vérifier les informations ci-dessous ou réessayer", "GoogleBizError": "Erreur lors de la demande de service Google, veuillez vérifier les informations ci-dessous ou réessayer", + "GroqBizError": "Une erreur s'est produite lors de la demande de service Groq. Veuillez vérifier les informations ci-dessous ou réessayer.", "InvalidAccessCode": "Le mot de passe est incorrect ou vide. Veuillez saisir le mot de passe d'accès correct ou ajouter une clé API personnalisée.", "InvalidAnthropicAPIKey": "La clé API Anthropic est incorrecte ou manquante. Veuillez vérifier la clé API Anthropic et réessayer.", "InvalidAzureAPIKey": "Clé API Azure incorrecte ou vide, veuillez vérifier la clé API Azure et réessayer", "InvalidBedrockCredentials": "L'authentification Bedrock a échoué, veuillez vérifier AccessKeyId/SecretAccessKey et réessayer", "InvalidGoogleAPIKey": "Clé API Google incorrecte ou vide, veuillez vérifier la clé API Google et réessayer", + "InvalidGroqAPIKey": "Clé API Groq incorrecte ou vide, veuillez vérifier la clé API Groq et réessayer", "InvalidMistralAPIKey": "Clé API Mistral AI incorrecte ou manquante. Veuillez vérifier la clé API Mistral et réessayer.", "InvalidMoonshotAPIKey": "Clé API Moonshot AI incorrecte ou manquante. Veuillez vérifier la clé API Moonshot et réessayer.", "InvalidOllamaArgs": "La configuration d'Ollama n'est pas valide, veuillez vérifier la configuration d'Ollama et réessayer", @@ -91,6 +93,10 @@ "description": "Entrez votre clé API Google pour commencer la session. L'application ne conservera pas votre clé API", "title": "Utiliser une clé API Google personnalisée" }, + "Groq": { + "description": "Entrez votre clé d'API Groq pour commencer la session. L'application ne stockera pas votre clé d'API.", + "title": "Utiliser une clé d'API Groq personnalisée" + }, "Mistral": { "description": "Entrez votre clé API Mistral AI pour commencer la session. L'application ne stockera pas votre clé API.", "title": "Utiliser une clé API Mistral AI personnalisée" diff --git a/locales/fr-FR/setting.json b/locales/fr-FR/setting.json index b4650c6fa7a1..de2a2a49928e 100644 --- a/locales/fr-FR/setting.json +++ b/locales/fr-FR/setting.json @@ -99,6 +99,14 @@ "title": "Clé API" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "Entrez la clé API de Groq", + "placeholder": "Clé API Groq", + "title": "Clé API" + } + }, "Mistral": { "title": "Mistral AI", "token": { diff --git a/locales/it-IT/common.json b/locales/it-IT/common.json index 9b3e966d1432..d47a7c9470c7 100644 --- a/locales/it-IT/common.json +++ b/locales/it-IT/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "groq": "Groq", "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "Ollama", diff --git a/locales/it-IT/error.json b/locales/it-IT/error.json index 5b488acaa119..0ec23008c142 100644 --- a/locales/it-IT/error.json +++ b/locales/it-IT/error.json @@ -38,11 +38,13 @@ "AzureBizError": "Errore nella richiesta del servizio Azure AI, controlla le informazioni seguenti o riprova", "BedrockBizError": "Errore nella richiesta del servizio Bedrock, controlla le informazioni seguenti o riprova", "GoogleBizError": "Errore nella richiesta del servizio Google, controlla le informazioni seguenti o riprova", + "GroqBizError": "Errore del servizio Groq, controlla le informazioni seguenti o riprova", "InvalidAccessCode": "Password incorrect or empty, please enter the correct access password, or add a custom API Key", "InvalidAnthropicAPIKey": "La chiave API Anthropic non è valida o è vuota. Si prega di controllare la chiave API Anthropic e riprovare.", "InvalidAzureAPIKey": "Chiave API Azure non corretta o vuota, controlla la chiave API Azure e riprova", "InvalidBedrockCredentials": "Autenticazione Bedrock non riuscita, controlla AccessKeyId/SecretAccessKey e riprova", "InvalidGoogleAPIKey": "Chiave API Google non corretta o vuota, controlla la chiave API Google e riprova", + "InvalidGroqAPIKey": "Chiave API Groq non valida o vuota, controlla la chiave API Groq e riprova", "InvalidMistralAPIKey": "Chiave API Mistral AI non valida o vuota. Si prega di controllare la chiave API Mistral e riprovare.", "InvalidMoonshotAPIKey": "La chiave API di Moonshot AI non è corretta o è vuota, si prega di controllare la chiave API di Moonshot e riprovare", "InvalidOllamaArgs": "Configurazione Ollama non valida, controllare la configurazione di Ollama e riprovare", @@ -91,6 +93,10 @@ "description": "Inserisci la tua chiave API Google per iniziare la sessione. L'applicazione non memorizzerà la tua chiave API", "title": "Utilizza la chiave API Google personalizzata" }, + "Groq": { + "description": "Inserisci la tua chiave API Groq per iniziare la sessione. L'applicazione non memorizzerà la tua chiave API", + "title": "Usa una chiave API Groq personalizzata" + }, "Mistral": { "description": "Inserisci la tua chiave API Mistral AI per iniziare la sessione. L'applicazione non memorizzerà la tua chiave API.", "title": "Utilizza una chiave API personalizzata per Mistral AI" diff --git a/locales/it-IT/setting.json b/locales/it-IT/setting.json index 67f8ac7d2242..644d069aab71 100644 --- a/locales/it-IT/setting.json +++ b/locales/it-IT/setting.json @@ -99,6 +99,14 @@ "title": "Chiave API" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "Inserisci la chiave API da Groq", + "placeholder": "Chiave API Groq", + "title": "Chiave API" + } + }, "Mistral": { "title": "Mistral AI", "token": { diff --git a/locales/ja-JP/common.json b/locales/ja-JP/common.json index aae7fdbedfba..e7efa4b36b87 100644 --- a/locales/ja-JP/common.json +++ b/locales/ja-JP/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWSベッドロック", "google": "Google", + "groq": "Groq", "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "オラマ", diff --git a/locales/ja-JP/error.json b/locales/ja-JP/error.json index b45af0c26b4c..590f4c439154 100644 --- a/locales/ja-JP/error.json +++ b/locales/ja-JP/error.json @@ -38,11 +38,13 @@ "AzureBizError": "Azure AIサービスのリクエストでエラーが発生しました。以下の情報に基づいてトラブルシューティングを行うか、再試行してください。", "BedrockBizError": "Bedrockサービスのリクエストでエラーが発生しました。以下の情報に基づいてトラブルシューティングを行うか、再試行してください。", "GoogleBizError": "Googleサービスのリクエストでエラーが発生しました。以下の情報に基づいてトラブルシューティングを行うか、再試行してください。", + "GroqBizError": "Groqサービスのリクエストでエラーが発生しました。以下の情報を確認して再試行してください。", "InvalidAccessCode": "パスワードが正しくないか空です。正しいアクセスパスワードを入力するか、カスタムAPIキーを追加してください", "InvalidAnthropicAPIKey": "Anthropic APIキーが正しくないか空です。Anthropic APIキーを確認してもう一度お試しください。", "InvalidAzureAPIKey": "Azure APIキーが正しくないか空です。Azure APIキーを確認してから再試行してください。", "InvalidBedrockCredentials": "Bedrockの認証に失敗しました。AccessKeyId/SecretAccessKeyを確認してから再試行してください。", "InvalidGoogleAPIKey": "Google APIキーが正しくないか空です。Google APIキーを確認してから再試行してください。", + "InvalidGroqAPIKey": "Groq APIキーが正しくないか空です。Groq APIキーを確認して再試行してください。", "InvalidMistralAPIKey": "Mistral AI API キーが正しくないか空です。Mistral API キーを確認して再試行してください。", "InvalidMoonshotAPIKey": "Moonshot AI APIキーが正しくないか空です。Moonshot APIキーを確認して再試行してください。", "InvalidOllamaArgs": "Ollamaの設定が正しくありません。Ollamaの設定を確認してからもう一度お試しください", @@ -91,6 +93,10 @@ "description": "Google APIキーを入力してセッションを開始します。アプリはAPIキーを記録しません。", "title": "カスタムGoogle APIキーを使用" }, + "Groq": { + "description": "Groq APIキーを入力してセッションを開始します。アプリはAPIキーを記録しません。", + "title": "カスタムGroq APIキーを使用" + }, "Mistral": { "description": "Mistral AI API キーを入力してセッションを開始できます。アプリは API キーを記録しません。", "title": "カスタム Mistral AI API キーの使用" diff --git a/locales/ja-JP/setting.json b/locales/ja-JP/setting.json index 549b8a909d26..ffd0b8a2d60c 100644 --- a/locales/ja-JP/setting.json +++ b/locales/ja-JP/setting.json @@ -99,6 +99,14 @@ "title": "APIキー" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "Groq からの API キーを入力してください", + "placeholder": "Groq API キー", + "title": " API キー" + } + }, "Mistral": { "title": "Mistral AI", "token": { diff --git a/locales/ko-KR/common.json b/locales/ko-KR/common.json index 920f1fd97d28..454ba12e4b92 100644 --- a/locales/ko-KR/common.json +++ b/locales/ko-KR/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "groq": "Groq", "mistral": "Mistral AI", "moonshot": "문샷 AI", "ollama": "올라마", diff --git a/locales/ko-KR/error.json b/locales/ko-KR/error.json index 485da03f35d4..156b40040522 100644 --- a/locales/ko-KR/error.json +++ b/locales/ko-KR/error.json @@ -38,11 +38,13 @@ "AzureBizError": "Azure AI 서비스 요청 중 오류가 발생했습니다. 아래 정보를 확인하고 다시 시도하십시오.", "BedrockBizError": "Bedrock 서비스 요청 중 오류가 발생했습니다. 아래 정보를 확인하고 다시 시도하십시오.", "GoogleBizError": "Google 서비스 요청 중 오류가 발생했습니다. 아래 정보를 확인하고 다시 시도하십시오.", + "GroqBizError": "Groq 서비스 요청 중 오류가 발생했습니다. 아래 정보를 확인하고 다시 시도해주세요.", "InvalidAccessCode": "액세스 코드가 잘못되었거나 비어 있습니다. 올바른 액세스 코드를 입력하거나 사용자 지정 API 키를 추가하십시오.", "InvalidAnthropicAPIKey": "Anthropic API 키가 잘못되었거나 비어 있습니다. Anthropic API 키를 확인하고 다시 시도하십시오.", "InvalidAzureAPIKey": "잘못된 또는 비어 있는 Azure API Key입니다. Azure API Key를 확인한 후 다시 시도하십시오.", "InvalidBedrockCredentials": "Bedrock 인증에 실패했습니다. AccessKeyId/SecretAccessKey를 확인한 후 다시 시도하십시오.", "InvalidGoogleAPIKey": "잘못된 또는 비어 있는 Google API Key입니다. Google API Key를 확인한 후 다시 시도하십시오.", + "InvalidGroqAPIKey": "잘못된 또는 비어 있는 Groq API Key입니다. Groq API Key를 확인한 후 다시 시도하십시오.", "InvalidMistralAPIKey": "Mistral AI API 키가 잘못되었거나 비어 있습니다. Mistral API 키를 확인한 후 다시 시도해주세요.", "InvalidMoonshotAPIKey": "Moonshot AI API 키가 잘못되었거나 비어 있습니다. Moonshot API 키를 확인한 후 다시 시도해주세요.", "InvalidOllamaArgs": "Ollama 구성이 잘못되었습니다. Ollama 구성을 확인한 후 다시 시도하십시오.", @@ -91,6 +93,10 @@ "description": "Google API Key를 입력하여 세션을 시작합니다. 앱은 귀하의 API Key를 기록하지 않습니다.", "title": "사용자 정의 Google API Key 사용" }, + "Groq": { + "description": "Groq API 키를 입력하면 세션을 시작할 수 있습니다. 애플리케이션은 API 키를 기록하지 않습니다.", + "title": "사용자 지정 Groq API 키 사용" + }, "Mistral": { "description": "Mistral AI API 키를 입력하면 세션을 시작할 수 있습니다. 애플리케이션은 API 키를 기록하지 않습니다.", "title": "사용자 지정 Mistral AI API 키 사용" diff --git a/locales/ko-KR/setting.json b/locales/ko-KR/setting.json index 0a0aa5388e17..21ed7ad39c45 100644 --- a/locales/ko-KR/setting.json +++ b/locales/ko-KR/setting.json @@ -99,6 +99,14 @@ "title": "API Key" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "Groq의 API 키를 입력하세요", + "placeholder": "Groq API 키", + "title": "API 키" + } + }, "Mistral": { "title": "Mistral AI", "token": { diff --git a/locales/nl-NL/common.json b/locales/nl-NL/common.json index da0fff4ee218..43ed2319b319 100644 --- a/locales/nl-NL/common.json +++ b/locales/nl-NL/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "groq": "Groq", "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "Ollama", diff --git a/locales/nl-NL/error.json b/locales/nl-NL/error.json index f60cc4a11091..eac05903a512 100644 --- a/locales/nl-NL/error.json +++ b/locales/nl-NL/error.json @@ -38,11 +38,13 @@ "AzureBizError": "Error requesting Azure AI service, please troubleshoot or retry based on the following information", "BedrockBizError": "Error requesting Bedrock service, please troubleshoot or retry based on the following information", "GoogleBizError": "Error requesting Google service, please troubleshoot or retry based on the following information", + "GroqBizError": "Er is een fout opgetreden bij het aanroepen van de Groq-service. Controleer de onderstaande informatie of probeer het opnieuw.", "InvalidAccessCode": "Ongeldige toegangscode: het wachtwoord is onjuist of leeg. Voer de juiste toegangscode in of voeg een aangepaste API-sleutel toe.", "InvalidAnthropicAPIKey": "Anthropic API Key is onjuist of leeg. Controleer de Anthropic API Key en probeer het opnieuw.", "InvalidAzureAPIKey": "Incorrect or empty Azure API Key, please check the Azure API Key and retry", "InvalidBedrockCredentials": "Bedrock authentication failed, please check AccessKeyId/SecretAccessKey and retry", "InvalidGoogleAPIKey": "Incorrect or empty Google API Key, please check the Google API Key and retry", + "InvalidGroqAPIKey": "Groq API Key is onjuist of leeg. Controleer de Groq API Key en probeer het opnieuw.", "InvalidMistralAPIKey": "Ongeldige of lege Mistral AI API-sleutel. Controleer de Mistral API-sleutel en probeer het opnieuw.", "InvalidMoonshotAPIKey": "Moonshot AI API密钥不正确或为空,请检查Moonshot API密钥后重试", "InvalidOllamaArgs": "Ollama-configuratie is onjuist, controleer de Ollama-configuratie en probeer het opnieuw", @@ -91,6 +93,10 @@ "description": "Enter your Google API Key to start the session. The app will not record your API Key", "title": "Use custom Google API Key" }, + "Groq": { + "description": "Voer je Groq API-sleutel in om te beginnen met de sessie. De app zal je API-sleutel niet opslaan.", + "title": "Gebruik een aangepaste Groq API-sleutel" + }, "Mistral": { "description": "Voer je Mistral AI API-sleutel in om een sessie te starten. De app slaat je API-sleutel niet op.", "title": "Gebruik aangepaste Mistral AI API-sleutel" diff --git a/locales/nl-NL/setting.json b/locales/nl-NL/setting.json index ca6618bfcdba..df09341ad1ac 100644 --- a/locales/nl-NL/setting.json +++ b/locales/nl-NL/setting.json @@ -99,6 +99,14 @@ "title": "API-sleutel" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "Voer de API-sleutel van Groq in", + "placeholder": "Groq API-sleutel", + "title": "API-sleutel" + } + }, "Mistral": { "title": "Mistral AI", "token": { diff --git a/locales/pl-PL/common.json b/locales/pl-PL/common.json index dbc5019d10b0..b028bef60cba 100644 --- a/locales/pl-PL/common.json +++ b/locales/pl-PL/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "groq": "Groq", "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "Ollama", diff --git a/locales/pl-PL/error.json b/locales/pl-PL/error.json index 30d33f33cbec..0dd4a8e1d2bc 100644 --- a/locales/pl-PL/error.json +++ b/locales/pl-PL/error.json @@ -38,11 +38,13 @@ "AzureBizError": "Wystąpił błąd żądania usługi Azure AI, prosimy o sprawdzenie poniższych informacji lub ponowne próbowanie.", "BedrockBizError": "Wystąpił błąd żądania usługi Bedrock, prosimy o sprawdzenie poniższych informacji lub ponowne próbowanie.", "GoogleBizError": "Wystąpił błąd żądania usługi Google, prosimy o sprawdzenie poniższych informacji lub ponowne próbowanie.", + "GroqBizError": "Wystąpił błąd usługi Groq. Sprawdź poniższe informacje lub spróbuj ponownie.", "InvalidAccessCode": "Nieprawidłowy kod dostępu: Hasło jest nieprawidłowe lub puste. Proszę wprowadzić poprawne hasło dostępu lub dodać niestandardowy klucz API.", "InvalidAnthropicAPIKey": "Anthropic API Key jest nieprawidłowy lub pusty. Sprawdź poprawność klucza API Anthropic i spróbuj ponownie.", "InvalidAzureAPIKey": "Nieprawidłowy lub pusty klucz API Azure, prosimy sprawdzić klucz API Azure i spróbować ponownie.", "InvalidBedrockCredentials": "Uwierzytelnienie Bedrock nie powiodło się, prosimy sprawdzić AccessKeyId/SecretAccessKey i spróbować ponownie.", "InvalidGoogleAPIKey": "Nieprawidłowy lub pusty klucz API Google, prosimy sprawdzić klucz API Google i spróbować ponownie.", + "InvalidGroqAPIKey": "Nieprawidłowy klucz API Groq, prosimy sprawdzić klucz API Groq i spróbować ponownie.", "InvalidMistralAPIKey": "Mistral AI API Key 不正确或为空,请检查 Mistral API Key 后重试", "InvalidMoonshotAPIKey": "Moonshot AI API密钥不正确或为空,请检查Moonshot API密钥后重试", "InvalidOllamaArgs": "Nieprawidłowa konfiguracja Ollama, sprawdź konfigurację Ollama i spróbuj ponownie", @@ -91,6 +93,10 @@ "description": "Wprowadź swój klucz API Google, aby rozpocząć sesję. Aplikacja nie będzie przechowywać Twojego klucza API.", "title": "Użyj niestandardowego klucza API Google" }, + "Groq": { + "description": "Wprowadź swój klucz API Groq, aby rozpocząć sesję. Aplikacja nie będzie przechowywać Twojego klucza API.", + "title": "Użyj niestandardowego klucza API Groq" + }, "Mistral": { "description": "输入你的 Mistral AI API Key 即可开始会话。应用不会记录你的 API Key", "title": "使用自定义 Mistral AI API Key" diff --git a/locales/pl-PL/setting.json b/locales/pl-PL/setting.json index baa2d4a71be9..deb4585d41dc 100644 --- a/locales/pl-PL/setting.json +++ b/locales/pl-PL/setting.json @@ -99,6 +99,14 @@ "title": "Klucz API" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "Wprowadź klucz API z Groq", + "placeholder": " Klucz API Groq", + "title": " Klucz API" + } + }, "Mistral": { "title": "Mistral AI", "token": { diff --git a/locales/pt-BR/common.json b/locales/pt-BR/common.json index 6381f563dc00..827bd6b9f62e 100644 --- a/locales/pt-BR/common.json +++ b/locales/pt-BR/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "groq": "Groq", "mistral": "Mistral AI", "moonshot": "Moonshot IA", "ollama": "Ollama", diff --git a/locales/pt-BR/error.json b/locales/pt-BR/error.json index a5c73090c214..250392d7c242 100644 --- a/locales/pt-BR/error.json +++ b/locales/pt-BR/error.json @@ -38,11 +38,13 @@ "AzureBizError": "Erro ao solicitar o serviço Azure AI, por favor, verifique as informações abaixo ou tente novamente", "BedrockBizError": "Erro ao solicitar o serviço Bedrock, por favor, verifique as informações abaixo ou tente novamente", "GoogleBizError": "Erro ao solicitar o serviço Google, por favor, verifique as informações abaixo ou tente novamente", + "GroqBizError": "O serviço Groq encontrou um erro. Por favor, verifique as informações abaixo ou tente novamente.", "InvalidAccessCode": "Senha de acesso inválida ou em branco. Por favor, insira a senha de acesso correta ou adicione uma Chave de API personalizada.", "InvalidAnthropicAPIKey": "A chave da API Anthropic está incorreta ou vazia. Por favor, verifique a chave da API Anthropic e tente novamente.", "InvalidAzureAPIKey": "Chave de API Azure incorreta ou vazia, por favor, verifique a chave de API Azure e tente novamente", "InvalidBedrockCredentials": "Credenciais Bedrock inválidas, por favor, verifique AccessKeyId/SecretAccessKey e tente novamente", "InvalidGoogleAPIKey": "Chave de API Google incorreta ou vazia, por favor, verifique a chave de API Google e tente novamente", + "InvalidGroqAPIKey": "Chave de API Groq AI inválida ou em branco, verifique a chave de API Groq e tente novamente", "InvalidMistralAPIKey": "Chave de API Mistral AI inválida ou vazia. Por favor, verifique a chave de API Mistral e tente novamente.", "InvalidMoonshotAPIKey": "A chave da API Moonshot AI está incorreta ou vazia. Por favor, verifique a chave da API Moonshot e tente novamente.", "InvalidOllamaArgs": "Configuração Ollama inválida, verifique a configuração do Ollama e tente novamente", @@ -91,6 +93,10 @@ "description": "Digite sua chave de API Google para iniciar a sessão. O aplicativo não irá armazenar sua chave de API", "title": "Usar chave de API Google personalizada" }, + "Groq": { + "description": "Insira sua chave de API Groq para iniciar a sessão. O aplicativo não irá armazenar sua chave de API.", + "title": "Usar chave de API Groq personalizada" + }, "Mistral": { "description": "Insira sua chave de API Mistral AI para iniciar a sessão. O aplicativo não irá armazenar sua chave de API.", "title": "Usar chave de API Mistral AI personalizada" diff --git a/locales/pt-BR/setting.json b/locales/pt-BR/setting.json index e567ba663ad0..029dfe6baceb 100644 --- a/locales/pt-BR/setting.json +++ b/locales/pt-BR/setting.json @@ -99,6 +99,14 @@ "title": "API Key" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "Insira a chave da API do Groq", + "placeholder": " Chave da API do Groq", + "title": "Chave da API" + } + }, "Mistral": { "title": "Mistral AI", "token": { diff --git a/locales/ru-RU/common.json b/locales/ru-RU/common.json index 87500b86c6fc..dd25bbbbd4a9 100644 --- a/locales/ru-RU/common.json +++ b/locales/ru-RU/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "groq": "Groq", "mistral": "Mistral AI", "moonshot": "Искусственный интеллект Moonshot", "ollama": "Оллама", diff --git a/locales/ru-RU/error.json b/locales/ru-RU/error.json index 713d289aeb0f..59728543d06b 100644 --- a/locales/ru-RU/error.json +++ b/locales/ru-RU/error.json @@ -38,11 +38,13 @@ "AzureBizError": "Ошибка запроса службы Azure AI, пожалуйста, проверьте и повторите попытку в соответствии с предоставленной информацией", "BedrockBizError": "Ошибка запроса службы Bedrock, пожалуйста, проверьте и повторите попытку в соответствии с предоставленной информацией", "GoogleBizError": "Ошибка запроса службы Google, пожалуйста, проверьте и повторите попытку в соответствии с предоставленной информацией", + "GroqBizError": "Ошибка обращения к сервису Groq. Пожалуйста, проверьте следующую информацию или повторите попытку", "InvalidAccessCode": "Неверный код доступа: введите правильный код доступа или добавьте пользовательский ключ API", "InvalidAnthropicAPIKey": "Anthropic API Key недействителен или отсутствует. Пожалуйста, проверьте Anthropic API Key и повторите попытку", "InvalidAzureAPIKey": "Неверный или пустой ключ API Azure, пожалуйста, проверьте ключ API Azure и повторите попытку", "InvalidBedrockCredentials": "Аутентификация Bedrock не прошла, пожалуйста, проверьте AccessKeyId/SecretAccessKey и повторите попытку", "InvalidGoogleAPIKey": "Неверный или пустой ключ API Google, пожалуйста, проверьте ключ API Google и повторите попытку", + "InvalidGroqAPIKey": "Неверный или пустой ключ API Groq, пожалуйста, проверьте ключ API Groq и повторите попытку", "InvalidMistralAPIKey": "Неверный или пустой ключ API Mistral AI. Пожалуйста, проверьте ключ API Mistral и повторите попытку", "InvalidMoonshotAPIKey": "Moonshot AI API Key неверный или пустой, пожалуйста, проверьте ключ API Moonshot и повторите попытку", "InvalidOllamaArgs": "Неверная конфигурация Ollama, пожалуйста, проверьте конфигурацию Ollama и повторите попытку", @@ -91,6 +93,10 @@ "description": "Введите свой ключ API Google, чтобы начать сеанс. Приложение не будет сохранять ваш ключ API", "title": "Использовать пользовательский ключ API Google" }, + "Groq": { + "description": "Введите свой ключ API Groq, чтобы начать сеанс. Приложение не будет сохранять ваш ключ API", + "title": "Использовать пользовательский ключ API Groq" + }, "Mistral": { "description": "Введите свой ключ API Mistral AI, чтобы начать сеанс. Приложение не будет сохранять ваш ключ API", "title": "Использовать пользовательский ключ API Mistral AI" diff --git a/locales/ru-RU/setting.json b/locales/ru-RU/setting.json index 1d94c234ccc5..16c90a04562d 100644 --- a/locales/ru-RU/setting.json +++ b/locales/ru-RU/setting.json @@ -99,6 +99,14 @@ "title": "API-ключ" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "Введите API-ключ от Groq", + "placeholder": "Ключ API Groq", + "title": "API-ключ" + } + }, "Mistral": { "title": "Mistral AI", "token": { diff --git a/locales/tr-TR/common.json b/locales/tr-TR/common.json index c7a8a45dcc85..75145753488d 100644 --- a/locales/tr-TR/common.json +++ b/locales/tr-TR/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "groq": "Groq", "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "Ollama", diff --git a/locales/tr-TR/error.json b/locales/tr-TR/error.json index 1112552b9507..804267bf037a 100644 --- a/locales/tr-TR/error.json +++ b/locales/tr-TR/error.json @@ -38,11 +38,13 @@ "AzureBizError": "Azure AI servisi isteği hatası, lütfen aşağıdaki bilgilere göre sorunu gidermeye çalışın veya tekrar deneyin", "BedrockBizError": "Bedrock servisi isteği hatası, lütfen aşağıdaki bilgilere göre sorunu gidermeye çalışın veya tekrar deneyin", "GoogleBizError": "Google servisi isteği hatası, lütfen aşağıdaki bilgilere göre sorunu gidermeye çalışın veya tekrar deneyin", + "GroqBizError": "Groq hizmeti isteği sırasında bir hata oluştu. Lütfen aşağıdaki bilgilere göre sorunu giderin veya tekrar deneyin", "InvalidAccessCode": "Geçersiz Erişim Kodu: Geçersiz veya boş bir şifre girdiniz. Lütfen doğru erişim şifresini girin veya özel API Anahtarı ekleyin.", "InvalidAnthropicAPIKey": "Anthropic API Key geçersiz veya boş, lütfen Anthropic API Key'inizi kontrol edip tekrar deneyin", "InvalidAzureAPIKey": "Azure API Anahtarı yanlış veya boş, lütfen Azure API Anahtarınızı kontrol edip tekrar deneyin", "InvalidBedrockCredentials": "Bedrock kimlik doğrulaması geçersiz, lütfen AccessKeyId/SecretAccessKey bilgilerinizi kontrol edip tekrar deneyin", "InvalidGoogleAPIKey": "Google API Anahtarı yanlış veya boş, lütfen Google API Anahtarınızı kontrol edip tekrar deneyin", + "InvalidGroqAPIKey": "Groq API Anahtarı yanlış veya boş, lütfen Groq API Anahtarınızı kontrol edip tekrar deneyin", "InvalidMistralAPIKey": "Mistral AI API Anahtarı geçersiz veya boş. Lütfen Mistral API Anahtarınızı kontrol edip tekrar deneyin", "InvalidMoonshotAPIKey": "Geçersiz veya boş Moonshot AI API Anahtarı, lütfen Moonshot API Anahtarınızı kontrol edip tekrar deneyin", "InvalidOllamaArgs": "Ollama yapılandırması yanlış, lütfen Ollama yapılandırmasını kontrol edip tekrar deneyin", @@ -91,6 +93,10 @@ "description": "Google API Anahtarınızı girerek oturumu başlatabilirsiniz. Uygulama API Anahtarınızı kaydetmez", "title": "Özel Google API Anahtarını kullan" }, + "Groq": { + "description": "Oturumu başlatmak için Groq API Anahtarınızı girin. Uygulama API Anahtarınızı kaydetmez", + "title": "Özel Groq API Anahtarını Kullan" + }, "Mistral": { "description": "Mistral AI API Anahtarınızı girerek oturumu başlatabilirsiniz. Uygulama API Anahtarınızı kaydetmez", "title": "Özel Mistral AI API Anahtarı Kullan" diff --git a/locales/tr-TR/setting.json b/locales/tr-TR/setting.json index f6f9eac77376..f05742b9c926 100644 --- a/locales/tr-TR/setting.json +++ b/locales/tr-TR/setting.json @@ -99,6 +99,14 @@ "title": "API Anahtarı" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "Groq'dan alınan API Anahtarını girin", + "placeholder": "Groq API Anahtarı", + "title": "API Anahtarı" + } + }, "Mistral": { "title": "Mistral AI", "token": { diff --git a/locales/vi-VN/common.json b/locales/vi-VN/common.json index 9667990ce690..bf224e1d94e7 100644 --- a/locales/vi-VN/common.json +++ b/locales/vi-VN/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "groq": "Groq", "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "Ollama", diff --git a/locales/vi-VN/error.json b/locales/vi-VN/error.json index d68b62e389cc..16e47679a58b 100644 --- a/locales/vi-VN/error.json +++ b/locales/vi-VN/error.json @@ -38,11 +38,13 @@ "AzureBizError": "Yêu cầu dịch vụ Azure AI gặp lỗi, vui lòng kiểm tra và thử lại dựa trên thông tin dưới đây", "BedrockBizError": "Yêu cầu dịch vụ Bedrock gặp lỗi, vui lòng kiểm tra và thử lại dựa trên thông tin dưới đây", "GoogleBizError": "Yêu cầu dịch vụ Google gặp lỗi, vui lòng kiểm tra và thử lại dựa trên thông tin dưới đây", + "GroqBizError": "Yêu cầu dịch vụ Groq gặp sự cố, vui lòng kiểm tra thông tin bên dưới hoặc thử lại", "InvalidAccessCode": "Mật khẩu truy cập không hợp lệ hoặc trống, vui lòng nhập mật khẩu truy cập đúng hoặc thêm Khóa API tùy chỉnh", "InvalidAnthropicAPIKey": "Khóa API Anthropic không hợp lệ hoặc trống, vui lòng kiểm tra lại và thử lại", "InvalidAzureAPIKey": "Khóa API Azure không chính xác hoặc trống, vui lòng kiểm tra lại Khóa API Azure và thử lại", "InvalidBedrockCredentials": "Xác thực Bedrock không thành công, vui lòng kiểm tra AccessKeyId/SecretAccessKey và thử lại", "InvalidGoogleAPIKey": "Khóa API Google không chính xác hoặc trống, vui lòng kiểm tra lại Khóa API Google và thử lại", + "InvalidGroqAPIKey": "Khóa API Groq không hợp lệ hoặc trống, vui lòng kiểm tra lại Khóa API Groq và thử lại", "InvalidMistralAPIKey": "Mistral AI API Key không hợp lệ hoặc trống, vui lòng kiểm tra lại Mistral API Key và thử lại", "InvalidMoonshotAPIKey": "Khóa API Moonshot AI không hợp lệ hoặc trống, vui lòng kiểm tra lại Khóa API Moonshot và thử lại", "InvalidOllamaArgs": "Cấu hình Ollama không hợp lệ, vui lòng kiểm tra lại cấu hình Ollama và thử lại", @@ -91,6 +93,10 @@ "description": "Nhập Google API Key của bạn để bắt đầu phiên làm việc. Ứng dụng sẽ không lưu trữ API Key của bạn", "title": "Sử dụng thông tin xác thực tùy chỉnh của Google" }, + "Groq": { + "description": "Nhập Groq API Key của bạn để bắt đầu phiên làm việc. Ứng dụng sẽ không lưu trữ API Key của bạn", + "title": "Sử dụng Groq API Key tùy chỉnh" + }, "Mistral": { "description": "Nhập Mistral AI API Key của bạn để bắt đầu phiên làm việc. Ứng dụng sẽ không lưu trữ API Key của bạn", "title": "Sử dụng Mistral AI API Key tùy chỉnh" diff --git a/locales/vi-VN/setting.json b/locales/vi-VN/setting.json index 47a56f540795..b9d7e69bfb6a 100644 --- a/locales/vi-VN/setting.json +++ b/locales/vi-VN/setting.json @@ -99,6 +99,14 @@ "title": "API Key" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "Nhập API Key từ Groq", + "placeholder": "Groq API Key", + "title": "API Key" + } + }, "Mistral": { "title": "Mistral AI", "token": { diff --git a/locales/zh-CN/common.json b/locales/zh-CN/common.json index c7e8e100abc5..cca5c343e13f 100644 --- a/locales/zh-CN/common.json +++ b/locales/zh-CN/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "groq": "Groq", "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "Ollama", diff --git a/locales/zh-CN/error.json b/locales/zh-CN/error.json index d172c93f4d43..5c2936d19355 100644 --- a/locales/zh-CN/error.json +++ b/locales/zh-CN/error.json @@ -65,6 +65,8 @@ "PerplexityBizError": "请求 Perplexity AI 服务出错,请根据以下信息排查或重试", "InvalidAnthropicAPIKey": "Anthropic API Key 不正确或为空,请检查 Anthropic API Key 后重试", "AnthropicBizError": "请求 Anthropic AI 服务出错,请根据以下信息排查或重试", + "InvalidGroqAPIKey": "Groq API Key 不正确或为空,请检查 Groq API Key 后重试", + "GroqBizError": "请求 Groq 服务出错,请根据以下信息排查或重试", "InvalidOllamaArgs": "Ollama 配置不正确,请检查 Ollama 配置后重试", "OllamaBizError": "请求 Ollama 服务出错,请根据以下信息排查或重试", "OllamaServiceUnavailable": "未检测到 Ollama 服务,请检查是否正常启动", @@ -91,6 +93,10 @@ "description": "输入你的 Google API Key 即可开始会话。应用不会记录你的 API Key", "title": "使用自定义 Google API Key" }, + "Groq": { + "description": "输入你的 Groq API Key 即可开始会话。应用不会记录你的 API Key", + "title": "使用自定义 Groq API Key" + }, "Mistral": { "description": "输入你的 Mistral AI API Key 即可开始会话。应用不会记录你的 API Key", "title": "使用自定义 Mistral AI API Key" diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json index 500650a859f0..7af58069d2ee 100644 --- a/locales/zh-CN/setting.json +++ b/locales/zh-CN/setting.json @@ -99,6 +99,14 @@ "title": "API Key" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "填入来自 Groq 的 API Key", + "placeholder": "Groq API Key", + "title": "API Key" + } + }, "Mistral": { "title": "Mistral AI", "token": { diff --git a/locales/zh-TW/common.json b/locales/zh-TW/common.json index d46f606382e3..ca17db25b74a 100644 --- a/locales/zh-TW/common.json +++ b/locales/zh-TW/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "groq": "Groq", "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "奧拉馬", diff --git a/locales/zh-TW/error.json b/locales/zh-TW/error.json index ccfa5e9109f2..ecb4e8283330 100644 --- a/locales/zh-TW/error.json +++ b/locales/zh-TW/error.json @@ -38,11 +38,13 @@ "AzureBizError": "請求 Azure AI 服務出錯,請根據以下信息排查或重試", "BedrockBizError": "請求 Bedrock 服務出錯,請根據以下信息排查或重試", "GoogleBizError": "請求 Google 服務出錯,請根據以下信息排查或重試", + "GroqBizError": "請求 Groq 服務出錯,請根據以下信息排查或重試", "InvalidAccessCode": "密碼不正確或為空,請輸入正確的訪問密碼,或添加自定義 API 金鑰", "InvalidAnthropicAPIKey": "Anthropic API 金鑰不正確或為空,請檢查 Anthropic API 金鑰後重試", "InvalidAzureAPIKey": "Azure API Key 不正確或為空,請檢查 Azure API Key 後重試", "InvalidBedrockCredentials": "Bedrock 驗證未通過,請檢查 AccessKeyId/SecretAccessKey 後重試", "InvalidGoogleAPIKey": "Google API Key 不正確或為空,請檢查 Google API Key 後重試", + "InvalidGroqAPIKey": "Groq API 金鑰不正確或為空,請檢查 Groq API 金鑰後重試", "InvalidMistralAPIKey": "Mistral AI API Key 不正確或為空,請檢查 Mistral API Key 後重試", "InvalidMoonshotAPIKey": "Moonshot AI API 金鑰不正確或為空,請檢查 Moonshot API 金鑰後重試", "InvalidOllamaArgs": "Ollama 配置不正確,請檢查 Ollama 配置後重試", @@ -91,6 +93,10 @@ "description": "輸入你的 Google API Key 即可開始會話。應用不會記錄你的 API Key", "title": "使用自定義 Google API Key" }, + "Groq": { + "description": "輸入你的 Groq API 金鑰即可開始會話。應用不會記錄你的 API 金鑰", + "title": "使用自定義 Groq API 金鑰" + }, "Mistral": { "description": "輸入你的 Mistral AI API Key 即可開始會話。應用不會記錄你的 API Key", "title": "使用自定義 Mistral AI API Key" diff --git a/locales/zh-TW/setting.json b/locales/zh-TW/setting.json index 68f313b04383..3610e6d6038d 100644 --- a/locales/zh-TW/setting.json +++ b/locales/zh-TW/setting.json @@ -99,6 +99,14 @@ "title": "API 金鑰" } }, + "Groq": { + "title": "Groq", + "token": { + "desc": "填入來自 Groq 的 API 金鑰", + "placeholder": "Groq API 金鑰", + "title": "API 金鑰" + } + }, "Mistral": { "title": "Mistral AI", "token": { diff --git a/src/app/api/chat/[provider]/agentRuntime.ts b/src/app/api/chat/[provider]/agentRuntime.ts index 12f27ebd2aa3..fbb640a35953 100644 --- a/src/app/api/chat/[provider]/agentRuntime.ts +++ b/src/app/api/chat/[provider]/agentRuntime.ts @@ -13,6 +13,7 @@ import { LobeAzureOpenAI, LobeBedrockAI, LobeGoogleAI, + LobeGroq, LobeMistralAI, LobeMoonshotAI, LobeOllamaAI, @@ -162,11 +163,16 @@ class AgentRuntime { runtimeModel = this.initAnthropic(payload); break; } - + case ModelProvider.Mistral: { runtimeModel = this.initMistral(payload); break; } + + case ModelProvider.Groq: { + runtimeModel = this.initGroq(payload); + break; + } } return new AgentRuntime(runtimeModel); @@ -261,13 +267,20 @@ class AgentRuntime { const baseURL = payload?.endpoint || ANTHROPIC_PROXY_URL; return new LobeAnthropicAI({ apiKey, baseURL }); } - + private static initMistral(payload: JWTPayload) { const { MISTRAL_API_KEY } = getServerConfig(); const apiKey = apiKeyManager.pick(payload?.apiKey || MISTRAL_API_KEY); return new LobeMistralAI({ apiKey }); } + + private static initGroq(payload: JWTPayload) { + const { GROQ_API_KEY } = getServerConfig(); + const apiKey = apiKeyManager.pick(payload?.apiKey || GROQ_API_KEY); + + return new LobeGroq({ apiKey }); + } } export default AgentRuntime; diff --git a/src/app/api/config/route.ts b/src/app/api/config/route.ts index cc242fb70630..856ed49fde2d 100644 --- a/src/app/api/config/route.ts +++ b/src/app/api/config/route.ts @@ -16,6 +16,7 @@ export const GET = async () => { ENABLED_ZHIPU, ENABLED_AWS_BEDROCK, ENABLED_GOOGLE, + ENABLED_GROQ, ENABLE_OAUTH_SSO, ENABLE_OLLAMA, ENABLED_PERPLEXITY, @@ -36,6 +37,7 @@ export const GET = async () => { anthropic: { enabled: ENABLED_ANTHROPIC }, bedrock: { enabled: ENABLED_AWS_BEDROCK }, google: { enabled: ENABLED_GOOGLE }, + groq: { enabled: ENABLED_GROQ }, mistral: { enabled: ENABLED_MISTRAL }, moonshot: { enabled: ENABLED_MOONSHOT }, ollama: { customModelName: OLLAMA_CUSTOM_MODELS, enabled: ENABLE_OLLAMA }, diff --git a/src/app/api/errorResponse.ts b/src/app/api/errorResponse.ts index b58ea9315efe..bbbeb25bdee7 100644 --- a/src/app/api/errorResponse.ts +++ b/src/app/api/errorResponse.ts @@ -50,6 +50,9 @@ const getStatus = (errorType: ILobeAgentRuntimeErrorType | ErrorType) => { case AgentRuntimeErrorType.MistralBizError: { return 481; } + case AgentRuntimeErrorType.GroqBizError: { + return 482; + } } return errorType as number; }; diff --git a/src/app/settings/llm/Groq/index.tsx b/src/app/settings/llm/Groq/index.tsx new file mode 100644 index 000000000000..e70e709d18f1 --- /dev/null +++ b/src/app/settings/llm/Groq/index.tsx @@ -0,0 +1,47 @@ +import { Groq } from '@lobehub/icons'; +import { Input } from 'antd'; +import { useTheme } from 'antd-style'; +import { memo } from 'react'; +import { useTranslation } from 'react-i18next'; + +import { ModelProvider } from '@/libs/agent-runtime'; + +import Checker from '../components/Checker'; +import ProviderConfig from '../components/ProviderConfig'; +import { LLMProviderApiTokenKey, LLMProviderConfigKey } from '../const'; + +const providerKey = 'groq'; + +const GroqProvider = memo(() => { + const { t } = useTranslation('setting'); + + const theme = useTheme(); + + return ( + + ), + desc: t('llm.Groq.token.desc'), + label: t('llm.Groq.token.title'), + name: [LLMProviderConfigKey, providerKey, LLMProviderApiTokenKey], + }, + { + children: , + desc: t('llm.checker.desc'), + label: t('llm.checker.title'), + minWidth: '100%', + }, + ]} + provider={providerKey} + title={} + /> + ); +}); + +export default GroqProvider; diff --git a/src/app/settings/llm/index.tsx b/src/app/settings/llm/index.tsx index c47a49c1de83..3d1948c16544 100644 --- a/src/app/settings/llm/index.tsx +++ b/src/app/settings/llm/index.tsx @@ -11,6 +11,7 @@ import Footer from '../features/Footer'; import Anthropic from './Anthropic'; import Bedrock from './Bedrock'; import Google from './Google'; +import Groq from './Groq'; import Mistral from './Mistral'; import Moonshot from './Moonshot'; import Ollama from './Ollama'; @@ -29,6 +30,7 @@ export default memo<{ showOllama: boolean }>(({ showOllama }) => { {showOllama && } + diff --git a/src/components/ModelProviderIcon/index.tsx b/src/components/ModelProviderIcon/index.tsx index 456b9f3d1985..741612b94879 100644 --- a/src/components/ModelProviderIcon/index.tsx +++ b/src/components/ModelProviderIcon/index.tsx @@ -3,6 +3,7 @@ import { Azure, Bedrock, Google, + Groq, Mistral, Moonshot, Ollama, @@ -69,6 +70,10 @@ const ModelProviderIcon = memo(({ provider }) => { return ; } + case ModelProvider.Groq: { + return ; + } + default: { return null; } diff --git a/src/config/modelProviders/groq.ts b/src/config/modelProviders/groq.ts new file mode 100644 index 000000000000..aaeb52298af3 --- /dev/null +++ b/src/config/modelProviders/groq.ts @@ -0,0 +1,24 @@ +import { ModelProviderCard } from '@/types/llm'; + +const Groq: ModelProviderCard = { + chatModels: [ + { + displayName: 'Mixtral-8x7b-Instruct-v0.1', + id: 'mixtral-8x7b-32768', + tokens: 32_768, + }, + { + displayName: 'Gemma-7b-it', + id: 'gemma-7b-it', + tokens: 8192, + }, + { + displayName: 'LLaMA2-70b-chat', + id: 'llama2-70b-4096', + tokens: 4096, + }, + ], + id: 'groq', +}; + +export default Groq; diff --git a/src/config/modelProviders/index.ts b/src/config/modelProviders/index.ts index e30bd72edfc7..9ca0c4fcac69 100644 --- a/src/config/modelProviders/index.ts +++ b/src/config/modelProviders/index.ts @@ -3,6 +3,7 @@ import { ChatModelCard } from '@/types/llm'; import AnthropicProvider from './anthropic'; import BedrockProvider from './bedrock'; import GoogleProvider from './google'; +import GroqProvider from './groq'; import MistralProvider from './mistral'; import MoonshotProvider from './moonshot'; import OllamaProvider from './ollama'; @@ -15,6 +16,7 @@ export const LOBE_DEFAULT_MODEL_LIST: ChatModelCard[] = [ ZhiPuProvider.chatModels, BedrockProvider.chatModels, GoogleProvider.chatModels, + GroqProvider.chatModels, MistralProvider.chatModels, MoonshotProvider.chatModels, OllamaProvider.chatModels, @@ -25,6 +27,7 @@ export const LOBE_DEFAULT_MODEL_LIST: ChatModelCard[] = [ export { default as AnthropicProvider } from './anthropic'; export { default as BedrockProvider } from './bedrock'; export { default as GoogleProvider } from './google'; +export { default as GroqProvider } from './groq'; export { default as MistralProvider } from './mistral'; export { default as MoonshotProvider } from './moonshot'; export { default as OllamaProvider } from './ollama'; diff --git a/src/config/server/provider.ts b/src/config/server/provider.ts index 785125ed59f8..47aaff61076d 100644 --- a/src/config/server/provider.ts +++ b/src/config/server/provider.ts @@ -36,10 +36,13 @@ declare global { // Anthropic Provider ANTHROPIC_API_KEY?: string; ANTHROPIC_PROXY_URL?: string; - + // Mistral Provider MISTRAL_API_KEY?: string; + // Groq Provider + GROQ_API_KEY?: string; + // AWS Credentials AWS_REGION?: string; AWS_ACCESS_KEY_ID?: string; @@ -67,9 +70,11 @@ export const getProviderConfig = () => { const PERPLEXITY_API_KEY = process.env.PERPLEXITY_API_KEY || ''; const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY || ''; - + const MISTRAL_API_KEY = process.env.MISTRAL_API_KEY || ''; + const GROQ_API_KEY = process.env.GROQ_API_KEY || ''; + // region format: iad1,sfo1 let regions: string[] = []; if (process.env.OPENAI_FUNCTION_REGIONS) { @@ -97,7 +102,7 @@ export const getProviderConfig = () => { ENABLED_ANTHROPIC: !!ANTHROPIC_API_KEY, ANTHROPIC_API_KEY, ANTHROPIC_PROXY_URL: process.env.ANTHROPIC_PROXY_URL, - + ENABLED_MISTRAL: !!MISTRAL_API_KEY, MISTRAL_API_KEY, @@ -105,6 +110,9 @@ export const getProviderConfig = () => { MOONSHOT_API_KEY, MOONSHOT_PROXY_URL: process.env.MOONSHOT_PROXY_URL, + ENABLED_GROQ: !!GROQ_API_KEY, + GROQ_API_KEY, + ENABLED_AWS_BEDROCK: !!AWS_ACCESS_KEY_ID, AWS_REGION: process.env.AWS_REGION, AWS_ACCESS_KEY_ID: AWS_ACCESS_KEY_ID, diff --git a/src/const/settings.ts b/src/const/settings.ts index 20d0d4f136d3..a959f558e65b 100644 --- a/src/const/settings.ts +++ b/src/const/settings.ts @@ -66,6 +66,10 @@ export const DEFAULT_LLM_CONFIG: GlobalLLMConfig = { apiKey: '', enabled: false, }, + groq: { + apiKey: '', + enabled: false, + }, mistral: { apiKey: '', enabled: false, diff --git a/src/features/Conversation/Error/APIKeyForm/Groq.tsx b/src/features/Conversation/Error/APIKeyForm/Groq.tsx new file mode 100644 index 000000000000..c4152db13909 --- /dev/null +++ b/src/features/Conversation/Error/APIKeyForm/Groq.tsx @@ -0,0 +1,60 @@ +import { Groq } from '@lobehub/icons'; +import { Input } from 'antd'; +import { memo } from 'react'; +import { useTranslation } from 'react-i18next'; + +import { ModelProvider } from '@/libs/agent-runtime'; +import { useGlobalStore } from '@/store/global'; +import { modelProviderSelectors } from '@/store/global/selectors'; + +import { FormAction } from '../style'; + +const GroqForm = memo(() => { + const { t } = useTranslation('error'); + // const [showProxy, setShow] = useState(false); + + const [apiKey, setConfig] = useGlobalStore((s) => [ + modelProviderSelectors.groqAPIKey(s), + s.setModelProviderConfig, + ]); + + return ( + } + description={t('unlock.apikey.Groq.description')} + title={t('unlock.apikey.Groq.title')} + > + { + setConfig(ModelProvider.Groq, { apiKey: e.target.value }); + }} + placeholder={'*********************************'} + type={'block'} + value={apiKey} + /> + {/*{showProxy ? (*/} + {/* {*/} + {/* setConfig({ endpoint: e.target.value });*/} + {/* }}*/} + {/* placeholder={'https://api.openai.com/v1'}*/} + {/* type={'block'}*/} + {/* value={proxyUrl}*/} + {/* />*/} + {/*) : (*/} + {/* }*/} + {/* onClick={() => {*/} + {/* setShow(true);*/} + {/* }}*/} + {/* type={'text'}*/} + {/* >*/} + {/* {t('unlock.apikey.addProxyUrl')}*/} + {/* */} + {/*)}*/} + + ); +}); + +export default GroqForm; diff --git a/src/features/Conversation/Error/APIKeyForm/index.tsx b/src/features/Conversation/Error/APIKeyForm/index.tsx index 08376a50237c..aecd67507e31 100644 --- a/src/features/Conversation/Error/APIKeyForm/index.tsx +++ b/src/features/Conversation/Error/APIKeyForm/index.tsx @@ -9,6 +9,7 @@ import { useChatStore } from '@/store/chat'; import AnthropicForm from './Anthropic'; import BedrockForm from './Bedrock'; import GoogleForm from './Google'; +import GroqForm from './Groq'; import MistralForm from './Mistral'; import MoonshotForm from './Moonshot'; import OpenAIForm from './OpenAI'; @@ -55,6 +56,10 @@ const APIKeyForm = memo(({ id, provider }) => { return ; } + case ModelProvider.Groq: { + return ; + } + default: case ModelProvider.OpenAI: { return ; diff --git a/src/features/Conversation/Error/index.tsx b/src/features/Conversation/Error/index.tsx index 246c68b7e5fe..3443c90b64df 100644 --- a/src/features/Conversation/Error/index.tsx +++ b/src/features/Conversation/Error/index.tsx @@ -74,6 +74,7 @@ const ErrorMessageExtra = memo<{ data: ChatMessage }>(({ data }) => { case AgentRuntimeErrorType.InvalidGoogleAPIKey: case AgentRuntimeErrorType.InvalidPerplexityAPIKey: case AgentRuntimeErrorType.InvalidAnthropicAPIKey: + case AgentRuntimeErrorType.InvalidGroqAPIKey: case AgentRuntimeErrorType.NoOpenAIAPIKey: { return ; } diff --git a/src/features/Conversation/components/ChatItem/index.tsx b/src/features/Conversation/components/ChatItem/index.tsx index 1ab8610c4cd8..7745fcf613e4 100644 --- a/src/features/Conversation/components/ChatItem/index.tsx +++ b/src/features/Conversation/components/ChatItem/index.tsx @@ -81,13 +81,14 @@ const Item = memo(({ index, id }) => { [item?.role], ); + const { t: errorT } = useTranslation('error'); const error = useMemo(() => { if (!item?.error) return; const messageError = item.error; const alertConfig = getErrorAlertConfig(messageError.type); - return { message: t(`response.${messageError.type}` as any, { ns: 'error' }), ...alertConfig }; + return { message: errorT(`response.${messageError.type}` as any), ...alertConfig }; }, [item?.error]); const enableHistoryDivider = useSessionStore((s) => { diff --git a/src/libs/agent-runtime/error.ts b/src/libs/agent-runtime/error.ts index 37828b0faa3d..9e45df3d1e56 100644 --- a/src/libs/agent-runtime/error.ts +++ b/src/libs/agent-runtime/error.ts @@ -34,6 +34,9 @@ export const AgentRuntimeErrorType = { InvalidAnthropicAPIKey: 'InvalidAnthropicAPIKey', AnthropicBizError: 'AnthropicBizError', + + InvalidGroqAPIKey: 'InvalidGroqAPIKey', + GroqBizError: 'GroqBizError', } as const; export type ILobeAgentRuntimeErrorType = diff --git a/src/libs/agent-runtime/groq/index.ts b/src/libs/agent-runtime/groq/index.ts new file mode 100644 index 000000000000..39905c64f356 --- /dev/null +++ b/src/libs/agent-runtime/groq/index.ts @@ -0,0 +1,78 @@ +import { OpenAIStream, StreamingTextResponse } from 'ai'; +import OpenAI, { ClientOptions } from 'openai'; + +import { LobeRuntimeAI } from '../BaseAI'; +import { AgentRuntimeErrorType } from '../error'; +import { ChatCompetitionOptions, ChatStreamPayload, ModelProvider } from '../types'; +import { AgentRuntimeError } from '../utils/createError'; +import { debugStream } from '../utils/debugStream'; +import { desensitizeUrl } from '../utils/desensitizeUrl'; +import { handleOpenAIError } from '../utils/handleOpenAIError'; + +const DEFAULT_BASE_URL = 'https://api.groq.com/openai/v1'; + +export class LobeGroq implements LobeRuntimeAI { + private client: OpenAI; + + baseURL: string; + + constructor({ apiKey, baseURL = DEFAULT_BASE_URL, ...res }: ClientOptions) { + if (!apiKey) throw AgentRuntimeError.createError(AgentRuntimeErrorType.InvalidGroqAPIKey); + + this.client = new OpenAI({ apiKey, baseURL, ...res }); + this.baseURL = this.client.baseURL; + } + + async chat(payload: ChatStreamPayload, options?: ChatCompetitionOptions) { + try { + const response = await this.client.chat.completions.create( + payload as unknown as OpenAI.ChatCompletionCreateParamsStreaming, + ); + const [prod, debug] = response.tee(); + + if (process.env.DEBUG_GROQ_CHAT_COMPLETION === '1') { + debugStream(debug.toReadableStream()).catch(console.error); + } + + return new StreamingTextResponse(OpenAIStream(prod, options?.callback), { + headers: options?.headers, + }); + } catch (error) { + let desensitizedEndpoint = this.baseURL; + + if (this.baseURL !== DEFAULT_BASE_URL) { + desensitizedEndpoint = desensitizeUrl(this.baseURL); + } + + if ('status' in (error as any)) { + switch ((error as Response).status) { + case 401: { + throw AgentRuntimeError.chat({ + endpoint: desensitizedEndpoint, + error: error as any, + errorType: AgentRuntimeErrorType.InvalidGroqAPIKey, + provider: ModelProvider.Groq, + }); + } + + default: { + break; + } + } + } + + const { errorResult, RuntimeError } = handleOpenAIError(error); + + const errorType = RuntimeError || AgentRuntimeErrorType.GroqBizError; + + throw AgentRuntimeError.chat({ + endpoint: desensitizedEndpoint, + error: errorResult, + errorType, + provider: ModelProvider.Groq, + }); + } + } +} + +export default LobeGroq; diff --git a/src/libs/agent-runtime/index.ts b/src/libs/agent-runtime/index.ts index b73072c11ebf..bff5b94e2bca 100644 --- a/src/libs/agent-runtime/index.ts +++ b/src/libs/agent-runtime/index.ts @@ -4,6 +4,7 @@ export * from './BaseAI'; export { LobeBedrockAI } from './bedrock'; export * from './error'; export { LobeGoogleAI } from './google'; +export { LobeGroq } from './groq'; export { LobeMistralAI } from './mistral'; export { LobeMoonshotAI } from './moonshot'; export { LobeOllamaAI } from './ollama'; diff --git a/src/libs/agent-runtime/types/type.ts b/src/libs/agent-runtime/types/type.ts index b43eaf702079..24894f69d706 100644 --- a/src/libs/agent-runtime/types/type.ts +++ b/src/libs/agent-runtime/types/type.ts @@ -27,6 +27,7 @@ export enum ModelProvider { Bedrock = 'bedrock', ChatGLM = 'chatglm', Google = 'google', + Groq = 'groq', Mistral = 'mistral', Moonshot = 'moonshot', Ollama = 'ollama', diff --git a/src/locales/default/common.ts b/src/locales/default/common.ts index a08c96f8ebc7..5aa2ed6b4cc9 100644 --- a/src/locales/default/common.ts +++ b/src/locales/default/common.ts @@ -104,6 +104,7 @@ export default { azure: 'Azure', bedrock: 'AWS Bedrock', google: 'Google', + groq: 'Groq', mistral: 'Mistral AI', moonshot: 'Moonshot AI', ollama: 'Ollama', diff --git a/src/locales/default/error.ts b/src/locales/default/error.ts index ba00343c34bb..3d77a876336b 100644 --- a/src/locales/default/error.ts +++ b/src/locales/default/error.ts @@ -82,6 +82,9 @@ export default { InvalidAnthropicAPIKey: 'Anthropic API Key 不正确或为空,请检查 Anthropic API Key 后重试', AnthropicBizError: '请求 Anthropic AI 服务出错,请根据以下信息排查或重试', + InvalidGroqAPIKey: 'Groq API Key 不正确或为空,请检查 Groq API Key 后重试', + GroqBizError: '请求 Groq 服务出错,请根据以下信息排查或重试', + InvalidOllamaArgs: 'Ollama 配置不正确,请检查 Ollama 配置后重试', OllamaBizError: '请求 Ollama 服务出错,请根据以下信息排查或重试', OllamaServiceUnavailable: '未检测到 Ollama 服务,请检查是否正常启动', @@ -111,6 +114,10 @@ export default { description: '输入你的 Google API Key 即可开始会话。应用不会记录你的 API Key', title: '使用自定义 Google API Key', }, + Groq: { + description: '输入你的 Groq API Key 即可开始会话。应用不会记录你的 API Key', + title: '使用自定义 Groq API Key', + }, Mistral: { description: '输入你的 Mistral AI API Key 即可开始会话。应用不会记录你的 API Key', title: '使用自定义 Mistral AI API Key', diff --git a/src/locales/default/setting.ts b/src/locales/default/setting.ts index ade6cd400db8..dc83b9a6f8e4 100644 --- a/src/locales/default/setting.ts +++ b/src/locales/default/setting.ts @@ -100,6 +100,14 @@ export default { title: 'API Key', }, }, + Groq: { + title: 'Groq', + token: { + desc: '填入来自 Groq 的 API Key', + placeholder: 'Groq API Key', + title: 'API Key', + }, + }, Mistral: { title: 'Mistral AI', token: { diff --git a/src/services/_auth.ts b/src/services/_auth.ts index 93dcd44b54b1..fd30ec699cde 100644 --- a/src/services/_auth.ts +++ b/src/services/_auth.ts @@ -57,11 +57,15 @@ export const getProviderAuthPayload = (provider: string) => { const endpoint = modelProviderSelectors.anthropicProxyUrl(useGlobalStore.getState()); return { apiKey, endpoint }; } - + case ModelProvider.Mistral: { return { apiKey: modelProviderSelectors.mistralAPIKey(useGlobalStore.getState()) }; } + case ModelProvider.Groq: { + return { apiKey: modelProviderSelectors.groqAPIKey(useGlobalStore.getState()) }; + } + default: case ModelProvider.OpenAI: { const openai = modelProviderSelectors.openAIConfig(useGlobalStore.getState()); diff --git a/src/store/global/slices/settings/selectors/modelProvider.ts b/src/store/global/slices/settings/selectors/modelProvider.ts index 1980a8c0be43..cf7127a15137 100644 --- a/src/store/global/slices/settings/selectors/modelProvider.ts +++ b/src/store/global/slices/settings/selectors/modelProvider.ts @@ -4,6 +4,7 @@ import { AnthropicProvider, BedrockProvider, GoogleProvider, + GroqProvider, LOBE_DEFAULT_MODEL_LIST, MistralProvider, MoonshotProvider, @@ -58,6 +59,9 @@ const enableAnthropic = (s: GlobalStore) => modelProvider(s).anthropic.enabled; const anthropicAPIKey = (s: GlobalStore) => modelProvider(s).anthropic.apiKey; const anthropicProxyUrl = (s: GlobalStore) => modelProvider(s).anthropic.endpoint; +const enableGroq = (s: GlobalStore) => modelProvider(s).groq.enabled; +const groqAPIKey = (s: GlobalStore) => modelProvider(s).groq.apiKey; + // const azureModelList = (s: GlobalStore): ModelProviderCard => { // const azure = azureConfig(s); // return { @@ -143,14 +147,15 @@ const modelSelectList = (s: GlobalStore): ModelProviderCard[] => { chatModels: openaiChatModels, }, // { ...azureModelList(s), enabled: enableAzure(s) }, - { ...ZhiPuProvider, enabled: enableZhipu(s) }, - { ...MoonshotProvider, enabled: enableMoonshot(s) }, + { ...OllamaProvider, chatModels: ollamaChatModels, enabled: enableOllama(s) }, + { ...AnthropicProvider, enabled: enableAnthropic(s) }, { ...GoogleProvider, enabled: enableGoogle(s) }, { ...BedrockProvider, enabled: enableBedrock(s) }, - { ...OllamaProvider, chatModels: ollamaChatModels, enabled: enableOllama(s) }, { ...PerplexityProvider, enabled: enablePerplexity(s) }, - { ...AnthropicProvider, enabled: enableAnthropic(s) }, { ...MistralProvider, enabled: enableMistral(s) }, + { ...GroqProvider, enabled: enableGroq(s) }, + { ...ZhiPuProvider, enabled: enableZhipu(s) }, + { ...MoonshotProvider, enabled: enableMoonshot(s) }, ]; }; @@ -229,8 +234,12 @@ export const modelProviderSelectors = { enableAnthropic, anthropicAPIKey, anthropicProxyUrl, - + // Mistral enableMistral, mistralAPIKey, + + // Groq + enableGroq, + groqAPIKey, }; diff --git a/src/types/settings/modelProvider.ts b/src/types/settings/modelProvider.ts index e80fa1971b67..9342d29e8156 100644 --- a/src/types/settings/modelProvider.ts +++ b/src/types/settings/modelProvider.ts @@ -71,11 +71,17 @@ export interface MistralConfig { enabled: boolean; } +export interface GroqConfig { + apiKey?: string; + enabled: boolean; +} + export interface GlobalLLMConfig { anthropic: AnthropicConfig; azure: AzureOpenAIConfig; bedrock: AWSBedrockConfig; google: GoogleConfig; + groq: GroqConfig; mistral: MistralConfig; moonshot: MoonshotConfig; ollama: OllamaConfig;