@lobehub/chat 0.155.3 → 0.155.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 +25 -0
- package/package.json +1 -1
- package/src/features/AgentSetting/AgentChat/index.tsx +3 -5
- package/src/features/AgentSetting/AgentMeta/index.tsx +51 -54
- package/src/features/AgentSetting/AgentModal/index.tsx +2 -2
- package/src/features/AgentSetting/AgentTTS/index.tsx +18 -16
- package/src/features/AgentSetting/useSyncAgemtSettings.ts +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.155.4](https://github.com/lobehub/lobe-chat/compare/v0.155.3...v0.155.4)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-05-08**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Fix Agent Settings Form.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Fix Agent Settings Form ([12c62a0](https://github.com/lobehub/lobe-chat/commit/12c62a0))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
### [Version 0.155.3](https://github.com/lobehub/lobe-chat/compare/v0.155.2...v0.155.3)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2024-05-08**</sup>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.155.
|
|
3
|
+
"version": "0.155.4",
|
|
4
4
|
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -3,22 +3,20 @@
|
|
|
3
3
|
import { Form, ItemGroup, SelectWithImg, SliderWithInput } from '@lobehub/ui';
|
|
4
4
|
import { Input, Switch } from 'antd';
|
|
5
5
|
import { useThemeMode } from 'antd-style';
|
|
6
|
-
import { debounce } from 'lodash-es';
|
|
7
6
|
import { LayoutList, MessagesSquare } from 'lucide-react';
|
|
8
7
|
import { memo } from 'react';
|
|
9
8
|
import { useTranslation } from 'react-i18next';
|
|
10
9
|
|
|
11
|
-
import { useSyncSettings } from '@/app/(main)/settings/hooks/useSyncSettings';
|
|
12
10
|
import { FORM_STYLE } from '@/const/layoutTokens';
|
|
13
11
|
import { imageUrl } from '@/const/url';
|
|
14
12
|
|
|
15
13
|
import { useStore } from '../store';
|
|
14
|
+
import { useAgentSyncSettings } from '../useSyncAgemtSettings';
|
|
16
15
|
|
|
17
16
|
const AgentChat = memo(() => {
|
|
18
17
|
const { t } = useTranslation('setting');
|
|
19
18
|
const [form] = Form.useForm();
|
|
20
19
|
const { isDarkMode } = useThemeMode();
|
|
21
|
-
|
|
22
20
|
const [
|
|
23
21
|
displayMode,
|
|
24
22
|
enableAutoCreateTopic,
|
|
@@ -33,7 +31,7 @@ const AgentChat = memo(() => {
|
|
|
33
31
|
s.setAgentConfig,
|
|
34
32
|
]);
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
useAgentSyncSettings(form);
|
|
37
35
|
|
|
38
36
|
const chat: ItemGroup = {
|
|
39
37
|
children: [
|
|
@@ -125,7 +123,7 @@ const AgentChat = memo(() => {
|
|
|
125
123
|
form={form}
|
|
126
124
|
items={[chat]}
|
|
127
125
|
itemsType={'group'}
|
|
128
|
-
onValuesChange={
|
|
126
|
+
onValuesChange={updateConfig}
|
|
129
127
|
variant={'pure'}
|
|
130
128
|
{...FORM_STYLE}
|
|
131
129
|
/>
|
|
@@ -6,7 +6,7 @@ import isEqual from 'fast-deep-equal';
|
|
|
6
6
|
import { isString } from 'lodash-es';
|
|
7
7
|
import { Wand2 } from 'lucide-react';
|
|
8
8
|
import dynamic from 'next/dynamic';
|
|
9
|
-
import { memo
|
|
9
|
+
import { memo } from 'react';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
11
|
|
|
12
12
|
import { FORM_STYLE } from '@/const/layoutTokens';
|
|
@@ -77,60 +77,57 @@ const AgentMeta = memo(() => {
|
|
|
77
77
|
};
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
-
const metaData: ItemGroup =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
e.stopPropagation();
|
|
80
|
+
const metaData: ItemGroup = {
|
|
81
|
+
children: [
|
|
82
|
+
{
|
|
83
|
+
children: (
|
|
84
|
+
<EmojiPicker
|
|
85
|
+
backgroundColor={meta.backgroundColor}
|
|
86
|
+
locale={locale}
|
|
87
|
+
onChange={(avatar) => updateMeta({ avatar })}
|
|
88
|
+
value={meta.avatar}
|
|
89
|
+
/>
|
|
90
|
+
),
|
|
91
|
+
label: t('settingAgent.avatar.title'),
|
|
92
|
+
minWidth: undefined,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
children: (
|
|
96
|
+
<BackgroundSwatches
|
|
97
|
+
backgroundColor={meta.backgroundColor}
|
|
98
|
+
onChange={(backgroundColor) => updateMeta({ backgroundColor })}
|
|
99
|
+
/>
|
|
100
|
+
),
|
|
101
|
+
label: t('settingAgent.backgroundColor.title'),
|
|
102
|
+
minWidth: undefined,
|
|
103
|
+
},
|
|
104
|
+
...autocompleteItems,
|
|
105
|
+
],
|
|
106
|
+
extra: (
|
|
107
|
+
<Tooltip
|
|
108
|
+
title={
|
|
109
|
+
!hasSystemRole
|
|
110
|
+
? t('autoGenerateTooltipDisabled', { ns: 'common' })
|
|
111
|
+
: t('autoGenerateTooltip', { ns: 'common' })
|
|
112
|
+
}
|
|
113
|
+
>
|
|
114
|
+
<Button
|
|
115
|
+
disabled={!hasSystemRole}
|
|
116
|
+
icon={<Icon icon={Wand2} />}
|
|
117
|
+
loading={Object.values(loading).some((i) => !!i)}
|
|
118
|
+
onClick={(e: any) => {
|
|
119
|
+
e.stopPropagation();
|
|
121
120
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
[autocompleteItems, meta],
|
|
133
|
-
);
|
|
121
|
+
autocompleteAllMeta(true);
|
|
122
|
+
}}
|
|
123
|
+
size={'small'}
|
|
124
|
+
>
|
|
125
|
+
{t('autoGenerate', { ns: 'common' })}
|
|
126
|
+
</Button>
|
|
127
|
+
</Tooltip>
|
|
128
|
+
),
|
|
129
|
+
title: t('settingAgent.title'),
|
|
130
|
+
};
|
|
134
131
|
|
|
135
132
|
return <Form items={[metaData]} itemsType={'group'} variant={'pure'} {...FORM_STYLE} />;
|
|
136
133
|
});
|
|
@@ -6,10 +6,10 @@ import { debounce } from 'lodash-es';
|
|
|
6
6
|
import { memo } from 'react';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
|
|
9
|
-
import { useSyncSettings } from '@/app/(main)/settings/hooks/useSyncSettings';
|
|
10
9
|
import { FORM_STYLE } from '@/const/layoutTokens';
|
|
11
10
|
|
|
12
11
|
import { useStore } from '../store';
|
|
12
|
+
import { useAgentSyncSettings } from '../useSyncAgemtSettings';
|
|
13
13
|
import ModelSelect from './ModelSelect';
|
|
14
14
|
|
|
15
15
|
const AgentModal = memo(() => {
|
|
@@ -21,7 +21,7 @@ const AgentModal = memo(() => {
|
|
|
21
21
|
s.setAgentConfig,
|
|
22
22
|
]);
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
useAgentSyncSettings(form);
|
|
25
25
|
|
|
26
26
|
const model: ItemGroup = {
|
|
27
27
|
children: [
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import { VoiceList } from '@lobehub/tts';
|
|
4
4
|
import { Form, ItemGroup } from '@lobehub/ui';
|
|
5
|
-
import {
|
|
6
|
-
import isEqual from 'fast-deep-equal';
|
|
5
|
+
import { Select, Switch } from 'antd';
|
|
7
6
|
import { debounce } from 'lodash-es';
|
|
8
7
|
import { Mic } from 'lucide-react';
|
|
9
|
-
import { memo,
|
|
8
|
+
import { memo, useMemo } from 'react';
|
|
10
9
|
import { useTranslation } from 'react-i18next';
|
|
11
10
|
|
|
12
11
|
import { FORM_STYLE } from '@/const/layoutTokens';
|
|
@@ -14,6 +13,7 @@ import { useUserStore } from '@/store/user';
|
|
|
14
13
|
import { settingsSelectors } from '@/store/user/selectors';
|
|
15
14
|
|
|
16
15
|
import { useStore } from '../store';
|
|
16
|
+
import { useAgentSyncSettings } from '../useSyncAgemtSettings';
|
|
17
17
|
import SelectWithTTSPreview from './SelectWithTTSPreview';
|
|
18
18
|
import { ttsOptions } from './options';
|
|
19
19
|
|
|
@@ -22,21 +22,23 @@ const { openaiVoiceOptions, localeOptions } = VoiceList;
|
|
|
22
22
|
|
|
23
23
|
const AgentTTS = memo(() => {
|
|
24
24
|
const { t } = useTranslation('setting');
|
|
25
|
-
const
|
|
26
|
-
const [form] = AFrom.useForm();
|
|
25
|
+
const [form] = Form.useForm();
|
|
27
26
|
const voiceList = useUserStore((s) => {
|
|
28
27
|
const locale = settingsSelectors.currentLanguage(s);
|
|
29
28
|
return (all?: boolean) => new VoiceList(all ? undefined : locale);
|
|
30
29
|
});
|
|
31
|
-
const
|
|
30
|
+
const [showAllLocaleVoice, ttsService, updateConfig] = useStore((s) => [
|
|
31
|
+
s.config.tts.showAllLocaleVoice,
|
|
32
|
+
s.config.tts.ttsService,
|
|
33
|
+
s.setAgentConfig,
|
|
34
|
+
]);
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
form.setFieldsValue(config);
|
|
35
|
-
}, [config]);
|
|
36
|
+
useAgentSyncSettings(form);
|
|
36
37
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
const { edgeVoiceOptions, microsoftVoiceOptions } = useMemo(
|
|
39
|
+
() => voiceList(showAllLocaleVoice),
|
|
40
|
+
[showAllLocaleVoice],
|
|
41
|
+
);
|
|
40
42
|
|
|
41
43
|
const tts: ItemGroup = {
|
|
42
44
|
children: [
|
|
@@ -49,7 +51,7 @@ const AgentTTS = memo(() => {
|
|
|
49
51
|
{
|
|
50
52
|
children: <Switch />,
|
|
51
53
|
desc: t('settingTTS.showAllLocaleVoice.desc'),
|
|
52
|
-
hidden:
|
|
54
|
+
hidden: ttsService === 'openai',
|
|
53
55
|
label: t('settingTTS.showAllLocaleVoice.title'),
|
|
54
56
|
minWidth: undefined,
|
|
55
57
|
name: [TTS_SETTING_KEY, 'showAllLocaleVoice'],
|
|
@@ -58,7 +60,7 @@ const AgentTTS = memo(() => {
|
|
|
58
60
|
{
|
|
59
61
|
children: <SelectWithTTSPreview options={openaiVoiceOptions} server={'openai'} />,
|
|
60
62
|
desc: t('settingTTS.voice.desc'),
|
|
61
|
-
hidden:
|
|
63
|
+
hidden: ttsService !== 'openai',
|
|
62
64
|
label: t('settingTTS.voice.title'),
|
|
63
65
|
name: [TTS_SETTING_KEY, 'voice', 'openai'],
|
|
64
66
|
},
|
|
@@ -66,7 +68,7 @@ const AgentTTS = memo(() => {
|
|
|
66
68
|
children: <SelectWithTTSPreview options={edgeVoiceOptions} server={'edge'} />,
|
|
67
69
|
desc: t('settingTTS.voice.desc'),
|
|
68
70
|
divider: false,
|
|
69
|
-
hidden:
|
|
71
|
+
hidden: ttsService !== 'edge',
|
|
70
72
|
label: t('settingTTS.voice.title'),
|
|
71
73
|
name: [TTS_SETTING_KEY, 'voice', 'edge'],
|
|
72
74
|
},
|
|
@@ -74,7 +76,7 @@ const AgentTTS = memo(() => {
|
|
|
74
76
|
children: <SelectWithTTSPreview options={microsoftVoiceOptions} server={'microsoft'} />,
|
|
75
77
|
desc: t('settingTTS.voice.desc'),
|
|
76
78
|
divider: false,
|
|
77
|
-
hidden:
|
|
79
|
+
hidden: ttsService !== 'microsoft',
|
|
78
80
|
label: t('settingTTS.voice.title'),
|
|
79
81
|
name: [TTS_SETTING_KEY, 'voice', 'microsoft'],
|
|
80
82
|
},
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FormInstance } from 'antd/es/form/hooks/useForm';
|
|
2
|
+
import isEqual from 'fast-deep-equal';
|
|
3
|
+
import { useLayoutEffect } from 'react';
|
|
4
|
+
|
|
5
|
+
import { useStore } from './store';
|
|
6
|
+
|
|
7
|
+
export const useAgentSyncSettings = (form: FormInstance) => {
|
|
8
|
+
const config = useStore((s) => s.config, isEqual);
|
|
9
|
+
useLayoutEffect(() => {
|
|
10
|
+
form.setFieldsValue(config);
|
|
11
|
+
}, [config]);
|
|
12
|
+
|
|
13
|
+
return config;
|
|
14
|
+
};
|