From fbcfc96a8df08f6ebfdb8b7b93add27a56695f7c Mon Sep 17 00:00:00 2001 From: Arvin Xu Date: Wed, 14 Feb 2024 00:01:32 +0800 Subject: [PATCH 1/3] :sparkles: feat(llm): support Ollama AI Provider (local LLM) (#1293) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :sparkles: feat(llm): support Ollama AI Provider (local llm) * 🎨 refactor: improve code style * ✨ feat: add more ollama model * 🌐 style: add locales --------- Co-authored-by: Johnson Co-authored-by: shijianyue --- .env.example | 8 ++ Dockerfile | 3 + docs/Deployment/Environment-Variable.md | 10 ++ docs/Deployment/Environment-Variable.zh-CN.md | 10 ++ locales/ar/common.json | 1 + locales/ar/error.json | 2 + locales/ar/setting.json | 16 +++ locales/de-DE/common.json | 1 + locales/de-DE/error.json | 2 + locales/de-DE/setting.json | 16 +++ locales/en-US/common.json | 1 + locales/en-US/error.json | 2 + locales/en-US/setting.json | 16 +++ locales/es-ES/common.json | 1 + locales/es-ES/error.json | 2 + locales/es-ES/setting.json | 16 +++ locales/fr-FR/common.json | 1 + locales/fr-FR/error.json | 2 + locales/fr-FR/setting.json | 16 +++ locales/it-IT/common.json | 1 + locales/it-IT/error.json | 2 + locales/it-IT/setting.json | 16 +++ locales/ja-JP/common.json | 1 + locales/ja-JP/error.json | 2 + locales/ja-JP/setting.json | 16 +++ locales/ko-KR/common.json | 1 + locales/ko-KR/error.json | 2 + locales/ko-KR/setting.json | 16 +++ locales/nl-NL/common.json | 1 + locales/nl-NL/error.json | 2 + locales/nl-NL/setting.json | 16 +++ locales/pl-PL/common.json | 1 + locales/pl-PL/error.json | 2 + locales/pl-PL/setting.json | 16 +++ locales/pt-BR/common.json | 1 + locales/pt-BR/error.json | 2 + locales/pt-BR/setting.json | 16 +++ locales/ru-RU/common.json | 1 + locales/ru-RU/error.json | 2 + locales/ru-RU/setting.json | 16 +++ locales/tr-TR/common.json | 1 + locales/tr-TR/error.json | 2 + locales/tr-TR/setting.json | 16 +++ locales/vi-VN/common.json | 1 + locales/vi-VN/error.json | 2 + locales/vi-VN/setting.json | 16 +++ locales/zh-CN/common.json | 1 + locales/zh-CN/error.json | 2 + locales/zh-CN/setting.json | 16 +++ locales/zh-TW/common.json | 1 + locales/zh-TW/error.json | 2 + locales/zh-TW/setting.json | 16 +++ src/app/api/chat/[provider]/agentRuntime.ts | 14 +++ src/app/api/config/route.ts | 2 + src/app/api/errorResponse.ts | 3 + src/app/settings/llm/Ollama/index.tsx | 81 ++++++++++++ src/app/settings/llm/page.tsx | 7 ++ src/components/ModelProviderIcon/index.tsx | 6 +- src/config/modelProviders/index.ts | 3 + src/config/modelProviders/ollama.ts | 118 ++++++++++++++++++ src/config/server/provider.ts | 6 + src/const/settings.ts | 4 + src/libs/agent-runtime/error.ts | 3 + src/libs/agent-runtime/index.ts | 1 + src/libs/agent-runtime/ollama/index.ts | 80 ++++++++++++ src/libs/agent-runtime/types/type.ts | 1 + src/locales/default/common.ts | 1 + src/locales/default/error.ts | 3 + src/locales/default/setting.ts | 16 +++ src/services/_auth.ts | 8 ++ .../settings/selectors/modelProvider.ts | 26 +++- src/types/settings/modelProvider.ts | 7 ++ 72 files changed, 722 insertions(+), 3 deletions(-) create mode 100644 src/app/settings/llm/Ollama/index.tsx create mode 100644 src/config/modelProviders/ollama.ts create mode 100644 src/libs/agent-runtime/ollama/index.ts diff --git a/.env.example b/.env.example index 80c71c6b77e4..80f55efd9c4d 100644 --- a/.env.example +++ b/.env.example @@ -59,6 +59,14 @@ OPENAI_API_KEY=sk-xxxxxxxxx #AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxx #AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +######################################## +######### Ollama AI Service ########## +######################################## + +# You can use ollama to get and run LLM locally, learn more about it via https://github.com/ollama/ollama +# The local/remote ollama service url +# OLLAMA_PROXY_URL=http://127.0.0.1:11434/v1 + ######################################## ############ Market Service ############ ######################################## diff --git a/Dockerfile b/Dockerfile index 34ad12d2c921..798b7caae085 100644 --- a/Dockerfile +++ b/Dockerfile @@ -78,4 +78,7 @@ ENV ZHIPU_API_KEY "" # Moonshot ENV MOONSHOT_API_KEY "" +# Ollama +ENV OLLAMA_PROXY_URL "" + CMD ["node", "server.js"] diff --git a/docs/Deployment/Environment-Variable.md b/docs/Deployment/Environment-Variable.md index fd05a4df69f2..866d9774aabc 100644 --- a/docs/Deployment/Environment-Variable.md +++ b/docs/Deployment/Environment-Variable.md @@ -18,6 +18,7 @@ LobeChat provides additional configuration options during deployment, which can - [Moonshot AI](#moonshot-ai) - [Google AI](#google-ai) - [AWS Bedrock](#aws-bedrock) + - [Ollama](#ollama) - [Plugin Service](#plugin-service) - [`PLUGINS_INDEX_URL`](#plugins_index_url) - [`PLUGIN_SETTINGS`](#plugin_settings) @@ -208,6 +209,15 @@ If you need to use Azure OpenAI to provide model services, you can refer to the - Default Value: `us-east-1` - Example: `us-east-1` +### Ollama + +#### `OLLAMA_PROXY_URL` + +- Type: Optional +- Description: To enable the Ollama service provider, if set up which will appear as selectable model card in the language model setting page, you can also specify a custom language model. +- Default: - +- Example: `http://127.0.0.1:11434/v1` + ## Plugin Service ### `PLUGINS_INDEX_URL` diff --git a/docs/Deployment/Environment-Variable.zh-CN.md b/docs/Deployment/Environment-Variable.zh-CN.md index 8d40e8aa98eb..ef699fc9e926 100644 --- a/docs/Deployment/Environment-Variable.zh-CN.md +++ b/docs/Deployment/Environment-Variable.zh-CN.md @@ -18,6 +18,7 @@ LobeChat 在部署时提供了一些额外的配置项,使用环境变量进 - [Moonshot AI](#moonshot-ai) - [Google AI](#google-ai) - [AWS Bedrock](#aws-bedrock) + - [Ollama](#ollama) - [插件服务](#插件服务) - [`PLUGINS_INDEX_URL`](#plugins_index_url) - [`PLUGIN_SETTINGS`](#plugin_settings) @@ -206,6 +207,15 @@ LobeChat 在部署时提供了一些额外的配置项,使用环境变量进 - 默认值:`us-east-1` - 示例:`us-east-1` +### Ollama + +#### `OLLAMA_PROXY_URL` + +- 类型:可选 +- 描述:用于启用 Ollama 服务,设置后可在语言模型列表内展示可选开源语言模型,也可以指定自定义语言模型 +- 默认值:- +- 示例:`http://127.0.0.1:11434/v1` + ## 插件服务 ### `PLUGINS_INDEX_URL` diff --git a/locales/ar/common.json b/locales/ar/common.json index faa4f1f887ae..3d6e1d9aeedf 100644 --- a/locales/ar/common.json +++ b/locales/ar/common.json @@ -103,6 +103,7 @@ "bedrock": "بيدروك لأمازون ويب سيرفيس", "google": "جوجل", "moonshot": "مونشوت الذكاء الاصطناعي", + "ollama": "أولاما", "oneapi": "وان آبي آي", "openai": "أوبن إيه آي", "zhipu": "زهيبو" diff --git a/locales/ar/error.json b/locales/ar/error.json index 938e44b47083..6262846f5df0 100644 --- a/locales/ar/error.json +++ b/locales/ar/error.json @@ -42,10 +42,12 @@ "InvalidBedrockCredentials": "فشلت مصادقة Bedrock، يرجى التحقق من AccessKeyId/SecretAccessKey وإعادة المحاولة", "InvalidGoogleAPIKey": "مفتاح Google API غير صحيح أو فارغ، يرجى التحقق من مفتاح Google API وإعادة المحاولة", "InvalidMoonshotAPIKey": "مفتاح API لـ Moonshot AI غير صحيح أو فارغ، يرجى التحقق من مفتاح API لـ Moonshot وإعادة المحاولة", + "InvalidOllamaArgs": "تكوين Ollama غير صحيح، يرجى التحقق من تكوين Ollama وإعادة المحاولة", "InvalidZhipuAPIKey": "مفتاح Zhipu API غير صحيح أو فارغ، يرجى التحقق من مفتاح Zhipu API وإعادة المحاولة", "LocationNotSupportError": "عذرًا، لا يدعم موقعك الحالي خدمة هذا النموذج، قد يكون ذلك بسبب قيود المنطقة أو عدم توفر الخدمة. يرجى التحقق مما إذا كان الموقع الحالي يدعم استخدام هذه الخدمة، أو محاولة استخدام معلومات الموقع الأخرى.", "MoonshotBizError": "حدث خطأ في خدمة جانب القمر، يرجى التحقق من المعلومات أدناه أو إعادة المحاولة", "NoOpenAIAPIKey": "مفتاح API الخاص بـ OpenAI فارغ، يرجى إضافة مفتاح API الخاص بـ OpenAI", + "OllamaBizError": "خطأ في طلب خدمة Ollama، يرجى التحقق من المعلومات التالية أو إعادة المحاولة", "OpenAIBizError": "حدث خطأ في طلب خدمة OpenAI، يرجى التحقق من المعلومات أدناه وإعادة المحاولة", "PluginApiNotFound": "عذرًا، لا يوجد API للإضافة في وصف الإضافة، يرجى التحقق من تطابق طريقة الطلب الخاصة بك مع API الوصف", "PluginApiParamsError": "عذرًا، فشلت التحقق من صحة معلمات الطلب للإضافة، يرجى التحقق من تطابق المعلمات مع معلومات الوصف", diff --git a/locales/ar/setting.json b/locales/ar/setting.json index 1a939d9d9f9e..42c985fd83ab 100644 --- a/locales/ar/setting.json +++ b/locales/ar/setting.json @@ -84,6 +84,22 @@ "title": "مفتاح API" } }, + "Ollama": { + "checker": { + "desc": "تحقق من صحة عنوان الوكيل" + }, + "customModelName": { + "desc": "إضافة نموذج مخصص، استخدم فاصلة (،) للنماذج المتعددة", + "placeholder": "فيكونا، للافا، كوديلاما، لاما2:13b-نص", + "title": "اسم النموذج المخصص" + }, + "endpoint": { + "desc": "أدخل عنوان وكيل واجهة Ollama، اتركه فارغًا إذا لم يتم تحديده محليًا", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "عنوان وكيل الواجهة" + }, + "title": "أولاما" + }, "OpenAI": { "azureApiVersion": { "desc": "إصدار واجهة برمجة التطبيقات لـ Azure، يتبع تنسيق YYYY-MM-DD، اطلع على [أحدث الإصدارات](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions)", diff --git a/locales/de-DE/common.json b/locales/de-DE/common.json index c8086637f296..54dae5060f4f 100644 --- a/locales/de-DE/common.json +++ b/locales/de-DE/common.json @@ -103,6 +103,7 @@ "bedrock": "AWS Bedrock", "google": "Google", "moonshot": "Moonshot KI", + "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", "zhipu": "Zhipu AI" diff --git a/locales/de-DE/error.json b/locales/de-DE/error.json index e3c49c7dcd00..9d1fd67356d0 100644 --- a/locales/de-DE/error.json +++ b/locales/de-DE/error.json @@ -42,10 +42,12 @@ "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.", "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.", "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.", "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.", "OpenAIBizError": "Fehler bei der OpenAI-Serviceanfrage. 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", diff --git a/locales/de-DE/setting.json b/locales/de-DE/setting.json index 784489fb352a..6a884bb02578 100644 --- a/locales/de-DE/setting.json +++ b/locales/de-DE/setting.json @@ -84,6 +84,22 @@ "title": "API-Schlüssel" } }, + "Ollama": { + "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": "Vicuna, Llava, Codellama, Llama2:13b-Text", + "title": "Benutzerdefinierte Modellnamen" + }, + "endpoint": { + "desc": "Geben Sie die Ollama-Proxy-URL ein. Wenn keine lokale URL angegeben ist, lassen Sie dieses Feld leer", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "Proxy-URL" + }, + "title": "Ollama" + }, "OpenAI": { "azureApiVersion": { "desc": "Die API-Version von Azure, im Format YYYY-MM-DD. Siehe [Neueste Version](https://learn.microsoft.com/de-de/azure/ai-services/openai/reference#chat-completions)", diff --git a/locales/en-US/common.json b/locales/en-US/common.json index 7342ccd8b659..baacdebac53c 100644 --- a/locales/en-US/common.json +++ b/locales/en-US/common.json @@ -103,6 +103,7 @@ "bedrock": "AWS Bedrock", "google": "Google", "moonshot": "Moonshot AI", + "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", "zhipu": "Zhipu AI" diff --git a/locales/en-US/error.json b/locales/en-US/error.json index f57cda59b35a..af20a421f44b 100644 --- a/locales/en-US/error.json +++ b/locales/en-US/error.json @@ -42,10 +42,12 @@ "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.", "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", "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.", "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", "OpenAIBizError": "Error requesting OpenAI 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", diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json index 06de1f86d5ad..a8469a173078 100644 --- a/locales/en-US/setting.json +++ b/locales/en-US/setting.json @@ -84,6 +84,22 @@ "title": "API Key" } }, + "Ollama": { + "checker": { + "desc": "Check if the proxy address is filled in correctly" + }, + "customModelName": { + "desc": "Add custom models, separate multiple models with commas", + "placeholder": "vicuna,llama,codellama,llama2:13b-text", + "title": "Custom Model Name" + }, + "endpoint": { + "desc": "Enter the Ollama API proxy address, leave blank if not specifically set locally", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "API Proxy Address" + }, + "title": "Ollama" + }, "OpenAI": { "azureApiVersion": { "desc": "The API version for Azure, following the format YYYY-MM-DD, check the [latest version](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions)", diff --git a/locales/es-ES/common.json b/locales/es-ES/common.json index 3ed54275d236..de627506d149 100644 --- a/locales/es-ES/common.json +++ b/locales/es-ES/common.json @@ -103,6 +103,7 @@ "bedrock": "AWS Bedrock", "google": "Google", "moonshot": "Moonshot IA", + "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", "zhipu": "Zhipu AI" diff --git a/locales/es-ES/error.json b/locales/es-ES/error.json index 219a537378ca..3af9b75335c5 100644 --- a/locales/es-ES/error.json +++ b/locales/es-ES/error.json @@ -42,10 +42,12 @@ "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", "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", "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.", "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", "OpenAIBizError": "Error al solicitar el servicio OpenAI. Depure o reintente según la siguiente información", "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", diff --git a/locales/es-ES/setting.json b/locales/es-ES/setting.json index d92b268fac89..2cc0688ff994 100644 --- a/locales/es-ES/setting.json +++ b/locales/es-ES/setting.json @@ -84,6 +84,22 @@ "title": "Clave API" } }, + "Ollama": { + "checker": { + "desc": "Verifica si la dirección del proxy está correctamente escrita" + }, + "customModelName": { + "desc": "Agrega modelos personalizados, separados por comas (,)", + "placeholder": "vicuña,llama,codellama,llama2:13b-text", + "title": "Nombre del modelo personalizado" + }, + "endpoint": { + "desc": "Ingresa la dirección del proxy de la interfaz de Ollama, déjalo en blanco si no se especifica localmente", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "Dirección del proxy de la interfaz" + }, + "title": "Ollama" + }, "OpenAI": { "azureApiVersion": { "desc": "Versión de la API de Azure, sigue el formato YYYY-MM-DD, consulta la [última versión](https://learn.microsoft.com/es-es/azure/ai-services/openai/reference#chat-completions)", diff --git a/locales/fr-FR/common.json b/locales/fr-FR/common.json index c832dd6b7fa2..bef6a184c428 100644 --- a/locales/fr-FR/common.json +++ b/locales/fr-FR/common.json @@ -103,6 +103,7 @@ "bedrock": "AWS Bedrock", "google": "Google", "moonshot": "Moonshot IA", + "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", "zhipu": "Zhipu AI" diff --git a/locales/fr-FR/error.json b/locales/fr-FR/error.json index 4d0f7516cde0..0550d9346c15 100644 --- a/locales/fr-FR/error.json +++ b/locales/fr-FR/error.json @@ -42,10 +42,12 @@ "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", "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", "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.", "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", "OpenAIBizError": "Erreur de service OpenAI. Veuillez diagnostiquer ou réessayer en fonction des informations ci-dessous", "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", diff --git a/locales/fr-FR/setting.json b/locales/fr-FR/setting.json index fed0e8fdf8d2..b6eea449bf60 100644 --- a/locales/fr-FR/setting.json +++ b/locales/fr-FR/setting.json @@ -84,6 +84,22 @@ "title": "API密钥" } }, + "Ollama": { + "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": "vicuna,llava,codellama,llama2:13b-text", + "title": "Nom du modèle personnalisé" + }, + "endpoint": { + "desc": "Entrez l'adresse du proxy de l'interface Ollama, laissez vide si non spécifié localement", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "Adresse du proxy de l'interface" + }, + "title": "Ollama" + }, "OpenAI": { "azureApiVersion": { "desc": "Version de l'API Azure, au format YYYY-MM-DD, consultez la [dernière version](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions)", diff --git a/locales/it-IT/common.json b/locales/it-IT/common.json index 63443cfb9b62..092449dffbc3 100644 --- a/locales/it-IT/common.json +++ b/locales/it-IT/common.json @@ -103,6 +103,7 @@ "bedrock": "AWS Bedrock", "google": "Google", "moonshot": "Moonshot AI", + "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", "zhipu": "Zhipu AI" diff --git a/locales/it-IT/error.json b/locales/it-IT/error.json index 1799478ade90..4d978b4267f1 100644 --- a/locales/it-IT/error.json +++ b/locales/it-IT/error.json @@ -42,10 +42,12 @@ "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", "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", "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.", "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", "OpenAIBizError": "Errore nella richiesta del servizio OpenAI. Segui le informazioni seguenti per individuare e riprovare", "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", diff --git a/locales/it-IT/setting.json b/locales/it-IT/setting.json index c4c99a9056b9..3e6410f6283e 100644 --- a/locales/it-IT/setting.json +++ b/locales/it-IT/setting.json @@ -84,6 +84,22 @@ "title": "Chiave API" } }, + "Ollama": { + "checker": { + "desc": "Verifica se l'indirizzo del proxy è stato compilato correttamente" + }, + "customModelName": { + "desc": "Aggiungi un modello personalizzato, separando i modelli multipli con una virgola (,)", + "placeholder": "vicuna,llama,codellama,llama2:13b-text", + "title": "Nome del modello personalizzato" + }, + "endpoint": { + "desc": "Inserisci l'indirizzo del proxy dell'interfaccia Ollama, lascialo vuoto se non è stato specificato localmente", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "Indirizzo del proxy dell'interfaccia" + }, + "title": "Ollama" + }, "OpenAI": { "azureApiVersion": { "desc": "Versione dell'API di Azure, nel formato YYYY-MM-DD, consulta [ultima versione](https://learn.microsoft.com/it-it/azure/ai-services/openai/reference#chat-completions)", diff --git a/locales/ja-JP/common.json b/locales/ja-JP/common.json index bdda5de75cac..a833b4ad3357 100644 --- a/locales/ja-JP/common.json +++ b/locales/ja-JP/common.json @@ -103,6 +103,7 @@ "bedrock": "AWSベッドロック", "google": "Google", "moonshot": "Moonshot AI", + "ollama": "オラマ", "oneapi": "One API", "openai": "OpenAI", "zhipu": "智譜AI" diff --git a/locales/ja-JP/error.json b/locales/ja-JP/error.json index 2c5123b16ca9..2c382f4c8092 100644 --- a/locales/ja-JP/error.json +++ b/locales/ja-JP/error.json @@ -42,10 +42,12 @@ "InvalidBedrockCredentials": "Bedrockの認証に失敗しました。AccessKeyId/SecretAccessKeyを確認してから再試行してください。", "InvalidGoogleAPIKey": "Google APIキーが正しくないか空です。Google APIキーを確認してから再試行してください。", "InvalidMoonshotAPIKey": "Moonshot AI APIキーが正しくないか空です。Moonshot APIキーを確認して再試行してください。", + "InvalidOllamaArgs": "Ollamaの設定が正しくありません。Ollamaの設定を確認してからもう一度お試しください", "InvalidZhipuAPIKey": "Zhipu APIキーが正しくないか空です。Zhipu APIキーを確認してから再試行してください。", "LocationNotSupportError": "申し訳ありませんが、お住まいの地域ではこのモデルサービスをサポートしていません。地域制限またはサービスが利用できない可能性があります。現在の位置がこのサービスをサポートしているかどうかを確認するか、他の位置情報を使用してみてください。", "MoonshotBizError": "月の裏側サービスのリクエストでエラーが発生しました。以下の情報を確認して再試行してください。", "NoOpenAIAPIKey": "OpenAI APIキーが空です。カスタムOpenAI APIキーを追加してください。", + "OllamaBizError": "Ollamaサービスのリクエストでエラーが発生しました。以下の情報に基づいてトラブルシューティングを行うか、再度お試しください", "OpenAIBizError": "OpenAIサービスのリクエストエラーが発生しました。以下の情報に基づいて問題を解決したり、再試行したりしてください", "PluginApiNotFound": "申し訳ありませんが、プラグインのマニフェストに指定されたAPIが見つかりませんでした。リクエストメソッドとプラグインのマニフェストのAPIが一致しているかどうかを確認してください", "PluginApiParamsError": "申し訳ありませんが、プラグインのリクエストパラメータの検証に失敗しました。パラメータとAPIの説明が一致しているかどうか確認してください", diff --git a/locales/ja-JP/setting.json b/locales/ja-JP/setting.json index def40ada2362..dd59b9f9e6ab 100644 --- a/locales/ja-JP/setting.json +++ b/locales/ja-JP/setting.json @@ -84,6 +84,22 @@ "title": "API キー" } }, + "Ollama": { + "checker": { + "desc": "プロキシアドレスが正しく入力されているかをテストします" + }, + "customModelName": { + "desc": "カスタムモデルを追加します。複数のモデルはコンマ(,)で区切ってください", + "placeholder": "ビクーニャ、リャマ、コードリャマ、リャマ2:13b-テキスト", + "title": "カスタムモデル名" + }, + "endpoint": { + "desc": "Ollama インターフェースプロキシアドレスを入力します。ローカルで追加指定がない場合は空白のままにしてください", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "インターフェースプロキシアドレス" + }, + "title": "Ollama" + }, "OpenAI": { "azureApiVersion": { "desc": "Azure の API バージョンは YYYY-MM-DD 形式に従い、[最新バージョン](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions)を参照してください", diff --git a/locales/ko-KR/common.json b/locales/ko-KR/common.json index 682ee8fb14c7..c6fc6b8ee363 100644 --- a/locales/ko-KR/common.json +++ b/locales/ko-KR/common.json @@ -103,6 +103,7 @@ "bedrock": "AWS Bedrock", "google": "Google", "moonshot": "문샷 AI", + "ollama": "올라마", "oneapi": "One API", "openai": "OpenAI", "zhipu": "지푸 AI" diff --git a/locales/ko-KR/error.json b/locales/ko-KR/error.json index 6d6afd416f57..79bb808b22c3 100644 --- a/locales/ko-KR/error.json +++ b/locales/ko-KR/error.json @@ -42,10 +42,12 @@ "InvalidBedrockCredentials": "Bedrock 인증에 실패했습니다. AccessKeyId/SecretAccessKey를 확인한 후 다시 시도하십시오.", "InvalidGoogleAPIKey": "잘못된 또는 비어 있는 Google API Key입니다. Google API Key를 확인한 후 다시 시도하십시오.", "InvalidMoonshotAPIKey": "Moonshot AI API 키가 잘못되었거나 비어 있습니다. Moonshot API 키를 확인한 후 다시 시도해주세요.", + "InvalidOllamaArgs": "Ollama 구성이 잘못되었습니다. Ollama 구성을 확인한 후 다시 시도하십시오.", "InvalidZhipuAPIKey": "잘못된 또는 비어 있는 Zhipu API Key입니다. Zhipu API Key를 확인한 후 다시 시도하십시오.", "LocationNotSupportError": "죄송합니다. 귀하의 현재 위치는 해당 모델 서비스를 지원하지 않습니다. 지역 제한 또는 서비스 미개통으로 인한 것일 수 있습니다. 현재 위치가 해당 서비스를 지원하는지 확인하거나 다른 위치 정보를 사용해 보십시오.", "MoonshotBizError": "요청한 문샷 비즈니스에 오류가 발생했습니다. 아래 정보를 확인하고 다시 시도해주세요.", "NoOpenAIAPIKey": "OpenAI API 키가 비어 있습니다. 사용자 정의 OpenAI API 키를 추가해주세요.", + "OllamaBizError": "Ollama 서비스 요청 중 오류가 발생했습니다. 아래 정보를 확인하고 다시 시도하십시오.", "OpenAIBizError": "OpenAI 서비스 요청 중 오류가 발생했습니다. 아래 정보를 확인하고 문제를 해결하거나 다시 시도해주세요.", "PluginApiNotFound": "죄송합니다. 플러그인 설명서에 해당 API가 없습니다. 요청 메서드와 플러그인 설명서 API가 일치하는지 확인해주세요.", "PluginApiParamsError": "죄송합니다. 플러그인 요청의 입력 매개변수 유효성 검사에 실패했습니다. 입력 매개변수와 API 설명 정보가 일치하는지 확인해주세요.", diff --git a/locales/ko-KR/setting.json b/locales/ko-KR/setting.json index 4eb8c1b7d422..c2cabe70ab97 100644 --- a/locales/ko-KR/setting.json +++ b/locales/ko-KR/setting.json @@ -84,6 +84,22 @@ "title": "API 키" } }, + "Ollama": { + "checker": { + "desc": "프록시 주소가 올바르게 입력되었는지 확인합니다." + }, + "customModelName": { + "desc": "사용자 정의 모델을 추가하고, 여러 모델은 쉼표(,)로 구분합니다.", + "placeholder": "비쿠나, 람라, 코데람라, 람라2:13b-텍스트", + "title": "사용자 정의 모델 이름" + }, + "endpoint": { + "desc": "Ollama 인터페이스 프록시 주소를 입력하고, 로컬에서 별도로 지정하지 않은 경우 비워 둡니다.", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "인터페이스 프록시 주소" + }, + "title": "Ollama" + }, "OpenAI": { "azureApiVersion": { "desc": "Azure의 API 버전으로 YYYY-MM-DD 형식을 따르며 [최신 버전](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions)을 확인하세요", diff --git a/locales/nl-NL/common.json b/locales/nl-NL/common.json index 6a3b340df54b..1ff32831637e 100644 --- a/locales/nl-NL/common.json +++ b/locales/nl-NL/common.json @@ -103,6 +103,7 @@ "bedrock": "AWS Bedrock", "google": "Google", "moonshot": "Moonshot AI", + "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", "zhipu": "智谱AI" diff --git a/locales/nl-NL/error.json b/locales/nl-NL/error.json index 919b09b0d27f..bd7d50ae7d09 100644 --- a/locales/nl-NL/error.json +++ b/locales/nl-NL/error.json @@ -42,10 +42,12 @@ "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", "InvalidMoonshotAPIKey": "Moonshot AI API密钥不正确或为空,请检查Moonshot API密钥后重试", + "InvalidOllamaArgs": "Ollama-configuratie is onjuist, controleer de Ollama-configuratie 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.", "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", "OpenAIBizError": "Fout bij het aanvragen van OpenAI-service. Controleer de onderstaande informatie voor probleemoplossing of probeer 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", diff --git a/locales/nl-NL/setting.json b/locales/nl-NL/setting.json index 63bdfb9f616e..3d4921beb2d0 100644 --- a/locales/nl-NL/setting.json +++ b/locales/nl-NL/setting.json @@ -84,6 +84,22 @@ "title": "API 密钥" } }, + "Ollama": { + "checker": { + "desc": "Check of de proxy-adres correct is ingevuld" + }, + "customModelName": { + "desc": "Voeg aangepast model toe, gebruik komma's (,) om meerdere modellen te scheiden", + "placeholder": "vicuna,llama,codellama,llama2:13b-text", + "title": "Aangepaste modelnaam" + }, + "endpoint": { + "desc": "Vul het Ollama-interface proxy-adres in, laat leeg als lokaal niet apart is gespecificeerd", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "Interface proxy-adres" + }, + "title": "Ollama" + }, "OpenAI": { "azureApiVersion": { "desc": "API-versie van Azure, in het formaat YYYY-MM-DD, zie [laatste versie](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions)", diff --git a/locales/pl-PL/common.json b/locales/pl-PL/common.json index fddfea633156..abc4c72bdbf0 100644 --- a/locales/pl-PL/common.json +++ b/locales/pl-PL/common.json @@ -103,6 +103,7 @@ "bedrock": "AWS Bedrock", "google": "Google", "moonshot": "Moonshot AI", + "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", "zhipu": "智谱AI" diff --git a/locales/pl-PL/error.json b/locales/pl-PL/error.json index 10b0569784fa..da3e3c015ad5 100644 --- a/locales/pl-PL/error.json +++ b/locales/pl-PL/error.json @@ -42,10 +42,12 @@ "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.", "InvalidMoonshotAPIKey": "Moonshot AI API密钥不正确或为空,请检查Moonshot API密钥后重试", + "InvalidOllamaArgs": "Nieprawidłowa konfiguracja Ollama, sprawdź konfigurację Ollama 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.", "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", "OpenAIBizError": "Błąd żądania usługi OpenAI. Proszę sprawdź poniższe informacje i 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", diff --git a/locales/pl-PL/setting.json b/locales/pl-PL/setting.json index 11cdda67ada9..efcabaa5f580 100644 --- a/locales/pl-PL/setting.json +++ b/locales/pl-PL/setting.json @@ -84,6 +84,22 @@ "title": "Klucz API" } }, + "Ollama": { + "checker": { + "desc": "Sprawdź, czy adres proxy jest poprawnie wypełniony" + }, + "customModelName": { + "desc": "Dodaj niestandardowy model, używając przecinka (,) do oddzielenia wielu modeli", + "placeholder": "wikuna,llama,codellama,llama2:13b-text", + "title": "Nazwa niestandardowego modelu" + }, + "endpoint": { + "desc": "Wprowadź adres proxy interfejsu Ollama, pozostaw puste, jeśli nie jest lokalnie określony", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "Adres proxy interfejsu" + }, + "title": "Ollama" + }, "OpenAI": { "azureApiVersion": { "desc": "Wersja API dla usługi Azure, zgodna z formatem RRRR-MM-DD. Zobacz [najnowszą wersję](https://learn.microsoft.com/pl-pl/azure/ai-services/openai/reference#chat-completions)", diff --git a/locales/pt-BR/common.json b/locales/pt-BR/common.json index 18ec0c5cc71b..9357e7d320ff 100644 --- a/locales/pt-BR/common.json +++ b/locales/pt-BR/common.json @@ -103,6 +103,7 @@ "bedrock": "AWS Bedrock", "google": "Google", "moonshot": "Moonshot IA", + "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", "zhipu": "Zhipu AI" diff --git a/locales/pt-BR/error.json b/locales/pt-BR/error.json index 2c8e0491c1b2..82598bd272fe 100644 --- a/locales/pt-BR/error.json +++ b/locales/pt-BR/error.json @@ -42,10 +42,12 @@ "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", "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", "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.", "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", "OpenAIBizError": "Erro ao solicitar o serviço OpenAI. Verifique ou tente novamente com base nas informações abaixo", "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", diff --git a/locales/pt-BR/setting.json b/locales/pt-BR/setting.json index 0e4b8926beeb..23bc9307b724 100644 --- a/locales/pt-BR/setting.json +++ b/locales/pt-BR/setting.json @@ -84,6 +84,22 @@ "title": "Chave da API" } }, + "Ollama": { + "checker": { + "desc": "Verifique se o endereço do proxy está preenchido corretamente" + }, + "customModelName": { + "desc": "Adicione modelos personalizados, separados por vírgula (,) se forem vários modelos", + "placeholder": "vicuna,llava,codellama,llama2:13b-text", + "title": "Nome do modelo personalizado" + }, + "endpoint": { + "desc": "Insira o endereço do proxy da interface Ollama. Deixe em branco se não for especificado localmente", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "Endereço do proxy da interface" + }, + "title": "Ollama" + }, "OpenAI": { "azureApiVersion": { "desc": "Versão da API Azure, no formato YYYY-MM-DD. Consulte a [última versão](https://learn.microsoft.com/pt-br/azure/ai-services/openai/reference#chat-completions)", diff --git a/locales/ru-RU/common.json b/locales/ru-RU/common.json index 039086dc0b48..9c2fc8624355 100644 --- a/locales/ru-RU/common.json +++ b/locales/ru-RU/common.json @@ -103,6 +103,7 @@ "bedrock": "AWS Bedrock", "google": "Google", "moonshot": "Искусственный интеллект Moonshot", + "ollama": "Оллама", "oneapi": "One API", "openai": "OpenAI", "zhipu": "Zhipu AI" diff --git a/locales/ru-RU/error.json b/locales/ru-RU/error.json index 0b9236dd358b..841f7b0e62d1 100644 --- a/locales/ru-RU/error.json +++ b/locales/ru-RU/error.json @@ -42,10 +42,12 @@ "InvalidBedrockCredentials": "Аутентификация Bedrock не прошла, пожалуйста, проверьте AccessKeyId/SecretAccessKey и повторите попытку", "InvalidGoogleAPIKey": "Неверный или пустой ключ API Google, пожалуйста, проверьте ключ API Google и повторите попытку", "InvalidMoonshotAPIKey": "Moonshot AI API Key неверный или пустой, пожалуйста, проверьте ключ API Moonshot и повторите попытку", + "InvalidOllamaArgs": "Неверная конфигурация Ollama, пожалуйста, проверьте конфигурацию Ollama и повторите попытку", "InvalidZhipuAPIKey": "Неверный или пустой ключ API Zhipu, пожалуйста, проверьте ключ API Zhipu и повторите попытку", "LocationNotSupportError": "Извините, ваше текущее местоположение не поддерживает эту службу модели, возможно из-за ограничений региона или недоступности службы. Пожалуйста, убедитесь, что текущее местоположение поддерживает использование этой службы, или попробуйте использовать другую информацию о местоположении.", "MoonshotBizError": "请求月球暗面服务出错,请根据以下信息排查或重试", "NoOpenAIAPIKey": "Ключ OpenAI API пуст, пожалуйста, добавьте свой собственный ключ OpenAI API", + "OllamaBizError": "Ошибка обращения к сервису Ollama, пожалуйста, проверьте следующую информацию или повторите попытку", "OpenAIBizError": "Ошибка запроса службы OpenAI. Устраните неполадку или повторите попытку, основываясь на следующей информации.", "PluginApiNotFound": "К сожалению, API не существует в манифесте плагина. Пожалуйста, проверьте, соответствует ли ваш метод запроса API манифеста плагина", "PluginApiParamsError": "К сожалению, проверка входных параметров для запроса плагина не удалась. Пожалуйста, проверьте, соответствуют ли входные параметры описанию API", diff --git a/locales/ru-RU/setting.json b/locales/ru-RU/setting.json index df63399f8bb4..57c1be52ccdf 100644 --- a/locales/ru-RU/setting.json +++ b/locales/ru-RU/setting.json @@ -84,6 +84,22 @@ "title": "Ключ API" } }, + "Ollama": { + "checker": { + "desc": "Проверьте правильность заполнения адреса прокси" + }, + "customModelName": { + "desc": "Добавьте пользовательскую модель, разделяя их запятыми (,)", + "placeholder": "викунья,льама,кодельльама,льама2:13b-текст", + "title": "Имя пользовательской модели" + }, + "endpoint": { + "desc": "Введите адрес прокси-сервера Ollama, оставьте пустым, если не указано локально", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "Адрес прокси-сервера" + }, + "title": "Ollama" + }, "OpenAI": { "azureApiVersion": { "desc": "Версия API Azure, следуйте формату ГГГГ-ММ-ДД, см. [последнюю версию](https://learn.microsoft.com/ru-ru/azure/ai-services/openai/reference#chat-completions)", diff --git a/locales/tr-TR/common.json b/locales/tr-TR/common.json index e2cef2e39b3d..ad42365eab0e 100644 --- a/locales/tr-TR/common.json +++ b/locales/tr-TR/common.json @@ -103,6 +103,7 @@ "bedrock": "AWS Bedrock", "google": "Google", "moonshot": "Moonshot AI", + "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", "zhipu": "Zhipu AI" diff --git a/locales/tr-TR/error.json b/locales/tr-TR/error.json index 1b46e8df02f3..5cacc49b302c 100644 --- a/locales/tr-TR/error.json +++ b/locales/tr-TR/error.json @@ -42,10 +42,12 @@ "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", "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", "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.", "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", "OpenAIBizError": "OpenAI hizmeti talep ederken hata oluştu. Aşağıdaki bilgilere dayanarak sorun giderin 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", diff --git a/locales/tr-TR/setting.json b/locales/tr-TR/setting.json index f62941a5ca74..86faefae60b0 100644 --- a/locales/tr-TR/setting.json +++ b/locales/tr-TR/setting.json @@ -84,6 +84,22 @@ "title": "API 密钥" } }, + "Ollama": { + "checker": { + "desc": "Proxy adresinin doğru şekilde doldurulup doldurulmadığını test edin" + }, + "customModelName": { + "desc": "Özel model ekleyin, birden fazla model virgül (,) ile ayrılır", + "placeholder": "vicuna,llama,codellama,llama2:13b-text", + "title": "Özel Model Adı" + }, + "endpoint": { + "desc": "Ollama arayüzü proxy adresini girin, yerel olarak özel bir adres belirtilmemişse boş bırakın", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "Proxy Adresi" + }, + "title": "Ollama" + }, "OpenAI": { "azureApiVersion": { "desc": "Azure için API sürümü, YYYY-MM-DD formatını takip eder, [en son sürümü kontrol edin](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions)", diff --git a/locales/vi-VN/common.json b/locales/vi-VN/common.json index 956759ba5de3..275ffe71a5f8 100644 --- a/locales/vi-VN/common.json +++ b/locales/vi-VN/common.json @@ -103,6 +103,7 @@ "bedrock": "AWS Bedrock", "google": "Google", "moonshot": "Moonshot AI", + "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", "zhipu": "Zhipu AI" diff --git a/locales/vi-VN/error.json b/locales/vi-VN/error.json index f90aaca8fe6d..e46b4cb92cc3 100644 --- a/locales/vi-VN/error.json +++ b/locales/vi-VN/error.json @@ -42,10 +42,12 @@ "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", "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", "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.", "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", "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", "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", diff --git a/locales/vi-VN/setting.json b/locales/vi-VN/setting.json index f3349c83c794..139bee5de9d3 100644 --- a/locales/vi-VN/setting.json +++ b/locales/vi-VN/setting.json @@ -84,6 +84,22 @@ "title": "Khóa API" } }, + "Ollama": { + "checker": { + "desc": "Kiểm tra xem địa chỉ proxy có được điền đúng không" + }, + "customModelName": { + "desc": "Thêm mô hình tùy chỉnh, nhiều mô hình sử dụng dấu phẩy (,) để ngăn cách", + "placeholder": "vicuna,llava,codellama,llama2:13b-text", + "title": "Tên mô hình tùy chỉnh" + }, + "endpoint": { + "desc": "Nhập địa chỉ proxy giao diện Ollama, để trống nếu không được chỉ định cụ thể", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "Địa chỉ proxy giao diện" + }, + "title": "Ollama" + }, "OpenAI": { "azureApiVersion": { "desc": "Phiên bản API của Azure, theo định dạng YYYY-MM-DD, xem chi tiết tại [phiên bản mới nhất](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions)", diff --git a/locales/zh-CN/common.json b/locales/zh-CN/common.json index 9945bc98036c..73da341ff83a 100644 --- a/locales/zh-CN/common.json +++ b/locales/zh-CN/common.json @@ -103,6 +103,7 @@ "bedrock": "AWS Bedrock", "google": "Google", "moonshot": "Moonshot AI", + "ollama": "Ollama", "oneapi": "One API", "openai": "OpenAI", "zhipu": "智谱AI" diff --git a/locales/zh-CN/error.json b/locales/zh-CN/error.json index 002894c07ac1..442090ac9678 100644 --- a/locales/zh-CN/error.json +++ b/locales/zh-CN/error.json @@ -59,6 +59,8 @@ "BedrockBizError": "请求 Bedrock 服务出错,请根据以下信息排查或重试", "InvalidAzureAPIKey": "Azure API Key 不正确或为空,请检查 Azure API Key 后重试", "AzureBizError": "请求 Azure AI 服务出错,请根据以下信息排查或重试", + "InvalidOllamaArgs": "Ollama 配置不正确,请检查 Ollama 配置后重试", + "OllamaBizError": "请求 Ollama 服务出错,请根据以下信息排查或重试", "AgentRuntimeError": "Lobe 语言模型运行时执行出错,请根据以下信息排查或重试" }, "stt": { diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json index 99165555afdd..1248136a727a 100644 --- a/locales/zh-CN/setting.json +++ b/locales/zh-CN/setting.json @@ -84,6 +84,22 @@ "title": "API Key" } }, + "Ollama": { + "checker": { + "desc": "测试代理地址是否正确填写" + }, + "customModelName": { + "desc": "增加自定义模型,多个模型使用逗号(,)隔开", + "placeholder": "vicuna,llava,codellama,llama2:13b-text", + "title": "自定义模型名称" + }, + "endpoint": { + "desc": "填入 Ollama 接口代理地址,本地未额外指定可留空", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "接口代理地址" + }, + "title": "Ollama" + }, "OpenAI": { "azureApiVersion": { "desc": "Azure 的 API 版本,遵循 YYYY-MM-DD 格式,查阅[最新版本](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions)", diff --git a/locales/zh-TW/common.json b/locales/zh-TW/common.json index fda59335386c..876980f40458 100644 --- a/locales/zh-TW/common.json +++ b/locales/zh-TW/common.json @@ -103,6 +103,7 @@ "bedrock": "AWS Bedrock", "google": "Google", "moonshot": "Moonshot AI", + "ollama": "奧拉馬", "oneapi": "One API", "openai": "OpenAI", "zhipu": "智譜AI" diff --git a/locales/zh-TW/error.json b/locales/zh-TW/error.json index 6a5def949426..ba45aa46da1b 100644 --- a/locales/zh-TW/error.json +++ b/locales/zh-TW/error.json @@ -42,10 +42,12 @@ "InvalidBedrockCredentials": "Bedrock 驗證未通過,請檢查 AccessKeyId/SecretAccessKey 後重試", "InvalidGoogleAPIKey": "Google API Key 不正確或為空,請檢查 Google API Key 後重試", "InvalidMoonshotAPIKey": "Moonshot AI API 金鑰不正確或為空,請檢查 Moonshot API 金鑰後重試", + "InvalidOllamaArgs": "Ollama 配置不正確,請檢查 Ollama 配置後重試", "InvalidZhipuAPIKey": "Zhipu API Key 不正確或為空,請檢查 Zhipu API Key 後重試", "LocationNotSupportError": "很抱歉,你的所在位置不支持此模型服務,可能是由於地區限制或服務未開通。請確認當前位置是否支持使用此服務,或嘗試使用其他位置信息。", "MoonshotBizError": "請求月球背面服務出錯,請根據以下信息排查或重試", "NoOpenAIAPIKey": "OpenAI API 金鑰為空,請添加自訂 OpenAI API 金鑰", + "OllamaBizError": "請求 Ollama 服務出錯,請根據以下資訊排查或重試", "OpenAIBizError": "請求 OpenAI 服務出錯。請根據以下資訊進行排查或重試。", "PluginApiNotFound": "抱歉,外掛描述檔案中不存在該 API。請檢查您的請求方法與外掛清單 API 是否相符", "PluginApiParamsError": "抱歉,該外掛請求的輸入參數驗證失敗。請檢查輸入參數與 API 描述資訊是否相符", diff --git a/locales/zh-TW/setting.json b/locales/zh-TW/setting.json index 1e1fbff3e224..8ac5e19a03b9 100644 --- a/locales/zh-TW/setting.json +++ b/locales/zh-TW/setting.json @@ -84,6 +84,22 @@ "title": "API 金鑰" } }, + "Ollama": { + "checker": { + "desc": "檢查代理地址是否正確填寫" + }, + "customModelName": { + "desc": "新增自定義模型,多個模型使用逗號(,)隔開", + "placeholder": "維庫納,利亞瓦,科迪拉瑪,拉瑪2:13b-文本", + "title": "自定義模型名稱" + }, + "endpoint": { + "desc": "填入 Ollama 接口代理地址,本地未額外指定可留空", + "placeholder": "http://127.0.0.1:11434/v1", + "title": "接口代理地址" + }, + "title": "Ollama" + }, "OpenAI": { "azureApiVersion": { "desc": "Azure 的 API 版本,遵循 YYYY-MM-DD 格式,查閱[最新版本](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions)", diff --git a/src/app/api/chat/[provider]/agentRuntime.ts b/src/app/api/chat/[provider]/agentRuntime.ts index bd8bba2646ca..4e868df2d20a 100644 --- a/src/app/api/chat/[provider]/agentRuntime.ts +++ b/src/app/api/chat/[provider]/agentRuntime.ts @@ -6,6 +6,7 @@ import { LobeBedrockAI, LobeGoogleAI, LobeMoonshotAI, + LobeOllamaAI, LobeOpenAI, LobeRuntimeAI, LobeZhipuAI, @@ -66,6 +67,12 @@ class AgentRuntime { case ModelProvider.Bedrock: { runtimeModel = this.initBedrock(payload); + break; + } + + case ModelProvider.Ollama: { + runtimeModel = this.initOllama(payload); + break; } } @@ -138,6 +145,13 @@ class AgentRuntime { return new LobeBedrockAI({ accessKeyId, accessKeySecret, region }); } + + private static initOllama(payload: JWTPayload) { + const { OLLAMA_PROXY_URL } = getServerConfig(); + const baseUrl = payload?.endpoint || OLLAMA_PROXY_URL; + + return new LobeOllamaAI(baseUrl); + } } export default AgentRuntime; diff --git a/src/app/api/config/route.ts b/src/app/api/config/route.ts index a389ab182954..eea1978cbe90 100644 --- a/src/app/api/config/route.ts +++ b/src/app/api/config/route.ts @@ -14,6 +14,7 @@ export const GET = async () => { ENABLED_AWS_BEDROCK, ENABLED_GOOGLE, ENABLE_OAUTH_SSO, + ENABLE_OLLAMA, } = getServerConfig(); const config: GlobalServerConfig = { @@ -23,6 +24,7 @@ export const GET = async () => { bedrock: { enabled: ENABLED_AWS_BEDROCK }, google: { enabled: ENABLED_GOOGLE }, moonshot: { enabled: ENABLED_MOONSHOT }, + ollama: { enabled: ENABLE_OLLAMA }, zhipu: { enabled: ENABLED_ZHIPU }, }, }; diff --git a/src/app/api/errorResponse.ts b/src/app/api/errorResponse.ts index 9dde96feb6ab..2a6748cbbe70 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.OllamaBizError: { + return 478; + } } return errorType as number; }; diff --git a/src/app/settings/llm/Ollama/index.tsx b/src/app/settings/llm/Ollama/index.tsx new file mode 100644 index 000000000000..f32c2074b894 --- /dev/null +++ b/src/app/settings/llm/Ollama/index.tsx @@ -0,0 +1,81 @@ +import { Ollama } from '@lobehub/icons'; +import { Form, type ItemGroup } from '@lobehub/ui'; +import { Form as AntForm, Input, Switch } from 'antd'; +import { useTheme } from 'antd-style'; +import { debounce } from 'lodash-es'; +import { memo } from 'react'; +import { useTranslation } from 'react-i18next'; +import { Flexbox } from 'react-layout-kit'; + +import { FORM_STYLE } from '@/const/layoutTokens'; +import { ModelProvider } from '@/libs/agent-runtime'; +import { useGlobalStore } from '@/store/global'; +import { modelProviderSelectors } from '@/store/global/selectors'; + +import Checker from '../Checker'; +import { LLMProviderBaseUrlKey, LLMProviderConfigKey } from '../const'; +import { useSyncSettings } from '../useSyncSettings'; + +const providerKey = 'ollama'; + +const OllamaProvider = memo(() => { + const { t } = useTranslation('setting'); + const [form] = AntForm.useForm(); + const theme = useTheme(); + const [toggleProviderEnabled, setSettings] = useGlobalStore((s) => [ + s.toggleProviderEnabled, + s.setSettings, + ]); + const enabled = useGlobalStore(modelProviderSelectors.enableOllama); + + useSyncSettings(form); + + const model: ItemGroup = { + children: [ + { + children: , + desc: t('llm.Ollama.endpoint.desc'), + label: t('llm.Ollama.endpoint.title'), + name: [LLMProviderConfigKey, providerKey, LLMProviderBaseUrlKey], + }, + { + children: ( + + ), + desc: t('llm.Ollama.customModelName.desc'), + label: t('llm.Ollama.customModelName.title'), + name: [LLMProviderConfigKey, providerKey, 'customModelName'], + }, + { + children: , + desc: t('llm.Ollama.checker.desc'), + label: t('llm.checker.title'), + minWidth: undefined, + }, + ], + defaultActive: enabled, + extra: ( + { + toggleProviderEnabled(providerKey, enabled); + }} + value={enabled} + /> + ), + title: ( + + + + ), + }; + + return ( +
+ ); +}); + +export default OllamaProvider; diff --git a/src/app/settings/llm/page.tsx b/src/app/settings/llm/page.tsx index 935bc708059b..4a0a0acf345c 100644 --- a/src/app/settings/llm/page.tsx +++ b/src/app/settings/llm/page.tsx @@ -7,17 +7,23 @@ import { Trans, useTranslation } from 'react-i18next'; import Footer from '@/app/settings/features/Footer'; import PageTitle from '@/components/PageTitle'; import { MORE_MODEL_PROVIDER_REQUEST_URL } from '@/const/url'; +import { useGlobalStore } from '@/store/global'; import { useSwitchSideBarOnInit } from '@/store/global/hooks/useSwitchSettingsOnInit'; import { SettingsTabs } from '@/store/global/initialState'; +import { modelProviderSelectors } from '@/store/global/selectors'; import Bedrock from './Bedrock'; import Google from './Google'; import Moonshot from './Moonshot'; +import Ollama from './Ollama'; import OpenAI from './OpenAI'; import Zhipu from './Zhipu'; export default memo(() => { useSwitchSideBarOnInit(SettingsTabs.LLM); + const enableOllamaFormServerConfig = useGlobalStore( + modelProviderSelectors.enableOllamaConfigInSettings, + ); const { t } = useTranslation('setting'); return ( <> @@ -28,6 +34,7 @@ export default memo(() => { + {enableOllamaFormServerConfig && }