@lobehub/chat 0.162.16 → 0.162.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +4 -0
- package/CHANGELOG.md +50 -0
- package/Dockerfile +3 -0
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/docs/self-hosting/advanced/settings-url-share.mdx +89 -57
- package/docs/self-hosting/advanced/settings-url-share.zh-CN.mdx +87 -56
- package/docs/self-hosting/advanced/upstream-sync.mdx +1 -1
- package/docs/self-hosting/environment-variables/model-provider.mdx +10 -1
- package/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx +9 -0
- package/docs/usage/features/multi-ai-providers.mdx +1 -0
- package/docs/usage/features/multi-ai-providers.zh-CN.mdx +1 -0
- package/locales/ar/error.json +7 -37
- package/locales/ar/modelProvider.json +15 -171
- package/locales/ar/setting.json +5 -8
- package/locales/bg-BG/error.json +6 -36
- package/locales/bg-BG/modelProvider.json +15 -171
- package/locales/bg-BG/setting.json +5 -8
- package/locales/de-DE/error.json +6 -36
- package/locales/de-DE/modelProvider.json +15 -171
- package/locales/de-DE/setting.json +5 -8
- package/locales/en-US/error.json +6 -36
- package/locales/en-US/modelProvider.json +15 -171
- package/locales/en-US/setting.json +6 -9
- package/locales/es-ES/error.json +6 -36
- package/locales/es-ES/modelProvider.json +15 -171
- package/locales/es-ES/setting.json +5 -8
- package/locales/fr-FR/error.json +6 -36
- package/locales/fr-FR/modelProvider.json +15 -171
- package/locales/fr-FR/setting.json +9 -12
- package/locales/it-IT/error.json +6 -36
- package/locales/it-IT/modelProvider.json +15 -171
- package/locales/it-IT/setting.json +5 -8
- package/locales/ja-JP/error.json +6 -36
- package/locales/ja-JP/modelProvider.json +15 -171
- package/locales/ja-JP/setting.json +5 -8
- package/locales/ko-KR/error.json +6 -36
- package/locales/ko-KR/modelProvider.json +15 -171
- package/locales/ko-KR/setting.json +5 -8
- package/locales/nl-NL/error.json +6 -36
- package/locales/nl-NL/modelProvider.json +15 -171
- package/locales/nl-NL/setting.json +5 -8
- package/locales/pl-PL/error.json +6 -36
- package/locales/pl-PL/modelProvider.json +15 -171
- package/locales/pl-PL/setting.json +6 -9
- package/locales/pt-BR/error.json +6 -36
- package/locales/pt-BR/modelProvider.json +15 -171
- package/locales/pt-BR/setting.json +5 -8
- package/locales/ru-RU/error.json +6 -36
- package/locales/ru-RU/modelProvider.json +15 -171
- package/locales/ru-RU/setting.json +5 -8
- package/locales/tr-TR/error.json +6 -36
- package/locales/tr-TR/modelProvider.json +15 -171
- package/locales/tr-TR/setting.json +5 -8
- package/locales/vi-VN/error.json +6 -36
- package/locales/vi-VN/modelProvider.json +15 -171
- package/locales/vi-VN/setting.json +5 -8
- package/locales/zh-CN/error.json +7 -37
- package/locales/zh-CN/modelProvider.json +15 -171
- package/locales/zh-CN/setting.json +5 -8
- package/locales/zh-TW/error.json +7 -37
- package/locales/zh-TW/modelProvider.json +15 -171
- package/locales/zh-TW/setting.json +5 -8
- package/package.json +1 -2
- package/src/app/(main)/settings/llm/ProviderList/Azure/index.tsx +107 -0
- package/src/app/(main)/settings/llm/ProviderList/Bedrock/index.tsx +68 -0
- package/src/app/(main)/settings/llm/ProviderList/Ollama/index.tsx +29 -0
- package/src/app/(main)/settings/llm/ProviderList/OpenAI/index.tsx +20 -0
- package/src/app/(main)/settings/llm/ProviderList/providers.tsx +141 -0
- package/src/app/(main)/settings/llm/components/ProviderConfig/index.tsx +18 -27
- package/src/app/(main)/settings/llm/index.tsx +7 -34
- package/src/app/(main)/settings/llm/type.ts +5 -0
- package/src/app/api/chat/[provider]/route.ts +8 -3
- package/src/app/api/chat/agentRuntime.test.ts +17 -0
- package/src/app/api/chat/agentRuntime.ts +7 -0
- package/src/app/api/errorResponse.test.ts +7 -89
- package/src/app/api/errorResponse.ts +6 -43
- package/src/app/api/middleware/auth/index.ts +7 -3
- package/src/components/ModelProviderIcon/index.tsx +5 -0
- package/src/components/ModelSelect/index.tsx +7 -10
- package/src/config/llm.ts +6 -0
- package/src/config/modelProviders/anthropic.ts +5 -0
- package/src/config/modelProviders/azure.ts +2 -0
- package/src/config/modelProviders/bedrock.ts +2 -0
- package/src/config/modelProviders/deepseek.ts +4 -1
- package/src/config/modelProviders/google.ts +5 -0
- package/src/config/modelProviders/groq.ts +5 -0
- package/src/config/modelProviders/index.ts +4 -0
- package/src/config/modelProviders/minimax.ts +2 -0
- package/src/config/modelProviders/mistral.ts +2 -0
- package/src/config/modelProviders/moonshot.ts +2 -0
- package/src/config/modelProviders/ollama.ts +4 -0
- package/src/config/modelProviders/openai.ts +3 -0
- package/src/config/modelProviders/openrouter.ts +3 -0
- package/src/config/modelProviders/perplexity.ts +5 -0
- package/src/config/modelProviders/qwen.ts +35 -0
- package/src/config/modelProviders/togetherai.ts +3 -0
- package/src/config/modelProviders/zeroone.ts +4 -2
- package/src/config/modelProviders/zhipu.ts +2 -0
- package/src/const/settings/llm.ts +5 -0
- package/src/features/Conversation/Error/APIKeyForm/ProviderApiKeyForm.tsx +6 -3
- package/src/features/Conversation/Error/APIKeyForm/ProviderAvatar.tsx +5 -0
- package/src/features/Conversation/Error/APIKeyForm/index.tsx +4 -0
- package/src/features/Conversation/Error/OllamaBizError/InvalidOllamaModel/index.tsx +11 -14
- package/src/features/Conversation/Error/index.tsx +29 -19
- package/src/features/Conversation/components/ChatItem/index.tsx +4 -13
- package/src/features/ModelSelect/index.tsx +1 -1
- package/src/features/ModelSwitchPanel/index.tsx +1 -1
- package/src/hooks/useProviderName.ts +8 -0
- package/src/libs/agent-runtime/AgentRuntime.ts +8 -1
- package/src/libs/agent-runtime/anthropic/index.test.ts +8 -5
- package/src/libs/agent-runtime/anthropic/index.ts +3 -3
- package/src/libs/agent-runtime/azureOpenai/index.test.ts +5 -2
- package/src/libs/agent-runtime/azureOpenai/index.ts +2 -2
- package/src/libs/agent-runtime/bedrock/index.test.ts +2 -2
- package/src/libs/agent-runtime/bedrock/index.ts +2 -2
- package/src/libs/agent-runtime/deepseek/index.test.ts +3 -2
- package/src/libs/agent-runtime/deepseek/index.ts +0 -5
- package/src/libs/agent-runtime/error.ts +11 -43
- package/src/libs/agent-runtime/google/index.test.ts +3 -4
- package/src/libs/agent-runtime/google/index.ts +4 -4
- package/src/libs/agent-runtime/groq/index.test.ts +3 -2
- package/src/libs/agent-runtime/groq/index.ts +0 -4
- package/src/libs/agent-runtime/index.ts +1 -0
- package/src/libs/agent-runtime/minimax/index.test.ts +3 -2
- package/src/libs/agent-runtime/minimax/index.ts +5 -5
- package/src/libs/agent-runtime/mistral/index.test.ts +2 -2
- package/src/libs/agent-runtime/mistral/index.ts +0 -5
- package/src/libs/agent-runtime/moonshot/index.test.ts +3 -2
- package/src/libs/agent-runtime/moonshot/index.ts +0 -5
- package/src/libs/agent-runtime/openrouter/index.test.ts +3 -2
- package/src/libs/agent-runtime/openrouter/index.ts +0 -6
- package/src/libs/agent-runtime/perplexity/index.test.ts +2 -2
- package/src/libs/agent-runtime/perplexity/index.ts +0 -5
- package/src/libs/agent-runtime/qwen/index.test.ts +251 -0
- package/src/libs/agent-runtime/qwen/index.ts +28 -0
- package/src/libs/agent-runtime/togetherai/index.test.ts +3 -2
- package/src/libs/agent-runtime/togetherai/index.ts +0 -5
- package/src/libs/agent-runtime/types/type.ts +1 -1
- package/src/libs/agent-runtime/utils/openaiCompatibleFactory/index.test.ts +123 -6
- package/src/libs/agent-runtime/utils/openaiCompatibleFactory/index.ts +12 -6
- package/src/libs/agent-runtime/utils/streams/openai.ts +1 -1
- package/src/libs/agent-runtime/zeroone/index.test.ts +3 -2
- package/src/libs/agent-runtime/zeroone/index.ts +1 -5
- package/src/libs/agent-runtime/zhipu/index.test.ts +8 -5
- package/src/libs/agent-runtime/zhipu/index.ts +2 -2
- package/src/locales/default/error.ts +10 -51
- package/src/locales/default/modelProvider.ts +12 -169
- package/src/locales/default/setting.ts +5 -8
- package/src/server/globalConfig/index.ts +2 -0
- package/src/services/__tests__/chat.test.ts +16 -0
- package/src/services/chat.ts +3 -0
- package/src/services/message/client.test.ts +4 -1
- package/src/types/fetch.ts +3 -1
- package/src/types/llm.ts +22 -0
- package/src/types/user/settings/keyVaults.ts +1 -0
- package/src/app/(main)/settings/llm/Anthropic/index.tsx +0 -25
- package/src/app/(main)/settings/llm/Azure/index.tsx +0 -110
- package/src/app/(main)/settings/llm/Bedrock/index.tsx +0 -74
- package/src/app/(main)/settings/llm/DeepSeek/index.tsx +0 -21
- package/src/app/(main)/settings/llm/Google/index.tsx +0 -31
- package/src/app/(main)/settings/llm/Groq/index.tsx +0 -26
- package/src/app/(main)/settings/llm/Minimax/index.tsx +0 -20
- package/src/app/(main)/settings/llm/Mistral/index.tsx +0 -20
- package/src/app/(main)/settings/llm/Moonshot/index.tsx +0 -28
- package/src/app/(main)/settings/llm/Ollama/index.tsx +0 -37
- package/src/app/(main)/settings/llm/OpenAI/index.tsx +0 -28
- package/src/app/(main)/settings/llm/OpenRouter/index.tsx +0 -21
- package/src/app/(main)/settings/llm/Perplexity/index.tsx +0 -23
- package/src/app/(main)/settings/llm/TogetherAI/index.tsx +0 -19
- package/src/app/(main)/settings/llm/ZeroOne/index.tsx +0 -20
- package/src/app/(main)/settings/llm/Zhipu/index.tsx +0 -18
- /package/src/app/(main)/settings/llm/{Ollama → ProviderList/Ollama}/Checker.tsx +0 -0
|
@@ -76,56 +76,20 @@ export default {
|
|
|
76
76
|
LocationNotSupportError:
|
|
77
77
|
'很抱歉,你的所在地区不支持此模型服务,可能是由于区域限制或服务未开通。请确认当前地区是否支持使用此服务,或尝试使用切换到其他地区后重试。',
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
MistralBizError: '请求 Mistral AI 服务出错,请根据以下信息排查或重试',
|
|
86
|
-
InvalidMistralAPIKey: 'Mistral AI API Key 不正确或为空,请检查 Mistral API Key 后重试',
|
|
87
|
-
|
|
88
|
-
MoonshotBizError: '请求月之暗面服务出错,请根据以下信息排查或重试',
|
|
89
|
-
InvalidMoonshotAPIKey: 'Moonshot AI API Key 不正确或为空,请检查 Moonshot API Key 后重试',
|
|
90
|
-
|
|
91
|
-
GoogleBizError: '请求 Google 服务出错,请根据以下信息排查或重试',
|
|
92
|
-
InvalidGoogleAPIKey: 'Google API Key 不正确或为空,请检查 Google API Key 后重试',
|
|
79
|
+
InvalidProviderAPIKey: '{{provider}} API Key 不正确或为空,请检查 {{provider}} API Key 后重试',
|
|
80
|
+
ProviderBizAPIKey: '请求 {{provider}} 服务出错,请根据以下信息排查或重试',
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated
|
|
83
|
+
*/
|
|
84
|
+
NoOpenAIAPIKey: 'OpenAI API Key 不正确或为空,请添加自定义 OpenAI API Key',
|
|
93
85
|
|
|
94
86
|
InvalidBedrockCredentials: 'Bedrock 鉴权未通过,请检查 AccessKeyId/SecretAccessKey 后重试',
|
|
95
|
-
BedrockBizError: '请求 Bedrock 服务出错,请根据以下信息排查或重试',
|
|
96
|
-
|
|
97
|
-
InvalidDeepSeekAPIKey: 'DeepSeek API Key 不正确或为空,请检查 DeepSeek API Key 后重试',
|
|
98
|
-
DeepSeekBizError: '请求 DeepSeek 服务出错,请根据以下信息排查或重试',
|
|
99
|
-
|
|
100
|
-
InvalidAzureAPIKey: 'Azure API Key 不正确或为空,请检查 Azure API Key 后重试',
|
|
101
|
-
AzureBizError: '请求 Azure AI 服务出错,请根据以下信息排查或重试',
|
|
102
|
-
|
|
103
|
-
InvalidPerplexityAPIKey: 'Perplexity API Key 不正确或为空,请检查 Perplexity API Key 后重试',
|
|
104
|
-
PerplexityBizError: '请求 Perplexity AI 服务出错,请根据以下信息排查或重试',
|
|
105
|
-
|
|
106
|
-
InvalidAnthropicAPIKey: 'Anthropic API Key 不正确或为空,请检查 Anthropic API Key 后重试',
|
|
107
|
-
AnthropicBizError: '请求 Anthropic AI 服务出错,请根据以下信息排查或重试',
|
|
108
|
-
|
|
109
|
-
InvalidGroqAPIKey: 'Groq API Key 不正确或为空,请检查 Groq API Key 后重试',
|
|
110
|
-
GroqBizError: '请求 Groq 服务出错,请根据以下信息排查或重试',
|
|
111
|
-
|
|
112
|
-
InvalidOpenRouterAPIKey: 'OpenRouter API Key 不正确或为空,请检查 OpenRouter API Key 后重试',
|
|
113
|
-
OpenRouterBizError: '请求 OpenRouter AI 服务出错,请根据以下信息排查或重试',
|
|
114
|
-
|
|
115
|
-
InvalidTogetherAIAPIKey: 'TogetherAI API Key 不正确或为空,请检查 TogetherAI API Key 后重试',
|
|
116
|
-
TogetherAIBizError: '请求 TogetherAI AI 服务出错,请根据以下信息排查或重试',
|
|
117
|
-
|
|
118
|
-
ZeroOneBizError: '请求零一万物服务出错,请根据以下信息排查或重试',
|
|
119
|
-
InvalidZeroOneAPIKey: '零一万物 API Key 不正确或为空,请检查零一万物 API Key 后重试',
|
|
120
87
|
|
|
121
88
|
InvalidOllamaArgs: 'Ollama 配置不正确,请检查 Ollama 配置后重试',
|
|
122
89
|
OllamaBizError: '请求 Ollama 服务出错,请根据以下信息排查或重试',
|
|
123
90
|
OllamaServiceUnavailable:
|
|
124
91
|
'Ollama 服务连接失败,请检查 Ollama 是否运行正常,或是否正确设置 Ollama 的跨域配置',
|
|
125
92
|
|
|
126
|
-
MinimaxBizError: '请求 Minimax 服务出错,请根据以下信息排查或重试',
|
|
127
|
-
InvalidMinimaxAPIKey: 'Minimax API Key 不正确或为空,请检查 Minimax API Key 后重试',
|
|
128
|
-
|
|
129
93
|
AgentRuntimeError: 'Lobe AI Runtime 执行出错,请根据以下信息排查或重试',
|
|
130
94
|
/* eslint-enable */
|
|
131
95
|
},
|
|
@@ -137,23 +101,18 @@ export default {
|
|
|
137
101
|
},
|
|
138
102
|
unlock: {
|
|
139
103
|
addProxyUrl: '添加 OpenAI 代理地址(可选)',
|
|
104
|
+
apiKey: {
|
|
105
|
+
description: '输入你的 {{name}} API Key 即可开始会话',
|
|
106
|
+
title: '使用自定义 {{name}} API Key',
|
|
107
|
+
},
|
|
140
108
|
closeMessage: '关闭提示',
|
|
141
109
|
confirm: '确认并重试',
|
|
142
|
-
|
|
143
110
|
oauth: {
|
|
144
111
|
description: '管理员已开启统一登录认证,点击下方按钮登录,即可解锁应用',
|
|
145
112
|
success: '登录成功',
|
|
146
113
|
title: '登录账号',
|
|
147
114
|
welcome: '欢迎你!',
|
|
148
115
|
},
|
|
149
|
-
ollama: {
|
|
150
|
-
cancel: '取消下载',
|
|
151
|
-
confirm: '下载',
|
|
152
|
-
description: '输入你的 Ollama 模型标签,完成即可继续会话',
|
|
153
|
-
downloaded: '{{completed}} / {{total}}',
|
|
154
|
-
starting: '开始下载...',
|
|
155
|
-
title: '下载指定的 Ollama 模型',
|
|
156
|
-
},
|
|
157
116
|
password: {
|
|
158
117
|
description: '管理员已开启应用加密,输入应用密码后即可解锁应用。密码只需填写一次',
|
|
159
118
|
placeholder: '请输入密码',
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
anthropic: {
|
|
3
|
-
title: 'Anthropic',
|
|
4
|
-
token: {
|
|
5
|
-
desc: '填入来自 Anthropic 的 API Key',
|
|
6
|
-
placeholder: 'Anthropic API Key',
|
|
7
|
-
title: 'API Key',
|
|
8
|
-
},
|
|
9
|
-
unlock: {
|
|
10
|
-
description: '输入你的 Anthropic API Key 即可开始会话。应用不会记录你的 API Key',
|
|
11
|
-
title: '使用自定义 Anthropic API Key',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
2
|
azure: {
|
|
15
3
|
azureApiVersion: {
|
|
16
4
|
desc: 'Azure 的 API 版本,遵循 YYYY-MM-DD 格式,查阅[最新版本](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions)',
|
|
@@ -30,10 +18,6 @@ export default {
|
|
|
30
18
|
placeholder: 'Azure API Key',
|
|
31
19
|
title: 'API Key',
|
|
32
20
|
},
|
|
33
|
-
unlock: {
|
|
34
|
-
description: '输入你的 Azure OpenAI API Key 即可开始会话',
|
|
35
|
-
title: '使用自定义 Azure OpenAI API Key',
|
|
36
|
-
},
|
|
37
21
|
},
|
|
38
22
|
bedrock: {
|
|
39
23
|
accessKeyId: {
|
|
@@ -62,78 +46,6 @@ export default {
|
|
|
62
46
|
title: '使用自定义 Bedrock 鉴权信息',
|
|
63
47
|
},
|
|
64
48
|
},
|
|
65
|
-
deepseek: {
|
|
66
|
-
title: 'DeepSeek',
|
|
67
|
-
token: {
|
|
68
|
-
desc: '填入来自 DeepSeek 的 API Key',
|
|
69
|
-
placeholder: 'DeepSeek API Key',
|
|
70
|
-
title: 'API Key',
|
|
71
|
-
},
|
|
72
|
-
unlock: {
|
|
73
|
-
description: '输入你的 DeepSeek API Key 即可开始会话。应用不会记录你的 API Key',
|
|
74
|
-
title: '使用自定义 DeepSeek API Key',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
google: {
|
|
78
|
-
title: 'Google',
|
|
79
|
-
token: {
|
|
80
|
-
desc: '填入来自 Google 的 API Key',
|
|
81
|
-
placeholder: 'Google API Key',
|
|
82
|
-
title: 'API Key',
|
|
83
|
-
},
|
|
84
|
-
unlock: {
|
|
85
|
-
description: '输入你的 Google API Key 即可开始会话。应用不会记录你的 API Key',
|
|
86
|
-
title: '使用自定义 Google API Key',
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
groq: {
|
|
90
|
-
title: 'Groq',
|
|
91
|
-
token: {
|
|
92
|
-
desc: '填入来自 Groq 的 API Key',
|
|
93
|
-
placeholder: 'Groq API Key',
|
|
94
|
-
title: 'API Key',
|
|
95
|
-
},
|
|
96
|
-
unlock: {
|
|
97
|
-
description: '输入你的 Groq API Key 即可开始会话。应用不会记录你的 API Key',
|
|
98
|
-
title: '使用自定义 Groq API Key',
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
minimax: {
|
|
102
|
-
title: 'Minimax',
|
|
103
|
-
token: {
|
|
104
|
-
desc: '填入来自 Minimax 的 API Key',
|
|
105
|
-
placeholder: 'Minimax API Key',
|
|
106
|
-
title: 'API Key',
|
|
107
|
-
},
|
|
108
|
-
unlock: {
|
|
109
|
-
description: '输入你的 Minimax API Key 即可开始会话。应用不会记录你的 API Key',
|
|
110
|
-
title: '使用自定义 Minimax API Key',
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
mistral: {
|
|
114
|
-
title: 'Mistral AI',
|
|
115
|
-
token: {
|
|
116
|
-
desc: '填入来自 Mistral AI 的 API Key',
|
|
117
|
-
placeholder: 'Mistral AI API Key',
|
|
118
|
-
title: 'API Key',
|
|
119
|
-
},
|
|
120
|
-
unlock: {
|
|
121
|
-
description: '输入你的 Mistral AI API Key 即可开始会话。应用不会记录你的 API Key',
|
|
122
|
-
title: '使用自定义 Mistral AI API Key',
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
moonshot: {
|
|
126
|
-
title: 'Moonshot AI',
|
|
127
|
-
token: {
|
|
128
|
-
desc: '填入来自 Moonshot AI 的 API Key',
|
|
129
|
-
placeholder: 'Moonshot AI API Key',
|
|
130
|
-
title: 'API Key',
|
|
131
|
-
},
|
|
132
|
-
unlock: {
|
|
133
|
-
description: '输入你的 Moonshot AI API Key 即可开始会话。应用不会记录你的 API Key',
|
|
134
|
-
title: '使用自定义 Moonshot AI API Key',
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
49
|
ollama: {
|
|
138
50
|
checker: {
|
|
139
51
|
desc: '测试代理地址是否正确填写',
|
|
@@ -144,6 +56,12 @@ export default {
|
|
|
144
56
|
placeholder: 'vicuna,llava,codellama,llama2:13b-text',
|
|
145
57
|
title: '自定义模型名称',
|
|
146
58
|
},
|
|
59
|
+
download: {
|
|
60
|
+
desc: 'Ollama 正在下载该模型,请尽量不要关闭本页面。重新下载时将会中断处继续',
|
|
61
|
+
remainingTime: '剩余时间',
|
|
62
|
+
speed: '下载速度',
|
|
63
|
+
title: '正在下载模型 {{model}} ',
|
|
64
|
+
},
|
|
147
65
|
endpoint: {
|
|
148
66
|
desc: '填入 Ollama 接口代理地址,本地未额外指定可留空',
|
|
149
67
|
title: 'Ollama 服务地址',
|
|
@@ -175,94 +93,19 @@ export default {
|
|
|
175
93
|
},
|
|
176
94
|
},
|
|
177
95
|
title: 'Ollama',
|
|
178
|
-
},
|
|
179
|
-
openai: {
|
|
180
|
-
title: 'OpenAI',
|
|
181
|
-
token: {
|
|
182
|
-
desc: '使用自己的 OpenAI Key',
|
|
183
|
-
placeholder: 'OpenAI API Key',
|
|
184
|
-
title: 'OpenAI API Key',
|
|
185
|
-
},
|
|
186
96
|
unlock: {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
desc: '测试代理地址是否正确填写',
|
|
194
|
-
},
|
|
195
|
-
customModelName: {
|
|
196
|
-
desc: '增加自定义模型,多个模型使用逗号(,)隔开',
|
|
197
|
-
placeholder: 'mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free',
|
|
198
|
-
title: '自定义模型名称',
|
|
199
|
-
},
|
|
200
|
-
title: 'OpenRouter',
|
|
201
|
-
token: {
|
|
202
|
-
desc: '填入来自 OpenRouter AI 的 API Key',
|
|
203
|
-
placeholder: 'OpenRouter AI API Key',
|
|
204
|
-
title: 'API Key',
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
unlock: {
|
|
208
|
-
description: '输入你的 OpenRouter API Key 即可开始会话。应用不会记录你的 API Key',
|
|
209
|
-
title: '使用自定义 OpenRouter API Key',
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
perplexity: {
|
|
213
|
-
title: 'Perplexity',
|
|
214
|
-
token: {
|
|
215
|
-
desc: '填入来自 Perplexity AI 的 API Key',
|
|
216
|
-
placeholder: 'Perplexity AI API Key',
|
|
217
|
-
title: 'API Key',
|
|
218
|
-
},
|
|
219
|
-
unlock: {
|
|
220
|
-
description: '输入你的 Perplexity API Key 即可开始会话。应用不会记录你的 API Key',
|
|
221
|
-
title: '使用自定义 Perplexity API Key',
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
togetherai: {
|
|
225
|
-
checker: {
|
|
226
|
-
desc: '测试代理地址是否正确填写',
|
|
227
|
-
},
|
|
228
|
-
customModelName: {
|
|
229
|
-
desc: '增加自定义模型,多个模型使用逗号(,)隔开',
|
|
230
|
-
placeholder: 'togethercomputer/Llama-2-7B-32K-Instruct,teknium/OpenHermes-2-Mistral-7B',
|
|
231
|
-
title: '自定义模型名称',
|
|
232
|
-
},
|
|
233
|
-
title: 'TogetherAI',
|
|
234
|
-
token: {
|
|
235
|
-
desc: '填入来自 TogetherAI AI 的 API Key',
|
|
236
|
-
placeholder: 'TogetherAI AI API Key',
|
|
237
|
-
title: 'API Key',
|
|
238
|
-
},
|
|
239
|
-
unlock: {
|
|
240
|
-
description: '输入你的 TogetherAI API Key 即可开始会话。应用不会记录你的 API Key',
|
|
241
|
-
title: '使用自定义 TogetherAI API Key',
|
|
97
|
+
cancel: '取消下载',
|
|
98
|
+
confirm: '下载',
|
|
99
|
+
description: '输入你的 Ollama 模型标签,完成即可继续会话',
|
|
100
|
+
downloaded: '{{completed}} / {{total}}',
|
|
101
|
+
starting: '开始下载...',
|
|
102
|
+
title: '下载指定的 Ollama 模型',
|
|
242
103
|
},
|
|
243
104
|
},
|
|
244
105
|
zeroone: {
|
|
245
106
|
title: '01.AI 零一万物',
|
|
246
|
-
token: {
|
|
247
|
-
desc: '填入来自 01.AI 零一万物的 API Key',
|
|
248
|
-
placeholder: '01.AI 零一万物 API Key',
|
|
249
|
-
title: 'API Key',
|
|
250
|
-
},
|
|
251
|
-
unlock: {
|
|
252
|
-
description: '输入你的零一万物 API Key 即可开始会话。应用不会记录你的 API Key',
|
|
253
|
-
title: '使用自定义零一万物 API Key',
|
|
254
|
-
},
|
|
255
107
|
},
|
|
256
108
|
zhipu: {
|
|
257
109
|
title: '智谱',
|
|
258
|
-
token: {
|
|
259
|
-
desc: '填入来自智谱的 API Key',
|
|
260
|
-
placeholder: 'Zhipu API Key',
|
|
261
|
-
title: 'API Key',
|
|
262
|
-
},
|
|
263
|
-
unlock: {
|
|
264
|
-
description: '输入你的 Zhipu API Key 即可开始会话。应用不会记录你的 API Key',
|
|
265
|
-
title: '使用自定义 Zhipu API Key',
|
|
266
|
-
},
|
|
267
110
|
},
|
|
268
111
|
};
|
|
@@ -43,6 +43,11 @@ export default {
|
|
|
43
43
|
title: '设置',
|
|
44
44
|
},
|
|
45
45
|
llm: {
|
|
46
|
+
apiKey: {
|
|
47
|
+
desc: '请填写你的 {{name}} API Key',
|
|
48
|
+
placeholder: '{{name}} API Key',
|
|
49
|
+
title: 'API Key',
|
|
50
|
+
},
|
|
46
51
|
checker: {
|
|
47
52
|
button: '检查',
|
|
48
53
|
desc: '测试 Api Key 与代理地址是否正确填写',
|
|
@@ -112,14 +117,6 @@ export default {
|
|
|
112
117
|
},
|
|
113
118
|
waitingForMore: '更多模型正在 <1>计划接入</1> 中,敬请期待 ✨',
|
|
114
119
|
},
|
|
115
|
-
ollama: {
|
|
116
|
-
download: {
|
|
117
|
-
desc: 'Ollama 正在下载该模型,请尽量不要关闭本页面。重新下载时将会中断处继续',
|
|
118
|
-
remainingTime: '剩余时间',
|
|
119
|
-
speed: '下载速度',
|
|
120
|
-
title: '正在下载模型 {{model}} ',
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
120
|
plugin: {
|
|
124
121
|
addTooltip: '自定义插件',
|
|
125
122
|
clearDeprecated: '移除无效插件',
|
|
@@ -32,6 +32,7 @@ export const getServerGlobalConfig = () => {
|
|
|
32
32
|
ENABLED_ANTHROPIC,
|
|
33
33
|
ENABLED_MINIMAX,
|
|
34
34
|
ENABLED_MISTRAL,
|
|
35
|
+
ENABLED_QWEN,
|
|
35
36
|
|
|
36
37
|
ENABLED_AZURE_OPENAI,
|
|
37
38
|
AZURE_MODEL_LIST,
|
|
@@ -101,6 +102,7 @@ export const getServerGlobalConfig = () => {
|
|
|
101
102
|
}),
|
|
102
103
|
},
|
|
103
104
|
perplexity: { enabled: ENABLED_PERPLEXITY },
|
|
105
|
+
qwen: { enabled: ENABLED_QWEN },
|
|
104
106
|
|
|
105
107
|
togetherai: {
|
|
106
108
|
enabled: ENABLED_TOGETHERAI,
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
LobeOpenAI,
|
|
18
18
|
LobeOpenRouterAI,
|
|
19
19
|
LobePerplexityAI,
|
|
20
|
+
LobeQwenAI,
|
|
20
21
|
LobeTogetherAI,
|
|
21
22
|
LobeZeroOneAI,
|
|
22
23
|
LobeZhipuAI,
|
|
@@ -892,6 +893,21 @@ describe('AgentRuntimeOnClient', () => {
|
|
|
892
893
|
expect(runtime['_runtime']).toBeInstanceOf(LobeDeepSeekAI);
|
|
893
894
|
});
|
|
894
895
|
|
|
896
|
+
it('Qwen provider: with apiKey', async () => {
|
|
897
|
+
merge(initialSettingsState, {
|
|
898
|
+
settings: {
|
|
899
|
+
keyVaults: {
|
|
900
|
+
qwen: {
|
|
901
|
+
apiKey: 'user-qwen-key',
|
|
902
|
+
},
|
|
903
|
+
},
|
|
904
|
+
},
|
|
905
|
+
} as UserSettingsState) as unknown as UserStore;
|
|
906
|
+
const runtime = await initializeWithClientStore(ModelProvider.Qwen, {});
|
|
907
|
+
expect(runtime).toBeInstanceOf(AgentRuntime);
|
|
908
|
+
expect(runtime['_runtime']).toBeInstanceOf(LobeQwenAI);
|
|
909
|
+
});
|
|
910
|
+
|
|
895
911
|
/**
|
|
896
912
|
* Should not have a unknown provider in client, but has
|
|
897
913
|
* similar cases in server side
|
package/src/services/chat.ts
CHANGED
|
@@ -127,6 +127,9 @@ export function initializeWithClientStore(provider: string, payload: any) {
|
|
|
127
127
|
case ModelProvider.Perplexity: {
|
|
128
128
|
break;
|
|
129
129
|
}
|
|
130
|
+
case ModelProvider.Qwen: {
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
130
133
|
case ModelProvider.Anthropic: {
|
|
131
134
|
providerOptions = {
|
|
132
135
|
baseURL: providerAuthPayload?.endpoint,
|
|
@@ -194,7 +194,10 @@ describe('MessageClientService', () => {
|
|
|
194
194
|
describe('updateMessageError', () => {
|
|
195
195
|
it('should update the error field of a message', async () => {
|
|
196
196
|
// Setup
|
|
197
|
-
const newError = {
|
|
197
|
+
const newError = {
|
|
198
|
+
type: 'InvalidProviderAPIKey',
|
|
199
|
+
message: 'Error occurred',
|
|
200
|
+
} as ChatMessageError;
|
|
198
201
|
(MessageModel.update as Mock).mockResolvedValue({ ...mockMessage, error: newError });
|
|
199
202
|
|
|
200
203
|
// Execute
|
package/src/types/fetch.ts
CHANGED
|
@@ -6,7 +6,9 @@ export const ChatErrorType = {
|
|
|
6
6
|
|
|
7
7
|
InvalidAccessCode: 'InvalidAccessCode', // 密码无效
|
|
8
8
|
InvalidClerkUser: 'InvalidClerkUser', // is not Clerk User
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated
|
|
11
|
+
*/
|
|
10
12
|
NoOpenAIAPIKey: 'NoOpenAIAPIKey',
|
|
11
13
|
OllamaServiceUnavailable: 'OllamaServiceUnavailable', // 未启动/检测到 Ollama 服务
|
|
12
14
|
|
package/src/types/llm.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
1
3
|
export interface ChatModelCard {
|
|
2
4
|
/**
|
|
3
5
|
* only used in azure
|
|
@@ -43,8 +45,28 @@ export interface ChatModelCard {
|
|
|
43
45
|
|
|
44
46
|
export interface ModelProviderCard {
|
|
45
47
|
chatModels: ChatModelCard[];
|
|
48
|
+
/**
|
|
49
|
+
* the default model that used for connection check
|
|
50
|
+
*/
|
|
51
|
+
checkModel?: string;
|
|
46
52
|
enabled?: boolean;
|
|
47
53
|
id: string;
|
|
54
|
+
modelList?: {
|
|
55
|
+
azureDeployName?: boolean;
|
|
56
|
+
notFoundContent?: ReactNode;
|
|
57
|
+
placeholder?: string;
|
|
58
|
+
showModelFetcher?: boolean;
|
|
59
|
+
};
|
|
60
|
+
name: string;
|
|
61
|
+
proxyUrl?:
|
|
62
|
+
| {
|
|
63
|
+
desc?: string;
|
|
64
|
+
placeholder: string;
|
|
65
|
+
title?: string;
|
|
66
|
+
}
|
|
67
|
+
| false;
|
|
68
|
+
showApiKey?: boolean;
|
|
69
|
+
showBrowserRequest?: boolean;
|
|
48
70
|
}
|
|
49
71
|
|
|
50
72
|
// 语言模型的设置参数
|
|
@@ -30,6 +30,7 @@ export interface UserKeyVaults {
|
|
|
30
30
|
openrouter?: OpenAICompatibleKeyVault;
|
|
31
31
|
password?: string;
|
|
32
32
|
perplexity?: OpenAICompatibleKeyVault;
|
|
33
|
+
qwen?: OpenAICompatibleKeyVault;
|
|
33
34
|
togetherai?: OpenAICompatibleKeyVault;
|
|
34
35
|
zeroone?: OpenAICompatibleKeyVault;
|
|
35
36
|
zhipu?: OpenAICompatibleKeyVault;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Anthropic, Claude } from '@lobehub/icons';
|
|
4
|
-
import { useTheme } from 'antd-style';
|
|
5
|
-
import { memo } from 'react';
|
|
6
|
-
|
|
7
|
-
import { ModelProvider } from '@/libs/agent-runtime';
|
|
8
|
-
|
|
9
|
-
import ProviderConfig from '../components/ProviderConfig';
|
|
10
|
-
|
|
11
|
-
const AnthropicProvider = memo(() => {
|
|
12
|
-
const { isDarkMode } = useTheme();
|
|
13
|
-
return (
|
|
14
|
-
<ProviderConfig
|
|
15
|
-
checkModel={'claude-3-haiku-20240307'}
|
|
16
|
-
provider={ModelProvider.Anthropic}
|
|
17
|
-
proxyUrl={{
|
|
18
|
-
placeholder: 'https://api.anthropic.com',
|
|
19
|
-
}}
|
|
20
|
-
title={<Anthropic.Text color={isDarkMode ? undefined : Claude.colorPrimary} size={15} />}
|
|
21
|
-
/>
|
|
22
|
-
);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export default AnthropicProvider;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Azure, OpenAI } from '@lobehub/icons';
|
|
4
|
-
import { Markdown } from '@lobehub/ui';
|
|
5
|
-
import { AutoComplete, Divider, Input } from 'antd';
|
|
6
|
-
import { createStyles } from 'antd-style';
|
|
7
|
-
import { memo } from 'react';
|
|
8
|
-
import { useTranslation } from 'react-i18next';
|
|
9
|
-
import { Flexbox } from 'react-layout-kit';
|
|
10
|
-
|
|
11
|
-
import { ModelProvider } from '@/libs/agent-runtime';
|
|
12
|
-
import { useUserStore } from '@/store/user';
|
|
13
|
-
import { modelProviderSelectors } from '@/store/user/selectors';
|
|
14
|
-
|
|
15
|
-
import ProviderConfig from '../components/ProviderConfig';
|
|
16
|
-
import { KeyVaultsConfigKey, LLMProviderApiTokenKey } from '../const';
|
|
17
|
-
|
|
18
|
-
const useStyles = createStyles(({ css, token }) => ({
|
|
19
|
-
markdown: css`
|
|
20
|
-
p {
|
|
21
|
-
color: ${token.colorTextDescription} !important;
|
|
22
|
-
}
|
|
23
|
-
`,
|
|
24
|
-
tip: css`
|
|
25
|
-
font-size: 12px;
|
|
26
|
-
color: ${token.colorTextDescription};
|
|
27
|
-
`,
|
|
28
|
-
}));
|
|
29
|
-
|
|
30
|
-
const providerKey = ModelProvider.Azure;
|
|
31
|
-
|
|
32
|
-
const AzureOpenAIProvider = memo(() => {
|
|
33
|
-
const { t } = useTranslation('modelProvider');
|
|
34
|
-
|
|
35
|
-
const { styles } = useStyles();
|
|
36
|
-
|
|
37
|
-
// Get the first model card's deployment name as the check model
|
|
38
|
-
const checkModel = useUserStore((s) => {
|
|
39
|
-
const chatModelCards = modelProviderSelectors.getModelCardsById(providerKey)(s);
|
|
40
|
-
|
|
41
|
-
if (chatModelCards.length > 0) {
|
|
42
|
-
return chatModelCards[0].deploymentName;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return 'gpt-35-turbo';
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<ProviderConfig
|
|
50
|
-
apiKeyItems={[
|
|
51
|
-
{
|
|
52
|
-
children: (
|
|
53
|
-
<Input.Password
|
|
54
|
-
autoComplete={'new-password'}
|
|
55
|
-
placeholder={t('azure.token.placeholder')}
|
|
56
|
-
/>
|
|
57
|
-
),
|
|
58
|
-
desc: t('azure.token.desc'),
|
|
59
|
-
label: t('azure.token.title'),
|
|
60
|
-
name: [KeyVaultsConfigKey, providerKey, LLMProviderApiTokenKey],
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
children: <Input allowClear placeholder={t('azure.endpoint.placeholder')} />,
|
|
64
|
-
desc: t('azure.endpoint.desc'),
|
|
65
|
-
label: t('azure.endpoint.title'),
|
|
66
|
-
name: [KeyVaultsConfigKey, providerKey, 'endpoint'],
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
children: (
|
|
70
|
-
<AutoComplete
|
|
71
|
-
options={[
|
|
72
|
-
'2024-02-01',
|
|
73
|
-
'2024-03-01-preview',
|
|
74
|
-
'2024-02-15-preview',
|
|
75
|
-
'2023-10-01-preview',
|
|
76
|
-
'2023-06-01-preview',
|
|
77
|
-
'2023-05-15',
|
|
78
|
-
].map((i) => ({ label: i, value: i }))}
|
|
79
|
-
placeholder={'20XX-XX-XX'}
|
|
80
|
-
/>
|
|
81
|
-
),
|
|
82
|
-
desc: (
|
|
83
|
-
<Markdown className={styles.markdown} fontSize={12} variant={'chat'}>
|
|
84
|
-
{t('azure.azureApiVersion.desc')}
|
|
85
|
-
</Markdown>
|
|
86
|
-
),
|
|
87
|
-
label: t('azure.azureApiVersion.title'),
|
|
88
|
-
name: [KeyVaultsConfigKey, providerKey, 'apiVersion'],
|
|
89
|
-
},
|
|
90
|
-
]}
|
|
91
|
-
checkModel={checkModel}
|
|
92
|
-
modelList={{
|
|
93
|
-
azureDeployName: true,
|
|
94
|
-
notFoundContent: t('azure.empty'),
|
|
95
|
-
placeholder: t('azure.modelListPlaceholder'),
|
|
96
|
-
}}
|
|
97
|
-
provider={providerKey}
|
|
98
|
-
showBrowserRequest
|
|
99
|
-
title={
|
|
100
|
-
<Flexbox align={'center'} gap={8} horizontal>
|
|
101
|
-
<Azure.Combine size={22} type={'color'}></Azure.Combine>
|
|
102
|
-
<Divider style={{ margin: '0 4px' }} type={'vertical'} />
|
|
103
|
-
<OpenAI.Combine size={24}></OpenAI.Combine>
|
|
104
|
-
</Flexbox>
|
|
105
|
-
}
|
|
106
|
-
/>
|
|
107
|
-
);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
export default AzureOpenAIProvider;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Aws, Bedrock } from '@lobehub/icons';
|
|
4
|
-
import { Divider, Input, Select } from 'antd';
|
|
5
|
-
import { memo } from 'react';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import { Flexbox } from 'react-layout-kit';
|
|
8
|
-
|
|
9
|
-
import { ModelProvider } from '@/libs/agent-runtime';
|
|
10
|
-
import { GlobalLLMProviderKey } from '@/types/user/settings';
|
|
11
|
-
|
|
12
|
-
import ProviderConfig from '../components/ProviderConfig';
|
|
13
|
-
import { KeyVaultsConfigKey } from '../const';
|
|
14
|
-
|
|
15
|
-
const providerKey: GlobalLLMProviderKey = 'bedrock';
|
|
16
|
-
|
|
17
|
-
const BedrockProvider = memo(() => {
|
|
18
|
-
const { t } = useTranslation('modelProvider');
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<ProviderConfig
|
|
22
|
-
apiKeyItems={[
|
|
23
|
-
{
|
|
24
|
-
children: (
|
|
25
|
-
<Input.Password
|
|
26
|
-
autoComplete={'new-password'}
|
|
27
|
-
placeholder={t(`${providerKey}.accessKeyId.placeholder`)}
|
|
28
|
-
/>
|
|
29
|
-
),
|
|
30
|
-
desc: t(`${providerKey}.accessKeyId.desc`),
|
|
31
|
-
label: t(`${providerKey}.accessKeyId.title`),
|
|
32
|
-
name: [KeyVaultsConfigKey, providerKey, 'accessKeyId'],
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
children: (
|
|
36
|
-
<Input.Password
|
|
37
|
-
autoComplete={'new-password'}
|
|
38
|
-
placeholder={t(`${providerKey}.secretAccessKey.placeholder`)}
|
|
39
|
-
/>
|
|
40
|
-
),
|
|
41
|
-
desc: t(`${providerKey}.secretAccessKey.desc`),
|
|
42
|
-
label: t(`${providerKey}.secretAccessKey.title`),
|
|
43
|
-
name: [KeyVaultsConfigKey, providerKey, 'secretAccessKey'],
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
children: (
|
|
47
|
-
<Select
|
|
48
|
-
allowClear
|
|
49
|
-
options={['us-east-1', 'us-west-2', 'ap-southeast-1'].map((i) => ({
|
|
50
|
-
label: i,
|
|
51
|
-
value: i,
|
|
52
|
-
}))}
|
|
53
|
-
placeholder={'us-east-1'}
|
|
54
|
-
/>
|
|
55
|
-
),
|
|
56
|
-
desc: t(`${providerKey}.region.desc`),
|
|
57
|
-
label: t(`${providerKey}.region.title`),
|
|
58
|
-
name: [KeyVaultsConfigKey, providerKey, 'region'],
|
|
59
|
-
},
|
|
60
|
-
]}
|
|
61
|
-
checkModel={'anthropic.claude-instant-v1'}
|
|
62
|
-
provider={ModelProvider.Bedrock}
|
|
63
|
-
title={
|
|
64
|
-
<Flexbox align={'center'} gap={8} horizontal>
|
|
65
|
-
<Aws.Color size={32} />
|
|
66
|
-
<Divider style={{ margin: '0 4px' }} type={'vertical'} />
|
|
67
|
-
<Bedrock.Combine size={26} type={'color'} />
|
|
68
|
-
</Flexbox>
|
|
69
|
-
}
|
|
70
|
-
/>
|
|
71
|
-
);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
export default BedrockProvider;
|