From 780b1a225ffa43199fdfbee4a47d86e78bc6118b Mon Sep 17 00:00:00 2001 From: Linghui Gong Date: Sat, 16 Mar 2024 21:17:37 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20support=20openrouter=20as?= =?UTF-8?q?=20a=20new=20model=20provider=20(#1572)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :sparkles: feat: add openrouter provider * :sparkles: feat: add openrouter default headers * :bug: fix: test case bug --- .env.example | 6 + Dockerfile | 3 + .../environment-variables/model-provider.mdx | 18 +- .../model-provider.zh-CN.mdx | 8 + locales/ar/common.json | 3 +- locales/ar/error.json | 8 +- locales/ar/setting.json | 16 + locales/de-DE/common.json | 3 +- locales/de-DE/error.json | 8 +- locales/de-DE/setting.json | 16 + locales/en-US/common.json | 3 +- locales/en-US/error.json | 8 +- locales/en-US/setting.json | 16 + locales/es-ES/common.json | 3 +- locales/es-ES/error.json | 8 +- locales/es-ES/setting.json | 16 + locales/fr-FR/common.json | 3 +- locales/fr-FR/error.json | 8 +- locales/fr-FR/setting.json | 16 + locales/it-IT/common.json | 3 +- locales/it-IT/error.json | 8 +- locales/it-IT/setting.json | 16 + locales/ja-JP/common.json | 3 +- locales/ja-JP/error.json | 8 +- locales/ja-JP/setting.json | 16 + locales/ko-KR/common.json | 3 +- locales/ko-KR/error.json | 8 +- locales/ko-KR/setting.json | 16 + locales/nl-NL/common.json | 3 +- locales/nl-NL/error.json | 8 +- locales/nl-NL/setting.json | 16 + locales/pl-PL/common.json | 3 +- locales/pl-PL/error.json | 8 +- locales/pl-PL/setting.json | 16 + locales/pt-BR/common.json | 3 +- locales/pt-BR/error.json | 8 +- locales/pt-BR/setting.json | 16 + locales/ru-RU/common.json | 3 +- locales/ru-RU/error.json | 8 +- locales/ru-RU/setting.json | 16 + locales/tr-TR/common.json | 3 +- locales/tr-TR/error.json | 8 +- locales/tr-TR/setting.json | 16 + locales/vi-VN/common.json | 3 +- locales/vi-VN/error.json | 8 +- locales/vi-VN/setting.json | 16 + locales/zh-CN/common.json | 3 +- locales/zh-CN/error.json | 8 +- locales/zh-CN/setting.json | 16 + locales/zh-TW/common.json | 3 +- locales/zh-TW/error.json | 8 +- locales/zh-TW/setting.json | 16 + .../api/chat/[provider]/agentRuntime.test.ts | 26 ++ src/app/api/chat/[provider]/agentRuntime.ts | 14 + src/app/api/config/route.ts | 2 + src/app/api/errorResponse.test.ts | 7 + src/app/api/errorResponse.ts | 3 + src/app/settings/llm/OpenRouter/index.tsx | 64 ++++ src/app/settings/llm/index.tsx | 2 + src/config/modelProviders/index.ts | 3 + src/config/modelProviders/openrouter.ts | 44 +++ src/config/server/provider.ts | 8 + src/const/settings.ts | 4 + .../Error/APIKeyForm/OpenRouter.tsx | 40 ++ .../Conversation/Error/APIKeyForm/index.tsx | 5 + src/features/Conversation/Error/index.tsx | 1 + src/libs/agent-runtime/error.ts | 3 + src/libs/agent-runtime/index.ts | 1 + .../agent-runtime/openrouter/index.test.ts | 347 ++++++++++++++++++ src/libs/agent-runtime/openrouter/index.ts | 86 +++++ 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 | 16 + src/services/_auth.test.ts | 10 + src/services/_auth.ts | 4 + .../settings/selectors/modelProvider.ts | 14 + src/types/settings/modelProvider.ts | 7 + 78 files changed, 1151 insertions(+), 36 deletions(-) create mode 100644 src/app/settings/llm/OpenRouter/index.tsx create mode 100644 src/config/modelProviders/openrouter.ts create mode 100644 src/features/Conversation/Error/APIKeyForm/OpenRouter.tsx create mode 100644 src/libs/agent-runtime/openrouter/index.test.ts create mode 100644 src/libs/agent-runtime/openrouter/index.ts diff --git a/.env.example b/.env.example index f157d0d03694..88cde9413825 100644 --- a/.env.example +++ b/.env.example @@ -93,6 +93,12 @@ OPENAI_API_KEY=sk-xxxxxxxxx # GROQ_API_KEY=gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx +######################################## +######### OpenRouter Service ########## +######################################## + +#OPENROUTER_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + ######################################## ############ Market Service ############ ######################################## diff --git a/Dockerfile b/Dockerfile index 2f88937f0478..c45c9782a479 100644 --- a/Dockerfile +++ b/Dockerfile @@ -92,4 +92,7 @@ ENV ANTHROPIC_API_KEY "" # Mistral ENV MISTRAL_API_KEY "" +# OpenRouter +ENV OPENROUTER_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 e04bc83cf499..70d686933f7c 100644 --- a/docs/self-hosting/environment-variables/model-provider.mdx +++ b/docs/self-hosting/environment-variables/model-provider.mdx @@ -161,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` +## Mistral AI + +### `MISTRAL_API_KEY` + +- Type: Required +- Description: This is the API key you applied for in the Mistral AI service +- Default: - +- Example: `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=` + ## Groq AI ### `GROQ_API_KEY` @@ -170,13 +179,14 @@ When using the `turn` mode, the API Keys will be retrieved in a round-robin mann - Default: - - Example: `gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx` -## Mistral AI +## OpenRouter AI -### `MISTRAL_API_KEY` +### `OPENROUTER_API_KEY` - Type: Required -- Description: This is the API key you applied for in the Mistral AI service +- Description: This is the API key you applied for in the OpenRouter AI service - Default: - -- Example: `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=` +- Example: `sk-or-v1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=` + [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/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx b/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx index 1fa10f70a6e9..36d6777ed713 100644 --- a/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx +++ b/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx @@ -176,5 +176,13 @@ LobeChat 在部署时提供了丰富的模型服务商相关的环境变量, - 描述:这是你在 Groq AI 服务中申请的 API 密钥 - 默认值:- - 示例:`gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx` +## OpenRouter AI + +### `OPENROUTER_API_KEY` + +- 类型:必选 +- 描述:这是你在 OpenRouter AI 服务中申请的 API 密钥 +- 默认值:- +- 示例:`sk-or-v1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=` [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 f9788ed9d097..6325cffc90af 100644 --- a/locales/ar/common.json +++ b/locales/ar/common.json @@ -110,6 +110,7 @@ "ollama": "أولاما", "oneapi": "وان آبي آي", "openai": "أوبن إيه آي", + "openrouter": "OpenRouter", "perplexity": "Perplexity", "zhipu": "Zhipu" }, @@ -146,4 +147,4 @@ "hasNew": "يوجد تحديث متاح", "newVersion": "هناك إصدار جديد متاح: {{version}}" } -} +} \ No newline at end of file diff --git a/locales/ar/error.json b/locales/ar/error.json index 3b43b30a79cb..f7367a2a385b 100644 --- a/locales/ar/error.json +++ b/locales/ar/error.json @@ -48,6 +48,7 @@ "InvalidMistralAPIKey": "مفتاح Mistral AI API غير صحيح أو فارغ، يرجى التحقق من مفتاح Mistral API وإعادة المحاولة", "InvalidMoonshotAPIKey": "مفتاح API لـ Moonshot AI غير صحيح أو فارغ، يرجى التحقق من مفتاح API لـ Moonshot وإعادة المحاولة", "InvalidOllamaArgs": "تكوين Ollama غير صحيح، يرجى التحقق من تكوين Ollama وإعادة المحاولة", + "InvalidOpenRouterAPIKey": "مفتاح OpenRouter API غير صحيح أو فارغ، يرجى التحقق من مفتاح OpenRouter API وإعادة المحاولة", "InvalidPerplexityAPIKey": "مفتاح Perplexity API غير صحيح أو فارغ، يرجى التحقق من مفتاح Perplexity API وإعادة المحاولة", "InvalidZhipuAPIKey": "مفتاح Zhipu API غير صحيح أو فارغ، يرجى التحقق من مفتاح Zhipu API وإعادة المحاولة", "LocationNotSupportError": "عذرًا، لا يدعم موقعك الحالي خدمة هذا النموذج، قد يكون ذلك بسبب قيود المنطقة أو عدم توفر الخدمة. يرجى التحقق مما إذا كان الموقع الحالي يدعم استخدام هذه الخدمة، أو محاولة استخدام معلومات الموقع الأخرى.", @@ -57,6 +58,7 @@ "OllamaBizError": "خطأ في طلب خدمة Ollama، يرجى التحقق من المعلومات التالية أو إعادة المحاولة", "OllamaServiceUnavailable": "خدمة Ollama غير متوفرة، يرجى التحقق مما إذا كانت قد تم تشغيلها بشكل صحيح", "OpenAIBizError": "حدث خطأ في طلب خدمة OpenAI، يرجى التحقق من المعلومات أدناه وإعادة المحاولة", + "OpenRouterBizError": "خطأ في طلب خدمة OpenRouter AI، يرجى التحقق من المعلومات التالية أو إعادة المحاولة", "PerplexityBizError": "خطأ في طلب خدمة Perplexity AI، يرجى التحقق من المعلومات التالية أو إعادة المحاولة", "PluginApiNotFound": "عذرًا، لا يوجد API للإضافة في وصف الإضافة، يرجى التحقق من تطابق طريقة الطلب الخاصة بك مع API الوصف", "PluginApiParamsError": "عذرًا، فشلت التحقق من صحة معلمات الطلب للإضافة، يرجى التحقق من تطابق المعلمات مع معلومات الوصف", @@ -110,6 +112,10 @@ "description": "أدخل مفتاح OpenAI API الخاص بك لبدء الجلسة. لن يقوم التطبيق بتسجيل مفتاح الواجهة البرمجية الخاص بك", "title": "استخدام مفتاح OpenAI API المخصص" }, + "OpenRouter": { + "description": "أدخل مفتاح OpenRouter API الخاص بك للبدء في الجلسة. لن يتم تسجيل مفتاح الخاص بك من قبل التطبيق", + "title": "استخدام مفتاح OpenRouter API المخصص" + }, "Perplexity": { "description": "أدخل مفتاح Perplexity API الخاص بك للبدء في الجلسة. لن يتم تسجيل مفتاح الواجهة البرمجية لتطبيقات الجلسة", "title": "استخدام مفتاح Perplexity API المخصص" @@ -144,4 +150,4 @@ "password": "كلمة المرور" } } -} +} \ No newline at end of file diff --git a/locales/ar/setting.json b/locales/ar/setting.json index 50053e9245a8..15f79e1ce7b9 100644 --- a/locales/ar/setting.json +++ b/locales/ar/setting.json @@ -177,6 +177,22 @@ "title": "استخدام Azure OpenAI" } }, + "OpenRouter": { + "checker": { + "desc": "اختبار صحة عنوان الوكيل" + }, + "customModelName": { + "desc": "إضافة نموذج مخصص، استخدم فاصلة (،) للنماذج المتعددة", + "placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free", + "title": "اسم النموذج المخصص" + }, + "title": "OpenRouter", + "token": { + "desc": "أدخل مفتاح API من OpenRouter AI", + "placeholder": "مفتاح API من OpenRouter AI", + "title": "مفتاح API" + } + }, "Perplexity": { "title": "Perplexity AI", "token": { diff --git a/locales/de-DE/common.json b/locales/de-DE/common.json index 8a6fd8fd83a3..32424cc60c3f 100644 --- a/locales/de-DE/common.json +++ b/locales/de-DE/common.json @@ -110,6 +110,7 @@ "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", + "openrouter": "OpenRouter", "perplexity": "Perplexity", "zhipu": "Zhipu AI" }, @@ -146,4 +147,4 @@ "hasNew": "Neue Version verfügbar", "newVersion": "Neue Version verfügbar: {{version}}" } -} +} \ No newline at end of file diff --git a/locales/de-DE/error.json b/locales/de-DE/error.json index ca93a7c6e495..05ce18502531 100644 --- a/locales/de-DE/error.json +++ b/locales/de-DE/error.json @@ -48,6 +48,7 @@ "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.", + "InvalidOpenRouterAPIKey": "OpenRouter API-Schlüssel ungültig oder leer. Bitte überprüfen Sie den OpenRouter API-Schlüssel 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.", @@ -57,6 +58,7 @@ "OllamaBizError": "Fehler bei der Anforderung des Ollama-Dienstes. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.", "OllamaServiceUnavailable": "Ollama-Dienst nicht verfügbar. Bitte überprüfen Sie, ob er ordnungsgemäß gestartet wurde.", "OpenAIBizError": "Fehler bei der OpenAI-Serviceanfrage. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut", + "OpenRouterBizError": "Fehler bei der Anforderung des OpenRouter AI-Dienstes. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.", "PerplexityBizError": "Fehler bei der Anforderung des Perplexity AI-Dienstes. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.", "PluginApiNotFound": "Entschuldigung, das API des Plugins im Plugin-Manifest existiert nicht. Bitte überprüfen Sie, ob Ihre Anfragemethode mit dem Plugin-Manifest-API übereinstimmt", "PluginApiParamsError": "Entschuldigung, die Eingabeüberprüfung der Plugin-Anfrage ist fehlgeschlagen. Bitte überprüfen Sie, ob die Eingabe mit den API-Beschreibungsinformationen übereinstimmt", @@ -110,6 +112,10 @@ "description": "Geben Sie Ihren OpenAI API-Schlüssel ein, um die Sitzung zu starten. Die Anwendung speichert Ihren API-Schlüssel nicht.", "title": "Verwenden von benutzerdefinierten OpenAI API-Schlüssel" }, + "OpenRouter": { + "description": "Geben Sie Ihren OpenRouter API-Schlüssel ein, um die Sitzung zu starten. Die App speichert Ihren API-Schlüssel nicht.", + "title": "Verwenden Sie einen benutzerdefinierten OpenRouter API-Schlüssel" + }, "Perplexity": { "description": "Geben Sie Ihren eigenen Perplexity API Key ein, um das Gespräch zu beginnen. Die App speichert Ihren API Key nicht.", "title": "Verwenden Sie einen benutzerdefinierten Perplexity API Key" @@ -144,4 +150,4 @@ "password": "Passwort" } } -} +} \ No newline at end of file diff --git a/locales/de-DE/setting.json b/locales/de-DE/setting.json index e8045600a67e..58a6548a99f7 100644 --- a/locales/de-DE/setting.json +++ b/locales/de-DE/setting.json @@ -177,6 +177,22 @@ "title": "Azure OpenAI verwenden" } }, + "OpenRouter": { + "checker": { + "desc": "Überprüfen Sie, ob die Proxy-Adresse korrekt eingegeben wurde" + }, + "customModelName": { + "desc": "Fügen Sie benutzerdefinierte Modelle hinzu. Verwenden Sie zur Angabe mehrerer Modelle ein Komma (,)", + "placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free", + "title": "Benutzerdefinierte Modellnamen" + }, + "title": "OpenRouter", + "token": { + "desc": "Geben Sie den API-Schlüssel von OpenRouter AI ein", + "placeholder": "OpenRouter AI API-Schlüssel", + "title": "API-Schlüssel" + } + }, "Perplexity": { "title": "perplexity", "token": { diff --git a/locales/en-US/common.json b/locales/en-US/common.json index 8d4e1b0a034e..f4e4e33d0227 100644 --- a/locales/en-US/common.json +++ b/locales/en-US/common.json @@ -110,6 +110,7 @@ "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", + "openrouter": "OpenRouter", "perplexity": "Perplexity", "zhipu": "Zhipu AI" }, @@ -146,4 +147,4 @@ "hasNew": "New update available", "newVersion": "New version available: {{version}}" } -} +} \ No newline at end of file diff --git a/locales/en-US/error.json b/locales/en-US/error.json index 5ded129e49ce..11189d6165ef 100644 --- a/locales/en-US/error.json +++ b/locales/en-US/error.json @@ -48,6 +48,7 @@ "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", + "InvalidOpenRouterAPIKey": "Invalid or empty OpenRouter API Key. Please check your OpenRouter API Key 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.", @@ -57,6 +58,7 @@ "OllamaBizError": "Error requesting Ollama service, please troubleshoot or retry based on the following information", "OllamaServiceUnavailable": "Ollama service not detected, please check if it is running properly", "OpenAIBizError": "Error requesting OpenAI service. Please troubleshoot or retry based on the following information.", + "OpenRouterBizError": "Error requesting OpenRouter AI service. Please troubleshoot or retry based on the following information.", "PerplexityBizError": "Error requesting Perplexity AI service. Please troubleshoot or retry based on the following information.", "PluginApiNotFound": "Sorry, the API does not exist in the plugin's manifest. Please check if your request method matches the plugin manifest API", "PluginApiParamsError": "Sorry, the input parameter validation for the plugin request failed. Please check if the input parameters match the API description", @@ -110,6 +112,10 @@ "description": "Enter your OpenAI API Key to start the session. The app will not store your API Key.", "title": "Use custom OpenAI API Key" }, + "OpenRouter": { + "description": "Enter your OpenRouter API Key to start the session. The application will not store your API Key.", + "title": "Use Custom OpenRouter API Key" + }, "Perplexity": { "description": "Enter your Perplexity API Key to start the session. The app will not store your API Key.", "title": "Use custom Perplexity API Key" @@ -144,4 +150,4 @@ "password": "Password" } } -} +} \ No newline at end of file diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json index 5a8b460acaf4..3d64008a651d 100644 --- a/locales/en-US/setting.json +++ b/locales/en-US/setting.json @@ -177,6 +177,22 @@ "title": "Azure OpenAI" } }, + "OpenRouter": { + "checker": { + "desc": "Test if the proxy address is filled in correctly" + }, + "customModelName": { + "desc": "Add custom model, separate multiple models with comma (,)", + "placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free", + "title": "Custom Model Name" + }, + "title": "OpenRouter", + "token": { + "desc": "Enter the API Key from OpenRouter AI", + "placeholder": "OpenRouter AI API Key", + "title": "API Key" + } + }, "Perplexity": { "title": "Perplexity AI", "token": { diff --git a/locales/es-ES/common.json b/locales/es-ES/common.json index 234052b47e23..40eda49e3bcb 100644 --- a/locales/es-ES/common.json +++ b/locales/es-ES/common.json @@ -110,6 +110,7 @@ "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", + "openrouter": "OpenRouter", "perplexity": "Perplexity", "zhipu": "Zhipu AI" }, @@ -146,4 +147,4 @@ "hasNew": "Hay una nueva actualización disponible", "newVersion": "Nueva versión disponible: {{version}}" } -} +} \ No newline at end of file diff --git a/locales/es-ES/error.json b/locales/es-ES/error.json index 3cae64f0d0f3..3a7a9a680950 100644 --- a/locales/es-ES/error.json +++ b/locales/es-ES/error.json @@ -48,6 +48,7 @@ "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", + "InvalidOpenRouterAPIKey": "La clave de API de OpenRouter es incorrecta o está vacía. Por favor, revisa la clave de API de OpenRouter 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.", @@ -57,6 +58,7 @@ "OllamaBizError": "Error al solicitar el servicio de Ollama, por favor verifica la siguiente información o inténtalo de nuevo", "OllamaServiceUnavailable": "Servicio Ollama no disponible: Ollama no detectado. Por favor, verifica si está iniciado correctamente.", "OpenAIBizError": "Error al solicitar el servicio OpenAI. Depure o reintente según la siguiente información", + "OpenRouterBizError": "Error al solicitar el servicio de IA de OpenRouter. Por favor, revisa la siguiente información o inténtalo de nuevo", "PerplexityBizError": "Error comercial al solicitar el servicio de IA de Perplexity. Por favor, revisa la siguiente información o inténtalo de nuevo", "PluginApiNotFound": "Lo sentimos, el API especificado no existe en el manifiesto del complemento. Verifique si su método de solicitud coincide con el API del manifiesto del complemento", "PluginApiParamsError": "Lo sentimos, la validación de los parámetros de entrada de la solicitud del complemento no ha pasado. Verifique si los parámetros de entrada coinciden con la información de descripción del API", @@ -110,6 +112,10 @@ "description": "Ingresa tu clave de API de OpenAI para comenzar la sesión. La aplicación no guardará tu clave de API", "title": "Usar clave de API personalizada de OpenAI" }, + "OpenRouter": { + "description": "Ingresa tu clave de API de OpenRouter para comenzar la sesión. La aplicación no almacenará tu clave de API", + "title": "Usar una clave de API personalizada de OpenRouter" + }, "Perplexity": { "description": "Ingresa tu clave de API de Perplexity para comenzar la sesión. La aplicación no guardará tu clave de API", "title": "Usar tu propia clave de API de Perplexity" @@ -144,4 +150,4 @@ "password": "Contraseña" } } -} +} \ No newline at end of file diff --git a/locales/es-ES/setting.json b/locales/es-ES/setting.json index 9024909a5384..3bfcf43c6d97 100644 --- a/locales/es-ES/setting.json +++ b/locales/es-ES/setting.json @@ -177,6 +177,22 @@ "title": "Azure OpenAI" } }, + "OpenRouter": { + "checker": { + "desc": "Verifica si la dirección del proxy está correctamente escrita" + }, + "customModelName": { + "desc": "Agrega modelos personalizados, separados por comas (,) si son varios", + "placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free", + "title": "Nombre del modelo personalizado" + }, + "title": "OpenRouter", + "token": { + "desc": "Ingresa la API Key de OpenRouter AI", + "placeholder": "API Key de OpenRouter AI", + "title": "API Key" + } + }, "Perplexity": { "title": "Perplexity AI", "token": { diff --git a/locales/fr-FR/common.json b/locales/fr-FR/common.json index 0af6f15b1f5c..e0334287bc46 100644 --- a/locales/fr-FR/common.json +++ b/locales/fr-FR/common.json @@ -110,6 +110,7 @@ "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", + "openrouter": "OpenRouter", "perplexity": "Perplexity", "zhipu": "Zhipu AI" }, @@ -146,4 +147,4 @@ "hasNew": "Nouvelle mise à jour disponible", "newVersion": "Nouvelle version disponible : {{version}}" } -} +} \ No newline at end of file diff --git a/locales/fr-FR/error.json b/locales/fr-FR/error.json index adec5b461b9f..d5379ac2e01b 100644 --- a/locales/fr-FR/error.json +++ b/locales/fr-FR/error.json @@ -48,6 +48,7 @@ "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", + "InvalidOpenRouterAPIKey": "La clé d'API OpenRouter est incorrecte ou manquante. Veuillez vérifier la clé d'API OpenRouter 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.", @@ -57,6 +58,7 @@ "OllamaBizError": "Erreur commerciale lors de la demande de service Ollama, veuillez vérifier les informations ci-dessous ou réessayer", "OllamaServiceUnavailable": "Service Ollama non disponible, veuillez vérifier s'il est démarré correctement", "OpenAIBizError": "Erreur de service OpenAI. Veuillez diagnostiquer ou réessayer en fonction des informations ci-dessous", + "OpenRouterBizError": "Erreur commerciale lors de la demande de service OpenRouter AI. Veuillez vérifier les informations ci-dessous ou réessayer.", "PerplexityBizError": "Erreur commerciale lors de la demande de service Perplexity AI. Veuillez vérifier les informations suivantes ou réessayer.", "PluginApiNotFound": "Désolé, l'API spécifiée n'existe pas dans le manifeste du plugin. Veuillez vérifier que votre méthode de requête correspond à l'API du manifeste du plugin", "PluginApiParamsError": "Désolé, la validation des paramètres d'entrée de la requête de ce plugin a échoué. Veuillez vérifier que les paramètres d'entrée correspondent aux informations de l'API", @@ -110,6 +112,10 @@ "description": "Entrez votre clé API OpenAI pour commencer la session. L'application ne conservera pas votre clé API", "title": "Utiliser une clé API OpenAI personnalisée" }, + "OpenRouter": { + "description": "Entrez votre clé d'API OpenRouter pour commencer la session. L'application ne stockera pas votre clé d'API.", + "title": "Utiliser une clé d'API OpenRouter personnalisée" + }, "Perplexity": { "description": "Entrez votre clé API Perplexity pour commencer la session. L'application ne conservera pas votre clé API.", "title": "Utiliser une clé API Perplexity personnalisée" @@ -144,4 +150,4 @@ "password": "Mot de passe" } } -} +} \ No newline at end of file diff --git a/locales/fr-FR/setting.json b/locales/fr-FR/setting.json index de2a2a49928e..a7472533683c 100644 --- a/locales/fr-FR/setting.json +++ b/locales/fr-FR/setting.json @@ -177,6 +177,22 @@ "title": "Azure OpenAI" } }, + "OpenRouter": { + "checker": { + "desc": "Vérifiez si l'adresse du proxy est correctement remplie" + }, + "customModelName": { + "desc": "Ajoutez un modèle personnalisé, séparez les modèles multiples par des virgules (,)", + "placeholder": "mistralai/mistral-7b-instruct:gratuit,openchat/openchat-7b:gratuit", + "title": "Nom du modèle personnalisé" + }, + "title": "OpenRouter", + "token": { + "desc": "Entrez la clé API de OpenRouter AI", + "placeholder": "Clé API OpenRouter AI", + "title": "Clé API" + } + }, "Perplexity": { "title": "Perplexity", "token": { diff --git a/locales/it-IT/common.json b/locales/it-IT/common.json index d47a7c9470c7..430aaa986d50 100644 --- a/locales/it-IT/common.json +++ b/locales/it-IT/common.json @@ -110,6 +110,7 @@ "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", + "openrouter": "OpenRouter", "perplexity": "Perplexity", "zhipu": "Zhipu AI" }, @@ -146,4 +147,4 @@ "hasNew": "Nuovo aggiornamento disponibile", "newVersion": "Nuova versione disponibile: {{version}}" } -} +} \ No newline at end of file diff --git a/locales/it-IT/error.json b/locales/it-IT/error.json index 0ec23008c142..dfbba6cd36ee 100644 --- a/locales/it-IT/error.json +++ b/locales/it-IT/error.json @@ -48,6 +48,7 @@ "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", + "InvalidOpenRouterAPIKey": "La chiave API di OpenRouter non è valida o è vuota. Si prega di controllare la chiave API di OpenRouter 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.", @@ -57,6 +58,7 @@ "OllamaBizError": "Errore di servizio Ollama, controllare le informazioni seguenti o riprovare", "OllamaServiceUnavailable": "Servizio Ollama non disponibile: controlla se è avviato correttamente", "OpenAIBizError": "Errore nella richiesta del servizio OpenAI. Segui le informazioni seguenti per individuare e riprovare", + "OpenRouterBizError": "Errore di richiesta del servizio OpenRouter AI. Si prega di controllare le informazioni seguenti o riprovare.", "PerplexityBizError": "Errore di business nella richiesta del servizio Perplexity AI, controlla le informazioni seguenti o riprova", "PluginApiNotFound": "Spiacenti, l'API specificata non esiste nel manifesto del plugin. Verifica che il metodo di richiesta corrisponda all'API del manifesto del plugin", "PluginApiParamsError": "Spiacenti, la convalida dei parametri di input della richiesta del plugin non è riuscita. Verifica che i parametri di input corrispondano alle informazioni dell'API", @@ -110,6 +112,10 @@ "description": "Inserisci la tua chiave API OpenAI per iniziare la sessione. L'applicazione non memorizzerà la tua chiave API", "title": "Utilizza la chiave API OpenAI personalizzata" }, + "OpenRouter": { + "description": "Inserisci la tua chiave API di OpenRouter per iniziare la sessione. L'applicazione non memorizzerà la tua chiave API.", + "title": "Utilizza la tua chiave API personalizzata di OpenRouter" + }, "Perplexity": { "description": "Inserisci la tua chiave API Perplexity per iniziare la sessione. L'applicazione non memorizzerà la tua chiave API", "title": "Utilizza la tua chiave API Perplexity personalizzata" @@ -144,4 +150,4 @@ "password": "Password" } } -} +} \ No newline at end of file diff --git a/locales/it-IT/setting.json b/locales/it-IT/setting.json index 644d069aab71..4991c7f76c80 100644 --- a/locales/it-IT/setting.json +++ b/locales/it-IT/setting.json @@ -177,6 +177,22 @@ "title": "Usa Azure OpenAI" } }, + "OpenRouter": { + "checker": { + "desc": "Verifica se l'indirizzo del proxy è stato compilato correttamente" + }, + "customModelName": { + "desc": "Aggiungi un modello personalizzato, separando più modelli con virgola (,)", + "placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free", + "title": "Nome del modello personalizzato" + }, + "title": "OpenRouter", + "token": { + "desc": "Inserisci la chiave API da OpenRouter AI", + "placeholder": "Chiave API OpenRouter AI", + "title": "Chiave API" + } + }, "Perplexity": { "title": "Perplexity", "token": { diff --git a/locales/ja-JP/common.json b/locales/ja-JP/common.json index e7efa4b36b87..e50ba34da8a3 100644 --- a/locales/ja-JP/common.json +++ b/locales/ja-JP/common.json @@ -110,6 +110,7 @@ "ollama": "オラマ", "oneapi": "One API", "openai": "OpenAI", + "openrouter": "OpenRouter", "perplexity": "Perplexity AI", "zhipu": "智譜AI" }, @@ -146,4 +147,4 @@ "hasNew": "利用可能な更新があります", "newVersion": "新しいバージョンが利用可能です:{{version}}" } -} +} \ No newline at end of file diff --git a/locales/ja-JP/error.json b/locales/ja-JP/error.json index 590f4c439154..d217fda04fb4 100644 --- a/locales/ja-JP/error.json +++ b/locales/ja-JP/error.json @@ -48,6 +48,7 @@ "InvalidMistralAPIKey": "Mistral AI API キーが正しくないか空です。Mistral API キーを確認して再試行してください。", "InvalidMoonshotAPIKey": "Moonshot AI APIキーが正しくないか空です。Moonshot APIキーを確認して再試行してください。", "InvalidOllamaArgs": "Ollamaの設定が正しくありません。Ollamaの設定を確認してからもう一度お試しください", + "InvalidOpenRouterAPIKey": "OpenRouter API キーが正しくないか空です。OpenRouter API キーを確認してもう一度お試しください。", "InvalidPerplexityAPIKey": "Perplexity APIキーが正しくないか空です。Perplexity APIキーを確認してもう一度お試しください", "InvalidZhipuAPIKey": "Zhipu APIキーが正しくないか空です。Zhipu APIキーを確認してから再試行してください。", "LocationNotSupportError": "申し訳ありませんが、お住まいの地域ではこのモデルサービスをサポートしていません。地域制限またはサービスが利用できない可能性があります。現在の位置がこのサービスをサポートしているかどうかを確認するか、他の位置情報を使用してみてください。", @@ -57,6 +58,7 @@ "OllamaBizError": "Ollamaサービスのリクエストでエラーが発生しました。以下の情報に基づいてトラブルシューティングを行うか、再度お試しください", "OllamaServiceUnavailable": "Ollamaサービスが利用できません。正常に起動しているかどうかを確認してください", "OpenAIBizError": "OpenAIサービスのリクエストエラーが発生しました。以下の情報に基づいて問題を解決したり、再試行したりしてください", + "OpenRouterBizError": "OpenRouter AI サービスのリクエスト中にエラーが発生しました。以下の情報に基づいてトラブルシューティングを行うか、もう一度お試しください。", "PerplexityBizError": "Perplexity AIサービスのリクエストでエラーが発生しました。以下の情報に基づいてトラブルシューティングするか、再度お試しください", "PluginApiNotFound": "申し訳ありませんが、プラグインのマニフェストに指定されたAPIが見つかりませんでした。リクエストメソッドとプラグインのマニフェストのAPIが一致しているかどうかを確認してください", "PluginApiParamsError": "申し訳ありませんが、プラグインのリクエストパラメータの検証に失敗しました。パラメータとAPIの説明が一致しているかどうか確認してください", @@ -110,6 +112,10 @@ "description": "OpenAI APIキーを入力してセッションを開始します。アプリはAPIキーを記録しません。", "title": "カスタムOpenAI APIキーを使用" }, + "OpenRouter": { + "description": "OpenRouter API キーを入力するとセッションが開始されます。アプリは API キーを記録しません。", + "title": "カスタム OpenRouter API キーを使用する" + }, "Perplexity": { "description": "Perplexity APIキーを入力して会話を開始します。アプリはAPIキーを記録しません", "title": "カスタムPerplexity APIキーを使用" @@ -144,4 +150,4 @@ "password": "パスワード" } } -} +} \ No newline at end of file diff --git a/locales/ja-JP/setting.json b/locales/ja-JP/setting.json index ffd0b8a2d60c..cf1dfa12b8a3 100644 --- a/locales/ja-JP/setting.json +++ b/locales/ja-JP/setting.json @@ -177,6 +177,22 @@ "title": "Azure OpenAI を使用" } }, + "OpenRouter": { + "checker": { + "desc": "プロキシアドレスが正しく入力されているかをテストします" + }, + "customModelName": { + "desc": "カスタムモデルを追加します。複数のモデルはコンマ(,)で区切ってください", + "placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free", + "title": "カスタムモデル名" + }, + "title": "OpenRouter", + "token": { + "desc": "OpenRouter AIから取得したAPIキーを入力してください", + "placeholder": "OpenRouter AI APIキー", + "title": "APIキー" + } + }, "Perplexity": { "title": "Perplexity", "token": { diff --git a/locales/ko-KR/common.json b/locales/ko-KR/common.json index 454ba12e4b92..11bb25bb9e49 100644 --- a/locales/ko-KR/common.json +++ b/locales/ko-KR/common.json @@ -110,6 +110,7 @@ "ollama": "올라마", "oneapi": "One API", "openai": "OpenAI", + "openrouter": "오픈 라우터", "perplexity": "Perplexity", "zhipu": "지푸 AI" }, @@ -146,4 +147,4 @@ "hasNew": "사용 가능한 업데이트가 있습니다", "newVersion": "새 버전 사용 가능: {{version}}" } -} +} \ No newline at end of file diff --git a/locales/ko-KR/error.json b/locales/ko-KR/error.json index 156b40040522..fac81edbb7cf 100644 --- a/locales/ko-KR/error.json +++ b/locales/ko-KR/error.json @@ -48,6 +48,7 @@ "InvalidMistralAPIKey": "Mistral AI API 키가 잘못되었거나 비어 있습니다. Mistral API 키를 확인한 후 다시 시도해주세요.", "InvalidMoonshotAPIKey": "Moonshot AI API 키가 잘못되었거나 비어 있습니다. Moonshot API 키를 확인한 후 다시 시도해주세요.", "InvalidOllamaArgs": "Ollama 구성이 잘못되었습니다. Ollama 구성을 확인한 후 다시 시도하십시오.", + "InvalidOpenRouterAPIKey": "OpenRouter API 키가 잘못되었거나 비어 있습니다. OpenRouter API 키를 확인한 후 다시 시도하십시오.", "InvalidPerplexityAPIKey": "Perplexity API 키가 잘못되었거나 비어 있습니다. Perplexity API 키를 확인한 후 다시 시도하십시오.", "InvalidZhipuAPIKey": "잘못된 또는 비어 있는 Zhipu API Key입니다. Zhipu API Key를 확인한 후 다시 시도하십시오.", "LocationNotSupportError": "죄송합니다. 귀하의 현재 위치는 해당 모델 서비스를 지원하지 않습니다. 지역 제한 또는 서비스 미개통으로 인한 것일 수 있습니다. 현재 위치가 해당 서비스를 지원하는지 확인하거나 다른 위치 정보를 사용해 보십시오.", @@ -57,6 +58,7 @@ "OllamaBizError": "Ollama 서비스 요청 중 오류가 발생했습니다. 아래 정보를 확인하고 다시 시도하십시오.", "OllamaServiceUnavailable": "Ollama 서비스를 찾을 수 없습니다. 정상적으로 시작되었는지 확인하십시오.", "OpenAIBizError": "OpenAI 서비스 요청 중 오류가 발생했습니다. 아래 정보를 확인하고 문제를 해결하거나 다시 시도해주세요.", + "OpenRouterBizError": "OpenRouter AI 서비스 요청 중 오류가 발생했습니다. 다음 정보를 확인하고 다시 시도하십시오.", "PerplexityBizError": "Perplexity AI 서비스 요청 중 오류가 발생했습니다. 아래 정보를 확인하고 다시 시도하십시오.", "PluginApiNotFound": "죄송합니다. 플러그인 설명서에 해당 API가 없습니다. 요청 메서드와 플러그인 설명서 API가 일치하는지 확인해주세요.", "PluginApiParamsError": "죄송합니다. 플러그인 요청의 입력 매개변수 유효성 검사에 실패했습니다. 입력 매개변수와 API 설명 정보가 일치하는지 확인해주세요.", @@ -110,6 +112,10 @@ "description": "OpenAI API Key를 입력하여 세션을 시작합니다. 앱은 귀하의 API Key를 기록하지 않습니다.", "title": "사용자 정의 OpenAI API Key 사용" }, + "OpenRouter": { + "description": "OpenRouter API 키를 입력하면 세션을 시작할 수 있습니다. 애플리케이션은 API 키를 기록하지 않습니다.", + "title": "사용자 지정 OpenRouter API 키 사용" + }, "Perplexity": { "description": "Perplexity API 키를 입력하면 대화를 시작할 수 있습니다. 애플리케이션은 API 키를 기록하지 않습니다.", "title": "사용자 지정 Perplexity API 키 사용" @@ -144,4 +150,4 @@ "password": "비밀번호" } } -} +} \ No newline at end of file diff --git a/locales/ko-KR/setting.json b/locales/ko-KR/setting.json index 21ed7ad39c45..dc197e1185ac 100644 --- a/locales/ko-KR/setting.json +++ b/locales/ko-KR/setting.json @@ -177,6 +177,22 @@ "title": "Azure OpenAI" } }, + "OpenRouter": { + "checker": { + "desc": "프록시 주소가 올바르게 입력되었는지 확인합니다." + }, + "customModelName": { + "desc": "사용자 정의 모델을 추가하고, 여러 모델은 쉼표(,)로 구분합니다", + "placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free", + "title": "사용자 정의 모델 이름" + }, + "title": "OpenRouter", + "token": { + "desc": "OpenRouter AI에서 받은 API 키를 입력합니다.", + "placeholder": "OpenRouter AI API 키", + "title": "API 키" + } + }, "Perplexity": { "title": "Perplexity", "token": { diff --git a/locales/nl-NL/common.json b/locales/nl-NL/common.json index 43ed2319b319..eba607b52206 100644 --- a/locales/nl-NL/common.json +++ b/locales/nl-NL/common.json @@ -110,6 +110,7 @@ "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", + "openrouter": "OpenRouter", "perplexity": "Perplexity", "zhipu": "Zhipu AI" }, @@ -146,4 +147,4 @@ "hasNew": "有可用更新", "newVersion": "有新版本可用:{{version}}" } -} +} \ No newline at end of file diff --git a/locales/nl-NL/error.json b/locales/nl-NL/error.json index eac05903a512..b1eaa89b2cc6 100644 --- a/locales/nl-NL/error.json +++ b/locales/nl-NL/error.json @@ -48,6 +48,7 @@ "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", + "InvalidOpenRouterAPIKey": "OpenRouter API Key is onjuist of leeg. Controleer de OpenRouter API Key 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.", @@ -57,6 +58,7 @@ "OllamaBizError": "Fout bij het aanroepen van de Ollama-service, controleer de onderstaande informatie en probeer opnieuw", "OllamaServiceUnavailable": "Ollama 服务不可用,请检查是否已正常启动", "OpenAIBizError": "Fout bij het aanvragen van OpenAI-service. Controleer de onderstaande informatie voor probleemoplossing of probeer opnieuw", + "OpenRouterBizError": "Fout bij het aanvragen van OpenRouter AI-service. Controleer de onderstaande informatie en probeer opnieuw.", "PerplexityBizError": "Er is een fout opgetreden bij het aanvragen van de Perplexity AI-service. Controleer de onderstaande informatie en probeer het opnieuw.", "PluginApiNotFound": "Sorry, de API van de plug-inbeschrijvingslijst bestaat niet. Controleer of uw verzoeksmethode overeenkomt met de plug-inbeschrijvingslijst API", "PluginApiParamsError": "Sorry, de validatie van de invoerparameters van de plug-in is mislukt. Controleer of de invoerparameters overeenkomen met de API-beschrijving", @@ -110,6 +112,10 @@ "description": "Enter your OpenAI API Key to start the session. The app will not record your API Key", "title": "Use custom OpenAI API Key" }, + "OpenRouter": { + "description": "Voer uw OpenRouter API Key in om de sessie te starten. De app zal uw API Key niet opslaan.", + "title": "Gebruik aangepaste OpenRouter API Key" + }, "Perplexity": { "description": "Voer uw eigen Perplexity API Key in om het gesprek te starten. De app zal uw API Key niet opslaan.", "title": "Gebruik een aangepaste Perplexity API Key" @@ -144,4 +150,4 @@ "password": "Password" } } -} +} \ No newline at end of file diff --git a/locales/nl-NL/setting.json b/locales/nl-NL/setting.json index df09341ad1ac..75ef766768b6 100644 --- a/locales/nl-NL/setting.json +++ b/locales/nl-NL/setting.json @@ -177,6 +177,22 @@ "title": "Azure OpenAI gebruiken" } }, + "OpenRouter": { + "checker": { + "desc": "Check of de proxy-adres correct is ingevuld" + }, + "customModelName": { + "desc": "Voeg aangepast model toe, gebruik een komma (,) om meerdere modellen te scheiden", + "placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free", + "title": "Aangepaste modelnaam" + }, + "title": "OpenRouter", + "token": { + "desc": "Voer de API-sleutel in van OpenRouter AI", + "placeholder": "OpenRouter AI API-sleutel", + "title": "API-sleutel" + } + }, "Perplexity": { "title": "Perplexity", "token": { diff --git a/locales/pl-PL/common.json b/locales/pl-PL/common.json index b028bef60cba..315674735a55 100644 --- a/locales/pl-PL/common.json +++ b/locales/pl-PL/common.json @@ -110,6 +110,7 @@ "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", + "openrouter": "OpenRouter", "perplexity": "Perplexity", "zhipu": "Zhipu AI" }, @@ -146,4 +147,4 @@ "hasNew": "Dostępna jest nowa aktualizacja", "newVersion": "Dostępna jest nowa wersja: {{version}}" } -} +} \ No newline at end of file diff --git a/locales/pl-PL/error.json b/locales/pl-PL/error.json index 0dd4a8e1d2bc..09c84fbd973c 100644 --- a/locales/pl-PL/error.json +++ b/locales/pl-PL/error.json @@ -48,6 +48,7 @@ "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", + "InvalidOpenRouterAPIKey": "OpenRouter API Key jest nieprawidłowy lub pusty. Sprawdź klucz API OpenRouter 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.", @@ -57,6 +58,7 @@ "OllamaBizError": "Błąd usługi Ollama, sprawdź poniższe informacje lub spróbuj ponownie", "OllamaServiceUnavailable": "Usługa Ollama jest niedostępna. Sprawdź, czy została poprawnie uruchomiona.", "OpenAIBizError": "Błąd żądania usługi OpenAI. Proszę sprawdź poniższe informacje i spróbuj ponownie", + "OpenRouterBizError": "Wystąpił błąd biznesowy podczas żądania usługi OpenRouter AI. Sprawdź poniższe informacje lub spróbuj ponownie.", "PerplexityBizError": "Błąd biznesowy podczas żądania usługi Perplexity AI. Sprawdź poniższe informacje lub spróbuj ponownie.", "PluginApiNotFound": "Przepraszamy, w manifestach wtyczki nie istnieje to API. Proszę sprawdź, czy metoda żądania jest zgodna z API w manifestach wtyczki", "PluginApiParamsError": "Przepraszamy, walidacja parametrów wejściowych żądanej wtyczki nie powiodła się. Proszę sprawdź, czy parametry wejściowe są zgodne z informacjami opisującymi API", @@ -110,6 +112,10 @@ "description": "Wprowadź swój klucz API OpenAI, aby rozpocząć sesję. Aplikacja nie będzie przechowywać Twojego klucza API.", "title": "Użyj niestandardowego klucza API OpenAI" }, + "OpenRouter": { + "description": "Wprowadź swój klucz API OpenRouter, aby rozpocząć sesję. Aplikacja nie będzie przechowywać Twojego klucza API.", + "title": "Użyj niestandardowego klucza API OpenRouter" + }, "Perplexity": { "description": "Wprowadź swój klucz API Perplexity, aby rozpocząć sesję. Aplikacja nie będzie przechowywać Twojego klucza API.", "title": "Użyj niestandardowego klucza API Perplexity" @@ -144,4 +150,4 @@ "password": "Hasło" } } -} +} \ No newline at end of file diff --git a/locales/pl-PL/setting.json b/locales/pl-PL/setting.json index deb4585d41dc..0453a49013aa 100644 --- a/locales/pl-PL/setting.json +++ b/locales/pl-PL/setting.json @@ -177,6 +177,22 @@ "title": "Użyj Azure OpenAI" } }, + "OpenRouter": { + "checker": { + "desc": "测试代理地址是否正确填写" + }, + "customModelName": { + "desc": "增加自定义模型,多个模型使用逗号(,)隔开", + "placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free", + "title": "自定义模型名称" + }, + "title": "OpenRouter", + "token": { + "desc": "填入来自 OpenRouter AI 的 API Key", + "placeholder": "OpenRouter AI API Key", + "title": "API Key" + } + }, "Perplexity": { "title": "Perplexity", "token": { diff --git a/locales/pt-BR/common.json b/locales/pt-BR/common.json index 827bd6b9f62e..76f1512e6856 100644 --- a/locales/pt-BR/common.json +++ b/locales/pt-BR/common.json @@ -110,6 +110,7 @@ "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", + "openrouter": "OpenRouter", "perplexity": "Perplexity", "zhipu": "Zhipu AI" }, @@ -146,4 +147,4 @@ "hasNew": "Nova atualização disponível", "newVersion": "Nova versão disponível: {{version}}" } -} +} \ No newline at end of file diff --git a/locales/pt-BR/error.json b/locales/pt-BR/error.json index 250392d7c242..54bdb80991e1 100644 --- a/locales/pt-BR/error.json +++ b/locales/pt-BR/error.json @@ -48,6 +48,7 @@ "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", + "InvalidOpenRouterAPIKey": "Chave da API do OpenRouter inválida ou em branco. Por favor, verifique a chave da API do OpenRouter 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.", @@ -57,6 +58,7 @@ "OllamaBizError": "Erro de negócio ao solicitar o serviço Ollama, verifique as informações a seguir ou tente novamente", "OllamaServiceUnavailable": "O serviço Ollama não está disponível, verifique se está iniciado corretamente", "OpenAIBizError": "Erro ao solicitar o serviço OpenAI. Verifique ou tente novamente com base nas informações abaixo", + "OpenRouterBizError": "Erro de negócios ao solicitar o serviço de IA do OpenRouter. Por favor, verifique as informações abaixo ou tente novamente.", "PerplexityBizError": "Erro de negócios ao solicitar o serviço de IA Perplexity, verifique as informações a seguir ou tente novamente", "PluginApiNotFound": "Desculpe, o API especificado não existe no manifesto do plugin. Verifique se o método de solicitação corresponde ao API do manifesto do plugin", "PluginApiParamsError": "Desculpe, a validação dos parâmetros de entrada da solicitação do plugin falhou. Verifique se os parâmetros de entrada correspondem às informações de descrição do API", @@ -110,6 +112,10 @@ "description": "Digite sua chave de API OpenAI para iniciar a sessão. O aplicativo não irá armazenar sua chave de API", "title": "Usar chave de API OpenAI personalizada" }, + "OpenRouter": { + "description": "Insira sua chave da API do OpenRouter para iniciar a sessão. O aplicativo não irá armazenar sua chave da API.", + "title": "Usar chave da API do OpenRouter personalizada" + }, "Perplexity": { "description": "Insira sua chave da API Perplexity para iniciar a sessão. O aplicativo não irá armazenar sua chave da API", "title": "Usar chave da API Perplexity personalizada" @@ -144,4 +150,4 @@ "password": "Senha" } } -} +} \ No newline at end of file diff --git a/locales/pt-BR/setting.json b/locales/pt-BR/setting.json index 029dfe6baceb..f5db91a7082f 100644 --- a/locales/pt-BR/setting.json +++ b/locales/pt-BR/setting.json @@ -177,6 +177,22 @@ "title": "Usar Azure OpenAI" } }, + "OpenRouter": { + "checker": { + "desc": "Verifique se o endereço do proxy está preenchido corretamente" + }, + "customModelName": { + "desc": "Adicione modelos personalizados, separando vários modelos com vírgula (,)", + "placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free", + "title": "Nome do Modelo Personalizado" + }, + "title": "OpenRouter", + "token": { + "desc": "Insira a chave da API do OpenRouter AI", + "placeholder": "Chave da API do OpenRouter AI", + "title": "Chave da API" + } + }, "Perplexity": { "title": "Perplexity", "token": { diff --git a/locales/ru-RU/common.json b/locales/ru-RU/common.json index dd25bbbbd4a9..0f819d09a611 100644 --- a/locales/ru-RU/common.json +++ b/locales/ru-RU/common.json @@ -110,6 +110,7 @@ "ollama": "Оллама", "oneapi": "One API", "openai": "OpenAI", + "openrouter": "OpenRouter", "perplexity": "Perplexity AI", "zhipu": "Zhipu AI" }, @@ -146,4 +147,4 @@ "hasNew": "Доступно обновление", "newVersion": "Доступна новая версия: {{version}}" } -} +} \ No newline at end of file diff --git a/locales/ru-RU/error.json b/locales/ru-RU/error.json index 59728543d06b..2283cbe29244 100644 --- a/locales/ru-RU/error.json +++ b/locales/ru-RU/error.json @@ -48,6 +48,7 @@ "InvalidMistralAPIKey": "Неверный или пустой ключ API Mistral AI. Пожалуйста, проверьте ключ API Mistral и повторите попытку", "InvalidMoonshotAPIKey": "Moonshot AI API Key неверный или пустой, пожалуйста, проверьте ключ API Moonshot и повторите попытку", "InvalidOllamaArgs": "Неверная конфигурация Ollama, пожалуйста, проверьте конфигурацию Ollama и повторите попытку", + "InvalidOpenRouterAPIKey": "OpenRouter API Key недействителен или отсутствует. Пожалуйста, проверьте правильность OpenRouter API Key и повторите попытку", "InvalidPerplexityAPIKey": "Неверный или пустой ключ API Perplexity. Пожалуйста, проверьте ключ API Perplexity и повторите попытку", "InvalidZhipuAPIKey": "Неверный или пустой ключ API Zhipu, пожалуйста, проверьте ключ API Zhipu и повторите попытку", "LocationNotSupportError": "Извините, ваше текущее местоположение не поддерживает эту службу модели, возможно из-за ограничений региона или недоступности службы. Пожалуйста, убедитесь, что текущее местоположение поддерживает использование этой службы, или попробуйте использовать другую информацию о местоположении.", @@ -57,6 +58,7 @@ "OllamaBizError": "Ошибка обращения к сервису Ollama, пожалуйста, проверьте следующую информацию или повторите попытку", "OllamaServiceUnavailable": "Сервис Ollama недоступен. Пожалуйста, проверьте, запущен ли он корректно.", "OpenAIBizError": "Ошибка запроса службы OpenAI. Устраните неполадку или повторите попытку, основываясь на следующей информации.", + "OpenRouterBizError": "Ошибка запроса к сервису OpenRouter AI. Пожалуйста, проверьте информацию ниже или повторите попытку", "PerplexityBizError": "Ошибка обращения к сервису Perplexity AI. Пожалуйста, проверьте информацию ниже или повторите попытку", "PluginApiNotFound": "К сожалению, API не существует в манифесте плагина. Пожалуйста, проверьте, соответствует ли ваш метод запроса API манифеста плагина", "PluginApiParamsError": "К сожалению, проверка входных параметров для запроса плагина не удалась. Пожалуйста, проверьте, соответствуют ли входные параметры описанию API", @@ -110,6 +112,10 @@ "description": "Введите свой ключ API OpenAI, чтобы начать сеанс. Приложение не будет сохранять ваш ключ API", "title": "Использовать пользовательский ключ API OpenAI" }, + "OpenRouter": { + "description": "Введите свой ключ API OpenRouter, чтобы начать сеанс. Приложение не будет сохранять ваш ключ API", + "title": "Использование собственного ключа API OpenRouter" + }, "Perplexity": { "description": "Введите свой ключ API Perplexity, чтобы начать сеанс. Приложение не будет сохранять ваш ключ API", "title": "Использовать пользовательский ключ API Perplexity" @@ -144,4 +150,4 @@ "password": "Пароль" } } -} +} \ No newline at end of file diff --git a/locales/ru-RU/setting.json b/locales/ru-RU/setting.json index 16c90a04562d..073c79ca738b 100644 --- a/locales/ru-RU/setting.json +++ b/locales/ru-RU/setting.json @@ -177,6 +177,22 @@ "title": "Использовать Azure OpenAI" } }, + "OpenRouter": { + "checker": { + "desc": "Проверьте правильность заполнения адреса прокси" + }, + "customModelName": { + "desc": "Добавьте пользовательскую модель, используя запятую (,) для разделения нескольких моделей", + "placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free", + "title": "Имя пользовательской модели" + }, + "title": "OpenRouter", + "token": { + "desc": "Введите API-ключ от OpenRouter AI", + "placeholder": "Ключ API OpenRouter AI", + "title": "API-ключ" + } + }, "Perplexity": { "title": "Perplexity", "token": { diff --git a/locales/tr-TR/common.json b/locales/tr-TR/common.json index 75145753488d..8374526c129e 100644 --- a/locales/tr-TR/common.json +++ b/locales/tr-TR/common.json @@ -110,6 +110,7 @@ "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", + "openrouter": "AçıkYönlendirici", "perplexity": "Perplexity", "zhipu": "Zhipu AI" }, @@ -146,4 +147,4 @@ "hasNew": "Yeni güncelleme mevcut", "newVersion": "Yeni sürüm mevcut: {{version}}" } -} +} \ No newline at end of file diff --git a/locales/tr-TR/error.json b/locales/tr-TR/error.json index 804267bf037a..5cbe05d867ce 100644 --- a/locales/tr-TR/error.json +++ b/locales/tr-TR/error.json @@ -48,6 +48,7 @@ "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", + "InvalidOpenRouterAPIKey": "OpenRouter API Anahtarı geçersiz veya boş, lütfen OpenRouter API Anahtarınızı 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.", @@ -57,6 +58,7 @@ "OllamaBizError": "Ollama servisine yapılan istekte hata oluştu, lütfen aşağıdaki bilgilere göre sorunu gidermeye çalışın veya tekrar deneyin", "OllamaServiceUnavailable": "Ollama 服务不可用,请检查是否已正常启动", "OpenAIBizError": "OpenAI hizmeti talep ederken hata oluştu. Aşağıdaki bilgilere dayanarak sorun giderin veya tekrar deneyin.", + "OpenRouterBizError": "OpenRouter AI hizmetine yönelik istek hatası, lütfen aşağıdaki bilgilere göre sorunu gidermeye çalışın veya tekrar deneyin", "PerplexityBizError": "Perplexity AI hizmetine yapılan istekte hata oluştu, lütfen aşağıdaki bilgilere göre sorunu gidermeye çalışın veya tekrar deneyin", "PluginApiNotFound": "Üzgünüm, eklentinin bildiriminde API mevcut değil. Lütfen istek yönteminizin eklenti bildirim API'sı ile eşleşip eşleşmediğini kontrol edin", "PluginApiParamsError": "Üzgünüm, eklenti isteği için giriş parametre doğrulaması başarısız oldu. Lütfen giriş parametrelerinin API açıklamasıyla eşleşip eşleşmediğini kontrol edin", @@ -110,6 +112,10 @@ "description": "OpenAI API Anahtarınızı girerek oturumu başlatabilirsiniz. Uygulama API Anahtarınızı kaydetmez", "title": "Özel OpenAI API Anahtarını kullan" }, + "OpenRouter": { + "description": "Oturuma başlamak için OpenRouter API Anahtarınızı girin. Uygulama API Anahtarınızı kaydetmez", + "title": "Özel OpenRouter API Anahtarını Kullan" + }, "Perplexity": { "description": "Sohbeti başlatmak için Perplexity API Key'inizi girin. Uygulama API Key'inizi kaydetmez", "title": "Özel Perplexity API Key'i Kullan" @@ -144,4 +150,4 @@ "password": "Şifre" } } -} +} \ No newline at end of file diff --git a/locales/tr-TR/setting.json b/locales/tr-TR/setting.json index f05742b9c926..854ac540aebc 100644 --- a/locales/tr-TR/setting.json +++ b/locales/tr-TR/setting.json @@ -177,6 +177,22 @@ "title": "Azure OpenAI" } }, + "OpenRouter": { + "checker": { + "desc": "测试代理地址是否正确填写" + }, + "customModelName": { + "desc": "增加自定义模型,多个模型使用逗号(,)隔开", + "placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free", + "title": "自定义模型名称" + }, + "title": "OpenRouter", + "token": { + "desc": "填入来自 OpenRouter AI 的 API Key", + "placeholder": "OpenRouter AI API Key", + "title": "API Key" + } + }, "Perplexity": { "title": "Perplexity", "token": { diff --git a/locales/vi-VN/common.json b/locales/vi-VN/common.json index bf224e1d94e7..8004337c9873 100644 --- a/locales/vi-VN/common.json +++ b/locales/vi-VN/common.json @@ -110,6 +110,7 @@ "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", + "openrouter": "OpenRouter", "perplexity": "Perplexity AI", "zhipu": "Zhipu AI" }, @@ -146,4 +147,4 @@ "hasNew": "Có bản cập nhật mới", "newVersion": "Có phiên bản mới: {{version}}" } -} +} \ No newline at end of file diff --git a/locales/vi-VN/error.json b/locales/vi-VN/error.json index 16e47679a58b..7ce72019fd5c 100644 --- a/locales/vi-VN/error.json +++ b/locales/vi-VN/error.json @@ -48,6 +48,7 @@ "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", + "InvalidOpenRouterAPIKey": "OpenRouter API Key không hợp lệ hoặc trống, vui lòng kiểm tra lại 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.", @@ -57,6 +58,7 @@ "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", "OllamaServiceUnavailable": "Dịch vụ Ollama không khả dụng, vui lòng kiểm tra xem nó đã được khởi động chưa", "OpenAIBizError": "Yêu cầu dịch vụ OpenAI gặp lỗi, vui lòng xác minh hoặc thử lại dựa trên thông tin dưới đây", + "OpenRouterBizError": "Yêu cầu dịch vụ OpenRouter AI gặp lỗi, vui lòng kiểm tra thông tin dưới đây hoặc thử lại", "PerplexityBizError": "Yêu cầu dịch vụ AI Perplexity gặp lỗi, vui lòng kiểm tra thông tin dưới đây hoặc thử lại sau", "PluginApiNotFound": "Xin lỗi, không có API nào trong tệp mô tả plugin, vui lòng kiểm tra phương thức yêu cầu của bạn có khớp với API mô tả plugin không", "PluginApiParamsError": "Xin lỗi, kiểm tra tham số đầu vào yêu cầu của plugin không thông qua, vui lòng kiểm tra tham số đầu vào có khớp với thông tin mô tả API không", @@ -110,6 +112,10 @@ "description": "Nhập OpenAI 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 OpenAI" }, + "OpenRouter": { + "description": "Nhập OpenRouter 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 OpenRouter API Key tùy chỉnh" + }, "Perplexity": { "description": "Nhập Khóa API Perplexity của bạn để bắt đầu phiên làm việc. Ứng dụng sẽ không ghi lại Khóa API của bạn", "title": "Sử dụng Khóa API Perplexity tùy chỉnh" @@ -144,4 +150,4 @@ "password": "Mật khẩu" } } -} +} \ No newline at end of file diff --git a/locales/vi-VN/setting.json b/locales/vi-VN/setting.json index b9d7e69bfb6a..e43cc9b004dc 100644 --- a/locales/vi-VN/setting.json +++ b/locales/vi-VN/setting.json @@ -177,6 +177,22 @@ "title": "Sử dụng Azure OpenAI" } }, + "OpenRouter": { + "checker": { + "desc": "Kiểm tra xem địa chỉ proxy đã được điền đúng chưa" + }, + "customModelName": { + "desc": "Thêm tên mô hình tùy chỉnh, nhiều mô hình sử dụng dấu phẩy (,) để ngăn cách", + "placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free", + "title": "Tên mô hình tùy chỉnh" + }, + "title": "OpenRouter", + "token": { + "desc": "Nhập API Key từ OpenRouter AI", + "placeholder": "OpenRouter AI API Key", + "title": "API Key" + } + }, "Perplexity": { "title": "Perplexity AI", "token": { diff --git a/locales/zh-CN/common.json b/locales/zh-CN/common.json index cca5c343e13f..ccd7ef45c08b 100644 --- a/locales/zh-CN/common.json +++ b/locales/zh-CN/common.json @@ -110,6 +110,7 @@ "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", + "openrouter": "OpenRouter", "perplexity": "Perplexity", "zhipu": "智谱AI" }, @@ -146,4 +147,4 @@ "hasNew": "有可用更新", "newVersion": "有新版本可用:{{version}}" } -} +} \ No newline at end of file diff --git a/locales/zh-CN/error.json b/locales/zh-CN/error.json index 5c2936d19355..e956612d37c3 100644 --- a/locales/zh-CN/error.json +++ b/locales/zh-CN/error.json @@ -67,6 +67,8 @@ "AnthropicBizError": "请求 Anthropic AI 服务出错,请根据以下信息排查或重试", "InvalidGroqAPIKey": "Groq API Key 不正确或为空,请检查 Groq API Key 后重试", "GroqBizError": "请求 Groq 服务出错,请根据以下信息排查或重试", + "InvalidOpenRouterAPIKey": "OpenRouter API Key 不正确或为空,请检查 OpenRouter API Key 后重试", + "OpenRouterBizError": "请求 OpenRouter AI 服务出错,请根据以下信息排查或重试", "InvalidOllamaArgs": "Ollama 配置不正确,请检查 Ollama 配置后重试", "OllamaBizError": "请求 Ollama 服务出错,请根据以下信息排查或重试", "OllamaServiceUnavailable": "未检测到 Ollama 服务,请检查是否正常启动", @@ -110,6 +112,10 @@ "description": "输入你的 OpenAI API Key 即可开始会话。应用不会记录你的 API Key", "title": "使用自定义 OpenAI API Key" }, + "OpenRouter": { + "description": "输入你的 OpenRouter API Key 即可开始会话。应用不会记录你的 API Key", + "title": "使用自定义 OpenRouter API Key" + }, "Perplexity": { "description": "输入你的 Perplexity API Key 即可开始会话。应用不会记录你的 API Key", "title": "使用自定义 Perplexity API Key" @@ -144,4 +150,4 @@ "password": "密码" } } -} +} \ No newline at end of file diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json index 7af58069d2ee..e24a040248a8 100644 --- a/locales/zh-CN/setting.json +++ b/locales/zh-CN/setting.json @@ -177,6 +177,22 @@ "title": "Azure OpenAI" } }, + "OpenRouter": { + "checker": { + "desc": "测试代理地址是否正确填写" + }, + "customModelName": { + "desc": "增加自定义模型,多个模型使用逗号(,)隔开", + "placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free", + "title": "自定义模型名称" + }, + "title": "OpenRouter", + "token": { + "desc": "填入来自 OpenRouter AI 的 API Key", + "placeholder": "OpenRouter AI API Key", + "title": "API Key" + } + }, "Perplexity": { "title": "Perplexity", "token": { diff --git a/locales/zh-TW/common.json b/locales/zh-TW/common.json index ca17db25b74a..c2f015ecdfb3 100644 --- a/locales/zh-TW/common.json +++ b/locales/zh-TW/common.json @@ -110,6 +110,7 @@ "ollama": "奧拉馬", "oneapi": "One API", "openai": "OpenAI", + "openrouter": "OpenRouter", "perplexity": "Perplexity AI", "zhipu": "智譜AI" }, @@ -146,4 +147,4 @@ "hasNew": "有可用更新", "newVersion": "有新版本可用:{{version}}" } -} +} \ No newline at end of file diff --git a/locales/zh-TW/error.json b/locales/zh-TW/error.json index ecb4e8283330..b028f2348511 100644 --- a/locales/zh-TW/error.json +++ b/locales/zh-TW/error.json @@ -48,6 +48,7 @@ "InvalidMistralAPIKey": "Mistral AI API Key 不正確或為空,請檢查 Mistral API Key 後重試", "InvalidMoonshotAPIKey": "Moonshot AI API 金鑰不正確或為空,請檢查 Moonshot API 金鑰後重試", "InvalidOllamaArgs": "Ollama 配置不正確,請檢查 Ollama 配置後重試", + "InvalidOpenRouterAPIKey": "OpenRouter API 金鑰不正確或為空,請檢查 OpenRouter API 金鑰後重試", "InvalidPerplexityAPIKey": "Perplexity API Key 不正確或為空,請檢查 Perplexity API Key 後重試", "InvalidZhipuAPIKey": "Zhipu API Key 不正確或為空,請檢查 Zhipu API Key 後重試", "LocationNotSupportError": "很抱歉,你的所在位置不支持此模型服務,可能是由於地區限制或服務未開通。請確認當前位置是否支持使用此服務,或嘗試使用其他位置信息。", @@ -57,6 +58,7 @@ "OllamaBizError": "請求 Ollama 服務出錯,請根據以下資訊排查或重試", "OllamaServiceUnavailable": "未偵測到 Ollama 服務,請檢查是否正常啟動", "OpenAIBizError": "請求 OpenAI 服務出錯。請根據以下資訊進行排查或重試。", + "OpenRouterBizError": "請求 OpenRouter AI 服務出錯,請根據以下信息排查或重試", "PerplexityBizError": "請求 Perplexity AI 服務出錯,請根據以下信息排查或重試", "PluginApiNotFound": "抱歉,外掛描述檔案中不存在該 API。請檢查您的請求方法與外掛清單 API 是否相符", "PluginApiParamsError": "抱歉,該外掛請求的輸入參數驗證失敗。請檢查輸入參數與 API 描述資訊是否相符", @@ -110,6 +112,10 @@ "description": "輸入你的 OpenAI API Key 即可開始會話。應用不會記錄你的 API Key", "title": "使用自定義 OpenAI API Key" }, + "OpenRouter": { + "description": "輸入你的 OpenRouter API 金鑰即可開始會話。應用不會記錄你的 API 金鑰", + "title": "使用自定義 OpenRouter API 金鑰" + }, "Perplexity": { "description": "輸入你的 Perplexity API Key 即可開始會話。應用不會記錄你的 API Key", "title": "使用自定義 Perplexity API Key" @@ -144,4 +150,4 @@ "password": "密碼" } } -} +} \ No newline at end of file diff --git a/locales/zh-TW/setting.json b/locales/zh-TW/setting.json index 3610e6d6038d..da5efd0f3f99 100644 --- a/locales/zh-TW/setting.json +++ b/locales/zh-TW/setting.json @@ -177,6 +177,22 @@ "title": "Azure OpenAI" } }, + "OpenRouter": { + "checker": { + "desc": "測試代理地址是否正確填寫" + }, + "customModelName": { + "desc": "增加自定義模型,多個模型使用逗號(,)隔開", + "placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free", + "title": "自定義模型名稱" + }, + "title": "OpenRouter", + "token": { + "desc": "填入來自 OpenRouter AI 的 API 金鑰", + "placeholder": "OpenRouter AI API 金鑰", + "title": "API 金鑰" + } + }, "Perplexity": { "title": "Perplexity AI", "token": { diff --git a/src/app/api/chat/[provider]/agentRuntime.test.ts b/src/app/api/chat/[provider]/agentRuntime.test.ts index 715a4a2490da..851a3ca6f8e2 100644 --- a/src/app/api/chat/[provider]/agentRuntime.test.ts +++ b/src/app/api/chat/[provider]/agentRuntime.test.ts @@ -16,6 +16,7 @@ import { LobeMoonshotAI, LobeOllamaAI, LobeOpenAI, + LobeOpenRouterAI, LobePerplexityAI, LobeZhipuAI, ModelProvider, @@ -42,6 +43,7 @@ vi.mock('@/config/server', () => ({ PERPLEXITY_API_KEY: 'test-perplexity-key', ANTHROPIC_API_KEY: 'test-anthropic-key', MISTRAL_API_KEY: 'test-mistral-key', + OPENROUTER_API_KEY: 'test-openrouter-key', })), })); @@ -313,6 +315,30 @@ describe('AgentRuntime', () => { }); }); + describe('OpenRouter AI provider', () => { + it('should initialize correctly', async () => { + const jwtPayload: JWTPayload = { apiKey: 'user-openrouter-key' }; + const runtime = await AgentRuntime.initializeWithUserPayload( + ModelProvider.OpenRouter, + jwtPayload, + ); + + // 假设 LobeOpenRouterAI 是 OpenRouter 提供者的实现类 + expect(runtime['_runtime']).toBeInstanceOf(LobeOpenRouterAI); + }); + + it('should initialize correctly without apiKey', async () => { + const jwtPayload: JWTPayload = {}; + const runtime = await AgentRuntime.initializeWithUserPayload( + ModelProvider.OpenRouter, + jwtPayload, + ); + + // 假设 LobeOpenRouterAI 是 OpenRouter 提供者的实现类 + expect(runtime['_runtime']).toBeInstanceOf(LobeOpenRouterAI); + }); + }); + 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 fbb640a35953..55268184ba5d 100644 --- a/src/app/api/chat/[provider]/agentRuntime.ts +++ b/src/app/api/chat/[provider]/agentRuntime.ts @@ -18,6 +18,7 @@ import { LobeMoonshotAI, LobeOllamaAI, LobeOpenAI, + LobeOpenRouterAI, LobePerplexityAI, LobeRuntimeAI, LobeZhipuAI, @@ -173,6 +174,11 @@ class AgentRuntime { runtimeModel = this.initGroq(payload); break; } + + case ModelProvider.OpenRouter: { + runtimeModel = this.initOpenRouter(payload); + break; + } } return new AgentRuntime(runtimeModel); @@ -281,6 +287,14 @@ class AgentRuntime { return new LobeGroq({ apiKey }); } + + private static initOpenRouter(payload: JWTPayload) { + const { OPENROUTER_API_KEY } = getServerConfig(); + const apiKey = apiKeyManager.pick(payload?.apiKey || OPENROUTER_API_KEY); + + return new LobeOpenRouterAI({ apiKey }); + } + } export default AgentRuntime; diff --git a/src/app/api/config/route.ts b/src/app/api/config/route.ts index 856ed49fde2d..5bbdcd3ea1d2 100644 --- a/src/app/api/config/route.ts +++ b/src/app/api/config/route.ts @@ -22,6 +22,7 @@ export const GET = async () => { ENABLED_PERPLEXITY, ENABLED_ANTHROPIC, ENABLED_MISTRAL, + ENABLED_OPENROUTER, DEFAULT_AGENT_CONFIG, OLLAMA_CUSTOM_MODELS, } = getServerConfig(); @@ -41,6 +42,7 @@ export const GET = async () => { mistral: { enabled: ENABLED_MISTRAL }, moonshot: { enabled: ENABLED_MOONSHOT }, ollama: { customModelName: OLLAMA_CUSTOM_MODELS, enabled: ENABLE_OLLAMA }, + openrouter: { enabled: ENABLED_OPENROUTER }, perplexity: { enabled: ENABLED_PERPLEXITY }, zhipu: { enabled: ENABLED_ZHIPU }, }, diff --git a/src/app/api/errorResponse.test.ts b/src/app/api/errorResponse.test.ts index df005705cc2e..da55ab688bb2 100644 --- a/src/app/api/errorResponse.test.ts +++ b/src/app/api/errorResponse.test.ts @@ -86,6 +86,13 @@ describe('createErrorResponse', () => { expect(response.status).toBe(476); }); + // 测试 OpenRouterBizError 错误类型返回477状态码 + it('returns a 477 status for OpenRouterBizError error type', () => { + const errorType = AgentRuntimeErrorType.OpenRouterBizError; + const response = createErrorResponse(errorType); + expect(response.status).toBe(477); + }); + // 测试 OllamaBizError 错误类型返回478状态码 it('returns a 478 status for OllamaBizError error type', () => { const errorType = AgentRuntimeErrorType.OllamaBizError; diff --git a/src/app/api/errorResponse.ts b/src/app/api/errorResponse.ts index bbbeb25bdee7..7b56abea3a87 100644 --- a/src/app/api/errorResponse.ts +++ b/src/app/api/errorResponse.ts @@ -37,6 +37,9 @@ const getStatus = (errorType: ILobeAgentRuntimeErrorType | ErrorType) => { case AgentRuntimeErrorType.MoonshotBizError: { return 476; } + case AgentRuntimeErrorType.OpenRouterBizError: { + return 477; + } case ChatErrorType.OllamaServiceUnavailable: case AgentRuntimeErrorType.OllamaBizError: { return 478; diff --git a/src/app/settings/llm/OpenRouter/index.tsx b/src/app/settings/llm/OpenRouter/index.tsx new file mode 100644 index 000000000000..ffedecf95ef6 --- /dev/null +++ b/src/app/settings/llm/OpenRouter/index.tsx @@ -0,0 +1,64 @@ +import { OpenRouter } 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 = 'openrouter'; + +const OpenRouterProvider = memo(() => { + const { t } = useTranslation('setting'); + + const theme = useTheme(); + + return ( + + ), + desc: t('llm.OpenRouter.token.desc'), + label: t('llm.OpenRouter.token.title'), + name: [LLMProviderConfigKey, providerKey, LLMProviderApiTokenKey], + }, + { + children: ( + + ), + desc: t('llm.OpenRouter.customModelName.desc'), + label: t('llm.OpenRouter.customModelName.title'), + name: [LLMProviderConfigKey, providerKey, 'customModelName'], + }, + { + children: , + desc: t('llm.checker.desc'), + label: t('llm.checker.title'), + minWidth: '100%', + }, + ]} + provider={providerKey} + title={ + + } + /> + ); +}); + +export default OpenRouterProvider; diff --git a/src/app/settings/llm/index.tsx b/src/app/settings/llm/index.tsx index 3d1948c16544..a3b6667865f4 100644 --- a/src/app/settings/llm/index.tsx +++ b/src/app/settings/llm/index.tsx @@ -16,6 +16,7 @@ import Mistral from './Mistral'; import Moonshot from './Moonshot'; import Ollama from './Ollama'; import OpenAI from './OpenAI'; +import OpenRouter from './OpenRouter'; import Perplexity from './Perplexity'; import Zhipu from './Zhipu'; @@ -34,6 +35,7 @@ export default memo<{ showOllama: boolean }>(({ showOllama }) => { +