Skip to content

Commit 75cd63a

Browse files
justmywywMingholy
andauthored
✨ feat: Support Qwen as new model provider (#2715)
Co-authored-by: mingholy.lmh <[email protected]>
1 parent 5676899 commit 75cd63a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+707
-5
lines changed

.env.example

+4
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ OPENAI_API_KEY=sk-xxxxxxxxx
108108

109109
# DEEPSEEK_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
110110

111+
### Qwen AI ####
112+
113+
# QWEN_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
114+
111115
########################################
112116
############ Market Service ############
113117
########################################

Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,7 @@ ENV MINIMAX_API_KEY ""
132132
# DeepSeek
133133
ENV DEEPSEEK_API_KEY ""
134134

135+
# Qwen
136+
ENV QWEN_API_KEY ""
137+
135138
CMD ["node", "server.js"]

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ We have implemented support for the following model service providers:
131131
- **Moonshot AI (Dark Side of the Moon)**: Integrated with the Moonshot series models, an innovative AI startup from China, aiming to provide deeper conversation understanding. [Learn more](https://www.moonshot.cn/)
132132
- **Minimax**: Integrated the Minimax models, including the MoE model **abab6**, offers a broader range of choices. [Learn more](https://www.minimaxi.com/)
133133
- **DeepSeek**: Integrated with the DeepSeek series models, an innovative AI startup from China, The product has been designed to provide a model that balances performance with price. [Learn more](https://www.deepseek.com/)
134+
- **Qwen**: Integrated the Qwen series models, including the latest **qwen-turbo**, **qwen-plus** and **qwen-max**. [Lean more](https://help.aliyun.com/zh/dashscope/developer-reference/model-introduction)
134135

135136
At the same time, we are also planning to support more model service providers, such as Replicate and Perplexity, to further enrich our service provider library. If you would like LobeChat to support your favorite service provider, feel free to join our [community discussion](https://github.com/lobehub/lobe-chat/discussions/1284).
136137

README.zh-CN.md

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
- **OpenRouter**:其支持包括 **Claude 3****Gemma****Mistral****Llama2****Cohere**等模型路由,支持智能路由优化,提升使用效率,开放且灵活。[了解更多](https://openrouter.ai/)
131131
- **Minimax**: 接入了 Minimax 的 AI 模型,包括 MoE 模型 **abab6**,提供了更多的选择空间。[了解更多](https://www.minimaxi.com/)
132132
- **DeepSeek**: 接入了 DeepSeek 的 AI 模型,包括最新的 **DeepSeek-V2**,提供兼顾性能与价格的模型。[了解更多](https://www.deepseek.com/)
133+
- **Qwen**: 接入了 Qwen 的 AI 模型,包括最新的 **qwen-turbo****qwen-plus****qwen-max** 等模型。[了解更多](https://help.aliyun.com/zh/dashscope/developer-reference/model-introduction)
133134

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

docs/self-hosting/advanced/upstream-sync.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,4 @@ The following command configures Crontab to execute scripts every 5 minutes, or
158158
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
159159
```
160160

161-
</Steps>
161+
</Steps>

docs/self-hosting/environment-variables/model-provider.mdx

+10-1
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,15 @@ If you need to use Azure OpenAI to provide model services, you can refer to the
285285
- Type: Required
286286
- Description: This is the API key you applied for in the 01.AI service
287287
- Default: -
288-
- 示例:`xxxxxx...xxxxxx`
288+
- Example:`xxxxxx...xxxxxx`
289+
290+
## Qwen
291+
292+
### `QWEN_API_KEY`
293+
294+
- Type: Required
295+
- Description: This is the DashScope API key you can obtain from Alibaba Cloud
296+
- Default: -
297+
- Example:`sk-xxxxx...xxxxx`
289298

290299
[model-list]: /docs/self-hosting/advanced/model-list

docs/self-hosting/environment-variables/model-provider.zh-CN.mdx

+9
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,12 @@ LobeChat 在部署时提供了丰富的模型服务商相关的环境变量,
286286
- 示例:`xxxxxx...xxxxxx`
287287

288288
[model-list]: /docs/self-hosting/advanced/model-list
289+
290+
## 通义千问
291+
292+
### `QWEN_API_KEY`
293+
294+
- 类型:必选
295+
- 描述:这是你在阿里云百炼平台上获取的 DashScope API 密钥
296+
- 默认值:-
297+
- 示例:`sk-xxxxx...xxxxx`

docs/usage/features/multi-ai-providers.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ We have implemented support for the following model service providers:
4646
- **Together.ai**: Over 100 leading open-source Chat, Language, Image, Code, and Embedding models are available through the Together Inference API. For these models you pay just for what you use. [Learn more](https://www.together.ai/)
4747
- **Minimax**: Integrated the Minimax models, including the MoE model **abab6**, offers a broader range of choices. [Learn more](https://www.minimaxi.com/)
4848
- **DeepSeek**: Integrated with the DeepSeek series models, an innovative AI startup from China, The product has been designed to provide a model that balances performance with price. [Learn more](https://www.deepseek.com/)
49+
- **Qwen**: Integrated with the Qwen series models, including the latest **qwen-turbo**, **qwen-plus** and **qwen-max**. [Learn more](https://help.aliyun.com/zh/dashscope/developer-reference/model-introduction)
4950

5051
At the same time, we are also planning to support more model service providers, such as Replicate and Perplexity, to further enrich our service provider library. If you would like LobeChat to support your favorite service provider, feel free to join our [community discussion](https://github.com/lobehub/lobe-chat/discussions/1284).
5152

docs/usage/features/multi-ai-providers.zh-CN.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ tags:
4646
- **OpenRouter**:其支持包括 **Claude 3****Gemma****Mistral****Llama2****Cohere**等模型路由,支持智能路由优化,提升使用效率,开放且灵活。[了解更多](https://openrouter.ai/)
4747
- **Minimax**: 接入了 Minimax 的 AI 模型,包括 MoE 模型 **abab6**,提供了更多的选择空间。[了解更多](https://www.minimaxi.com/)
4848
- **DeepSeek**: 接入了 DeepSeek 的 AI 模型,包括最新的 **DeepSeek-V2**,提供兼顾性能与价格的模型。[了解更多](https://www.deepseek.com/)
49+
- **Qwen (通义千问)**: 接入了 Qwen 的 AI 模型,包括最新的 **qwen-turbo****qwen-plus****qwen-max** 等模型。[了解更多](https://help.aliyun.com/zh/dashscope/developer-reference/model-introduction)
4950

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

locales/ar/error.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
"InvalidTogetherAIAPIKey": "مفتاح TogetherAI API غير صحيح أو فارغ، يرجى التحقق من مفتاح TogetherAI API وإعادة المحاولة",
7878
"InvalidZeroOneAPIKey": "مفتاح ZeroOne API غير صحيح أو فارغ، يرجى التحقق من مفتاح ZeroOne API وإعادة المحاولة",
7979
"InvalidZhipuAPIKey": "مفتاح Zhipu API غير صحيح أو فارغ، يرجى التحقق من مفتاح Zhipu API وإعادة المحاولة",
80+
"InvalidQwenAPIKey": "مفتاح Qwen API غير صحيح أو فارغ، يرجى التحقق من مفتاح Qwen API وإعادة المحاولة",
8081
"LocationNotSupportError": "عذرًا، لا يدعم موقعك الحالي خدمة هذا النموذج، قد يكون ذلك بسبب قيود المنطقة أو عدم توفر الخدمة. يرجى التحقق مما إذا كان الموقع الحالي يدعم استخدام هذه الخدمة، أو محاولة استخدام معلومات الموقع الأخرى.",
8182
"MinimaxBizError": "حدث خطأ في طلب خدمة Minimax، يرجى التحقق من المعلومات التالية أو إعادة المحاولة",
8283
"MistralBizError": "طلب خدمة Mistral AI خاطئ، يرجى التحقق من المعلومات التالية أو إعادة المحاولة",
@@ -101,7 +102,8 @@
101102
"PluginSettingsInvalid": "تحتاج هذه الإضافة إلى تكوين صحيح قبل الاستخدام، يرجى التحقق من صحة تكوينك",
102103
"TogetherAIBizError": "خطأ في طلب خدمة TogetherAI AI، يرجى التحقق من المعلومات التالية أو إعادة المحاولة",
103104
"ZeroOneBizError": "طلب خدمة ZeroOneBiz خطأ، يرجى التحقق من المعلومات أدناه أو إعادة المحاولة",
104-
"ZhipuBizError": "حدث خطأ في طلب خدمة Zhipu، يرجى التحقق من المعلومات التالية أو إعادة المحاولة"
105+
"ZhipuBizError": "حدث خطأ في طلب خدمة Zhipu، يرجى التحقق من المعلومات التالية أو إعادة المحاولة",
106+
"QwenBizError": "حدث خطأ في طلب خدمة Qwen، يرجى التحقق من المعلومات التالية أو إعادة المحاولة"
105107
},
106108
"stt": {
107109
"responseError": "فشل طلب الخدمة، يرجى التحقق من الإعدادات أو إعادة المحاولة"

locales/ar/modelProvider.json

+12
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,18 @@
217217
"title": "استخدام مفتاح API الخاص بـ Perplexity المخصص"
218218
}
219219
},
220+
"qwen": {
221+
"title": "Qwen",
222+
"token": {
223+
"desc": "أدخل مفتاح API الخاص بـ Qwen",
224+
"placeholder": "Qwen API Key",
225+
"title": "مفتاح API"
226+
},
227+
"unlock": {
228+
"description": "أدخل مفتاح API الخاص بك في Qwen لبدء الجلسة. لن يتم تسجيل مفتاح الخاص بك من قبل التطبيق",
229+
"title": "استخدام مفتاح API الخاص بـ Qwen المخصص"
230+
}
231+
},
220232
"togetherai": {
221233
"checker": {
222234
"desc": "اختبر ما إذا تم إدخال عنوان الوكيل بشكل صحيح"

locales/bg-BG/error.json

+2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"InvalidOllamaArgs": "Невалидна конфигурация на Ollama, моля, проверете конфигурацията на Ollama и опитайте отново",
7575
"InvalidOpenRouterAPIKey": "Невалиден или празен API ключ на OpenRouter. Моля, проверете вашия API ключ на OpenRouter и опитайте отново.",
7676
"InvalidPerplexityAPIKey": "API ключът на Perplexity е неправилен или празен. Моля, проверете API ключа на Perplexity и опитайте отново.",
77+
"InvalidQwenAPIKey": "API ключът на Qwen е неправилен или празен. Моля, проверете API ключа на Qwen и опитайте отново.",
7778
"InvalidTogetherAIAPIKey": "TogetherAI API ключът е неправилен или липсва, моля, проверете TogetherAI API ключа и опитайте отново",
7879
"InvalidZeroOneAPIKey": "API ключът на 01-AI е неправилен или празен. Моля, проверете API ключа на 01-AI и опитайте отново.",
7980
"InvalidZhipuAPIKey": "API ключът на Zhipu е неправилен или празен. Моля, проверете API ключа на Zhipu и опитайте отново.",
@@ -99,6 +100,7 @@
99100
"PluginOpenApiInitError": "Съжаляваме, клиентът на OpenAPI не успя да се инициализира. Моля, проверете дали информацията за конфигурацията на OpenAPI е правилна.",
100101
"PluginServerError": "Заявката към сървъра на плъгина върна грешка. Моля, проверете файла на манифеста на плъгина, конфигурацията на плъгина или изпълнението на сървъра въз основа на информацията за грешката по-долу",
101102
"PluginSettingsInvalid": "Този плъгин трябва да бъде конфигуриран правилно, преди да може да се използва. Моля, проверете дали конфигурацията ви е правилна",
103+
"QwenBizError": "Грешка при заявка към услугата Qwen. Моля, отстранете неизправностите или опитайте отново въз основа на следната информация.",
102104
"TogetherAIBizError": "Възникна грешка при заявка към TogetherAI AI услугата, моля, проверете следната информация или опитайте отново",
103105
"ZeroOneBizError": "Грешка при заявка към услугата 01-AI. Моля, отстранете неизправностите или опитайте отново въз основа на следната информация.",
104106
"ZhipuBizError": "Грешка при заявка към услугата Zhipu. Моля, отстранете неизправностите или опитайте отново въз основа на следната информация."

locales/bg-BG/modelProvider.json

+12
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,18 @@
217217
"title": "Използване на персонализиран Perplexity API ключ"
218218
}
219219
},
220+
"qwen": {
221+
"title": "Qwen",
222+
"token": {
223+
"desc": "Въведете API Key, получен от Интелигентен албум",
224+
"placeholder": "Qwen API Key",
225+
"title": "API ключ"
226+
},
227+
"unlock": {
228+
"description": "Въведете вашия Qwen API ключ, за да започнете сесия. Приложението няма да запази вашия API ключ",
229+
"title": "Използване на персонализиран Qwen API ключ"
230+
}
231+
},
220232
"togetherai": {
221233
"checker": {
222234
"desc": "Тестване дали адресът на прокси е попълнен правилно"

locales/de-DE/error.json

+2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"InvalidOllamaArgs": "Ollama-Konfiguration ist ungültig. Bitte überprüfen Sie die Ollama-Konfiguration und versuchen Sie es erneut.",
7575
"InvalidOpenRouterAPIKey": "OpenRouter API-Schlüssel ungültig oder leer. Bitte überprüfen Sie den OpenRouter API-Schlüssel und versuchen Sie es erneut.",
7676
"InvalidPerplexityAPIKey": "Perplexity API Key ist ungültig oder leer. Bitte überprüfen Sie den Perplexity API Key und versuchen Sie es erneut.",
77+
"InvalidQwenAPIKey": "Der Qwen API-Schlüssel ist ungültig oder leer. Bitte überprüfen Sie den Qwen API-Schlüssel und versuchen Sie es erneut.",
7778
"InvalidTogetherAIAPIKey": "TogetherAI API-Schlüssel ungültig oder leer. Bitte überprüfen Sie den TogetherAI API-Schlüssel und versuchen Sie es erneut.",
7879
"InvalidZeroOneAPIKey": "Ungültiger oder leerer ZeroOne-API-Schlüssel. Bitte überprüfen Sie den ZeroOne-API-Schlüssel und versuchen Sie es erneut.",
7980
"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.",
@@ -99,6 +100,7 @@
99100
"PluginOpenApiInitError": "Entschuldigung, die Initialisierung des OpenAPI-Clients ist fehlgeschlagen. Bitte überprüfen Sie die Konfigurationsinformationen des OpenAPI auf Richtigkeit",
100101
"PluginServerError": "Fehler bei der Serveranfrage des Plugins. Bitte überprüfen Sie die Fehlerinformationen unten in Ihrer Plugin-Beschreibungsdatei, Plugin-Konfiguration oder Serverimplementierung",
101102
"PluginSettingsInvalid": "Das Plugin muss korrekt konfiguriert werden, um verwendet werden zu können. Bitte überprüfen Sie Ihre Konfiguration auf Richtigkeit",
103+
"QwenBizError": "Es ist ein Fehler bei der Anforderung des Qwen-Dienstes aufgetreten. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.",
102104
"TogetherAIBizError": "Fehler bei der Anforderung des TogetherAI AI-Dienstes. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.",
103105
"ZeroOneBizError": "Anfrage an ZeroOneBiz-Dienst fehlgeschlagen. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.",
104106
"ZhipuBizError": "Es ist ein Fehler bei der Anforderung des Zhipu-Dienstes aufgetreten. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut."

locales/de-DE/modelProvider.json

+12
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,18 @@
217217
"title": "Verwenden Sie einen individuellen Perplexity-API-Schlüssel"
218218
}
219219
},
220+
"qwen": {
221+
"title": "Qwen",
222+
"token": {
223+
"desc": "Geben Sie Ihren API-Key von Qwen ein",
224+
"placeholder": "Qwen API Key",
225+
"title": "API Key"
226+
},
227+
"unlock": {
228+
"description": "Geben Sie Ihren individuellen Qwen-API-Schlüssel ein, um das Gespräch zu beginnen. Die App speichert Ihren API-Schlüssel nicht.",
229+
"title": "Verwenden Sie einen individuellen Qwen-API-Schlüssel"
230+
}
231+
},
220232
"togetherai": {
221233
"checker": {
222234
"desc": "Testen Sie, ob die Proxy-Adresse korrekt eingetragen wurde"

locales/en-US/error.json

+2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"InvalidOllamaArgs": "Invalid Ollama configuration, please check Ollama configuration and try again",
7575
"InvalidOpenRouterAPIKey": "Invalid or empty OpenRouter API Key. Please check your OpenRouter API Key and try again.",
7676
"InvalidPerplexityAPIKey": "Perplexity API Key is incorrect or empty. Please check the Perplexity API Key and retry.",
77+
"InvalidQwenAPIKey": "Qwen API Key is incorrect or empty. Please check the Qwen API Key and retry.",
7778
"InvalidTogetherAIAPIKey": "Invalid or empty TogetherAI API Key. Please check your TogetherAI API Key and try again.",
7879
"InvalidZeroOneAPIKey": "01-AI API Key is incorrect or empty. Please check the 01-AI API Key and retry.",
7980
"InvalidZhipuAPIKey": "Zhipu API Key is incorrect or empty. Please check the Zhipu API Key and retry.",
@@ -99,6 +100,7 @@
99100
"PluginOpenApiInitError": "Sorry, the OpenAPI client failed to initialize. Please check if the OpenAPI configuration information is correct.",
100101
"PluginServerError": "Plugin server request returned an error. Please check your plugin manifest file, plugin configuration, or server implementation based on the error information below",
101102
"PluginSettingsInvalid": "This plugin needs to be correctly configured before it can be used. Please check if your configuration is correct",
103+
"QwenBizError": "Error requesting Qwen service. Please troubleshoot or retry based on the following information.",
102104
"TogetherAIBizError": "Error requesting TogetherAI AI service. Please troubleshoot or retry based on the following information.",
103105
"ZeroOneBizError": "Error requesting 01-AI service. Please troubleshoot or retry based on the following information.",
104106
"ZhipuBizError": "Error requesting Zhipu service. Please troubleshoot or retry based on the following information."

locales/en-US/modelProvider.json

+12
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,18 @@
217217
"title": "Use custom Perplexity API Key"
218218
}
219219
},
220+
"qwen": {
221+
"title": "Qwen",
222+
"token": {
223+
"desc": "Enter the API Key from Qwen",
224+
"placeholder": "Qwen API Key",
225+
"title": "API Key"
226+
},
227+
"unlock": {
228+
"description": "Enter your Qwen API Key to start the session. The app will not store your API Key.",
229+
"title": "Use Custom Qwen API Key"
230+
}
231+
},
220232
"togetherai": {
221233
"checker": {
222234
"desc": "Test if the proxy address is correctly filled in"

0 commit comments

Comments
 (0)