@lobehub/lobehub 2.0.0-next.2 → 2.0.0-next.4
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 +67 -0
- package/changelog/v1.json +18 -0
- package/locales/ar/models.json +9 -0
- package/locales/bg-BG/models.json +9 -0
- package/locales/de-DE/models.json +9 -0
- package/locales/en-US/models.json +9 -0
- package/locales/es-ES/models.json +9 -0
- package/locales/fa-IR/models.json +9 -0
- package/locales/fr-FR/models.json +9 -0
- package/locales/it-IT/models.json +9 -0
- package/locales/ja-JP/models.json +9 -0
- package/locales/ko-KR/models.json +9 -0
- package/locales/nl-NL/models.json +9 -0
- package/locales/pl-PL/models.json +9 -0
- package/locales/pt-BR/models.json +9 -0
- package/locales/ru-RU/models.json +9 -0
- package/locales/tr-TR/models.json +9 -0
- package/locales/vi-VN/models.json +9 -0
- package/locales/zh-CN/models.json +9 -0
- package/locales/zh-TW/models.json +9 -0
- package/package.json +1 -1
- package/packages/const/src/models.ts +13 -0
- package/packages/model-bank/src/aiModels/azure.ts +155 -0
- package/packages/model-bank/src/aiModels/bedrock.ts +44 -0
- package/packages/model-runtime/src/core/parameterResolver.ts +3 -0
- package/packages/model-runtime/src/providers/azureOpenai/index.ts +2 -1
- package/src/app/[variants]/(main)/settings/_layout/SettingsContent.tsx +0 -3
- package/src/libs/next-auth/sso-providers/index.ts +0 -2
- package/src/libs/oidc-provider/provider.ts +1 -1
- package/src/app/[variants]/(main)/settings/llm/ProviderList/Azure/index.tsx +0 -93
- package/src/app/[variants]/(main)/settings/llm/ProviderList/Bedrock/index.tsx +0 -70
- package/src/app/[variants]/(main)/settings/llm/ProviderList/Cloudflare/index.tsx +0 -39
- package/src/app/[variants]/(main)/settings/llm/ProviderList/Github/index.tsx +0 -52
- package/src/app/[variants]/(main)/settings/llm/ProviderList/HuggingFace/index.tsx +0 -52
- package/src/app/[variants]/(main)/settings/llm/ProviderList/Ollama/index.tsx +0 -20
- package/src/app/[variants]/(main)/settings/llm/ProviderList/OpenAI/index.tsx +0 -17
- package/src/app/[variants]/(main)/settings/llm/ProviderList/providers.tsx +0 -132
- package/src/app/[variants]/(main)/settings/llm/components/Checker.tsx +0 -118
- package/src/app/[variants]/(main)/settings/llm/components/ProviderConfig/index.tsx +0 -303
- package/src/app/[variants]/(main)/settings/llm/components/ProviderModelList/CustomModelOption.tsx +0 -98
- package/src/app/[variants]/(main)/settings/llm/components/ProviderModelList/ModelConfigModal/Form.tsx +0 -104
- package/src/app/[variants]/(main)/settings/llm/components/ProviderModelList/ModelConfigModal/index.tsx +0 -77
- package/src/app/[variants]/(main)/settings/llm/components/ProviderModelList/ModelFetcher.tsx +0 -105
- package/src/app/[variants]/(main)/settings/llm/components/ProviderModelList/Option.tsx +0 -68
- package/src/app/[variants]/(main)/settings/llm/components/ProviderModelList/index.tsx +0 -146
- package/src/app/[variants]/(main)/settings/llm/const.ts +0 -20
- package/src/app/[variants]/(main)/settings/llm/features/Footer.tsx +0 -35
- package/src/app/[variants]/(main)/settings/llm/index.tsx +0 -30
- package/src/app/[variants]/(main)/settings/llm/type.ts +0 -5
- package/src/libs/next-auth/sso-providers/azure-ad.ts +0 -33
|
@@ -1,6 +1,161 @@
|
|
|
1
1
|
import { AIChatModelCard, AIImageModelCard } from '../types/aiModel';
|
|
2
2
|
|
|
3
3
|
const azureChatModels: AIChatModelCard[] = [
|
|
4
|
+
{
|
|
5
|
+
abilities: {
|
|
6
|
+
functionCall: true,
|
|
7
|
+
reasoning: true,
|
|
8
|
+
structuredOutput: true,
|
|
9
|
+
vision: true,
|
|
10
|
+
},
|
|
11
|
+
config: {
|
|
12
|
+
deploymentName: 'gpt-5-pro',
|
|
13
|
+
},
|
|
14
|
+
contextWindowTokens: 400_000,
|
|
15
|
+
description:
|
|
16
|
+
'GPT-5 Pro 是 GPT-5 系列的高级版本,具备增强的推理能力。支持结构化输出、函数调用和文本/图像处理,适用于复杂的专业任务。',
|
|
17
|
+
displayName: 'GPT-5 Pro',
|
|
18
|
+
enabled: true,
|
|
19
|
+
id: 'gpt-5-pro',
|
|
20
|
+
maxOutput: 128_000,
|
|
21
|
+
pricing: {
|
|
22
|
+
units: [
|
|
23
|
+
{ name: 'textInput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
|
|
24
|
+
{ name: 'textOutput', rate: 120, strategy: 'fixed', unit: 'millionTokens' },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
releasedAt: '2025-10-06',
|
|
28
|
+
type: 'chat',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
abilities: {
|
|
32
|
+
functionCall: true,
|
|
33
|
+
structuredOutput: true,
|
|
34
|
+
},
|
|
35
|
+
config: {
|
|
36
|
+
deploymentName: 'gpt-5-codex',
|
|
37
|
+
},
|
|
38
|
+
contextWindowTokens: 400_000,
|
|
39
|
+
description:
|
|
40
|
+
'GPT-5 Codex 专为编程任务优化,针对 Codex CLI 和 VS Code 扩展进行了优化。支持结构化输出和函数调用,适用于代码生成和分析。',
|
|
41
|
+
displayName: 'GPT-5 Codex',
|
|
42
|
+
enabled: true,
|
|
43
|
+
id: 'gpt-5-codex',
|
|
44
|
+
maxOutput: 128_000,
|
|
45
|
+
pricing: {
|
|
46
|
+
units: [
|
|
47
|
+
{ name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
|
|
48
|
+
{ name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
|
|
49
|
+
{ name: 'textInput_cacheRead', rate: 0.125, strategy: 'fixed', unit: 'millionTokens' },
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
releasedAt: '2025-09-11',
|
|
53
|
+
type: 'chat',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
abilities: {
|
|
57
|
+
functionCall: true,
|
|
58
|
+
reasoning: true,
|
|
59
|
+
structuredOutput: true,
|
|
60
|
+
vision: true,
|
|
61
|
+
},
|
|
62
|
+
config: {
|
|
63
|
+
deploymentName: 'gpt-5',
|
|
64
|
+
},
|
|
65
|
+
contextWindowTokens: 400_000,
|
|
66
|
+
description:
|
|
67
|
+
'GPT-5 是 OpenAI 最新的旗舰模型,具备卓越的推理能力。支持文本和图像输入,结构化输出和并行工具调用,适用于需要深度理解和分析的复杂任务。',
|
|
68
|
+
displayName: 'GPT-5',
|
|
69
|
+
enabled: true,
|
|
70
|
+
id: 'gpt-5',
|
|
71
|
+
maxOutput: 128_000,
|
|
72
|
+
pricing: {
|
|
73
|
+
units: [
|
|
74
|
+
{ name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
|
|
75
|
+
{ name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
|
|
76
|
+
{ name: 'textInput_cacheRead', rate: 0.125, strategy: 'fixed', unit: 'millionTokens' },
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
releasedAt: '2025-08-07',
|
|
80
|
+
type: 'chat',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
abilities: {
|
|
84
|
+
functionCall: true,
|
|
85
|
+
reasoning: true,
|
|
86
|
+
structuredOutput: true,
|
|
87
|
+
vision: true,
|
|
88
|
+
},
|
|
89
|
+
config: {
|
|
90
|
+
deploymentName: 'gpt-5-mini',
|
|
91
|
+
},
|
|
92
|
+
contextWindowTokens: 400_000,
|
|
93
|
+
description:
|
|
94
|
+
'GPT-5 Mini 提供与 GPT-5 相似的能力,但更加高效和经济。支持推理、函数调用和视觉功能,适合大规模部署和对成本敏感的应用场景。',
|
|
95
|
+
displayName: 'GPT-5 Mini',
|
|
96
|
+
enabled: true,
|
|
97
|
+
id: 'gpt-5-mini',
|
|
98
|
+
maxOutput: 128_000,
|
|
99
|
+
pricing: {
|
|
100
|
+
units: [
|
|
101
|
+
{ name: 'textInput', rate: 0.25, strategy: 'fixed', unit: 'millionTokens' },
|
|
102
|
+
{ name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
|
|
103
|
+
{ name: 'textInput_cacheRead', rate: 0.025, strategy: 'fixed', unit: 'millionTokens' },
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
releasedAt: '2025-08-07',
|
|
107
|
+
type: 'chat',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
abilities: {
|
|
111
|
+
functionCall: true,
|
|
112
|
+
reasoning: true,
|
|
113
|
+
structuredOutput: true,
|
|
114
|
+
vision: true,
|
|
115
|
+
},
|
|
116
|
+
config: {
|
|
117
|
+
deploymentName: 'gpt-5-nano',
|
|
118
|
+
},
|
|
119
|
+
contextWindowTokens: 400_000,
|
|
120
|
+
description:
|
|
121
|
+
'GPT-5 Nano 是 GPT-5 系列中最小、最快的版本。在保持核心能力的同时,提供超低延迟和成本效益,适合边缘计算和实时应用。',
|
|
122
|
+
displayName: 'GPT-5 Nano',
|
|
123
|
+
enabled: true,
|
|
124
|
+
id: 'gpt-5-nano',
|
|
125
|
+
maxOutput: 128_000,
|
|
126
|
+
pricing: {
|
|
127
|
+
units: [
|
|
128
|
+
{ name: 'textInput', rate: 0.05, strategy: 'fixed', unit: 'millionTokens' },
|
|
129
|
+
{ name: 'textOutput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
|
|
130
|
+
{ name: 'textInput_cacheRead', rate: 0.005, strategy: 'fixed', unit: 'millionTokens' },
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
releasedAt: '2025-08-07',
|
|
134
|
+
type: 'chat',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
abilities: {
|
|
138
|
+
vision: true,
|
|
139
|
+
},
|
|
140
|
+
config: {
|
|
141
|
+
deploymentName: 'gpt-5-chat',
|
|
142
|
+
},
|
|
143
|
+
contextWindowTokens: 128_000,
|
|
144
|
+
description:
|
|
145
|
+
'GPT-5 Chat 专为对话场景优化的预览版本。支持文本和图像输入,仅输出文本,适用于聊天机器人和对话式AI应用。',
|
|
146
|
+
displayName: 'GPT-5 Chat',
|
|
147
|
+
id: 'gpt-5-chat',
|
|
148
|
+
maxOutput: 16_384,
|
|
149
|
+
pricing: {
|
|
150
|
+
units: [
|
|
151
|
+
{ name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
|
|
152
|
+
{ name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
|
|
153
|
+
{ name: 'textInput_cacheRead', rate: 0.125, strategy: 'fixed', unit: 'millionTokens' },
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
releasedAt: '2025-08-07',
|
|
157
|
+
type: 'chat',
|
|
158
|
+
},
|
|
4
159
|
{
|
|
5
160
|
abilities: {
|
|
6
161
|
functionCall: true,
|
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
import { AIChatModelCard } from '../types/aiModel';
|
|
2
2
|
|
|
3
3
|
const bedrockChatModels: AIChatModelCard[] = [
|
|
4
|
+
{
|
|
5
|
+
abilities: {
|
|
6
|
+
functionCall: true,
|
|
7
|
+
reasoning: true,
|
|
8
|
+
structuredOutput: true,
|
|
9
|
+
vision: true,
|
|
10
|
+
},
|
|
11
|
+
contextWindowTokens: 200_000,
|
|
12
|
+
description: 'Claude Sonnet 4.5 是 Anthropic 迄今为止最智能的模型。',
|
|
13
|
+
displayName: 'Claude Sonnet 4.5',
|
|
14
|
+
enabled: true,
|
|
15
|
+
id: 'us.anthropic.claude-sonnet-4-5-20250929-v1:0',
|
|
16
|
+
maxOutput: 64_000,
|
|
17
|
+
pricing: {
|
|
18
|
+
units: [
|
|
19
|
+
{ name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
|
|
20
|
+
{ name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
releasedAt: '2025-09-29',
|
|
24
|
+
type: 'chat',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
abilities: {
|
|
28
|
+
functionCall: true,
|
|
29
|
+
reasoning: true,
|
|
30
|
+
structuredOutput: true,
|
|
31
|
+
vision: true,
|
|
32
|
+
},
|
|
33
|
+
contextWindowTokens: 200_000,
|
|
34
|
+
description: 'Claude Haiku 4.5 是 Anthropic 最快且最智能的 Haiku 模型,具有闪电般的速度和扩展思考能力。',
|
|
35
|
+
displayName: 'Claude Haiku 4.5',
|
|
36
|
+
enabled: true,
|
|
37
|
+
id: 'us.anthropic.claude-haiku-4-5-20251001-v1:0',
|
|
38
|
+
maxOutput: 64_000,
|
|
39
|
+
pricing: {
|
|
40
|
+
units: [
|
|
41
|
+
{ name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
|
|
42
|
+
{ name: 'textOutput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
releasedAt: '2025-10-15',
|
|
46
|
+
type: 'chat',
|
|
47
|
+
},
|
|
4
48
|
/*
|
|
5
49
|
// TODO: Not support for now
|
|
6
50
|
{
|
|
@@ -263,6 +263,7 @@ export const MODEL_PARAMETER_CONFLICTS = {
|
|
|
263
263
|
'claude-opus-4-20250514',
|
|
264
264
|
'claude-sonnet-4-20250514',
|
|
265
265
|
'claude-sonnet-4-5-20250929',
|
|
266
|
+
'claude-haiku-4-5-20251001',
|
|
266
267
|
// Bedrock model IDs
|
|
267
268
|
'anthropic.claude-opus-4-1-20250805-v1:0',
|
|
268
269
|
'us.anthropic.claude-opus-4-1-20250805-v1:0',
|
|
@@ -272,5 +273,7 @@ export const MODEL_PARAMETER_CONFLICTS = {
|
|
|
272
273
|
'us.anthropic.claude-sonnet-4-20250514-v1:0',
|
|
273
274
|
'anthropic.claude-sonnet-4-5-20250929-v1:0',
|
|
274
275
|
'us.anthropic.claude-sonnet-4-5-20250929-v1:0',
|
|
276
|
+
'anthropic.claude-haiku-4-5-20251001-v1:0',
|
|
277
|
+
'us.anthropic.claude-haiku-4-5-20251001-v1:0',
|
|
275
278
|
]),
|
|
276
279
|
};
|
|
@@ -51,7 +51,8 @@ export class LobeAzureOpenAI implements LobeRuntimeAI {
|
|
|
51
51
|
...message,
|
|
52
52
|
role:
|
|
53
53
|
// Convert 'system' role to 'user' or 'developer' based on the model
|
|
54
|
-
(model.includes('o1') || model.includes('o3')
|
|
54
|
+
(model.includes('o1') || model.includes('o3') || model.includes('gpt-5')) &&
|
|
55
|
+
message.role === 'system'
|
|
55
56
|
? [...systemToUserModels].some((sub) => model.includes(sub))
|
|
56
57
|
? 'user'
|
|
57
58
|
: 'developer'
|
|
@@ -15,9 +15,6 @@ const componentMap = {
|
|
|
15
15
|
[SettingsTabs.Agent]: dynamic(() => import('../agent'), {
|
|
16
16
|
loading: () => <Loading />,
|
|
17
17
|
}),
|
|
18
|
-
[SettingsTabs.LLM]: dynamic(() => import('../llm'), {
|
|
19
|
-
loading: () => <Loading />,
|
|
20
|
-
}),
|
|
21
18
|
[SettingsTabs.Provider]: dynamic(() => import('../provider'), {
|
|
22
19
|
loading: () => <Loading />,
|
|
23
20
|
}),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Auth0 from './auth0';
|
|
2
2
|
import Authelia from './authelia';
|
|
3
3
|
import Authentik from './authentik';
|
|
4
|
-
import AzureAD from './azure-ad';
|
|
5
4
|
import Casdoor from './casdoor';
|
|
6
5
|
import CloudflareZeroTrust from './cloudflare-zero-trust';
|
|
7
6
|
import Cognito from './cognito';
|
|
@@ -19,7 +18,6 @@ import Zitadel from './zitadel';
|
|
|
19
18
|
export const ssoProviders = [
|
|
20
19
|
Auth0,
|
|
21
20
|
Authentik,
|
|
22
|
-
AzureAD,
|
|
23
21
|
GenericOIDC,
|
|
24
22
|
Github,
|
|
25
23
|
Zitadel,
|
|
@@ -340,7 +340,7 @@ export const createOIDCProvider = async (db: LobeChatDatabase): Promise<Provider
|
|
|
340
340
|
|
|
341
341
|
// 8. 令牌有效期
|
|
342
342
|
ttl: {
|
|
343
|
-
AccessToken:
|
|
343
|
+
AccessToken: 7 * 24 * 3600, // 7 days
|
|
344
344
|
AuthorizationCode: 600, // 10 minutes
|
|
345
345
|
DeviceCode: 600, // 10 minutes (if enabled)
|
|
346
346
|
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { AutoComplete, Input, InputPassword, Markdown } from '@lobehub/ui';
|
|
4
|
-
import { createStyles } from 'antd-style';
|
|
5
|
-
import { ModelProvider } from 'model-bank';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
|
-
|
|
8
|
-
import { AzureProviderCard } from '@/config/modelProviders';
|
|
9
|
-
import { useUserStore } from '@/store/user';
|
|
10
|
-
import { modelProviderSelectors } from '@/store/user/selectors';
|
|
11
|
-
|
|
12
|
-
import { KeyVaultsConfigKey, LLMProviderApiTokenKey } from '../../const';
|
|
13
|
-
import { ProviderItem } from '../../type';
|
|
14
|
-
|
|
15
|
-
const useStyles = createStyles(({ css, token }) => ({
|
|
16
|
-
markdown: css`
|
|
17
|
-
p {
|
|
18
|
-
color: ${token.colorTextDescription} !important;
|
|
19
|
-
}
|
|
20
|
-
`,
|
|
21
|
-
tip: css`
|
|
22
|
-
font-size: 12px;
|
|
23
|
-
color: ${token.colorTextDescription};
|
|
24
|
-
`,
|
|
25
|
-
}));
|
|
26
|
-
|
|
27
|
-
const providerKey = ModelProvider.Azure;
|
|
28
|
-
|
|
29
|
-
export const useAzureProvider = (): ProviderItem => {
|
|
30
|
-
const { t } = useTranslation('modelProvider');
|
|
31
|
-
const { styles } = useStyles();
|
|
32
|
-
|
|
33
|
-
// Get the first model card's deployment name as the check model
|
|
34
|
-
const checkModel = useUserStore((s) => {
|
|
35
|
-
const chatModelCards = modelProviderSelectors.getModelCardsById(providerKey)(s);
|
|
36
|
-
|
|
37
|
-
if (chatModelCards.length > 0) {
|
|
38
|
-
return chatModelCards[0].deploymentName;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return 'gpt-35-turbo';
|
|
42
|
-
});
|
|
43
|
-
return {
|
|
44
|
-
...AzureProviderCard,
|
|
45
|
-
apiKeyItems: [
|
|
46
|
-
{
|
|
47
|
-
children: (
|
|
48
|
-
<InputPassword autoComplete={'new-password'} placeholder={t('azure.token.placeholder')} />
|
|
49
|
-
),
|
|
50
|
-
desc: t('azure.token.desc'),
|
|
51
|
-
label: t('azure.token.title'),
|
|
52
|
-
name: [KeyVaultsConfigKey, providerKey, LLMProviderApiTokenKey],
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
children: <Input allowClear placeholder={t('azure.endpoint.placeholder')} />,
|
|
56
|
-
desc: t('azure.endpoint.desc'),
|
|
57
|
-
label: t('azure.endpoint.title'),
|
|
58
|
-
name: [KeyVaultsConfigKey, providerKey, 'endpoint'],
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
children: (
|
|
62
|
-
<AutoComplete
|
|
63
|
-
options={[
|
|
64
|
-
'2024-06-01',
|
|
65
|
-
'2024-02-01',
|
|
66
|
-
'2024-05-01-preview',
|
|
67
|
-
'2024-04-01-preview',
|
|
68
|
-
'2024-03-01-preview',
|
|
69
|
-
'2024-02-15-preview',
|
|
70
|
-
'2023-10-01-preview',
|
|
71
|
-
'2023-06-01-preview',
|
|
72
|
-
'2023-05-15',
|
|
73
|
-
].map((i) => ({ label: i, value: i }))}
|
|
74
|
-
placeholder={'20XX-XX-XX'}
|
|
75
|
-
/>
|
|
76
|
-
),
|
|
77
|
-
desc: (
|
|
78
|
-
<Markdown className={styles.markdown} fontSize={12} variant={'chat'}>
|
|
79
|
-
{t('azure.azureApiVersion.desc')}
|
|
80
|
-
</Markdown>
|
|
81
|
-
),
|
|
82
|
-
label: t('azure.azureApiVersion.title'),
|
|
83
|
-
name: [KeyVaultsConfigKey, providerKey, 'apiVersion'],
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
checkModel,
|
|
87
|
-
modelList: {
|
|
88
|
-
azureDeployName: true,
|
|
89
|
-
notFoundContent: t('azure.empty'),
|
|
90
|
-
placeholder: t('azure.modelListPlaceholder'),
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { InputPassword, Select } from '@lobehub/ui';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
|
|
6
|
-
import { BedrockProviderCard } from '@/config/modelProviders';
|
|
7
|
-
import { GlobalLLMProviderKey } from '@/types/user/settings';
|
|
8
|
-
|
|
9
|
-
import { KeyVaultsConfigKey } from '../../const';
|
|
10
|
-
import { ProviderItem } from '../../type';
|
|
11
|
-
|
|
12
|
-
const providerKey: GlobalLLMProviderKey = 'bedrock';
|
|
13
|
-
|
|
14
|
-
export const useBedrockProvider = (): ProviderItem => {
|
|
15
|
-
const { t } = useTranslation('modelProvider');
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
...BedrockProviderCard,
|
|
19
|
-
apiKeyItems: [
|
|
20
|
-
{
|
|
21
|
-
children: (
|
|
22
|
-
<InputPassword
|
|
23
|
-
autoComplete={'new-password'}
|
|
24
|
-
placeholder={t(`${providerKey}.accessKeyId.placeholder`)}
|
|
25
|
-
/>
|
|
26
|
-
),
|
|
27
|
-
desc: t(`${providerKey}.accessKeyId.desc`),
|
|
28
|
-
label: t(`${providerKey}.accessKeyId.title`),
|
|
29
|
-
name: [KeyVaultsConfigKey, providerKey, 'accessKeyId'],
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
children: (
|
|
33
|
-
<InputPassword
|
|
34
|
-
autoComplete={'new-password'}
|
|
35
|
-
placeholder={t(`${providerKey}.secretAccessKey.placeholder`)}
|
|
36
|
-
/>
|
|
37
|
-
),
|
|
38
|
-
desc: t(`${providerKey}.secretAccessKey.desc`),
|
|
39
|
-
label: t(`${providerKey}.secretAccessKey.title`),
|
|
40
|
-
name: [KeyVaultsConfigKey, providerKey, 'secretAccessKey'],
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
children: (
|
|
44
|
-
<InputPassword
|
|
45
|
-
autoComplete={'new-password'}
|
|
46
|
-
placeholder={t(`${providerKey}.sessionToken.placeholder`)}
|
|
47
|
-
/>
|
|
48
|
-
),
|
|
49
|
-
desc: t(`${providerKey}.sessionToken.desc`),
|
|
50
|
-
label: t(`${providerKey}.sessionToken.title`),
|
|
51
|
-
name: [KeyVaultsConfigKey, providerKey, 'sessionToken'],
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
children: (
|
|
55
|
-
<Select
|
|
56
|
-
allowClear
|
|
57
|
-
options={['us-east-1', 'us-west-2', 'ap-southeast-1', 'eu-central-1'].map((i) => ({
|
|
58
|
-
label: i,
|
|
59
|
-
value: i,
|
|
60
|
-
}))}
|
|
61
|
-
placeholder={'us-east-1'}
|
|
62
|
-
/>
|
|
63
|
-
),
|
|
64
|
-
desc: t(`${providerKey}.region.desc`),
|
|
65
|
-
label: t(`${providerKey}.region.title`),
|
|
66
|
-
name: [KeyVaultsConfigKey, providerKey, 'region'],
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
};
|
|
70
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Input, InputPassword } from '@lobehub/ui';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
|
|
6
|
-
import { CloudflareProviderCard } from '@/config/modelProviders';
|
|
7
|
-
import { GlobalLLMProviderKey } from '@/types/user/settings';
|
|
8
|
-
|
|
9
|
-
import { KeyVaultsConfigKey } from '../../const';
|
|
10
|
-
import { ProviderItem } from '../../type';
|
|
11
|
-
|
|
12
|
-
const providerKey: GlobalLLMProviderKey = 'cloudflare';
|
|
13
|
-
|
|
14
|
-
export const useCloudflareProvider = (): ProviderItem => {
|
|
15
|
-
const { t } = useTranslation('modelProvider');
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
...CloudflareProviderCard,
|
|
19
|
-
apiKeyItems: [
|
|
20
|
-
{
|
|
21
|
-
children: (
|
|
22
|
-
<InputPassword
|
|
23
|
-
autoComplete={'new-password'}
|
|
24
|
-
placeholder={t(`${providerKey}.apiKey.placeholder`)}
|
|
25
|
-
/>
|
|
26
|
-
),
|
|
27
|
-
desc: t(`${providerKey}.apiKey.desc`),
|
|
28
|
-
label: t(`${providerKey}.apiKey.title`),
|
|
29
|
-
name: [KeyVaultsConfigKey, providerKey, 'apiKey'],
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
children: <Input placeholder={t(`${providerKey}.baseURLOrAccountID.placeholder`)} />,
|
|
33
|
-
desc: t(`${providerKey}.baseURLOrAccountID.desc`),
|
|
34
|
-
label: t(`${providerKey}.baseURLOrAccountID.title`),
|
|
35
|
-
name: [KeyVaultsConfigKey, providerKey, 'baseURLOrAccountID'],
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
};
|
|
39
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { InputPassword, Markdown } from '@lobehub/ui';
|
|
4
|
-
import { createStyles } from 'antd-style';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
|
|
7
|
-
import { GithubProviderCard } from '@/config/modelProviders';
|
|
8
|
-
import { GlobalLLMProviderKey } from '@/types/user/settings';
|
|
9
|
-
|
|
10
|
-
import { KeyVaultsConfigKey, LLMProviderApiTokenKey } from '../../const';
|
|
11
|
-
import { ProviderItem } from '../../type';
|
|
12
|
-
|
|
13
|
-
const useStyles = createStyles(({ css, token }) => ({
|
|
14
|
-
markdown: css`
|
|
15
|
-
p {
|
|
16
|
-
color: ${token.colorTextDescription} !important;
|
|
17
|
-
}
|
|
18
|
-
`,
|
|
19
|
-
tip: css`
|
|
20
|
-
font-size: 12px;
|
|
21
|
-
color: ${token.colorTextDescription};
|
|
22
|
-
`,
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
|
-
const providerKey: GlobalLLMProviderKey = 'github';
|
|
26
|
-
|
|
27
|
-
// Same as OpenAIProvider, but replace API Key with Github Personal Access Token
|
|
28
|
-
export const useGithubProvider = (): ProviderItem => {
|
|
29
|
-
const { t } = useTranslation('modelProvider');
|
|
30
|
-
const { styles } = useStyles();
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
...GithubProviderCard,
|
|
34
|
-
apiKeyItems: [
|
|
35
|
-
{
|
|
36
|
-
children: (
|
|
37
|
-
<InputPassword
|
|
38
|
-
autoComplete={'new-password'}
|
|
39
|
-
placeholder={t(`${providerKey}.personalAccessToken.placeholder`)}
|
|
40
|
-
/>
|
|
41
|
-
),
|
|
42
|
-
desc: (
|
|
43
|
-
<Markdown className={styles.markdown} fontSize={12} variant={'chat'}>
|
|
44
|
-
{t(`${providerKey}.personalAccessToken.desc`)}
|
|
45
|
-
</Markdown>
|
|
46
|
-
),
|
|
47
|
-
label: t(`${providerKey}.personalAccessToken.title`),
|
|
48
|
-
name: [KeyVaultsConfigKey, providerKey, LLMProviderApiTokenKey],
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
};
|
|
52
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { GlobalLLMProviderKey } from '@lobechat/types';
|
|
4
|
-
import { InputPassword, Markdown } from '@lobehub/ui';
|
|
5
|
-
import { createStyles } from 'antd-style';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
|
-
|
|
8
|
-
import { HuggingFaceProviderCard } from '@/config/modelProviders';
|
|
9
|
-
|
|
10
|
-
import { KeyVaultsConfigKey, LLMProviderApiTokenKey } from '../../const';
|
|
11
|
-
import { ProviderItem } from '../../type';
|
|
12
|
-
|
|
13
|
-
const useStyles = createStyles(({ css, token }) => ({
|
|
14
|
-
markdown: css`
|
|
15
|
-
p {
|
|
16
|
-
color: ${token.colorTextDescription} !important;
|
|
17
|
-
}
|
|
18
|
-
`,
|
|
19
|
-
tip: css`
|
|
20
|
-
font-size: 12px;
|
|
21
|
-
color: ${token.colorTextDescription};
|
|
22
|
-
`,
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
|
-
const providerKey: GlobalLLMProviderKey = 'huggingface';
|
|
26
|
-
|
|
27
|
-
// Same as OpenAIProvider, but replace API Key with HuggingFace Access Token
|
|
28
|
-
export const useHuggingFaceProvider = (): ProviderItem => {
|
|
29
|
-
const { t } = useTranslation('modelProvider');
|
|
30
|
-
const { styles } = useStyles();
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
...HuggingFaceProviderCard,
|
|
34
|
-
apiKeyItems: [
|
|
35
|
-
{
|
|
36
|
-
children: (
|
|
37
|
-
<InputPassword
|
|
38
|
-
autoComplete={'new-password'}
|
|
39
|
-
placeholder={t(`${providerKey}.accessToken.placeholder`)}
|
|
40
|
-
/>
|
|
41
|
-
),
|
|
42
|
-
desc: (
|
|
43
|
-
<Markdown className={styles.markdown} fontSize={12} variant={'chat'}>
|
|
44
|
-
{t(`${providerKey}.accessToken.desc`)}
|
|
45
|
-
</Markdown>
|
|
46
|
-
),
|
|
47
|
-
label: t(`${providerKey}.accessToken.title`),
|
|
48
|
-
name: [KeyVaultsConfigKey, providerKey, LLMProviderApiTokenKey],
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
};
|
|
52
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
|
|
5
|
-
import { OllamaProviderCard } from '@/config/modelProviders';
|
|
6
|
-
|
|
7
|
-
import { ProviderItem } from '../../type';
|
|
8
|
-
|
|
9
|
-
export const useOllamaProvider = (): ProviderItem => {
|
|
10
|
-
const { t } = useTranslation('modelProvider');
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
...OllamaProviderCard,
|
|
14
|
-
proxyUrl: {
|
|
15
|
-
desc: t('ollama.endpoint.desc'),
|
|
16
|
-
placeholder: 'http://127.0.0.1:11434',
|
|
17
|
-
title: t('ollama.endpoint.title'),
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { OpenAIProviderCard } from '@/config/modelProviders';
|
|
4
|
-
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
5
|
-
|
|
6
|
-
import { ProviderItem } from '../../type';
|
|
7
|
-
|
|
8
|
-
export const useOpenAIProvider = (): ProviderItem => {
|
|
9
|
-
const { showOpenAIProxyUrl, showOpenAIApiKey } = useServerConfigStore(featureFlagsSelectors);
|
|
10
|
-
return {
|
|
11
|
-
...OpenAIProviderCard,
|
|
12
|
-
proxyUrl: showOpenAIProxyUrl && {
|
|
13
|
-
placeholder: 'https://api.openai.com/v1',
|
|
14
|
-
},
|
|
15
|
-
showApiKey: showOpenAIApiKey,
|
|
16
|
-
};
|
|
17
|
-
};
|