From 4f94bfef3283480110dc7820ea6d4ac2fd8387cf Mon Sep 17 00:00:00 2001 From: Linghui Gong Date: Thu, 7 Mar 2024 11:03:03 +0800 Subject: [PATCH] :sparkles: feat: support Mistral model provider (#1455) * :sparkles: feat: support mistral as model provider * :bug: fix: a test case bug * :white_check_mark: add missing tests for anthropic and mistral --- .env.example | 5 + Dockerfile | 3 + .../environment-variables/model-provider.mdx | 8 + .../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 + .../api/chat/[provider]/agentRuntime.test.ts | 52 +++ src/app/api/chat/[provider]/agentRuntime.ts | 13 + src/app/api/config/route.ts | 2 + src/app/api/errorResponse.test.ts | 15 + src/app/api/errorResponse.ts | 3 + src/app/settings/llm/Mistral/index.tsx | 52 +++ src/app/settings/llm/index.tsx | 2 + src/config/modelProviders/index.ts | 3 + src/config/modelProviders/mistral.ts | 34 ++ src/config/server/provider.ts | 8 + src/const/settings.ts | 4 + .../Conversation/Error/APIKeyForm/Mistral.tsx | 60 +++ .../Conversation/Error/APIKeyForm/index.tsx | 5 + src/features/Conversation/Error/index.tsx | 1 + .../agent-runtime/anthropic/index.test.ts | 78 ++++ src/libs/agent-runtime/error.ts | 3 + src/libs/agent-runtime/index.ts | 1 + src/libs/agent-runtime/mistral/index.test.ts | 378 ++++++++++++++++++ src/libs/agent-runtime/mistral/index.ts | 87 ++++ src/locales/default/common.ts | 1 + src/locales/default/error.ts | 7 + src/locales/default/setting.ts | 8 + src/services/_auth.test.ts | 20 + src/services/_auth.ts | 4 + .../settings/selectors/modelProvider.ts | 9 + src/types/settings/modelProvider.ts | 6 + 78 files changed, 1122 insertions(+), 1 deletion(-) create mode 100644 src/app/settings/llm/Mistral/index.tsx create mode 100644 src/config/modelProviders/mistral.ts create mode 100644 src/features/Conversation/Error/APIKeyForm/Mistral.tsx create mode 100644 src/libs/agent-runtime/mistral/index.test.ts create mode 100644 src/libs/agent-runtime/mistral/index.ts diff --git a/.env.example b/.env.example index cdfa13aea1a2..149cc8e863fd 100644 --- a/.env.example +++ b/.env.example @@ -70,6 +70,11 @@ OPENAI_API_KEY=sk-xxxxxxxxx # The local/remote ollama service url # OLLAMA_PROXY_URL=http://127.0.0.1:11434/v1 +########### Mistral AI Service ########## +######################################## + +#MISTRAL_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + ######################################## ######### Perplexity Service ########## ######################################## diff --git a/Dockerfile b/Dockerfile index 132be2188597..2f88937f0478 100644 --- a/Dockerfile +++ b/Dockerfile @@ -89,4 +89,7 @@ ENV PERPLEXITY_API_KEY "" # Anthropic ENV ANTHROPIC_API_KEY "" +# Mistral +ENV MISTRAL_API_KEY "" + CMD ["node", "server.js"] diff --git a/docs/self-hosting/environment-variables/model-provider.mdx b/docs/self-hosting/environment-variables/model-provider.mdx index ad7277b32c61..5cf25f5926fe 100644 --- a/docs/self-hosting/environment-variables/model-provider.mdx +++ b/docs/self-hosting/environment-variables/model-provider.mdx @@ -163,3 +163,11 @@ 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` +## Mistral AI + +### `MISTRAL_API_KEY` + +- Type: Required +- Description: This is the API key you applied for in the Mistral AI service +- Default: - +- Example: `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=` 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 29949f68b1ad..d370b7bd4b48 100644 --- a/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx +++ b/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx @@ -159,4 +159,13 @@ LobeChat 在部署时提供了丰富的模型服务商相关的环境变量, - 类型:必选 - 描述:这是你在 Anthropic AI 服务中申请的 API 密钥 - 默认值:- -- 示例:`sk-ant-apixx-xxxxxxxxx-xxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxx` \ No newline at end of file +- 示例:`sk-ant-apixx-xxxxxxxxx-xxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxx` + +## Mistral AI + +### `MISTRAL_API_KEY` + +- 类型:必选 +- 描述:这是你在 Mistral AI 服务中申请的 API 密钥 +- 默认值:- +- 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=` diff --git a/locales/ar/common.json b/locales/ar/common.json index ad11a2586098..3d26f3443aa2 100644 --- a/locales/ar/common.json +++ b/locales/ar/common.json @@ -104,6 +104,7 @@ "azure": "أزور", "bedrock": "بيدروك لأمازون ويب سيرفيس", "google": "جوجل", + "mistral": "Mistral AI", "moonshot": "مونشوت الذكاء الاصطناعي", "ollama": "أولاما", "oneapi": "وان آبي آي", diff --git a/locales/ar/error.json b/locales/ar/error.json index 4feaaeb47288..df525f182429 100644 --- a/locales/ar/error.json +++ b/locales/ar/error.json @@ -43,11 +43,13 @@ "InvalidAzureAPIKey": "مفتاح Azure API غير صحيح أو فارغ، يرجى التحقق من مفتاح Azure API وإعادة المحاولة", "InvalidBedrockCredentials": "فشلت مصادقة Bedrock، يرجى التحقق من AccessKeyId/SecretAccessKey وإعادة المحاولة", "InvalidGoogleAPIKey": "مفتاح Google API غير صحيح أو فارغ، يرجى التحقق من مفتاح Google API وإعادة المحاولة", + "InvalidMistralAPIKey": "مفتاح Mistral AI API غير صحيح أو فارغ، يرجى التحقق من مفتاح Mistral API وإعادة المحاولة", "InvalidMoonshotAPIKey": "مفتاح API لـ Moonshot AI غير صحيح أو فارغ، يرجى التحقق من مفتاح API لـ Moonshot وإعادة المحاولة", "InvalidOllamaArgs": "تكوين Ollama غير صحيح، يرجى التحقق من تكوين Ollama وإعادة المحاولة", "InvalidPerplexityAPIKey": "مفتاح Perplexity API غير صحيح أو فارغ، يرجى التحقق من مفتاح Perplexity API وإعادة المحاولة", "InvalidZhipuAPIKey": "مفتاح Zhipu API غير صحيح أو فارغ، يرجى التحقق من مفتاح Zhipu API وإعادة المحاولة", "LocationNotSupportError": "عذرًا، لا يدعم موقعك الحالي خدمة هذا النموذج، قد يكون ذلك بسبب قيود المنطقة أو عدم توفر الخدمة. يرجى التحقق مما إذا كان الموقع الحالي يدعم استخدام هذه الخدمة، أو محاولة استخدام معلومات الموقع الأخرى.", + "MistralBizError": "طلب خدمة Mistral AI خاطئ، يرجى التحقق من المعلومات التالية أو إعادة المحاولة", "MoonshotBizError": "حدث خطأ في خدمة جانب القمر، يرجى التحقق من المعلومات أدناه أو إعادة المحاولة", "NoOpenAIAPIKey": "مفتاح API الخاص بـ OpenAI فارغ، يرجى إضافة مفتاح API الخاص بـ OpenAI", "OllamaBizError": "خطأ في طلب خدمة Ollama، يرجى التحقق من المعلومات التالية أو إعادة المحاولة", @@ -88,6 +90,10 @@ "description": "أدخل مفتاح Google API الخاص بك لبدء الجلسة. لن يقوم التطبيق بتسجيل مفتاح الواجهة البرمجية الخاص بك", "title": "استخدام مفتاح Google API المخصص" }, + "Mistral": { + "description": "أدخل مفتاح Mistral AI API الخاص بك لبدء الجلسة. لن يتم تسجيل مفتاح الواجهة البرمجية الخاص بك من قبل التطبيق", + "title": "استخدام مفتاح Mistral AI API المخصص" + }, "Moonshot": { "description": "قم بإدخال مفتاح API الخاص بك لـ Moonshot AI لبدء الجلسة. لن يتم تسجيل مفتاح الـ API الخاص بك من قبل التطبيق", "title": "استخدام مفتاح API مخصص لـ Moonshot AI" diff --git a/locales/ar/setting.json b/locales/ar/setting.json index d9f9b0b7958f..4715e85fcdd4 100644 --- a/locales/ar/setting.json +++ b/locales/ar/setting.json @@ -94,6 +94,14 @@ "title": "مفتاح واجهة برمجة التطبيقات" } }, + "Mistral": { + "title": "Mistral AI", + "token": { + "desc": "أدخل مفتاح API من Mistral AI", + "placeholder": "مفتاح API من Mistral AI", + "title": "مفتاح API" + } + }, "Moonshot": { "title": "الجانب المظلم من القمر", "token": { diff --git a/locales/de-DE/common.json b/locales/de-DE/common.json index a0695de8af99..6bb6c60ecfab 100644 --- a/locales/de-DE/common.json +++ b/locales/de-DE/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "mistral": "Mistral KI", "moonshot": "Moonshot KI", "ollama": "Ollama", "oneapi": "One API", diff --git a/locales/de-DE/error.json b/locales/de-DE/error.json index 5fb06f33a267..efe6a0d32e3c 100644 --- a/locales/de-DE/error.json +++ b/locales/de-DE/error.json @@ -43,11 +43,13 @@ "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.", + "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.", "InvalidPerplexityAPIKey": "Perplexity API Key ist ungültig oder leer. Bitte überprüfen Sie den Perplexity API Key und versuchen Sie es erneut.", "InvalidZhipuAPIKey": "Der Zhipu API-Schlüssel ist ungültig oder leer. Bitte überprüfen Sie den Zhipu API-Schlüssel und versuchen Sie es erneut.", "LocationNotSupportError": "Entschuldigung, Ihr Standort unterstützt diesen Modellservice möglicherweise aufgrund von regionalen Einschränkungen oder nicht aktivierten Diensten nicht. Bitte überprüfen Sie, ob der aktuelle Standort die Verwendung dieses Dienstes unterstützt, oder versuchen Sie, andere Standortinformationen zu verwenden.", + "MistralBizError": "Beim Anfordern des Mistral AI-Dienstes ist ein Fehler aufgetreten. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.", "MoonshotBizError": "Fehler beim Abrufen des Dark Side of the Moon-Services. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.", "NoOpenAIAPIKey": "Der OpenAI-API-Schlüssel ist leer. Bitte fügen Sie einen benutzerdefinierten OpenAI-API-Schlüssel hinzu", "OllamaBizError": "Fehler bei der Anforderung des Ollama-Dienstes. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.", @@ -88,6 +90,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" }, + "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" + }, "Moonshot": { "description": "Geben Sie Ihren individuellen Moonshot AI API-Schlüssel ein, um die Sitzung zu starten. Die App speichert Ihren API-Schlüssel nicht.", "title": "Verwenden Sie einen benutzerdefinierten Moonshot AI API-Schlüssel" diff --git a/locales/de-DE/setting.json b/locales/de-DE/setting.json index 783504eb4a7f..bd64d445fe70 100644 --- a/locales/de-DE/setting.json +++ b/locales/de-DE/setting.json @@ -94,6 +94,14 @@ "title": "API-Schlüssel" } }, + "Mistral": { + "title": "Mistral KI", + "token": { + "desc": "Geben Sie den API-Schlüssel von Mistral KI ein", + "placeholder": "Mistral KI API-Schlüssel", + "title": "API-Schlüssel" + } + }, "Moonshot": { "title": "月球着陆", "token": { diff --git a/locales/en-US/common.json b/locales/en-US/common.json index 2237dc2c7f93..03b4f7f4982a 100644 --- a/locales/en-US/common.json +++ b/locales/en-US/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "Ollama", "oneapi": "One API", diff --git a/locales/en-US/error.json b/locales/en-US/error.json index 97945cb53159..6d52efa3d8db 100644 --- a/locales/en-US/error.json +++ b/locales/en-US/error.json @@ -43,11 +43,13 @@ "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.", + "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", "InvalidPerplexityAPIKey": "Perplexity API Key is incorrect or empty. Please check the Perplexity API Key and retry.", "InvalidZhipuAPIKey": "Zhipu API Key is incorrect or empty. Please check the Zhipu API Key and retry.", "LocationNotSupportError": "We're sorry, your current location does not support this model service. This may be due to regional restrictions or the service not being available. Please confirm if the current location supports using this service, or try using a different location.", + "MistralBizError": "Error occurred while requesting Mistral AI service. Please troubleshoot based on the following information or retry.", "MoonshotBizError": "There was an error with the Moonshot service, please troubleshoot or retry based on the following information.", "NoOpenAIAPIKey": "OpenAI API Key is empty, please add a custom OpenAI API Key", "OllamaBizError": "Error requesting Ollama service, please troubleshoot or retry based on the following information", @@ -88,6 +90,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" }, + "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" + }, "Moonshot": { "description": "Enter your Moonshot AI API Key to start the session. The app will not store your API Key.", "title": "Use Custom Moonshot AI API Key" diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json index 3acf2663c56c..7bb4cdb13e93 100644 --- a/locales/en-US/setting.json +++ b/locales/en-US/setting.json @@ -94,6 +94,14 @@ "title": "API Key" } }, + "Mistral": { + "title": "Mistral AI", + "token": { + "desc": "Enter the API Key from Mistral AI", + "placeholder": "Mistral AI API Key", + "title": "API Key" + } + }, "Moonshot": { "title": "Dark Side of the Moon", "token": { diff --git a/locales/es-ES/common.json b/locales/es-ES/common.json index ad3ed27ad98e..d6f64b2738f2 100644 --- a/locales/es-ES/common.json +++ b/locales/es-ES/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "mistral": "Mistral IA", "moonshot": "Moonshot IA", "ollama": "Ollama", "oneapi": "One API", diff --git a/locales/es-ES/error.json b/locales/es-ES/error.json index 824eabde6f7f..d9f0d8b2e29c 100644 --- a/locales/es-ES/error.json +++ b/locales/es-ES/error.json @@ -43,11 +43,13 @@ "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", + "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", "InvalidPerplexityAPIKey": "La clave de API de Perplexity es inválida o está vacía. Por favor, verifica la clave de API de Perplexity e inténtalo de nuevo", "InvalidZhipuAPIKey": "La clave de API de Zhipu es incorrecta o está vacía, por favor, verifica la clave de API de Zhipu e inténtalo de nuevo", "LocationNotSupportError": "Lo sentimos, tu ubicación actual no es compatible con este servicio de modelo, puede ser debido a restricciones geográficas o a que el servicio no está disponible. Por favor, verifica si tu ubicación actual es compatible con este servicio o intenta usar otra información de ubicación.", + "MistralBizError": "Se produjo un error al solicitar el servicio Mistral AI. Por favor, revise la siguiente información o inténtelo de nuevo.", "MoonshotBizError": "Se produjo un error al solicitar el servicio de Moonshot en el lado oscuro de la luna. Por favor, revise la siguiente información o inténtelo de nuevo.", "NoOpenAIAPIKey": "La clave de API de OpenAI está vacía. Agregue una clave de API de OpenAI personalizada", "OllamaBizError": "Error al solicitar el servicio de Ollama, por favor verifica la siguiente información o inténtalo de nuevo", @@ -88,6 +90,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" }, + "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" + }, "Moonshot": { "description": "Ingrese su clave de API de Moonshot AI personalizada para comenzar la sesión. La aplicación no almacenará su clave de API.", "title": "Usar una clave de API personalizada de Moonshot AI" diff --git a/locales/es-ES/setting.json b/locales/es-ES/setting.json index d026f42e062f..2fe38c140458 100644 --- a/locales/es-ES/setting.json +++ b/locales/es-ES/setting.json @@ -94,6 +94,14 @@ "title": "Clave API" } }, + "Mistral": { + "title": "Mistral AI", + "token": { + "desc": "Introduce la clave API de Mistral AI", + "placeholder": "Clave API de Mistral AI", + "title": "Clave API" + } + }, "Moonshot": { "title": "Lado oscuro de la luna", "token": { diff --git a/locales/fr-FR/common.json b/locales/fr-FR/common.json index 4f62915988e1..2cd25d4892e3 100644 --- a/locales/fr-FR/common.json +++ b/locales/fr-FR/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "mistral": "Mistral AI", "moonshot": "Moonshot IA", "ollama": "Ollama", "oneapi": "One API", diff --git a/locales/fr-FR/error.json b/locales/fr-FR/error.json index e859c267f769..11c6beb4903d 100644 --- a/locales/fr-FR/error.json +++ b/locales/fr-FR/error.json @@ -43,11 +43,13 @@ "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", + "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", "InvalidPerplexityAPIKey": "La clé API Perplexity est incorrecte ou vide. Veuillez vérifier la clé API Perplexity et réessayer.", "InvalidZhipuAPIKey": "Clé API Zhipu incorrecte ou vide, veuillez vérifier la clé API Zhipu et réessayer", "LocationNotSupportError": "Désolé, votre emplacement actuel ne prend pas en charge ce service de modèle, peut-être en raison de restrictions géographiques ou de services non disponibles. Veuillez vérifier si votre emplacement actuel prend en charge ce service ou essayer avec une autre localisation.", + "MistralBizError": "Erreur de service Mistral AI. Veuillez vérifier les informations ci-dessous ou réessayer.", "MoonshotBizError": "Erreur de service Moonshot : une erreur s'est produite lors de la demande du service Côté Obscur de la Lune. Veuillez vérifier les informations suivantes ou réessayer.", "NoOpenAIAPIKey": "La clé API OpenAI est vide. Veuillez ajouter une clé API OpenAI personnalisée", "OllamaBizError": "Erreur commerciale lors de la demande de service Ollama, veuillez vérifier les informations ci-dessous ou réessayer", @@ -88,6 +90,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" }, + "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" + }, "Moonshot": { "description": "Entrez votre clé API Moonshot AI personnalisée pour commencer la session. L'application ne conservera pas votre clé API.", "title": "Utiliser une clé API Moonshot AI personnalisée" diff --git a/locales/fr-FR/setting.json b/locales/fr-FR/setting.json index 34eb2f1e5c42..39335ba4af58 100644 --- a/locales/fr-FR/setting.json +++ b/locales/fr-FR/setting.json @@ -94,6 +94,14 @@ "title": "Clé API" } }, + "Mistral": { + "title": "Mistral AI", + "token": { + "desc": "Veuillez saisir la clé API de Mistral AI", + "placeholder": "Clé API Mistral AI", + "title": "Clé API" + } + }, "Moonshot": { "title": "月球着陆", "token": { diff --git a/locales/it-IT/common.json b/locales/it-IT/common.json index 453639044b71..9b3e966d1432 100644 --- a/locales/it-IT/common.json +++ b/locales/it-IT/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "Ollama", "oneapi": "One API", diff --git a/locales/it-IT/error.json b/locales/it-IT/error.json index adf6016502f7..17f6a40315f6 100644 --- a/locales/it-IT/error.json +++ b/locales/it-IT/error.json @@ -43,11 +43,13 @@ "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", + "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", "InvalidPerplexityAPIKey": "Chiave API Perplexity non valida o vuota, controlla la chiave API Perplexity e riprova", "InvalidZhipuAPIKey": "Chiave API Zhipu non corretta o vuota, controlla la chiave API Zhipu e riprova", "LocationNotSupportError": "Spiacenti, la tua posizione attuale non supporta questo servizio modello, potrebbe essere a causa di restrizioni geografiche o servizi non attivati. Verifica se la posizione attuale supporta l'uso di questo servizio o prova a utilizzare un'altra posizione.", + "MistralBizError": "Errore di richiesta del servizio Mistral AI. Si prega di controllare le informazioni seguenti o riprovare.", "MoonshotBizError": "Si è verificato un errore nel servizio Moonshot, si prega di controllare le informazioni seguenti o riprovare", "NoOpenAIAPIKey": "La chiave API OpenAI è vuota. Aggiungi una chiave API personalizzata OpenAI", "OllamaBizError": "Errore di servizio Ollama, controllare le informazioni seguenti o riprovare", @@ -88,6 +90,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" }, + "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" + }, "Moonshot": { "description": "Inserisci la tua chiave API di Moonshot AI per iniziare la sessione. L'applicazione non memorizzerà la tua chiave API", "title": "Utilizza una chiave API personalizzata per Moonshot AI" diff --git a/locales/it-IT/setting.json b/locales/it-IT/setting.json index 61b8feaf879f..520d78cede62 100644 --- a/locales/it-IT/setting.json +++ b/locales/it-IT/setting.json @@ -94,6 +94,14 @@ "title": "Chiave API" } }, + "Mistral": { + "title": "Mistral AI", + "token": { + "desc": "Inserisci la chiave API da Mistral AI", + "placeholder": "Chiave API Mistral AI", + "title": "Chiave API" + } + }, "Moonshot": { "title": "Lato Oscuro della Luna", "token": { diff --git a/locales/ja-JP/common.json b/locales/ja-JP/common.json index a3851b7d66c4..aae7fdbedfba 100644 --- a/locales/ja-JP/common.json +++ b/locales/ja-JP/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWSベッドロック", "google": "Google", + "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "オラマ", "oneapi": "One API", diff --git a/locales/ja-JP/error.json b/locales/ja-JP/error.json index 900008371e54..4ba48b2a1168 100644 --- a/locales/ja-JP/error.json +++ b/locales/ja-JP/error.json @@ -43,11 +43,13 @@ "InvalidAzureAPIKey": "Azure APIキーが正しくないか空です。Azure APIキーを確認してから再試行してください。", "InvalidBedrockCredentials": "Bedrockの認証に失敗しました。AccessKeyId/SecretAccessKeyを確認してから再試行してください。", "InvalidGoogleAPIKey": "Google APIキーが正しくないか空です。Google APIキーを確認してから再試行してください。", + "InvalidMistralAPIKey": "Mistral AI API キーが正しくないか空です。Mistral API キーを確認して再試行してください。", "InvalidMoonshotAPIKey": "Moonshot AI APIキーが正しくないか空です。Moonshot APIキーを確認して再試行してください。", "InvalidOllamaArgs": "Ollamaの設定が正しくありません。Ollamaの設定を確認してからもう一度お試しください", "InvalidPerplexityAPIKey": "Perplexity APIキーが正しくないか空です。Perplexity APIキーを確認してもう一度お試しください", "InvalidZhipuAPIKey": "Zhipu APIキーが正しくないか空です。Zhipu APIキーを確認してから再試行してください。", "LocationNotSupportError": "申し訳ありませんが、お住まいの地域ではこのモデルサービスをサポートしていません。地域制限またはサービスが利用できない可能性があります。現在の位置がこのサービスをサポートしているかどうかを確認するか、他の位置情報を使用してみてください。", + "MistralBizError": "Mistral AI サービスのリクエストでエラーが発生しました。以下の情報を確認して再試行してください。", "MoonshotBizError": "月の裏側サービスのリクエストでエラーが発生しました。以下の情報を確認して再試行してください。", "NoOpenAIAPIKey": "OpenAI APIキーが空です。カスタムOpenAI APIキーを追加してください。", "OllamaBizError": "Ollamaサービスのリクエストでエラーが発生しました。以下の情報に基づいてトラブルシューティングを行うか、再度お試しください", @@ -88,6 +90,10 @@ "description": "Google APIキーを入力してセッションを開始します。アプリはAPIキーを記録しません。", "title": "カスタムGoogle APIキーを使用" }, + "Mistral": { + "description": "Mistral AI API キーを入力してセッションを開始できます。アプリは API キーを記録しません。", + "title": "カスタム Mistral AI API キーの使用" + }, "Moonshot": { "description": "Moonshot AI APIキーを入力してセッションを開始します。アプリはAPIキーを記録しません。", "title": "カスタムMoonshot AI APIキーを使用" diff --git a/locales/ja-JP/setting.json b/locales/ja-JP/setting.json index 82d0ea498868..ce4bac51a65a 100644 --- a/locales/ja-JP/setting.json +++ b/locales/ja-JP/setting.json @@ -94,6 +94,14 @@ "title": "APIキー" } }, + "Mistral": { + "title": "Mistral AI", + "token": { + "desc": "Mistral AI からの API キーを入力してください", + "placeholder": "Mistral AI API キー", + "title": "API キー" + } + }, "Moonshot": { "title": "月の裏側", "token": { diff --git a/locales/ko-KR/common.json b/locales/ko-KR/common.json index 3ab34b438ffc..920f1fd97d28 100644 --- a/locales/ko-KR/common.json +++ b/locales/ko-KR/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "mistral": "Mistral AI", "moonshot": "문샷 AI", "ollama": "올라마", "oneapi": "One API", diff --git a/locales/ko-KR/error.json b/locales/ko-KR/error.json index 50a32af5df7b..13ba63ba3b6e 100644 --- a/locales/ko-KR/error.json +++ b/locales/ko-KR/error.json @@ -43,11 +43,13 @@ "InvalidAzureAPIKey": "잘못된 또는 비어 있는 Azure API Key입니다. Azure API Key를 확인한 후 다시 시도하십시오.", "InvalidBedrockCredentials": "Bedrock 인증에 실패했습니다. AccessKeyId/SecretAccessKey를 확인한 후 다시 시도하십시오.", "InvalidGoogleAPIKey": "잘못된 또는 비어 있는 Google API Key입니다. Google API Key를 확인한 후 다시 시도하십시오.", + "InvalidMistralAPIKey": "Mistral AI API 키가 잘못되었거나 비어 있습니다. Mistral API 키를 확인한 후 다시 시도해주세요.", "InvalidMoonshotAPIKey": "Moonshot AI API 키가 잘못되었거나 비어 있습니다. Moonshot API 키를 확인한 후 다시 시도해주세요.", "InvalidOllamaArgs": "Ollama 구성이 잘못되었습니다. Ollama 구성을 확인한 후 다시 시도하십시오.", "InvalidPerplexityAPIKey": "Perplexity API 키가 잘못되었거나 비어 있습니다. Perplexity API 키를 확인한 후 다시 시도하십시오.", "InvalidZhipuAPIKey": "잘못된 또는 비어 있는 Zhipu API Key입니다. Zhipu API Key를 확인한 후 다시 시도하십시오.", "LocationNotSupportError": "죄송합니다. 귀하의 현재 위치는 해당 모델 서비스를 지원하지 않습니다. 지역 제한 또는 서비스 미개통으로 인한 것일 수 있습니다. 현재 위치가 해당 서비스를 지원하는지 확인하거나 다른 위치 정보를 사용해 보십시오.", + "MistralBizError": "Mistral AI 서비스 요청 중 오류가 발생했습니다. 아래 정보를 확인하고 다시 시도해주세요.", "MoonshotBizError": "요청한 문샷 비즈니스에 오류가 발생했습니다. 아래 정보를 확인하고 다시 시도해주세요.", "NoOpenAIAPIKey": "OpenAI API 키가 비어 있습니다. 사용자 정의 OpenAI API 키를 추가해주세요.", "OllamaBizError": "Ollama 서비스 요청 중 오류가 발생했습니다. 아래 정보를 확인하고 다시 시도하십시오.", @@ -88,6 +90,10 @@ "description": "Google API Key를 입력하여 세션을 시작합니다. 앱은 귀하의 API Key를 기록하지 않습니다.", "title": "사용자 정의 Google API Key 사용" }, + "Mistral": { + "description": "Mistral AI API 키를 입력하면 세션을 시작할 수 있습니다. 애플리케이션은 API 키를 기록하지 않습니다.", + "title": "사용자 지정 Mistral AI API 키 사용" + }, "Moonshot": { "description": "Moonshot AI API 키를 입력하면 세션을 시작할 수 있습니다. 애플리케이션은 API 키를 기록하지 않습니다.", "title": "사용자 정의 Moonshot AI API 키 사용" diff --git a/locales/ko-KR/setting.json b/locales/ko-KR/setting.json index 2d25168304bd..e4956c422ec2 100644 --- a/locales/ko-KR/setting.json +++ b/locales/ko-KR/setting.json @@ -94,6 +94,14 @@ "title": "API Key" } }, + "Mistral": { + "title": "Mistral AI", + "token": { + "desc": "Mistral AI의 API 키를 입력하세요", + "placeholder": "Mistral AI API 키", + "title": "API 키" + } + }, "Moonshot": { "title": "달의 그림자", "token": { diff --git a/locales/nl-NL/common.json b/locales/nl-NL/common.json index 58bac0a168bb..da0fff4ee218 100644 --- a/locales/nl-NL/common.json +++ b/locales/nl-NL/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "Ollama", "oneapi": "One API", diff --git a/locales/nl-NL/error.json b/locales/nl-NL/error.json index 8ad848326f4d..4b81111ff1ef 100644 --- a/locales/nl-NL/error.json +++ b/locales/nl-NL/error.json @@ -43,11 +43,13 @@ "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", + "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", "InvalidPerplexityAPIKey": "Perplexity API Key is onjuist of leeg. Controleer de Perplexity API Key en probeer het opnieuw.", "InvalidZhipuAPIKey": "Incorrect or empty Zhipu API Key, please check the Zhipu API Key and retry", "LocationNotSupportError": "Sorry, your current location does not support this model service, possibly due to regional restrictions or service not being available. Please confirm if the current location supports using this service, or try using other location information.", + "MistralBizError": "Er is een fout opgetreden bij het aanroepen van de Mistral AI-service. Controleer de onderstaande informatie of probeer het opnieuw.", "MoonshotBizError": "请求月球AI服务出错,请根据以下信息排查或重试", "NoOpenAIAPIKey": "OpenAI API-sleutel ontbreekt. Voeg een aangepaste OpenAI API-sleutel toe", "OllamaBizError": "Fout bij het aanroepen van de Ollama-service, controleer de onderstaande informatie en probeer opnieuw", @@ -88,6 +90,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" }, + "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" + }, "Moonshot": { "description": "输入您的Moonshot AI API密钥即可开始会话。应用不会记录您的API密钥", "title": "使用自定义Moonshot AI API密钥" diff --git a/locales/nl-NL/setting.json b/locales/nl-NL/setting.json index f8ea00966340..f81a33cd1f2a 100644 --- a/locales/nl-NL/setting.json +++ b/locales/nl-NL/setting.json @@ -94,6 +94,14 @@ "title": "API-sleutel" } }, + "Mistral": { + "title": "Mistral AI", + "token": { + "desc": "Voer de API-sleutel van Mistral AI in", + "placeholder": "Mistral AI API-sleutel", + "title": "API-sleutel" + } + }, "Moonshot": { "title": "月球计划", "token": { diff --git a/locales/pl-PL/common.json b/locales/pl-PL/common.json index 611cf2c25585..dbc5019d10b0 100644 --- a/locales/pl-PL/common.json +++ b/locales/pl-PL/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "Ollama", "oneapi": "One API", diff --git a/locales/pl-PL/error.json b/locales/pl-PL/error.json index 3bd4ddac46ed..318b2a8cebad 100644 --- a/locales/pl-PL/error.json +++ b/locales/pl-PL/error.json @@ -43,11 +43,13 @@ "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.", + "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", "InvalidPerplexityAPIKey": "Klucz API Perplexity jest nieprawidłowy lub pusty. Sprawdź klucz API Perplexity i spróbuj ponownie.", "InvalidZhipuAPIKey": "Nieprawidłowy lub pusty klucz API Zhipu, prosimy sprawdzić klucz API Zhipu i spróbować ponownie.", "LocationNotSupportError": "Przepraszamy, Twoja lokalizacja nie obsługuje tego usługi modelu, być może ze względu na ograniczenia regionalne lub brak dostępności usługi. Proszę sprawdź, czy bieżąca lokalizacja obsługuje tę usługę, lub spróbuj użyć innych informacji o lokalizacji.", + "MistralBizError": "请求 Mistral AI 服务出错,请根据以下信息排查或重试", "MoonshotBizError": "请求月球AI服务出错,请根据以下信息排查或重试", "NoOpenAIAPIKey": "Klucz API OpenAI jest pusty. Proszę dodać niestandardowy klucz API OpenAI", "OllamaBizError": "Błąd usługi Ollama, sprawdź poniższe informacje lub spróbuj ponownie", @@ -88,6 +90,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" }, + "Mistral": { + "description": "输入你的 Mistral AI API Key 即可开始会话。应用不会记录你的 API Key", + "title": "使用自定义 Mistral AI API Key" + }, "Moonshot": { "description": "输入您的Moonshot AI API密钥即可开始会话。应用不会记录您的API密钥", "title": "使用自定义Moonshot AI API密钥" diff --git a/locales/pl-PL/setting.json b/locales/pl-PL/setting.json index 77e5081de561..6461462c99cb 100644 --- a/locales/pl-PL/setting.json +++ b/locales/pl-PL/setting.json @@ -94,6 +94,14 @@ "title": "Klucz API" } }, + "Mistral": { + "title": "Mistral AI", + "token": { + "desc": "Wprowadź klucz API Mistral AI", + "placeholder": "Klucz API Mistral AI", + "title": "Klucz API" + } + }, "Moonshot": { "title": "Ciemna strona Księżyca", "token": { diff --git a/locales/pt-BR/common.json b/locales/pt-BR/common.json index 36eb876e783f..6381f563dc00 100644 --- a/locales/pt-BR/common.json +++ b/locales/pt-BR/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "mistral": "Mistral AI", "moonshot": "Moonshot IA", "ollama": "Ollama", "oneapi": "One API", diff --git a/locales/pt-BR/error.json b/locales/pt-BR/error.json index dee4e839a1c0..ee7780c33054 100644 --- a/locales/pt-BR/error.json +++ b/locales/pt-BR/error.json @@ -43,11 +43,13 @@ "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", + "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", "InvalidPerplexityAPIKey": "Chave da API Perplexity inválida ou em branco, verifique a chave da API Perplexity e tente novamente", "InvalidZhipuAPIKey": "Chave de API Zhipu incorreta ou vazia, por favor, verifique a chave de API Zhipu e tente novamente", "LocationNotSupportError": "Desculpe, sua localização atual não suporta este serviço de modelo, pode ser devido a restrições geográficas ou serviço não disponível. Por favor, verifique se a localização atual suporta o uso deste serviço ou tente usar outras informações de localização.", + "MistralBizError": "Ocorreu um erro ao solicitar o serviço Mistral AI. Por favor, verifique as informações abaixo ou tente novamente.", "MoonshotBizError": "O serviço Moonshot na face oculta da lua encontrou um erro. Por favor, verifique as informações abaixo ou tente novamente.", "NoOpenAIAPIKey": "A chave de API do OpenAI está em branco. Adicione uma chave de API personalizada do OpenAI", "OllamaBizError": "Erro de negócio ao solicitar o serviço Ollama, verifique as informações a seguir ou tente novamente", @@ -88,6 +90,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" }, + "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" + }, "Moonshot": { "description": "Insira a sua chave de API Moonshot AI para iniciar a sessão. O aplicativo não irá armazenar a sua chave de API.", "title": "Usar chave de API personalizada Moonshot AI" diff --git a/locales/pt-BR/setting.json b/locales/pt-BR/setting.json index e5d2cbdb6965..3fc2dd22c556 100644 --- a/locales/pt-BR/setting.json +++ b/locales/pt-BR/setting.json @@ -94,6 +94,14 @@ "title": "API Key" } }, + "Mistral": { + "title": "Mistral AI", + "token": { + "desc": "Insira a chave da API do Mistral AI", + "placeholder": "Chave da API do Mistral AI", + "title": "Chave da API" + } + }, "Moonshot": { "title": "Lado Escuro da Lua", "token": { diff --git a/locales/ru-RU/common.json b/locales/ru-RU/common.json index 612ad48db829..87500b86c6fc 100644 --- a/locales/ru-RU/common.json +++ b/locales/ru-RU/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "mistral": "Mistral AI", "moonshot": "Искусственный интеллект Moonshot", "ollama": "Оллама", "oneapi": "One API", diff --git a/locales/ru-RU/error.json b/locales/ru-RU/error.json index 3694be16f4a1..e11c811cbb69 100644 --- a/locales/ru-RU/error.json +++ b/locales/ru-RU/error.json @@ -43,11 +43,13 @@ "InvalidAzureAPIKey": "Неверный или пустой ключ API Azure, пожалуйста, проверьте ключ API Azure и повторите попытку", "InvalidBedrockCredentials": "Аутентификация Bedrock не прошла, пожалуйста, проверьте AccessKeyId/SecretAccessKey и повторите попытку", "InvalidGoogleAPIKey": "Неверный или пустой ключ API Google, пожалуйста, проверьте ключ API Google и повторите попытку", + "InvalidMistralAPIKey": "Неверный или пустой ключ API Mistral AI. Пожалуйста, проверьте ключ API Mistral и повторите попытку", "InvalidMoonshotAPIKey": "Moonshot AI API Key неверный или пустой, пожалуйста, проверьте ключ API Moonshot и повторите попытку", "InvalidOllamaArgs": "Неверная конфигурация Ollama, пожалуйста, проверьте конфигурацию Ollama и повторите попытку", "InvalidPerplexityAPIKey": "Неверный или пустой ключ API Perplexity. Пожалуйста, проверьте ключ API Perplexity и повторите попытку", "InvalidZhipuAPIKey": "Неверный или пустой ключ API Zhipu, пожалуйста, проверьте ключ API Zhipu и повторите попытку", "LocationNotSupportError": "Извините, ваше текущее местоположение не поддерживает эту службу модели, возможно из-за ограничений региона или недоступности службы. Пожалуйста, убедитесь, что текущее местоположение поддерживает использование этой службы, или попробуйте использовать другую информацию о местоположении.", + "MistralBizError": "Ошибка запроса к службе Mistral AI. Пожалуйста, проверьте следующую информацию или повторите попытку", "MoonshotBizError": "请求月球暗面服务出错,请根据以下信息排查或重试", "NoOpenAIAPIKey": "Ключ OpenAI API пуст, пожалуйста, добавьте свой собственный ключ OpenAI API", "OllamaBizError": "Ошибка обращения к сервису Ollama, пожалуйста, проверьте следующую информацию или повторите попытку", @@ -88,6 +90,10 @@ "description": "Введите свой ключ API Google, чтобы начать сеанс. Приложение не будет сохранять ваш ключ API", "title": "Использовать пользовательский ключ API Google" }, + "Mistral": { + "description": "Введите свой ключ API Mistral AI, чтобы начать сеанс. Приложение не будет сохранять ваш ключ API", + "title": "Использовать пользовательский ключ API Mistral AI" + }, "Moonshot": { "description": "Введите свой ключ API Moonshot AI, чтобы начать сеанс. Приложение не будет сохранять ваш ключ API", "title": "Использовать пользовательский ключ API Moonshot AI" diff --git a/locales/ru-RU/setting.json b/locales/ru-RU/setting.json index c2520a19da2a..abf594971ab9 100644 --- a/locales/ru-RU/setting.json +++ b/locales/ru-RU/setting.json @@ -94,6 +94,14 @@ "title": "API-ключ" } }, + "Mistral": { + "title": "Mistral AI", + "token": { + "desc": "Введите API-ключ от Mistral AI", + "placeholder": "Ключ API Mistral AI", + "title": "API-ключ" + } + }, "Moonshot": { "title": "Лунная тень", "token": { diff --git a/locales/tr-TR/common.json b/locales/tr-TR/common.json index d6cbea396643..c7a8a45dcc85 100644 --- a/locales/tr-TR/common.json +++ b/locales/tr-TR/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "Ollama", "oneapi": "One API", diff --git a/locales/tr-TR/error.json b/locales/tr-TR/error.json index a47b3b53fd1a..b5c387e74470 100644 --- a/locales/tr-TR/error.json +++ b/locales/tr-TR/error.json @@ -43,11 +43,13 @@ "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", + "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", "InvalidPerplexityAPIKey": "Perplexity API Key geçersiz veya boş, lütfen Perplexity API Key'inizi kontrol edip tekrar deneyin", "InvalidZhipuAPIKey": "Zhipu API Anahtarı yanlış veya boş, lütfen Zhipu API Anahtarınızı kontrol edip tekrar deneyin", "LocationNotSupportError": "Üzgünüz, bulunduğunuz konum bu model hizmetini desteklemiyor, muhtemelen bölge kısıtlamaları veya hizmetin henüz açılmamış olması nedeniyle. Lütfen mevcut konumun bu hizmeti kullanmaya uygun olup olmadığını doğrulayın veya başka bir konum bilgisi kullanmayı deneyin.", + "MistralBizError": "Mistral AI hizmeti isteği sırasında bir hata oluştu. Lütfen aşağıdaki bilgilere göre sorunu giderin veya tekrar deneyin", "MoonshotBizError": "Moonshot hizmetinde bir hata oluştu, lütfen aşağıdaki bilgilere göre sorunu giderin veya tekrar deneyin", "NoOpenAIAPIKey": "OpenAI API Anahtarı boş, lütfen özel bir OpenAI API Anahtarı ekleyin", "OllamaBizError": "Ollama servisine yapılan istekte hata oluştu, lütfen aşağıdaki bilgilere göre sorunu gidermeye çalışın veya tekrar deneyin", @@ -88,6 +90,10 @@ "description": "Google API Anahtarınızı girerek oturumu başlatabilirsiniz. Uygulama API Anahtarınızı kaydetmez", "title": "Özel Google 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" + }, "Moonshot": { "description": "Oturumu başlatmak için Moonshot AI API Anahtarınızı girin. Uygulama API Anahtarınızı kaydetmez", "title": "Özel Moonshot AI API Anahtarını Kullan" diff --git a/locales/tr-TR/setting.json b/locales/tr-TR/setting.json index a4eb424c4df3..8ee117fae3af 100644 --- a/locales/tr-TR/setting.json +++ b/locales/tr-TR/setting.json @@ -94,6 +94,14 @@ "title": "API Anahtarı" } }, + "Mistral": { + "title": "Mistral AI", + "token": { + "desc": "Mistral AI 的 API 密钥", + "placeholder": "Mistral AI API 密钥", + "title": "API 密钥" + } + }, "Moonshot": { "title": "月球背面", "token": { diff --git a/locales/vi-VN/common.json b/locales/vi-VN/common.json index f1779c9e6330..9667990ce690 100644 --- a/locales/vi-VN/common.json +++ b/locales/vi-VN/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "Ollama", "oneapi": "One API", diff --git a/locales/vi-VN/error.json b/locales/vi-VN/error.json index 572200ee2693..f46d9225e60f 100644 --- a/locales/vi-VN/error.json +++ b/locales/vi-VN/error.json @@ -43,11 +43,13 @@ "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", + "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", "InvalidPerplexityAPIKey": "Khóa API Perplexity không hợp lệ hoặc trống, vui lòng kiểm tra lại và thử lại sau", "InvalidZhipuAPIKey": "Khóa API Zhipu không chính xác hoặc trống, vui lòng kiểm tra lại Khóa API Zhipu và thử lại", "LocationNotSupportError": "Xin lỗi, vị trí của bạn không hỗ trợ dịch vụ mô hình này, có thể do hạn chế vùng miền hoặc dịch vụ chưa được mở. Vui lòng xác nhận xem vị trí hiện tại có hỗ trợ sử dụng dịch vụ này không, hoặc thử sử dụng thông tin vị trí khác.", + "MistralBizError": "Yêu cầu dịch vụ Mistral AI gặp lỗi, vui lòng kiểm tra thông tin dưới đây hoặc thử lại", "MoonshotBizError": "Yêu cầu dịch vụ Mặt Trăng Tối gặp sự cố, vui lòng kiểm tra thông tin dưới đây hoặc thử lại", "NoOpenAIAPIKey": "Khóa API OpenAI trống, vui lòng thêm Khóa API OpenAI tùy chỉnh", "OllamaBizError": "Yêu cầu dịch vụ Ollama gặp lỗi, vui lòng kiểm tra thông tin dưới đây hoặc thử lại", @@ -88,6 +90,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" }, + "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" + }, "Moonshot": { "description": "Nhập Khóa API Moonshot AI của bạn để bắt đầu phiên làm việc. Ứng dụng sẽ không lưu trữ Khóa API của bạn", "title": "Sử dụng Khóa API Moonshot AI tùy chỉnh" diff --git a/locales/vi-VN/setting.json b/locales/vi-VN/setting.json index f6d927c4d6e4..bed9019ee44a 100644 --- a/locales/vi-VN/setting.json +++ b/locales/vi-VN/setting.json @@ -94,6 +94,14 @@ "title": "API Key" } }, + "Mistral": { + "title": "Mistral AI", + "token": { + "desc": "Nhập API Key từ Mistral AI", + "placeholder": "Mistral AI API Key", + "title": "API Key" + } + }, "Moonshot": { "title": "Mặt trăng", "token": { diff --git a/locales/zh-CN/common.json b/locales/zh-CN/common.json index 5db6bab6fd7e..c7e8e100abc5 100644 --- a/locales/zh-CN/common.json +++ b/locales/zh-CN/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "Ollama", "oneapi": "One API", diff --git a/locales/zh-CN/error.json b/locales/zh-CN/error.json index 253bf515f721..43382d291144 100644 --- a/locales/zh-CN/error.json +++ b/locales/zh-CN/error.json @@ -51,6 +51,8 @@ "NoOpenAIAPIKey": "OpenAI API Key 为空,请添加自定义 OpenAI API Key", "ZhipuBizError": "请求智谱服务出错,请根据以下信息排查或重试", "InvalidZhipuAPIKey": "Zhipu API Key 不正确或为空,请检查 Zhipu API Key 后重试", + "MistralBizError": "请求 Mistral AI 服务出错,请根据以下信息排查或重试", + "InvalidMistralAPIKey": "Mistral AI API Key 不正确或为空,请检查 Mistral API Key 后重试", "MoonshotBizError": "请求月之暗面服务出错,请根据以下信息排查或重试", "InvalidMoonshotAPIKey": "Moonshot AI API Key 不正确或为空,请检查 Moonshot API Key 后重试", "GoogleBizError": "请求 Google 服务出错,请根据以下信息排查或重试", @@ -88,6 +90,10 @@ "description": "输入你的 Google API Key 即可开始会话。应用不会记录你的 API Key", "title": "使用自定义 Google API Key" }, + "Mistral": { + "description": "输入你的 Mistral AI API Key 即可开始会话。应用不会记录你的 API Key", + "title": "使用自定义 Mistral AI API Key" + }, "Moonshot": { "description": "输入你的 Moonshot AI API Key 即可开始会话。应用不会记录你的 API Key", "title": "使用自定义 Moonshot AI API Key" diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json index 017f27c9a2aa..3f8e2f977f78 100644 --- a/locales/zh-CN/setting.json +++ b/locales/zh-CN/setting.json @@ -94,6 +94,14 @@ "title": "API Key" } }, + "Mistral": { + "title": "Mistral AI", + "token": { + "desc": "填入来自 Mistral AI 的 API Key", + "placeholder": "Mistral AI API Key", + "title": "API Key" + } + }, "Moonshot": { "title": "月之暗面", "token": { diff --git a/locales/zh-TW/common.json b/locales/zh-TW/common.json index 9823519a71ad..d46f606382e3 100644 --- a/locales/zh-TW/common.json +++ b/locales/zh-TW/common.json @@ -104,6 +104,7 @@ "azure": "Azure", "bedrock": "AWS Bedrock", "google": "Google", + "mistral": "Mistral AI", "moonshot": "Moonshot AI", "ollama": "奧拉馬", "oneapi": "One API", diff --git a/locales/zh-TW/error.json b/locales/zh-TW/error.json index c1da25fc5a09..9777104e807e 100644 --- a/locales/zh-TW/error.json +++ b/locales/zh-TW/error.json @@ -43,11 +43,13 @@ "InvalidAzureAPIKey": "Azure API Key 不正確或為空,請檢查 Azure API Key 後重試", "InvalidBedrockCredentials": "Bedrock 驗證未通過,請檢查 AccessKeyId/SecretAccessKey 後重試", "InvalidGoogleAPIKey": "Google API Key 不正確或為空,請檢查 Google API Key 後重試", + "InvalidMistralAPIKey": "Mistral AI API Key 不正確或為空,請檢查 Mistral API Key 後重試", "InvalidMoonshotAPIKey": "Moonshot AI API 金鑰不正確或為空,請檢查 Moonshot API 金鑰後重試", "InvalidOllamaArgs": "Ollama 配置不正確,請檢查 Ollama 配置後重試", "InvalidPerplexityAPIKey": "Perplexity API Key 不正確或為空,請檢查 Perplexity API Key 後重試", "InvalidZhipuAPIKey": "Zhipu API Key 不正確或為空,請檢查 Zhipu API Key 後重試", "LocationNotSupportError": "很抱歉,你的所在位置不支持此模型服務,可能是由於地區限制或服務未開通。請確認當前位置是否支持使用此服務,或嘗試使用其他位置信息。", + "MistralBizError": "請求 Mistral AI 服務出錯,請根據以下信息排查或重試", "MoonshotBizError": "請求月球背面服務出錯,請根據以下信息排查或重試", "NoOpenAIAPIKey": "OpenAI API 金鑰為空,請添加自訂 OpenAI API 金鑰", "OllamaBizError": "請求 Ollama 服務出錯,請根據以下資訊排查或重試", @@ -88,6 +90,10 @@ "description": "輸入你的 Google API Key 即可開始會話。應用不會記錄你的 API Key", "title": "使用自定義 Google API Key" }, + "Mistral": { + "description": "輸入你的 Mistral AI API Key 即可開始會話。應用不會記錄你的 API Key", + "title": "使用自定義 Mistral AI API Key" + }, "Moonshot": { "description": "輸入你的 Moonshot AI API 金鑰即可開始會話。應用不會記錄你的 API 金鑰", "title": "使用自定義 Moonshot AI API 金鑰" diff --git a/locales/zh-TW/setting.json b/locales/zh-TW/setting.json index e7eb5382958f..b207cb91994b 100644 --- a/locales/zh-TW/setting.json +++ b/locales/zh-TW/setting.json @@ -94,6 +94,14 @@ "title": "API 金鑰" } }, + "Mistral": { + "title": "Mistral AI", + "token": { + "desc": "填入來自 Mistral AI 的 API 金鑰", + "placeholder": "Mistral AI API 金鑰", + "title": "API 金鑰" + } + }, "Moonshot": { "title": "月球背面", "token": { diff --git a/src/app/api/chat/[provider]/agentRuntime.test.ts b/src/app/api/chat/[provider]/agentRuntime.test.ts index c9391a18b57a..715a4a2490da 100644 --- a/src/app/api/chat/[provider]/agentRuntime.test.ts +++ b/src/app/api/chat/[provider]/agentRuntime.test.ts @@ -8,9 +8,11 @@ import { JWTPayload } from '@/const/auth'; import { TraceNameMap } from '@/const/trace'; import { ChatStreamPayload, + LobeAnthropicAI, LobeAzureOpenAI, LobeBedrockAI, LobeGoogleAI, + LobeMistralAI, LobeMoonshotAI, LobeOllamaAI, LobeOpenAI, @@ -38,6 +40,8 @@ vi.mock('@/config/server', () => ({ AWS_REGION: 'test-aws-region', OLLAMA_PROXY_URL: 'test-ollama-url', PERPLEXITY_API_KEY: 'test-perplexity-key', + ANTHROPIC_API_KEY: 'test-anthropic-key', + MISTRAL_API_KEY: 'test-mistral-key', })), })); @@ -261,6 +265,54 @@ describe('AgentRuntime', () => { }); }); + describe('Anthropic AI provider', () => { + it('should initialize correctly', async () => { + const jwtPayload: JWTPayload = { apiKey: 'user-anthropic-key' }; + const runtime = await AgentRuntime.initializeWithUserPayload( + ModelProvider.Anthropic, + jwtPayload, + ); + + // 假设 LobeAnthropicAI 是 Anthropic 提供者的实现类 + expect(runtime['_runtime']).toBeInstanceOf(LobeAnthropicAI); + }); + + it('should initialize correctly without apiKey', async () => { + const jwtPayload: JWTPayload = {}; + const runtime = await AgentRuntime.initializeWithUserPayload( + ModelProvider.Anthropic, + jwtPayload, + ); + + // 假设 LobeAnthropicAI 是 Anthropic 提供者的实现类 + expect(runtime['_runtime']).toBeInstanceOf(LobeAnthropicAI); + }); + }); + + describe('Mistral AI provider', () => { + it('should initialize correctly', async () => { + const jwtPayload: JWTPayload = { apiKey: 'user-mistral-key' }; + const runtime = await AgentRuntime.initializeWithUserPayload( + ModelProvider.Mistral, + jwtPayload, + ); + + // 假设 LobeMistralAI 是 Mistral 提供者的实现类 + expect(runtime['_runtime']).toBeInstanceOf(LobeMistralAI); + }); + + it('should initialize correctly without apiKey', async () => { + const jwtPayload: JWTPayload = {}; + const runtime = await AgentRuntime.initializeWithUserPayload( + ModelProvider.Mistral, + jwtPayload, + ); + + // 假设 LobeMistralAI 是 Mistral 提供者的实现类 + expect(runtime['_runtime']).toBeInstanceOf(LobeMistralAI); + }); + }); + it('should handle unknown provider gracefully', async () => { const jwtPayload: JWTPayload = {}; const runtime = await AgentRuntime.initializeWithUserPayload('unknown', jwtPayload); diff --git a/src/app/api/chat/[provider]/agentRuntime.ts b/src/app/api/chat/[provider]/agentRuntime.ts index 1040b275a545..d681036a9ee0 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, + LobeMistralAI, LobeMoonshotAI, LobeOllamaAI, LobeOpenAI, @@ -161,6 +162,11 @@ class AgentRuntime { runtimeModel = this.initAnthropic(payload); break; } + + case ModelProvider.Mistral: { + runtimeModel = this.initMistral(payload); + break; + } } return new AgentRuntime(runtimeModel); @@ -255,6 +261,13 @@ class AgentRuntime { return new LobeAnthropicAI({ apiKey }); } + + private static initMistral(payload: JWTPayload) { + const { MISTRAL_API_KEY } = getServerConfig(); + const apiKey = apiKeyManager.pick(payload?.apiKey || MISTRAL_API_KEY); + + return new LobeMistralAI({ apiKey }); + } } export default AgentRuntime; diff --git a/src/app/api/config/route.ts b/src/app/api/config/route.ts index 315f212e306e..a57acb03bedc 100644 --- a/src/app/api/config/route.ts +++ b/src/app/api/config/route.ts @@ -19,6 +19,7 @@ export const GET = async () => { ENABLE_OLLAMA, ENABLED_PERPLEXITY, ENABLED_ANTHROPIC, + ENABLED_MISTRAL, DEFAULT_AGENT_CONFIG, ENABLE_LANGFUSE, } = getServerConfig(); @@ -34,6 +35,7 @@ export const GET = async () => { anthropic: { enabled: ENABLED_ANTHROPIC }, bedrock: { enabled: ENABLED_AWS_BEDROCK }, google: { enabled: ENABLED_GOOGLE }, + mistral: { enabled: ENABLED_MISTRAL }, moonshot: { enabled: ENABLED_MOONSHOT }, ollama: { enabled: ENABLE_OLLAMA }, perplexity: { enabled: ENABLED_PERPLEXITY }, diff --git a/src/app/api/errorResponse.test.ts b/src/app/api/errorResponse.test.ts index 9e930f30a20b..df005705cc2e 100644 --- a/src/app/api/errorResponse.test.ts +++ b/src/app/api/errorResponse.test.ts @@ -99,6 +99,21 @@ describe('createErrorResponse', () => { const response = createErrorResponse(errorType); expect(response.status).toBe(479); }); + + // 测试 AnthropicBizError 错误类型返回480状态码 + it('returns a 480 status for AnthropicBizError error type', () => { + const errorType = AgentRuntimeErrorType.AnthropicBizError; + const response = createErrorResponse(errorType); + expect(response.status).toBe(480); + }); + + // 测试 MistralBizError 错误类型返回481状态码 + it('returns a 481 status for MistralBizError error type', () => { + const errorType = AgentRuntimeErrorType.MistralBizError; + const response = createErrorResponse(errorType); + expect(response.status).toBe(481); + }); + }); // 测试状态码不在200-599范围内的情况 diff --git a/src/app/api/errorResponse.ts b/src/app/api/errorResponse.ts index 649ab5015fae..c035619731fd 100644 --- a/src/app/api/errorResponse.ts +++ b/src/app/api/errorResponse.ts @@ -46,6 +46,9 @@ const getStatus = (errorType: ILobeAgentRuntimeErrorType | ErrorType) => { case AgentRuntimeErrorType.AnthropicBizError: { return 480; } + case AgentRuntimeErrorType.MistralBizError: { + return 481; + } } return errorType as number; }; diff --git a/src/app/settings/llm/Mistral/index.tsx b/src/app/settings/llm/Mistral/index.tsx new file mode 100644 index 000000000000..0aa1e43a8fa2 --- /dev/null +++ b/src/app/settings/llm/Mistral/index.tsx @@ -0,0 +1,52 @@ +import { Mistral } 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 = 'mistral'; + +const MistralProvider = memo(() => { + const { t } = useTranslation('setting'); + + const theme = useTheme(); + + return ( + + ), + desc: t('llm.Mistral.token.desc'), + label: t('llm.Mistral.token.title'), + name: [LLMProviderConfigKey, providerKey, LLMProviderApiTokenKey], + }, + { + children: , + desc: t('llm.checker.desc'), + label: t('llm.checker.title'), + minWidth: '100%', + }, + ]} + provider={providerKey} + title={ + + } + /> + ); +}); + +export default MistralProvider; diff --git a/src/app/settings/llm/index.tsx b/src/app/settings/llm/index.tsx index ce1ccab6051f..72ba4868923b 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 Mistral from './Mistral'; import Moonshot from './Moonshot'; import Ollama from './Ollama'; import OpenAI from './OpenAI'; @@ -31,6 +32,7 @@ export default memo<{ showOllama: boolean }>(({ showOllama }) => { + {showOllama && }