Skip to content

Commit

Permalink
✨ feat: support 01.AI as a new provider (lobehub#1627)
Browse files Browse the repository at this point in the history
* ✨add: Support 01-AI Models

* 🔧 chore: fix a config typo for model desc

* 🌐 add: Base 01.AI locale json

* 🐛 fix: remove custom model name and dark mode Logo for 01AI

* 💄 optimize: optimize the 01AI/Groq icon show and fix unused import

* 💄 optimize: optimize the settings icon show rules

* ✨ feat: add 01.AI APIKey Error Form

* 💄 fix: PR 01.AI review issue

* 💄 revert: Groq logo change

* 🌐 style: update locale
  • Loading branch information
MapleEve authored Mar 25, 2024
1 parent 99c47da commit 08342fd
Show file tree
Hide file tree
Showing 79 changed files with 672 additions and 101 deletions.
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ OPENAI_API_KEY=sk-xxxxxxxxx

#OPENROUTER_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

########################################
######### 01.AI Service ##########
########################################

#ZEROONEAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

########################################
############ Market Service ############
########################################
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,7 @@ ENV MISTRAL_API_KEY ""
# OpenRouter
ENV OPENROUTER_API_KEY ""

# 01.AI
ENV ZEROONE_API_KEY ""

CMD ["node", "server.js"]
1 change: 1 addition & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
- **Anthropic (Claude)**:接入了 Anthropic 的 **Claude** 系列模型,包括 Claude 3 和 Claude 2,多模态突破,超长上下文,树立行业新基准。[了解更多](https://www.anthropic.com/claude)
- **ChatGLM**:加入了智谱的 **ChatGLM** 系列模型(GLM-4/GLM-4-vision/GLM-3-turbo),为用户提供了另一种高效的会话模型选择。[了解更多](https://www.zhipuai.cn/)
- **Moonshot AI (月之暗面)**:集成了 Moonshot 系列模型,这是一家来自中国的创新性 AI 创业公司,旨在提供更深层次的会话理解。[了解更多](https://www.moonshot.cn/)
- **01.AI (零一万物)**:集成了零一万物模型,系列 API 具备较快的推理速度,这不仅缩短了处理时间,同时也保持了出色的模型效果。[了解更多](https://www.lingyiwanwu.com/)
- **Groq**:接入了 Groq 的 AI 模型,高效处理消息序列,生成回应,胜任多轮对话及单次交互任务。[了解更多](https://groq.com/)
- **OpenRouter**:其支持包括 **Claude 3****Gemma****Mistral****Llama2****Cohere**等模型路由,支持智能路由优化,提升使用效率,开放且灵活。[了解更多](https://openrouter.ai/)

Expand Down
10 changes: 10 additions & 0 deletions docs/self-hosting/environment-variables/model-provider.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ LobeChat 在部署时提供了丰富的模型服务商相关的环境变量,
- 描述:这是你在 Groq AI 服务中申请的 API 密钥
- 默认值:-
- 示例:`gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx`

## OpenRouter AI

### `OPENROUTER_API_KEY`
Expand All @@ -185,4 +186,13 @@ LobeChat 在部署时提供了丰富的模型服务商相关的环境变量,
- 默认值:-
- 示例:`sk-or-v1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=`

## 01 AI

### `ZEROONE_API_KEY`

- 类型:必选
- 描述:这是你在零一万物服务中申请的 API 密钥
- 默认值:-
- 示例:`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
1 change: 1 addition & 0 deletions docs/usage/features/multi-ai-providers.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- **Google AI (Gemini Pro、Gemini Vision)**:接入了 Google 的 **Gemini** 系列模型,包括 Gemini 和 Gemini Pro,以支持更高级的语言理解和生成。[了解更多](https://deepmind.google/technologies/gemini/)
- **ChatGLM**:加入了智谱的 **ChatGLM** 系列模型(GLM-4/GLM-4-vision/GLM-3-turbo),为用户提供了另一种高效的会话模型选择。[了解更多](https://www.zhipuai.cn/)
- **Moonshot AI (月之暗面)**:集成了 Moonshot 系列模型,这是一家来自中国的创新性 AI 创业公司,旨在提供更深层次的会话理解。[了解更多](https://www.moonshot.cn/)
- **01 AI (零一万物)**:集成了零一万物模型,系列 API 具备较快的推理速度,这不仅缩短了处理时间,同时也保持了出色的模型效果。[了解更多](https://www.lingyiwanwu.com/)

同时,我们也在计划支持更多的模型服务商,如 Replicate 和 Perplexity 等,以进一步丰富我们的服务商库。如果你希望让 LobeChat 支持你喜爱的服务商,欢迎加入我们的[社区讨论](https://github.com/lobehub/lobe-chat/discussions/1284)

Expand Down
1 change: 1 addition & 0 deletions locales/ar/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"openai": "أوبن إيه آي",
"openrouter": "OpenRouter",
"perplexity": "Perplexity",
"zeroone": "01.AI الصفر والواحد",
"zhipu": "Zhipu"
},
"noDescription": "لا توجد وصف",
Expand Down
8 changes: 7 additions & 1 deletion locales/ar/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"InvalidOllamaArgs": "تكوين Ollama غير صحيح، يرجى التحقق من تكوين Ollama وإعادة المحاولة",
"InvalidOpenRouterAPIKey": "مفتاح OpenRouter API غير صحيح أو فارغ، يرجى التحقق من مفتاح OpenRouter API وإعادة المحاولة",
"InvalidPerplexityAPIKey": "مفتاح Perplexity API غير صحيح أو فارغ، يرجى التحقق من مفتاح Perplexity API وإعادة المحاولة",
"InvalidZeroOneAPIKey": "مفتاح ZeroOne API غير صحيح أو فارغ، يرجى التحقق من مفتاح ZeroOne API وإعادة المحاولة",
"InvalidZhipuAPIKey": "مفتاح Zhipu API غير صحيح أو فارغ، يرجى التحقق من مفتاح Zhipu API وإعادة المحاولة",
"LocationNotSupportError": "عذرًا، لا يدعم موقعك الحالي خدمة هذا النموذج، قد يكون ذلك بسبب قيود المنطقة أو عدم توفر الخدمة. يرجى التحقق مما إذا كان الموقع الحالي يدعم استخدام هذه الخدمة، أو محاولة استخدام معلومات الموقع الأخرى.",
"MistralBizError": "طلب خدمة Mistral AI خاطئ، يرجى التحقق من المعلومات التالية أو إعادة المحاولة",
Expand All @@ -72,6 +73,7 @@
"PluginOpenApiInitError": "عذرًا، فشل تهيئة عميل OpenAPI، يرجى التحقق من معلومات تكوين OpenAPI",
"PluginServerError": "خطأ في استجابة الخادم لطلب الإضافة، يرجى التحقق من ملف وصف الإضافة وتكوين الإضافة وتنفيذ الخادم وفقًا لمعلومات الخطأ أدناه",
"PluginSettingsInvalid": "تحتاج هذه الإضافة إلى تكوين صحيح قبل الاستخدام، يرجى التحقق من صحة تكوينك",
"ZeroOneBizError": "طلب خدمة ZeroOneBiz خطأ، يرجى التحقق من المعلومات أدناه أو إعادة المحاولة",
"ZhipuBizError": "حدث خطأ في طلب خدمة Zhipu، يرجى التحقق من المعلومات التالية أو إعادة المحاولة"
},
"stt": {
Expand Down Expand Up @@ -120,6 +122,10 @@
"description": "أدخل مفتاح Perplexity API الخاص بك للبدء في الجلسة. لن يتم تسجيل مفتاح الواجهة البرمجية لتطبيقات الجلسة",
"title": "استخدام مفتاح Perplexity API المخصص"
},
"ZeroOne": {
"description": "أدخل مفتاح ZeroOne API الخاص بك لبدء الجلسة. لن يتم تسجيل مفتاح الواجهة البرمجية لتطبيقك",
"title": "استخدام مفتاح واجهة برمجة التطبيقات الخاص بك لـ ZeroOne"
},
"Zhipu": {
"description": "أدخل مفتاح Zhipu API الخاص بك لبدء الجلسة. لن يقوم التطبيق بتسجيل مفتاح الواجهة البرمجية الخاص بك",
"title": "استخدام مفتاح Zhipu API المخصص"
Expand Down Expand Up @@ -150,4 +156,4 @@
"password": "كلمة المرور"
}
}
}
}
8 changes: 8 additions & 0 deletions locales/ar/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@
"title": "مفتاح الواجهة البرمجية للتطبيق"
}
},
"ZeroOne": {
"title": "01.AI الصفر والواحد",
"token": {
"desc": "أدخل مفتاح API من 01.AI الصفر والواحد",
"placeholder": "مفتاح API من 01.AI الصفر والواحد",
"title": "مفتاح API"
}
},
"Zhipu": {
"title": "Zhipu AI",
"token": {
Expand Down
1 change: 1 addition & 0 deletions locales/de-DE/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"openai": "OpenAI",
"openrouter": "OpenRouter",
"perplexity": "Perplexity",
"zeroone": "01.AI Null Eins Alles",
"zhipu": "Zhipu AI"
},
"noDescription": "Keine Beschreibung vorhanden",
Expand Down
8 changes: 7 additions & 1 deletion locales/de-DE/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"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.",
"InvalidZeroOneAPIKey": "Ungültiger oder leerer ZeroOne-API-Schlüssel. Bitte überprüfen Sie den ZeroOne-API-Schlüssel und versuchen Sie es erneut.",
"InvalidZhipuAPIKey": "Der Zhipu API-Schlüssel ist ungültig oder leer. Bitte überprüfen Sie den Zhipu API-Schlüssel und versuchen Sie es erneut.",
"LocationNotSupportError": "Entschuldigung, Ihr Standort unterstützt diesen Modellservice möglicherweise aufgrund von regionalen Einschränkungen oder nicht aktivierten Diensten nicht. Bitte überprüfen Sie, ob der aktuelle Standort die Verwendung dieses Dienstes unterstützt, oder versuchen Sie, andere Standortinformationen zu verwenden.",
"MistralBizError": "Beim Anfordern des Mistral AI-Dienstes ist ein Fehler aufgetreten. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.",
Expand All @@ -72,6 +73,7 @@
"PluginOpenApiInitError": "Entschuldigung, die Initialisierung des OpenAPI-Clients ist fehlgeschlagen. Bitte überprüfen Sie die Konfigurationsinformationen des OpenAPI auf Richtigkeit",
"PluginServerError": "Fehler bei der Serveranfrage des Plugins. Bitte überprüfen Sie die Fehlerinformationen unten in Ihrer Plugin-Beschreibungsdatei, Plugin-Konfiguration oder Serverimplementierung",
"PluginSettingsInvalid": "Das Plugin muss korrekt konfiguriert werden, um verwendet werden zu können. Bitte überprüfen Sie Ihre Konfiguration auf Richtigkeit",
"ZeroOneBizError": "Anfrage an ZeroOneBiz-Dienst fehlgeschlagen. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.",
"ZhipuBizError": "Es ist ein Fehler bei der Anforderung des Zhipu-Dienstes aufgetreten. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut."
},
"stt": {
Expand Down Expand Up @@ -120,6 +122,10 @@
"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"
},
"ZeroOne": {
"description": "Geben Sie Ihren benutzerdefinierten ZeroOne-API-Schlüssel ein, um die Sitzung zu starten. Die App speichert Ihren API-Schlüssel nicht.",
"title": "Verwenden Sie einen benutzerdefinierten ZeroOne-API-Schlüssel"
},
"Zhipu": {
"description": "Geben Sie Ihren Zhipu API-Schlüssel ein, um die Sitzung zu starten. Die Anwendung speichert Ihren API-Schlüssel nicht.",
"title": "Verwenden von benutzerdefinierten Zhipu API-Schlüssel"
Expand Down Expand Up @@ -150,4 +156,4 @@
"password": "Passwort"
}
}
}
}
8 changes: 8 additions & 0 deletions locales/de-DE/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@
"title": "API-Schlüssel"
}
},
"ZeroOne": {
"title": "01.AI ZeroOne",
"token": {
"desc": "Geben Sie den API-Schlüssel von 01.AI ZeroOne ein",
"placeholder": "01.AI ZeroOne API-Schlüssel",
"title": "API-Schlüssel"
}
},
"Zhipu": {
"title": "Zhipu AI",
"token": {
Expand Down
1 change: 1 addition & 0 deletions locales/en-US/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"openai": "OpenAI",
"openrouter": "OpenRouter",
"perplexity": "Perplexity",
"zeroone": "01-AI",
"zhipu": "Zhipu AI"
},
"noDescription": "No description available",
Expand Down
8 changes: 7 additions & 1 deletion locales/en-US/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"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.",
"InvalidZeroOneAPIKey": "01-AI API Key is incorrect or empty. Please check the 01-AI API Key and retry.",
"InvalidZhipuAPIKey": "Zhipu API Key is incorrect or empty. Please check the Zhipu API Key and retry.",
"LocationNotSupportError": "We're sorry, your current location does not support this model service. This may be due to regional restrictions or the service not being available. Please confirm if the current location supports using this service, or try using a different location.",
"MistralBizError": "Error occurred while requesting Mistral AI service. Please troubleshoot based on the following information or retry.",
Expand All @@ -72,6 +73,7 @@
"PluginOpenApiInitError": "Sorry, the OpenAPI client failed to initialize. Please check if the OpenAPI configuration information is correct.",
"PluginServerError": "Plugin server request returned an error. Please check your plugin manifest file, plugin configuration, or server implementation based on the error information below",
"PluginSettingsInvalid": "This plugin needs to be correctly configured before it can be used. Please check if your configuration is correct",
"ZeroOneBizError": "Error requesting 01-AI service. Please troubleshoot or retry based on the following information.",
"ZhipuBizError": "Error requesting Zhipu service. Please troubleshoot or retry based on the following information."
},
"stt": {
Expand Down Expand Up @@ -120,6 +122,10 @@
"description": "Enter your Perplexity API Key to start the session. The app will not store your API Key.",
"title": "Use custom Perplexity API Key"
},
"ZeroOne": {
"description": "Enter your 01-AI API Key to start the session. The application will not store your API Key.",
"title": "Use Custom 01-AI API Key"
},
"Zhipu": {
"description": "Enter your Zhipu API Key to start the session. The app will not store your API Key.",
"title": "Use custom Zhipu API Key"
Expand Down Expand Up @@ -150,4 +156,4 @@
"password": "Password"
}
}
}
}
8 changes: 8 additions & 0 deletions locales/en-US/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@
"title": "API Key"
}
},
"ZeroOne": {
"title": "01-AI",
"token": {
"desc": "Enter the API Key from 01-AI",
"placeholder": "01-AI API Key",
"title": "API Key"
}
},
"Zhipu": {
"title": "Zhipu",
"token": {
Expand Down
1 change: 1 addition & 0 deletions locales/es-ES/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"openai": "OpenAI",
"openrouter": "OpenRouter",
"perplexity": "Perplexity",
"zeroone": "01.AI ZeroOne",
"zhipu": "Zhipu AI"
},
"noDescription": "Sin descripción",
Expand Down
8 changes: 7 additions & 1 deletion locales/es-ES/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"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",
"InvalidZeroOneAPIKey": "La clave de API de ZeroOneBiz es incorrecta o está vacía. Por favor, revise la clave de API de ZeroOneBiz e inténtelo de nuevo.",
"InvalidZhipuAPIKey": "La clave de API de Zhipu es incorrecta o está vacía, por favor, verifica la clave de API de Zhipu e inténtalo de nuevo",
"LocationNotSupportError": "Lo sentimos, tu ubicación actual no es compatible con este servicio de modelo, puede ser debido a restricciones geográficas o a que el servicio no está disponible. Por favor, verifica si tu ubicación actual es compatible con este servicio o intenta usar otra información de ubicación.",
"MistralBizError": "Se produjo un error al solicitar el servicio Mistral AI. Por favor, revise la siguiente información o inténtelo de nuevo.",
Expand All @@ -72,6 +73,7 @@
"PluginOpenApiInitError": "Lo sentimos, la inicialización del cliente OpenAPI ha fallado. Verifique si la información de configuración de OpenAPI es correcta",
"PluginServerError": "Error al recibir la respuesta del servidor del complemento. Verifique el archivo de descripción del complemento, la configuración del complemento o la implementación del servidor según la información de error a continuación",
"PluginSettingsInvalid": "Este complemento necesita una configuración correcta antes de poder usarse. Verifique si su configuración es correcta",
"ZeroOneBizError": "Se produjo un error al solicitar el servicio ZeroOneBiz. Por favor, revise la siguiente información o inténtelo de nuevo.",
"ZhipuBizError": "Se produjo un error al solicitar el servicio Zhipu, por favor, verifica la siguiente información o inténtalo de nuevo"
},
"stt": {
Expand Down Expand Up @@ -120,6 +122,10 @@
"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"
},
"ZeroOne": {
"description": "Ingrese su clave de API de ZeroOneBiz para comenzar la sesión. La aplicación no almacenará su clave de API.",
"title": "Usar clave de API personalizada de ZeroOneBiz"
},
"Zhipu": {
"description": "Ingresa tu clave de API de Zhipu para comenzar la sesión. La aplicación no guardará tu clave de API",
"title": "Usar clave de API personalizada de Zhipu"
Expand Down Expand Up @@ -150,4 +156,4 @@
"password": "Contraseña"
}
}
}
}
8 changes: 8 additions & 0 deletions locales/es-ES/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@
"title": "Clave API"
}
},
"ZeroOne": {
"title": "01.AI ZeroOne",
"token": {
"desc": "Introduce la clave API de 01.AI ZeroOne",
"placeholder": "Clave API de 01.AI ZeroOne",
"title": "Clave API"
}
},
"Zhipu": {
"title": "Zhipu AI",
"token": {
Expand Down
1 change: 1 addition & 0 deletions locales/fr-FR/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"openai": "OpenAI",
"openrouter": "OpenRouter",
"perplexity": "Perplexity",
"zeroone": "01. Intelligence Artificielle ZeroOne",
"zhipu": "Zhipu AI"
},
"noDescription": "Aucune description disponible",
Expand Down
Loading

0 comments on commit 08342fd

Please sign in to comment.