@lobehub/chat 0.145.11 → 0.145.13
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 +58 -0
- package/locales/ar/common.json +1 -1
- package/locales/ar/error.json +7 -7
- package/locales/ar/setting.json +108 -108
- package/locales/bg-BG/common.json +1 -0
- package/locales/bg-BG/error.json +7 -1
- package/locales/bg-BG/setting.json +107 -91
- package/locales/de-DE/common.json +1 -1
- package/locales/de-DE/error.json +7 -7
- package/locales/de-DE/setting.json +106 -106
- package/locales/en-US/common.json +1 -1
- package/locales/en-US/error.json +7 -7
- package/locales/en-US/setting.json +66 -66
- package/locales/es-ES/common.json +1 -1
- package/locales/es-ES/error.json +7 -7
- package/locales/es-ES/setting.json +91 -91
- package/locales/fr-FR/common.json +1 -1
- package/locales/fr-FR/error.json +7 -7
- package/locales/fr-FR/setting.json +87 -87
- package/locales/it-IT/common.json +1 -1
- package/locales/it-IT/error.json +7 -7
- package/locales/it-IT/setting.json +111 -111
- package/locales/ja-JP/common.json +1 -1
- package/locales/ja-JP/error.json +7 -7
- package/locales/ja-JP/setting.json +101 -101
- package/locales/ko-KR/common.json +1 -1
- package/locales/ko-KR/error.json +7 -3
- package/locales/ko-KR/setting.json +82 -82
- package/locales/nl-NL/common.json +1 -1
- package/locales/nl-NL/error.json +10 -10
- package/locales/nl-NL/setting.json +112 -112
- package/locales/pl-PL/common.json +1 -1
- package/locales/pl-PL/error.json +12 -12
- package/locales/pl-PL/setting.json +102 -102
- package/locales/pt-BR/common.json +1 -1
- package/locales/pt-BR/error.json +7 -7
- package/locales/pt-BR/setting.json +104 -104
- package/locales/ru-RU/common.json +1 -1
- package/locales/ru-RU/error.json +7 -7
- package/locales/ru-RU/setting.json +113 -113
- package/locales/tr-TR/common.json +1 -1
- package/locales/tr-TR/error.json +7 -7
- package/locales/tr-TR/setting.json +113 -113
- package/locales/vi-VN/common.json +1 -1
- package/locales/vi-VN/error.json +7 -7
- package/locales/vi-VN/setting.json +81 -81
- package/locales/zh-CN/common.json +1 -1
- package/locales/zh-CN/error.json +6 -6
- package/locales/zh-CN/setting.json +39 -39
- package/locales/zh-TW/common.json +1 -1
- package/locales/zh-TW/error.json +7 -7
- package/locales/zh-TW/setting.json +70 -70
- package/package.json +1 -1
- package/src/app/api/auth/sso-providers/azure-ad.ts +1 -1
- package/src/app/settings/llm/Anthropic/index.tsx +3 -43
- package/src/app/settings/llm/Azure/index.tsx +10 -10
- package/src/app/settings/llm/Bedrock/index.tsx +9 -9
- package/src/app/settings/llm/Google/index.tsx +3 -29
- package/src/app/settings/llm/Groq/index.tsx +2 -28
- package/src/app/settings/llm/Mistral/index.tsx +2 -28
- package/src/app/settings/llm/Moonshot/index.tsx +2 -28
- package/src/app/settings/llm/Ollama/index.tsx +13 -32
- package/src/app/settings/llm/OpenAI/index.tsx +15 -17
- package/src/app/settings/llm/OpenRouter/index.tsx +3 -40
- package/src/app/settings/llm/Perplexity/index.tsx +2 -28
- package/src/app/settings/llm/TogetherAI/index.tsx +3 -44
- package/src/app/settings/llm/ZeroOne/index.tsx +2 -28
- package/src/app/settings/llm/Zhipu/index.tsx +2 -30
- package/src/app/settings/llm/components/ProviderConfig/index.tsx +73 -9
- package/src/app/settings/llm/const.ts +6 -0
- package/src/app/settings/tts/TTS/index.tsx +1 -1
- package/src/locales/default/error.ts +1 -1
- package/src/locales/default/setting.ts +30 -31
- package/src/locales/resources.ts +4 -0
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { Ollama } from '@lobehub/icons';
|
|
2
|
-
import { Input } from 'antd';
|
|
3
2
|
import { useTheme } from 'antd-style';
|
|
4
3
|
import { memo } from 'react';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
6
5
|
|
|
7
|
-
import
|
|
8
|
-
import ProviderConfig from '../components/ProviderConfig';
|
|
9
|
-
import { LLMProviderBaseUrlKey, LLMProviderConfigKey } from '../const';
|
|
6
|
+
import { ModelProvider } from '@/libs/agent-runtime';
|
|
10
7
|
|
|
11
|
-
|
|
8
|
+
import ProviderConfig from '../components/ProviderConfig';
|
|
9
|
+
import Checker from './Checker';
|
|
12
10
|
|
|
13
11
|
const OllamaProvider = memo(() => {
|
|
14
12
|
const { t } = useTranslation('setting');
|
|
@@ -16,33 +14,16 @@ const OllamaProvider = memo(() => {
|
|
|
16
14
|
|
|
17
15
|
return (
|
|
18
16
|
<ProviderConfig
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
allowClear
|
|
30
|
-
placeholder={t('llm.Ollama.customModelName.placeholder')}
|
|
31
|
-
style={{ height: 100 }}
|
|
32
|
-
/>
|
|
33
|
-
),
|
|
34
|
-
desc: t('llm.Ollama.customModelName.desc'),
|
|
35
|
-
label: t('llm.Ollama.customModelName.title'),
|
|
36
|
-
name: [LLMProviderConfigKey, providerKey, 'customModelName'],
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
children: <Checker />,
|
|
40
|
-
desc: t('llm.Ollama.checker.desc'),
|
|
41
|
-
label: t('llm.checker.title'),
|
|
42
|
-
minWidth: undefined,
|
|
43
|
-
},
|
|
44
|
-
]}
|
|
45
|
-
provider={providerKey}
|
|
17
|
+
checkerItem={{
|
|
18
|
+
children: <Checker />,
|
|
19
|
+
desc: t('llm.ollama.checker.desc'),
|
|
20
|
+
label: t('llm.checker.title'),
|
|
21
|
+
minWidth: undefined,
|
|
22
|
+
}}
|
|
23
|
+
provider={ModelProvider.Ollama}
|
|
24
|
+
showApiKey={false}
|
|
25
|
+
showCustomModelName
|
|
26
|
+
showEndpoint
|
|
46
27
|
title={
|
|
47
28
|
<Ollama.Combine color={theme.isDarkMode ? theme.colorText : theme.colorPrimary} size={24} />
|
|
48
29
|
}
|
|
@@ -41,14 +41,12 @@ const LLM = memo(() => {
|
|
|
41
41
|
<Input.Password
|
|
42
42
|
autoComplete={'new-password'}
|
|
43
43
|
placeholder={
|
|
44
|
-
useAzure
|
|
45
|
-
? t('llm.AzureOpenAI.token.placeholder')
|
|
46
|
-
: t('llm.OpenAI.token.placeholder')
|
|
44
|
+
useAzure ? t('llm.azure.token.placeholder') : t('llm.openai.token.placeholder')
|
|
47
45
|
}
|
|
48
46
|
/>
|
|
49
47
|
),
|
|
50
|
-
desc: useAzure ? t('llm.
|
|
51
|
-
label: useAzure ? t('llm.
|
|
48
|
+
desc: useAzure ? t('llm.azure.token.desc') : t('llm.openai.token.desc'),
|
|
49
|
+
label: useAzure ? t('llm.azure.token.title') : t('llm.openai.token.title'),
|
|
52
50
|
name: [LLMProviderConfigKey, providerKey, 'OPENAI_API_KEY'],
|
|
53
51
|
},
|
|
54
52
|
{
|
|
@@ -57,31 +55,31 @@ const LLM = memo(() => {
|
|
|
57
55
|
allowClear
|
|
58
56
|
placeholder={
|
|
59
57
|
useAzure
|
|
60
|
-
? t('llm.
|
|
61
|
-
: t('llm.
|
|
58
|
+
? t('llm.azure.endpoint.placeholder')
|
|
59
|
+
: t('llm.openai.endpoint.placeholder')
|
|
62
60
|
}
|
|
63
61
|
/>
|
|
64
62
|
),
|
|
65
|
-
desc: useAzure ? t('llm.
|
|
66
|
-
label: useAzure ? t('llm.
|
|
63
|
+
desc: useAzure ? t('llm.azure.endpoint.desc') : t('llm.openai.endpoint.desc'),
|
|
64
|
+
label: useAzure ? t('llm.azure.endpoint.title') : t('llm.openai.endpoint.title'),
|
|
67
65
|
name: [LLMProviderConfigKey, providerKey, 'endpoint'],
|
|
68
66
|
},
|
|
69
67
|
{
|
|
70
68
|
children: (
|
|
71
69
|
<Input.TextArea
|
|
72
70
|
allowClear
|
|
73
|
-
placeholder={t('llm.
|
|
71
|
+
placeholder={t('llm.openai.customModelName.placeholder')}
|
|
74
72
|
style={{ height: 100 }}
|
|
75
73
|
/>
|
|
76
74
|
),
|
|
77
|
-
desc: t('llm.
|
|
78
|
-
label: t('llm.
|
|
75
|
+
desc: t('llm.openai.customModelName.desc'),
|
|
76
|
+
label: t('llm.openai.customModelName.title'),
|
|
79
77
|
name: [LLMProviderConfigKey, providerKey, 'customModelName'],
|
|
80
78
|
},
|
|
81
79
|
{
|
|
82
80
|
children: <Switch />,
|
|
83
|
-
desc: t('llm.
|
|
84
|
-
label: t('llm.
|
|
81
|
+
desc: t('llm.openai.useAzure.desc'),
|
|
82
|
+
label: t('llm.openai.useAzure.title'),
|
|
85
83
|
minWidth: undefined,
|
|
86
84
|
name: [LLMProviderConfigKey, 'openAI', 'useAzure'],
|
|
87
85
|
valuePropName: 'checked',
|
|
@@ -106,11 +104,11 @@ const LLM = memo(() => {
|
|
|
106
104
|
),
|
|
107
105
|
desc: (
|
|
108
106
|
<Markdown className={styles.markdown} fontSize={12} variant={'chat'}>
|
|
109
|
-
{t('llm.
|
|
107
|
+
{t('llm.openai.azureApiVersion.desc')}
|
|
110
108
|
</Markdown>
|
|
111
109
|
),
|
|
112
110
|
hidden: !useAzure,
|
|
113
|
-
label: t('llm.
|
|
111
|
+
label: t('llm.openai.azureApiVersion.title'),
|
|
114
112
|
name: [LLMProviderConfigKey, providerKey, 'azureApiVersion'],
|
|
115
113
|
},
|
|
116
114
|
{
|
|
@@ -121,7 +119,7 @@ const LLM = memo(() => {
|
|
|
121
119
|
},
|
|
122
120
|
]}
|
|
123
121
|
provider={providerKey}
|
|
124
|
-
title={<OpenAI.Combine size={24}
|
|
122
|
+
title={<OpenAI.Combine size={24} />}
|
|
125
123
|
/>
|
|
126
124
|
);
|
|
127
125
|
});
|
|
@@ -1,56 +1,19 @@
|
|
|
1
1
|
import { OpenRouter } from '@lobehub/icons';
|
|
2
|
-
import { Input } from 'antd';
|
|
3
2
|
import { useTheme } from 'antd-style';
|
|
4
3
|
import { memo } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
4
|
|
|
7
5
|
import { ModelProvider } from '@/libs/agent-runtime';
|
|
8
6
|
|
|
9
|
-
import Checker from '../components/Checker';
|
|
10
7
|
import ProviderConfig from '../components/ProviderConfig';
|
|
11
|
-
import { LLMProviderApiTokenKey, LLMProviderConfigKey } from '../const';
|
|
12
|
-
|
|
13
|
-
const providerKey = 'openrouter';
|
|
14
8
|
|
|
15
9
|
const OpenRouterProvider = memo(() => {
|
|
16
|
-
const { t } = useTranslation('setting');
|
|
17
|
-
|
|
18
10
|
const theme = useTheme();
|
|
19
11
|
|
|
20
12
|
return (
|
|
21
13
|
<ProviderConfig
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<Input.Password
|
|
26
|
-
autoComplete={'new-password'}
|
|
27
|
-
placeholder={t('llm.OpenRouter.token.placeholder')}
|
|
28
|
-
/>
|
|
29
|
-
),
|
|
30
|
-
desc: t('llm.OpenRouter.token.desc'),
|
|
31
|
-
label: t('llm.OpenRouter.token.title'),
|
|
32
|
-
name: [LLMProviderConfigKey, providerKey, LLMProviderApiTokenKey],
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
children: (
|
|
36
|
-
<Input.TextArea
|
|
37
|
-
allowClear
|
|
38
|
-
placeholder={t('llm.OpenRouter.customModelName.placeholder')}
|
|
39
|
-
style={{ height: 100 }}
|
|
40
|
-
/>
|
|
41
|
-
),
|
|
42
|
-
desc: t('llm.OpenRouter.customModelName.desc'),
|
|
43
|
-
label: t('llm.OpenRouter.customModelName.title'),
|
|
44
|
-
name: [LLMProviderConfigKey, providerKey, 'customModelName'],
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
children: <Checker model={'mistralai/mistral-7b-instruct:free'} provider={ModelProvider.OpenRouter} />,
|
|
48
|
-
desc: t('llm.checker.desc'),
|
|
49
|
-
label: t('llm.checker.title'),
|
|
50
|
-
minWidth: '100%',
|
|
51
|
-
},
|
|
52
|
-
]}
|
|
53
|
-
provider={providerKey}
|
|
14
|
+
checkModel={'mistralai/mistral-7b-instruct:free'}
|
|
15
|
+
provider={ModelProvider.OpenRouter}
|
|
16
|
+
showCustomModelName
|
|
54
17
|
title={
|
|
55
18
|
<OpenRouter.Combine
|
|
56
19
|
color={theme.isDarkMode ? theme.colorText : OpenRouter.colorPrimary}
|
|
@@ -1,44 +1,18 @@
|
|
|
1
1
|
import { Perplexity } from '@lobehub/icons';
|
|
2
|
-
import { Input } from 'antd';
|
|
3
2
|
import { useTheme } from 'antd-style';
|
|
4
3
|
import { memo } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
4
|
|
|
7
5
|
import { ModelProvider } from '@/libs/agent-runtime';
|
|
8
6
|
|
|
9
|
-
import Checker from '../components/Checker';
|
|
10
7
|
import ProviderConfig from '../components/ProviderConfig';
|
|
11
|
-
import { LLMProviderApiTokenKey, LLMProviderConfigKey } from '../const';
|
|
12
|
-
|
|
13
|
-
const providerKey = 'perplexity';
|
|
14
8
|
|
|
15
9
|
const PerplexityProvider = memo(() => {
|
|
16
|
-
const { t } = useTranslation('setting');
|
|
17
|
-
|
|
18
10
|
const theme = useTheme();
|
|
19
11
|
|
|
20
12
|
return (
|
|
21
13
|
<ProviderConfig
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
children: (
|
|
25
|
-
<Input.Password
|
|
26
|
-
autoComplete={'new-password'}
|
|
27
|
-
placeholder={t('llm.Perplexity.token.placeholder')}
|
|
28
|
-
/>
|
|
29
|
-
),
|
|
30
|
-
desc: t('llm.Perplexity.token.desc'),
|
|
31
|
-
label: t('llm.Perplexity.token.title'),
|
|
32
|
-
name: [LLMProviderConfigKey, providerKey, LLMProviderApiTokenKey],
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
children: <Checker model={'pplx-7b-chat'} provider={ModelProvider.Perplexity} />,
|
|
36
|
-
desc: t('llm.checker.desc'),
|
|
37
|
-
label: t('llm.checker.title'),
|
|
38
|
-
minWidth: '100%',
|
|
39
|
-
},
|
|
40
|
-
]}
|
|
41
|
-
provider={providerKey}
|
|
14
|
+
checkModel={'pplx-7b-chat'}
|
|
15
|
+
provider={ModelProvider.Perplexity}
|
|
42
16
|
title={
|
|
43
17
|
<Perplexity.Combine
|
|
44
18
|
color={theme.isDarkMode ? theme.colorText : Perplexity.colorPrimary}
|
|
@@ -1,58 +1,17 @@
|
|
|
1
1
|
import { Together } from '@lobehub/icons';
|
|
2
|
-
import { Input } from 'antd';
|
|
3
2
|
import { useTheme } from 'antd-style';
|
|
4
3
|
import { memo } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
4
|
|
|
7
|
-
import { ModelProvider } from '@/libs/agent-runtime';
|
|
8
|
-
|
|
9
|
-
import Checker from '../components/Checker';
|
|
10
5
|
import ProviderConfig from '../components/ProviderConfig';
|
|
11
|
-
import { LLMProviderApiTokenKey, LLMProviderConfigKey } from '../const';
|
|
12
|
-
|
|
13
|
-
const providerKey = 'togetherai';
|
|
14
6
|
|
|
15
7
|
const TogetherAIProvider = memo(() => {
|
|
16
|
-
const { t } = useTranslation('setting');
|
|
17
|
-
|
|
18
8
|
const theme = useTheme();
|
|
19
9
|
|
|
20
10
|
return (
|
|
21
11
|
<ProviderConfig
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<Input.Password
|
|
26
|
-
autoComplete={'new-password'}
|
|
27
|
-
placeholder={t('llm.TogetherAI.token.placeholder')}
|
|
28
|
-
/>
|
|
29
|
-
),
|
|
30
|
-
desc: t('llm.TogetherAI.token.desc'),
|
|
31
|
-
label: t('llm.TogetherAI.token.title'),
|
|
32
|
-
name: [LLMProviderConfigKey, providerKey, LLMProviderApiTokenKey],
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
children: (
|
|
36
|
-
<Input.TextArea
|
|
37
|
-
allowClear
|
|
38
|
-
placeholder={t('llm.TogetherAI.customModelName.placeholder')}
|
|
39
|
-
style={{ height: 100 }}
|
|
40
|
-
/>
|
|
41
|
-
),
|
|
42
|
-
desc: t('llm.TogetherAI.customModelName.desc'),
|
|
43
|
-
label: t('llm.TogetherAI.customModelName.title'),
|
|
44
|
-
name: [LLMProviderConfigKey, providerKey, 'customModelName'],
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
children: (
|
|
48
|
-
<Checker model={'togethercomputer/alpaca-7b'} provider={ModelProvider.TogetherAI} />
|
|
49
|
-
),
|
|
50
|
-
desc: t('llm.checker.desc'),
|
|
51
|
-
label: t('llm.checker.title'),
|
|
52
|
-
minWidth: '100%',
|
|
53
|
-
},
|
|
54
|
-
]}
|
|
55
|
-
provider={providerKey}
|
|
12
|
+
checkModel={'togethercomputer/alpaca-7b'}
|
|
13
|
+
provider={'togetherai'}
|
|
14
|
+
showCustomModelName
|
|
56
15
|
title={
|
|
57
16
|
<Together.Combine
|
|
58
17
|
color={theme.isDarkMode ? theme.colorText : Together.colorPrimary}
|
|
@@ -1,44 +1,18 @@
|
|
|
1
1
|
import { ZeroOne } from '@lobehub/icons';
|
|
2
|
-
import { Input } from 'antd';
|
|
3
2
|
import { useTheme } from 'antd-style';
|
|
4
3
|
import { memo } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
4
|
|
|
7
5
|
import { ModelProvider } from '@/libs/agent-runtime';
|
|
8
6
|
|
|
9
|
-
import Checker from '../components/Checker';
|
|
10
7
|
import ProviderConfig from '../components/ProviderConfig';
|
|
11
|
-
import { LLMProviderApiTokenKey, LLMProviderConfigKey } from '../const';
|
|
12
|
-
|
|
13
|
-
const providerKey = 'zeroone';
|
|
14
8
|
|
|
15
9
|
const ZeroOneProvider = memo(() => {
|
|
16
|
-
const { t } = useTranslation('setting');
|
|
17
|
-
|
|
18
10
|
const theme = useTheme();
|
|
19
11
|
|
|
20
12
|
return (
|
|
21
13
|
<ProviderConfig
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
children: (
|
|
25
|
-
<Input.Password
|
|
26
|
-
autoComplete={'new-password'}
|
|
27
|
-
placeholder={t('llm.ZeroOne.token.placeholder')}
|
|
28
|
-
/>
|
|
29
|
-
),
|
|
30
|
-
desc: t('llm.ZeroOne.token.desc'),
|
|
31
|
-
label: t('llm.ZeroOne.token.title'),
|
|
32
|
-
name: [LLMProviderConfigKey, providerKey, LLMProviderApiTokenKey],
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
children: <Checker model={'yi-34b-chat-0205'} provider={ModelProvider.ZeroOne} />,
|
|
36
|
-
desc: t('llm.checker.desc'),
|
|
37
|
-
label: t('llm.checker.title'),
|
|
38
|
-
minWidth: '100%',
|
|
39
|
-
},
|
|
40
|
-
]}
|
|
41
|
-
provider={providerKey}
|
|
14
|
+
checkModel={'yi-34b-chat-0205'}
|
|
15
|
+
provider={ModelProvider.ZeroOne}
|
|
42
16
|
title={
|
|
43
17
|
<ZeroOne.Combine
|
|
44
18
|
color={theme.isDarkMode ? theme.colorText : ZeroOne.colorPrimary}
|
|
@@ -1,45 +1,17 @@
|
|
|
1
1
|
import { Zhipu } from '@lobehub/icons';
|
|
2
|
-
import { Input } from 'antd';
|
|
3
2
|
import { useTheme } from 'antd-style';
|
|
4
3
|
import { lighten } from 'polished';
|
|
5
4
|
import { memo } from 'react';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
5
|
|
|
8
|
-
import { ModelProvider } from '@/libs/agent-runtime';
|
|
9
|
-
|
|
10
|
-
import Checker from '../components/Checker';
|
|
11
6
|
import ProviderConfig from '../components/ProviderConfig';
|
|
12
|
-
import { LLMProviderApiTokenKey, LLMProviderConfigKey } from '../const';
|
|
13
|
-
|
|
14
|
-
const providerKey = 'zhipu';
|
|
15
7
|
|
|
16
8
|
const ZhipuProvider = memo(() => {
|
|
17
|
-
const { t } = useTranslation('setting');
|
|
18
|
-
|
|
19
9
|
const theme = useTheme();
|
|
20
10
|
|
|
21
11
|
return (
|
|
22
12
|
<ProviderConfig
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
children: (
|
|
26
|
-
<Input.Password
|
|
27
|
-
autoComplete={'new-password'}
|
|
28
|
-
placeholder={t('llm.Zhipu.token.placeholder')}
|
|
29
|
-
/>
|
|
30
|
-
),
|
|
31
|
-
desc: t('llm.Zhipu.token.desc'),
|
|
32
|
-
label: t('llm.Zhipu.token.title'),
|
|
33
|
-
name: [LLMProviderConfigKey, providerKey, LLMProviderApiTokenKey],
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
children: <Checker model={'glm-3-turbo'} provider={ModelProvider.ZhiPu} />,
|
|
37
|
-
desc: t('llm.checker.desc'),
|
|
38
|
-
label: t('llm.checker.title'),
|
|
39
|
-
minWidth: '100%',
|
|
40
|
-
},
|
|
41
|
-
]}
|
|
42
|
-
provider={providerKey}
|
|
13
|
+
checkModel={'glm-3-turbo'}
|
|
14
|
+
provider={'zhipu'}
|
|
43
15
|
title={
|
|
44
16
|
<Zhipu.Combine
|
|
45
17
|
color={theme.isDarkMode ? lighten(0.1, Zhipu.colorPrimary) : Zhipu.colorPrimary}
|
|
@@ -1,36 +1,100 @@
|
|
|
1
|
-
import { Form, type ItemGroup } from '@lobehub/ui';
|
|
2
|
-
import
|
|
3
|
-
import { Form as AntForm, Switch } from 'antd';
|
|
1
|
+
import { Form, type FormItemProps, type ItemGroup } from '@lobehub/ui';
|
|
2
|
+
import { Form as AntForm, Input, Switch } from 'antd';
|
|
4
3
|
import { debounce } from 'lodash-es';
|
|
5
4
|
import { ReactNode, memo } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
6
|
|
|
7
7
|
import { useSyncSettings } from '@/app/settings/hooks/useSyncSettings';
|
|
8
|
+
import {
|
|
9
|
+
LLMProviderApiTokenKey,
|
|
10
|
+
LLMProviderBaseUrlKey,
|
|
11
|
+
LLMProviderConfigKey,
|
|
12
|
+
LLMProviderCustomModelKey,
|
|
13
|
+
} from '@/app/settings/llm/const';
|
|
8
14
|
import { FORM_STYLE } from '@/const/layoutTokens';
|
|
9
15
|
import { useGlobalStore } from '@/store/global';
|
|
10
16
|
import { modelProviderSelectors } from '@/store/global/selectors';
|
|
11
17
|
import { GlobalLLMProviderKey } from '@/types/settings';
|
|
12
18
|
|
|
19
|
+
import Checker from '../Checker';
|
|
20
|
+
|
|
13
21
|
interface ProviderConfigProps {
|
|
14
22
|
canDeactivate?: boolean;
|
|
15
|
-
|
|
23
|
+
checkModel?: string;
|
|
24
|
+
checkerItem?: FormItemProps;
|
|
25
|
+
configItems?: FormItemProps[];
|
|
16
26
|
provider: GlobalLLMProviderKey;
|
|
27
|
+
showApiKey?: boolean;
|
|
28
|
+
showCustomModelName?: boolean;
|
|
29
|
+
showEndpoint?: boolean;
|
|
17
30
|
title: ReactNode;
|
|
18
31
|
}
|
|
19
32
|
|
|
20
33
|
const ProviderConfig = memo<ProviderConfigProps>(
|
|
21
|
-
({
|
|
34
|
+
({
|
|
35
|
+
provider,
|
|
36
|
+
showCustomModelName,
|
|
37
|
+
showEndpoint,
|
|
38
|
+
showApiKey = true,
|
|
39
|
+
checkModel,
|
|
40
|
+
canDeactivate = true,
|
|
41
|
+
title,
|
|
42
|
+
configItems,
|
|
43
|
+
checkerItem,
|
|
44
|
+
}) => {
|
|
45
|
+
const { t } = useTranslation('setting');
|
|
22
46
|
const [form] = AntForm.useForm();
|
|
23
|
-
const [toggleProviderEnabled, setSettings] = useGlobalStore((s) => [
|
|
47
|
+
const [toggleProviderEnabled, setSettings, enabled] = useGlobalStore((s) => [
|
|
24
48
|
s.toggleProviderEnabled,
|
|
25
49
|
s.setSettings,
|
|
50
|
+
modelProviderSelectors.providerEnabled(provider)(s),
|
|
26
51
|
]);
|
|
27
52
|
|
|
28
|
-
const enabled = useGlobalStore(modelProviderSelectors.providerEnabled(provider));
|
|
29
|
-
|
|
30
53
|
useSyncSettings(form);
|
|
31
54
|
|
|
55
|
+
const defaultFormItems = [
|
|
56
|
+
showApiKey && {
|
|
57
|
+
children: (
|
|
58
|
+
<Input.Password
|
|
59
|
+
autoComplete={'new-password'}
|
|
60
|
+
placeholder={t(`llm.${provider}.token.placeholder` as any)}
|
|
61
|
+
/>
|
|
62
|
+
),
|
|
63
|
+
desc: t(`llm.${provider}.token.desc` as any),
|
|
64
|
+
label: t(`llm.${provider}.token.title` as any),
|
|
65
|
+
name: [LLMProviderConfigKey, provider, LLMProviderApiTokenKey],
|
|
66
|
+
},
|
|
67
|
+
showEndpoint && {
|
|
68
|
+
children: (
|
|
69
|
+
<Input allowClear placeholder={t(`llm.${provider}.endpoint.placeholder` as any)} />
|
|
70
|
+
),
|
|
71
|
+
desc: t(`llm.${provider}.endpoint.desc` as any),
|
|
72
|
+
label: t(`llm.${provider}.endpoint.title` as any),
|
|
73
|
+
name: [LLMProviderConfigKey, provider, LLMProviderBaseUrlKey],
|
|
74
|
+
},
|
|
75
|
+
showCustomModelName && {
|
|
76
|
+
children: (
|
|
77
|
+
<Input.TextArea
|
|
78
|
+
allowClear
|
|
79
|
+
placeholder={t(`llm.${provider}.customModelName.placeholder` as any)}
|
|
80
|
+
style={{ height: 100 }}
|
|
81
|
+
/>
|
|
82
|
+
),
|
|
83
|
+
desc: t(`llm.${provider}.customModelName.desc` as any),
|
|
84
|
+
label: t(`llm.${provider}.customModelName.title` as any),
|
|
85
|
+
name: [LLMProviderConfigKey, provider, LLMProviderCustomModelKey],
|
|
86
|
+
},
|
|
87
|
+
checkerItem ?? {
|
|
88
|
+
children: <Checker model={checkModel!} provider={provider} />,
|
|
89
|
+
desc: t('llm.checker.desc'),
|
|
90
|
+
label: t('llm.checker.title'),
|
|
91
|
+
minWidth: '100%',
|
|
92
|
+
},
|
|
93
|
+
].filter(Boolean) as FormItemProps[];
|
|
94
|
+
|
|
32
95
|
const model: ItemGroup = {
|
|
33
|
-
children: configItems,
|
|
96
|
+
children: configItems ?? defaultFormItems,
|
|
97
|
+
|
|
34
98
|
defaultActive: canDeactivate ? enabled : undefined,
|
|
35
99
|
extra: canDeactivate ? (
|
|
36
100
|
<Switch
|
|
@@ -11,3 +11,9 @@ export const LLMProviderApiTokenKey = 'apiKey';
|
|
|
11
11
|
* equal OPENAI_PROXY_URL
|
|
12
12
|
*/
|
|
13
13
|
export const LLMProviderBaseUrlKey = 'endpoint';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* we use this key to define the custom model name
|
|
17
|
+
* equal CUSTOM_MODELS
|
|
18
|
+
*/
|
|
19
|
+
export const LLMProviderCustomModelKey = 'customModelName';
|
|
@@ -116,7 +116,7 @@ export default {
|
|
|
116
116
|
Bedrock: {
|
|
117
117
|
customRegion: '自定义服务区域',
|
|
118
118
|
description:
|
|
119
|
-
'输入你的
|
|
119
|
+
'输入你的 AWS AccessKeyId / SecretAccessKey 即可开始会话。应用不会记录你的鉴权配置',
|
|
120
120
|
title: '使用自定义 Bedrock 鉴权信息',
|
|
121
121
|
},
|
|
122
122
|
Google: {
|