@lobehub/chat 0.42.3 → 0.43.0
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
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 0.43.0](https://github.com/lobehub/lobe-chat/compare/v0.42.3...v0.43.0)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-08-12**</sup>
|
|
8
|
+
|
|
9
|
+
#### ✨ Features
|
|
10
|
+
|
|
11
|
+
- **misc**: 支持切换语言.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's improved
|
|
19
|
+
|
|
20
|
+
- **misc**: 支持切换语言, closes [#67](https://github.com/lobehub/lobe-chat/issues/67) ([63ed8ec](https://github.com/lobehub/lobe-chat/commit/63ed8ec))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
### [Version 0.42.3](https://github.com/lobehub/lobe-chat/compare/v0.42.2...v0.42.3)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2023-08-12**</sup>
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Form, type ItemGroup, ThemeSwitch } from '@lobehub/ui';
|
|
2
2
|
import { Form as AntForm, App, Button, Input, Select } from 'antd';
|
|
3
3
|
import isEqual from 'fast-deep-equal';
|
|
4
|
+
import { changeLanguage } from 'i18next';
|
|
4
5
|
import { debounce } from 'lodash-es';
|
|
5
6
|
import { AppWindow, Palette, Webhook } from 'lucide-react';
|
|
6
7
|
import { memo, useCallback, useMemo } from 'react';
|
|
@@ -27,9 +28,10 @@ const Common = memo(() => {
|
|
|
27
28
|
const { t } = useTranslation('setting');
|
|
28
29
|
const [form] = AntForm.useForm();
|
|
29
30
|
const clearSessions = useSessionStore((s) => s.clearSessions);
|
|
31
|
+
|
|
30
32
|
const settings = useGlobalStore(settingsSelectors.currentSettings, isEqual);
|
|
31
33
|
const [setThemeMode, setSettings, resetSettings] = useGlobalStore((s) => [
|
|
32
|
-
s.
|
|
34
|
+
s.switchThemeMode,
|
|
33
35
|
s.setSettings,
|
|
34
36
|
s.resetSettings,
|
|
35
37
|
]);
|
|
@@ -89,7 +91,14 @@ const Common = memo(() => {
|
|
|
89
91
|
label: t('settingTheme.themeMode.title'),
|
|
90
92
|
},
|
|
91
93
|
{
|
|
92
|
-
children:
|
|
94
|
+
children: (
|
|
95
|
+
<Select
|
|
96
|
+
onChange={(e) => {
|
|
97
|
+
changeLanguage(e);
|
|
98
|
+
}}
|
|
99
|
+
options={options}
|
|
100
|
+
/>
|
|
101
|
+
),
|
|
93
102
|
label: t('settingTheme.lang.title'),
|
|
94
103
|
name: 'language',
|
|
95
104
|
},
|
|
@@ -29,7 +29,7 @@ export interface SettingsAction {
|
|
|
29
29
|
* 设置主题模式
|
|
30
30
|
* @param themeMode - 主题模式
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
switchThemeMode: (themeMode: ThemeMode) => void;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export const createSettingsSlice: StateCreator<
|
|
@@ -63,7 +63,7 @@ export const createSettingsSlice: StateCreator<
|
|
|
63
63
|
const oldSetting = get().settings;
|
|
64
64
|
set({ settings: merge(oldSetting, settings) }, false, t('setSettings', settings));
|
|
65
65
|
},
|
|
66
|
-
|
|
66
|
+
switchThemeMode: (themeMode) => {
|
|
67
67
|
get().setSettings({ themeMode });
|
|
68
68
|
},
|
|
69
69
|
});
|