@lobehub/chat 0.162.17 → 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/CHANGELOG.md +25 -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/locales/ar/error.json +7 -39
- package/locales/ar/modelProvider.json +15 -183
- package/locales/ar/setting.json +5 -8
- package/locales/bg-BG/error.json +6 -38
- package/locales/bg-BG/modelProvider.json +15 -183
- package/locales/bg-BG/setting.json +5 -8
- package/locales/de-DE/error.json +6 -38
- package/locales/de-DE/modelProvider.json +15 -183
- package/locales/de-DE/setting.json +5 -8
- package/locales/en-US/error.json +6 -38
- package/locales/en-US/modelProvider.json +15 -183
- package/locales/en-US/setting.json +6 -9
- package/locales/es-ES/error.json +6 -38
- package/locales/es-ES/modelProvider.json +15 -183
- package/locales/es-ES/setting.json +5 -8
- package/locales/fr-FR/error.json +6 -38
- package/locales/fr-FR/modelProvider.json +15 -183
- package/locales/fr-FR/setting.json +9 -12
- package/locales/it-IT/error.json +6 -38
- package/locales/it-IT/modelProvider.json +15 -183
- package/locales/it-IT/setting.json +5 -8
- package/locales/ja-JP/error.json +6 -38
- package/locales/ja-JP/modelProvider.json +15 -183
- package/locales/ja-JP/setting.json +5 -8
- package/locales/ko-KR/error.json +6 -38
- package/locales/ko-KR/modelProvider.json +15 -183
- package/locales/ko-KR/setting.json +5 -8
- package/locales/nl-NL/error.json +6 -38
- package/locales/nl-NL/modelProvider.json +15 -183
- package/locales/nl-NL/setting.json +5 -8
- package/locales/pl-PL/error.json +6 -38
- package/locales/pl-PL/modelProvider.json +15 -183
- package/locales/pl-PL/setting.json +6 -9
- package/locales/pt-BR/error.json +6 -38
- package/locales/pt-BR/modelProvider.json +15 -183
- package/locales/pt-BR/setting.json +5 -8
- package/locales/ru-RU/error.json +6 -38
- package/locales/ru-RU/modelProvider.json +15 -183
- package/locales/ru-RU/setting.json +5 -8
- package/locales/tr-TR/error.json +6 -38
- package/locales/tr-TR/modelProvider.json +15 -183
- package/locales/tr-TR/setting.json +5 -8
- package/locales/vi-VN/error.json +6 -38
- package/locales/vi-VN/modelProvider.json +15 -183
- package/locales/vi-VN/setting.json +5 -8
- package/locales/zh-CN/error.json +7 -39
- package/locales/zh-CN/modelProvider.json +15 -183
- package/locales/zh-CN/setting.json +5 -8
- package/locales/zh-TW/error.json +7 -39
- package/locales/zh-TW/modelProvider.json +15 -183
- 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 -36
- package/src/app/(main)/settings/llm/type.ts +5 -0
- package/src/app/api/chat/[provider]/route.ts +8 -3
- package/src/app/api/errorResponse.test.ts +7 -95
- package/src/app/api/errorResponse.ts +6 -46
- package/src/app/api/middleware/auth/index.ts +7 -3
- package/src/components/ModelSelect/index.tsx +7 -10
- 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/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 +3 -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/features/Conversation/Error/APIKeyForm/ProviderApiKeyForm.tsx +6 -3
- package/src/features/Conversation/Error/OllamaBizError/InvalidOllamaModel/index.tsx +11 -14
- package/src/features/Conversation/Error/index.tsx +29 -20
- 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/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 -46
- 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/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 +2 -2
- package/src/libs/agent-runtime/qwen/index.ts +0 -5
- 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/utils/openaiCompatibleFactory/index.test.ts +2 -6
- package/src/libs/agent-runtime/utils/openaiCompatibleFactory/index.ts +12 -6
- 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/services/message/client.test.ts +4 -1
- package/src/types/fetch.ts +3 -1
- package/src/types/llm.ts +22 -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/Qwen/index.tsx +0 -21
- 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
|
@@ -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: '移除无效插件',
|
|
@@ -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
|
// 语言模型的设置参数
|
|
@@ -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;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { DeepSeek } from '@lobehub/icons';
|
|
4
|
-
import { memo } from 'react';
|
|
5
|
-
|
|
6
|
-
import { ModelProvider } from '@/libs/agent-runtime';
|
|
7
|
-
|
|
8
|
-
import ProviderConfig from '../components/ProviderConfig';
|
|
9
|
-
|
|
10
|
-
const DeepSeekProvider = memo(() => {
|
|
11
|
-
return (
|
|
12
|
-
<ProviderConfig
|
|
13
|
-
checkModel={'deepseek-chat'}
|
|
14
|
-
modelList={{ showModelFetcher: true }}
|
|
15
|
-
provider={ModelProvider.DeepSeek}
|
|
16
|
-
title={<DeepSeek.Combine size={28} type={'color'} />}
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export default DeepSeekProvider;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Gemini, Google } from '@lobehub/icons';
|
|
4
|
-
import { Divider } from 'antd';
|
|
5
|
-
import { memo } from 'react';
|
|
6
|
-
import { Flexbox } from 'react-layout-kit';
|
|
7
|
-
|
|
8
|
-
import { ModelProvider } from '@/libs/agent-runtime';
|
|
9
|
-
|
|
10
|
-
import ProviderConfig from '../components/ProviderConfig';
|
|
11
|
-
|
|
12
|
-
const GoogleProvider = memo(() => {
|
|
13
|
-
return (
|
|
14
|
-
<ProviderConfig
|
|
15
|
-
checkModel={'gemini-pro'}
|
|
16
|
-
provider={ModelProvider.Google}
|
|
17
|
-
proxyUrl={{
|
|
18
|
-
placeholder: 'https://generativelanguage.googleapis.com',
|
|
19
|
-
}}
|
|
20
|
-
title={
|
|
21
|
-
<Flexbox align={'center'} gap={8} horizontal>
|
|
22
|
-
<Google.BrandColor size={22} />
|
|
23
|
-
<Divider style={{ margin: '0 4px' }} type={'vertical'} />
|
|
24
|
-
<Gemini.Combine size={22} type={'color'} />
|
|
25
|
-
</Flexbox>
|
|
26
|
-
}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export default GoogleProvider;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Groq } 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 GroqProvider = memo(() => {
|
|
12
|
-
const theme = useTheme();
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<ProviderConfig
|
|
16
|
-
checkModel={'gemma-7b-it'}
|
|
17
|
-
provider={ModelProvider.Groq}
|
|
18
|
-
proxyUrl={{
|
|
19
|
-
placeholder: 'https://api.groq.com/openai/v1',
|
|
20
|
-
}}
|
|
21
|
-
title={<Groq.Text color={theme.isDarkMode ? theme.colorText : Groq.colorPrimary} size={20} />}
|
|
22
|
-
/>
|
|
23
|
-
);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export default GroqProvider;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Minimax } from '@lobehub/icons';
|
|
4
|
-
import { memo } from 'react';
|
|
5
|
-
|
|
6
|
-
import { ModelProvider } from '@/libs/agent-runtime';
|
|
7
|
-
|
|
8
|
-
import ProviderConfig from '../components/ProviderConfig';
|
|
9
|
-
|
|
10
|
-
const MinimaxProvider = memo(() => {
|
|
11
|
-
return (
|
|
12
|
-
<ProviderConfig
|
|
13
|
-
checkModel={'abab5.5s-chat'}
|
|
14
|
-
provider={ModelProvider.Minimax}
|
|
15
|
-
title={<Minimax.Combine size={32} type={'color'} />}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export default MinimaxProvider;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Mistral } from '@lobehub/icons';
|
|
4
|
-
import { memo } from 'react';
|
|
5
|
-
|
|
6
|
-
import { ModelProvider } from '@/libs/agent-runtime';
|
|
7
|
-
|
|
8
|
-
import ProviderConfig from '../components/ProviderConfig';
|
|
9
|
-
|
|
10
|
-
const MistralProvider = memo(() => {
|
|
11
|
-
return (
|
|
12
|
-
<ProviderConfig
|
|
13
|
-
checkModel={'open-mistral-7b'}
|
|
14
|
-
provider={ModelProvider.Mistral}
|
|
15
|
-
title={<Mistral.Combine size={26} type={'color'} />}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export default MistralProvider;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Moonshot } 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 MoonshotProvider = memo(() => {
|
|
12
|
-
const theme = useTheme();
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<ProviderConfig
|
|
16
|
-
checkModel={'moonshot-v1-8k'}
|
|
17
|
-
provider={ModelProvider.Moonshot}
|
|
18
|
-
title={
|
|
19
|
-
<Moonshot.Combine
|
|
20
|
-
color={theme.isDarkMode ? theme.colorText : Moonshot.colorPrimary}
|
|
21
|
-
size={22}
|
|
22
|
-
/>
|
|
23
|
-
}
|
|
24
|
-
/>
|
|
25
|
-
);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export default MoonshotProvider;
|