@lobehub/chat 0.150.9 → 0.150.10
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/app/chat/(desktop)/features/ChatHeader/Tags.tsx +3 -3
- package/src/app/chat/(desktop)/features/ChatInput/Footer/DragUpload.tsx +3 -3
- package/src/app/chat/(desktop)/features/ChatInput/Footer/SendMore.tsx +3 -3
- package/src/app/chat/(desktop)/features/ChatInput/Footer/index.tsx +3 -3
- package/src/app/chat/(desktop)/features/ChatInput/TextArea.test.tsx +5 -5
- package/src/app/chat/(desktop)/features/ChatInput/TextArea.tsx +3 -3
- package/src/app/chat/(mobile)/features/SessionHeader.tsx +3 -3
- package/src/app/chat/features/ShareButton/ShareModal.tsx +3 -3
- package/src/app/chat/features/TelemetryNotification/index.tsx +2 -2
- package/src/app/chat/features/TopicListContent/Topic/index.tsx +2 -2
- package/src/app/chat/settings/features/SubmitAgentButton/SubmitAgentModal.tsx +3 -3
- package/src/app/settings/(mobile)/index.tsx +3 -3
- package/src/app/settings/about/Analytics.tsx +4 -4
- package/src/app/settings/agent/Agent.tsx +4 -4
- package/src/app/settings/common/Common.tsx +4 -4
- package/src/app/settings/common/Theme.tsx +4 -4
- package/src/app/settings/features/ThemeSwatches/ThemeSwatchesNeutral.tsx +3 -3
- package/src/app/settings/features/ThemeSwatches/ThemeSwatchesPrimary.tsx +3 -3
- package/src/app/settings/hooks/useSyncSettings.ts +3 -3
- package/src/app/settings/llm/Azure/index.tsx +3 -3
- package/src/app/settings/llm/components/ProviderConfig/index.tsx +3 -3
- package/src/app/settings/llm/components/ProviderModelList/CustomModelOption.tsx +4 -4
- package/src/app/settings/llm/components/ProviderModelList/ModelConfigModal.tsx +4 -4
- package/src/app/settings/llm/components/ProviderModelList/ModelFetcher.tsx +6 -6
- package/src/app/settings/llm/components/ProviderModelList/Option.tsx +3 -3
- package/src/app/settings/llm/components/ProviderModelList/index.tsx +6 -6
- package/src/app/settings/sync/Alert.tsx +3 -3
- package/src/app/settings/sync/DeviceInfo/DeviceName.tsx +3 -3
- package/src/app/settings/sync/WebRTC/index.tsx +2 -2
- package/src/app/settings/tts/TTS/index.tsx +4 -4
- package/src/chains/__tests__/summaryAgentName.test.ts +2 -2
- package/src/chains/__tests__/summaryDescription.test.ts +2 -2
- package/src/chains/__tests__/summaryTags.test.ts +2 -2
- package/src/chains/__tests__/summaryTitle.test.ts +2 -2
- package/src/chains/summaryAgentName.ts +1 -1
- package/src/chains/summaryDescription.ts +1 -1
- package/src/chains/summaryTags.ts +1 -1
- package/src/chains/summaryTitle.ts +1 -1
- package/src/features/AgentSetting/AgentConfig/ModelSelect.tsx +3 -6
- package/src/features/AgentSetting/AgentMeta/index.tsx +3 -3
- package/src/features/AgentSetting/AgentPrompt/TokenTag.tsx +4 -4
- package/src/features/AgentSetting/AgentTTS/index.tsx +3 -3
- package/src/features/AvatarWithUpload/index.tsx +3 -3
- package/src/features/ChatInput/ActionBar/FileUpload.tsx +3 -3
- package/src/features/ChatInput/ActionBar/Token/TokenTag.tsx +4 -4
- package/src/features/ChatInput/ActionBar/Token/index.tsx +3 -3
- package/src/features/ChatInput/ActionBar/Tools/index.tsx +3 -3
- package/src/features/ChatInput/STT/browser.tsx +4 -4
- package/src/features/ChatInput/STT/index.tsx +3 -3
- package/src/features/ChatInput/STT/openai.tsx +4 -4
- package/src/features/ChatInput/useChatInput.ts +3 -3
- package/src/features/Conversation/Error/APIKeyForm/Bedrock.tsx +3 -3
- package/src/features/Conversation/Error/APIKeyForm/ProviderApiKeyForm.tsx +3 -3
- package/src/features/Conversation/Error/AccessCodeForm.tsx +3 -3
- package/src/features/Conversation/Extras/TTS/index.tsx +3 -3
- package/src/features/Conversation/Plugins/Render/MarkdownType/index.tsx +3 -3
- package/src/features/Conversation/components/ChatItem/index.tsx +3 -3
- package/src/features/ModelSwitchPanel/index.tsx +3 -6
- package/src/features/PluginDevModal/LocalForm.tsx +3 -3
- package/src/features/SyncStatusInspector/DisableSync.tsx +3 -3
- package/src/features/SyncStatusInspector/EnableSync.tsx +4 -4
- package/src/features/SyncStatusInspector/index.tsx +2 -2
- package/src/hooks/_header.ts +4 -4
- package/src/hooks/useSyncData.ts +3 -3
- package/src/hooks/useTTS.ts +4 -4
- package/src/layout/DefaultLayout/Desktop/SideBar/BottomActions.tsx +2 -2
- package/src/layout/DefaultLayout/Desktop/SideBar/TopActions.tsx +2 -2
- package/src/layout/DefaultLayout/Mobile/index.tsx +1 -1
- package/src/layout/GlobalProvider/AppTheme.tsx +4 -4
- package/src/layout/GlobalProvider/StoreInitialization.tsx +6 -1
- package/src/services/__tests__/chat.test.ts +17 -20
- package/src/services/__tests__/tool.test.ts +2 -2
- package/src/services/_auth.test.ts +2 -2
- package/src/services/_auth.ts +7 -7
- package/src/services/_header.ts +4 -4
- package/src/services/chat.ts +13 -13
- package/src/services/config.ts +4 -4
- package/src/services/models.ts +3 -3
- package/src/services/ollama.ts +3 -3
- package/src/services/session/client.ts +2 -2
- package/src/services/tool.ts +1 -1
- package/src/services/trace.ts +3 -3
- package/src/store/agent/slices/chat/selectors.test.ts +2 -2
- package/src/store/chat/slices/message/selectors.test.ts +1 -1
- package/src/store/chat/slices/message/selectors.ts +3 -3
- package/src/store/global/{slices/preference/action.test.ts → action.test.ts} +65 -13
- package/src/store/global/{slices/preference/action.ts → action.ts} +30 -16
- package/src/store/global/initialState.ts +58 -8
- package/src/store/global/selectors.ts +9 -8
- package/src/store/global/store.ts +3 -7
- package/src/store/market/action.ts +1 -1
- package/src/store/session/slices/session/action.ts +3 -3
- package/src/store/{global → user}/helpers.ts +2 -2
- package/src/store/user/index.ts +1 -0
- package/src/store/user/initialState.ts +11 -0
- package/src/store/user/selectors.ts +8 -0
- package/src/store/{global → user}/slices/common/action.test.ts +29 -81
- package/src/store/{global → user}/slices/common/action.ts +2 -20
- package/src/store/user/slices/common/initialState.ts +18 -0
- package/src/store/user/slices/common/selectors.ts +6 -0
- package/src/store/user/slices/preference/action.test.ts +41 -0
- package/src/store/user/slices/preference/action.ts +50 -0
- package/src/store/user/slices/preference/initialState.ts +33 -0
- package/src/store/user/slices/preference/selectors.ts +13 -0
- package/src/store/{global → user}/slices/settings/actions/general.test.ts +6 -6
- package/src/store/{global → user}/slices/settings/actions/general.ts +2 -2
- package/src/store/{global → user}/slices/settings/actions/index.ts +2 -2
- package/src/store/{global → user}/slices/settings/actions/llm.test.ts +11 -14
- package/src/store/{global → user}/slices/settings/actions/llm.ts +2 -2
- package/src/store/{global → user}/slices/settings/initialState.ts +2 -2
- package/src/store/{global → user}/slices/settings/selectors/modelConfig.test.ts +8 -8
- package/src/store/{global → user}/slices/settings/selectors/modelConfig.ts +12 -12
- package/src/store/{global → user}/slices/settings/selectors/modelProvider.test.ts +17 -17
- package/src/store/{global → user}/slices/settings/selectors/modelProvider.ts +19 -20
- package/src/store/{global → user}/slices/settings/selectors/selectors.test.ts +8 -8
- package/src/store/{global → user}/slices/settings/selectors/settings.ts +12 -12
- package/src/store/user/slices/settings/selectors/sync.ts +14 -0
- package/src/store/user/store.ts +33 -0
- package/src/tools/dalle/Render/ToolBar.tsx +3 -3
- package/src/utils/localStorage.ts +3 -1
- package/src/store/global/slices/common/initialState.ts +0 -42
- package/src/store/global/slices/common/selectors.ts +0 -6
- package/src/store/global/slices/preference/initialState.ts +0 -51
- package/src/store/global/slices/preference/selectors.ts +0 -18
- package/src/store/global/slices/settings/selectors/sync.ts +0 -14
- /package/src/store/{global → user}/slices/settings/reducers/customModelCard.test.ts +0 -0
- /package/src/store/{global → user}/slices/settings/reducers/customModelCard.ts +0 -0
- /package/src/store/{global → user}/slices/settings/selectors/__snapshots__/selectors.test.ts.snap +0 -0
- /package/src/store/{global → user}/slices/settings/selectors/index.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.150.10](https://github.com/lobehub/lobe-chat/compare/v0.150.9...v0.150.10)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-04-28**</sup>
|
|
8
|
+
|
|
9
|
+
#### ♻ Code Refactoring
|
|
10
|
+
|
|
11
|
+
- **misc**: Rename globalStore to userStore.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### Code refactoring
|
|
19
|
+
|
|
20
|
+
- **misc**: Rename globalStore to userStore, closes [#2264](https://github.com/lobehub/lobe-chat/issues/2264) ([a3cb538](https://github.com/lobehub/lobe-chat/commit/a3cb538))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
### [Version 0.150.9](https://github.com/lobehub/lobe-chat/compare/v0.150.8...v0.150.9)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2024-04-28**</sup>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.150.
|
|
3
|
+
"version": "0.150.10",
|
|
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",
|
|
@@ -5,8 +5,8 @@ import ModelTag from '@/components/ModelTag';
|
|
|
5
5
|
import ModelSwitchPanel from '@/features/ModelSwitchPanel';
|
|
6
6
|
import { useAgentStore } from '@/store/agent';
|
|
7
7
|
import { agentSelectors } from '@/store/agent/selectors';
|
|
8
|
-
import {
|
|
9
|
-
import { modelProviderSelectors } from '@/store/
|
|
8
|
+
import { useUserStore } from '@/store/user';
|
|
9
|
+
import { modelProviderSelectors } from '@/store/user/selectors';
|
|
10
10
|
|
|
11
11
|
import PluginTag from '../../../features/PluginTag';
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ const TitleTags = memo(() => {
|
|
|
16
16
|
agentSelectors.currentAgentPlugins(s),
|
|
17
17
|
]);
|
|
18
18
|
|
|
19
|
-
const showPlugin =
|
|
19
|
+
const showPlugin = useUserStore(modelProviderSelectors.isModelEnabledFunctionCall(model));
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
22
|
<Flexbox gap={8} horizontal>
|
|
@@ -9,8 +9,8 @@ import { Center, Flexbox } from 'react-layout-kit';
|
|
|
9
9
|
import { useAgentStore } from '@/store/agent';
|
|
10
10
|
import { agentSelectors } from '@/store/agent/selectors';
|
|
11
11
|
import { useFileStore } from '@/store/file';
|
|
12
|
-
import {
|
|
13
|
-
import { modelProviderSelectors } from '@/store/
|
|
12
|
+
import { useUserStore } from '@/store/user';
|
|
13
|
+
import { modelProviderSelectors } from '@/store/user/selectors';
|
|
14
14
|
|
|
15
15
|
const useStyles = createStyles(({ css, token, stylish }) => {
|
|
16
16
|
return {
|
|
@@ -77,7 +77,7 @@ const DragUpload = memo(() => {
|
|
|
77
77
|
|
|
78
78
|
const model = useAgentStore(agentSelectors.currentAgentModel);
|
|
79
79
|
|
|
80
|
-
const enabledFiles =
|
|
80
|
+
const enabledFiles = useUserStore(modelProviderSelectors.isModelEnabledFiles(model));
|
|
81
81
|
|
|
82
82
|
const uploadImages = async (fileList: FileList | undefined) => {
|
|
83
83
|
if (!fileList || fileList.length === 0) return;
|
|
@@ -11,8 +11,8 @@ import HotKeys from '@/components/HotKeys';
|
|
|
11
11
|
import { ALT_KEY } from '@/const/hotkeys';
|
|
12
12
|
import { useSendMessage } from '@/features/ChatInput/useSend';
|
|
13
13
|
import { useChatStore } from '@/store/chat';
|
|
14
|
-
import {
|
|
15
|
-
import { preferenceSelectors } from '@/store/
|
|
14
|
+
import { useUserStore } from '@/store/user';
|
|
15
|
+
import { preferenceSelectors } from '@/store/user/selectors';
|
|
16
16
|
import { isMacOS } from '@/utils/platform';
|
|
17
17
|
|
|
18
18
|
const useStyles = createStyles(({ css, prefixCls }) => {
|
|
@@ -32,7 +32,7 @@ const SendMore = memo(() => {
|
|
|
32
32
|
|
|
33
33
|
const { styles } = useStyles();
|
|
34
34
|
|
|
35
|
-
const [useCmdEnterToSend, updatePreference] =
|
|
35
|
+
const [useCmdEnterToSend, updatePreference] = useUserStore((s) => [
|
|
36
36
|
preferenceSelectors.useCmdEnterToSend(s),
|
|
37
37
|
s.updatePreference,
|
|
38
38
|
]);
|
|
@@ -13,8 +13,8 @@ import { useSendMessage } from '@/features/ChatInput/useSend';
|
|
|
13
13
|
import { useAgentStore } from '@/store/agent';
|
|
14
14
|
import { agentSelectors } from '@/store/agent/slices/chat';
|
|
15
15
|
import { useChatStore } from '@/store/chat';
|
|
16
|
-
import {
|
|
17
|
-
import { modelProviderSelectors, preferenceSelectors } from '@/store/
|
|
16
|
+
import { useUserStore } from '@/store/user';
|
|
17
|
+
import { modelProviderSelectors, preferenceSelectors } from '@/store/user/selectors';
|
|
18
18
|
import { isMacOS } from '@/utils/platform';
|
|
19
19
|
|
|
20
20
|
import DragUpload from './DragUpload';
|
|
@@ -66,7 +66,7 @@ const Footer = memo<FooterProps>(({ setExpand }) => {
|
|
|
66
66
|
|
|
67
67
|
const model = useAgentStore(agentSelectors.currentAgentModel);
|
|
68
68
|
|
|
69
|
-
const [useCmdEnterToSend, canUpload] =
|
|
69
|
+
const [useCmdEnterToSend, canUpload] = useUserStore((s) => [
|
|
70
70
|
preferenceSelectors.useCmdEnterToSend(s),
|
|
71
71
|
modelProviderSelectors.isModelEnabledUpload(model)(s),
|
|
72
72
|
]);
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
4
|
|
|
5
5
|
import { useChatStore } from '@/store/chat';
|
|
6
|
-
import {
|
|
6
|
+
import { useUserStore } from '@/store/user';
|
|
7
7
|
|
|
8
8
|
import InputArea from './TextArea';
|
|
9
9
|
|
|
@@ -232,7 +232,7 @@ describe('<InputArea />', () => {
|
|
|
232
232
|
inputMessage: '123',
|
|
233
233
|
sendMessage: sendMessageMock,
|
|
234
234
|
});
|
|
235
|
-
|
|
235
|
+
useUserStore.getState().updatePreference({ useCmdEnterToSend: true });
|
|
236
236
|
});
|
|
237
237
|
|
|
238
238
|
render(<InputArea setExpand={setExpandMock} />);
|
|
@@ -252,7 +252,7 @@ describe('<InputArea />', () => {
|
|
|
252
252
|
sendMessage: sendMessageMock,
|
|
253
253
|
updateInputMessage: updateInputMessageMock,
|
|
254
254
|
});
|
|
255
|
-
|
|
255
|
+
useUserStore.getState().updatePreference({ useCmdEnterToSend: false });
|
|
256
256
|
});
|
|
257
257
|
|
|
258
258
|
render(<InputArea setExpand={setExpandMock} />);
|
|
@@ -275,7 +275,7 @@ describe('<InputArea />', () => {
|
|
|
275
275
|
inputMessage: '123',
|
|
276
276
|
sendMessage: sendMessageMock,
|
|
277
277
|
});
|
|
278
|
-
|
|
278
|
+
useUserStore.getState().updatePreference({ useCmdEnterToSend: true });
|
|
279
279
|
});
|
|
280
280
|
|
|
281
281
|
render(<InputArea setExpand={setExpandMock} />);
|
|
@@ -300,7 +300,7 @@ describe('<InputArea />', () => {
|
|
|
300
300
|
sendMessage: sendMessageMock,
|
|
301
301
|
updateInputMessage: updateInputMessageMock,
|
|
302
302
|
});
|
|
303
|
-
|
|
303
|
+
useUserStore.getState().updatePreference({ useCmdEnterToSend: false });
|
|
304
304
|
});
|
|
305
305
|
|
|
306
306
|
render(<InputArea setExpand={setExpandMock} />);
|
|
@@ -6,8 +6,8 @@ import { useTranslation } from 'react-i18next';
|
|
|
6
6
|
|
|
7
7
|
import { useSendMessage } from '@/features/ChatInput/useSend';
|
|
8
8
|
import { useChatStore } from '@/store/chat';
|
|
9
|
-
import {
|
|
10
|
-
import { preferenceSelectors } from '@/store/
|
|
9
|
+
import { useUserStore } from '@/store/user';
|
|
10
|
+
import { preferenceSelectors } from '@/store/user/selectors';
|
|
11
11
|
import { isCommandPressed } from '@/utils/keyboard';
|
|
12
12
|
|
|
13
13
|
import { useAutoFocus } from './useAutoFocus';
|
|
@@ -47,7 +47,7 @@ const InputArea = memo<InputAreaProps>(({ setExpand }) => {
|
|
|
47
47
|
s.updateInputMessage,
|
|
48
48
|
]);
|
|
49
49
|
|
|
50
|
-
const useCmdEnterToSend =
|
|
50
|
+
const useCmdEnterToSend = useUserStore(preferenceSelectors.useCmdEnterToSend);
|
|
51
51
|
|
|
52
52
|
const sendMessage = useSendMessage();
|
|
53
53
|
|
|
@@ -7,10 +7,10 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
7
7
|
|
|
8
8
|
import { MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens';
|
|
9
9
|
import SyncStatusInspector from '@/features/SyncStatusInspector';
|
|
10
|
-
import { useGlobalStore } from '@/store/global';
|
|
11
|
-
import { commonSelectors } from '@/store/global/selectors';
|
|
12
10
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
13
11
|
import { useSessionStore } from '@/store/session';
|
|
12
|
+
import { useUserStore } from '@/store/user';
|
|
13
|
+
import { commonSelectors } from '@/store/user/selectors';
|
|
14
14
|
import { mobileHeaderSticky } from '@/styles/mobileHeader';
|
|
15
15
|
|
|
16
16
|
export const useStyles = createStyles(({ css, token }) => ({
|
|
@@ -26,7 +26,7 @@ export const useStyles = createStyles(({ css, token }) => ({
|
|
|
26
26
|
const Header = memo(() => {
|
|
27
27
|
const [createSession] = useSessionStore((s) => [s.createSession]);
|
|
28
28
|
const router = useRouter();
|
|
29
|
-
const avatar =
|
|
29
|
+
const avatar = useUserStore(commonSelectors.userAvatar);
|
|
30
30
|
const { showCreateSession } = useServerConfigStore(featureFlagsSelectors);
|
|
31
31
|
|
|
32
32
|
return (
|
|
@@ -6,8 +6,8 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
6
6
|
|
|
7
7
|
import { FORM_STYLE } from '@/const/layoutTokens';
|
|
8
8
|
import { useChatStore } from '@/store/chat';
|
|
9
|
-
import {
|
|
10
|
-
import { commonSelectors } from '@/store/
|
|
9
|
+
import { useUserStore } from '@/store/user';
|
|
10
|
+
import { commonSelectors } from '@/store/user/selectors';
|
|
11
11
|
|
|
12
12
|
import Preview from './Preview';
|
|
13
13
|
import { FieldType, ImageType } from './type';
|
|
@@ -49,7 +49,7 @@ const ShareModal = memo<ModalProps>(({ onCancel, open }) => {
|
|
|
49
49
|
const [fieldValue, setFieldValue] = useState<FieldType>(DEFAULT_FIELD_VALUE);
|
|
50
50
|
const [tab, setTab] = useState<Tab>(Tab.Screenshot);
|
|
51
51
|
const { t } = useTranslation('chat');
|
|
52
|
-
const avatar =
|
|
52
|
+
const avatar = useUserStore(commonSelectors.userAvatar);
|
|
53
53
|
const [shareLoading, shareToShareGPT] = useChatStore((s) => [s.shareLoading, s.shareToShareGPT]);
|
|
54
54
|
const { loading, onDownload, title } = useScreenshot(fieldValue.imageType);
|
|
55
55
|
|
|
@@ -9,9 +9,9 @@ import { useTranslation } from 'react-i18next';
|
|
|
9
9
|
import { Flexbox } from 'react-layout-kit';
|
|
10
10
|
|
|
11
11
|
import { PRIVACY_URL } from '@/const/url';
|
|
12
|
-
import { useGlobalStore } from '@/store/global';
|
|
13
12
|
import { useServerConfigStore } from '@/store/serverConfig';
|
|
14
13
|
import { serverConfigSelectors } from '@/store/serverConfig/selectors';
|
|
14
|
+
import { useUserStore } from '@/store/user';
|
|
15
15
|
|
|
16
16
|
const useStyles = createStyles(({ css, token, isDarkMode }) => ({
|
|
17
17
|
container: css`
|
|
@@ -58,7 +58,7 @@ const TelemetryNotification = memo<{ mobile?: boolean }>(({ mobile }) => {
|
|
|
58
58
|
const { t } = useTranslation('common');
|
|
59
59
|
const shouldCheck = useServerConfigStore(serverConfigSelectors.enabledTelemetryChat);
|
|
60
60
|
|
|
61
|
-
const [useCheckTrace, updatePreference] =
|
|
61
|
+
const [useCheckTrace, updatePreference] = useUserStore((s) => [
|
|
62
62
|
s.useCheckTrace,
|
|
63
63
|
s.updatePreference,
|
|
64
64
|
]);
|
|
@@ -9,7 +9,7 @@ import { Virtuoso, VirtuosoHandle } from 'react-virtuoso';
|
|
|
9
9
|
import { imageUrl } from '@/const/url';
|
|
10
10
|
import { useChatStore } from '@/store/chat';
|
|
11
11
|
import { topicSelectors } from '@/store/chat/selectors';
|
|
12
|
-
import {
|
|
12
|
+
import { useUserStore } from '@/store/user';
|
|
13
13
|
import { ChatTopic } from '@/types/topic';
|
|
14
14
|
|
|
15
15
|
import { Placeholder, SkeletonList } from './SkeletonList';
|
|
@@ -30,7 +30,7 @@ export const Topic = memo(() => {
|
|
|
30
30
|
s.activeTopicId,
|
|
31
31
|
topicSelectors.currentTopicLength(s),
|
|
32
32
|
]);
|
|
33
|
-
const [visible, updateGuideState] =
|
|
33
|
+
const [visible, updateGuideState] = useUserStore((s) => [
|
|
34
34
|
s.preference.guide?.topic,
|
|
35
35
|
s.updateGuideState,
|
|
36
36
|
]);
|
|
@@ -12,10 +12,10 @@ import { AGENTS_INDEX_GITHUB_ISSUE } from '@/const/url';
|
|
|
12
12
|
import AgentInfo from '@/features/AgentInfo';
|
|
13
13
|
import { useAgentStore } from '@/store/agent';
|
|
14
14
|
import { agentSelectors } from '@/store/agent/selectors';
|
|
15
|
-
import { useGlobalStore } from '@/store/global';
|
|
16
|
-
import { settingsSelectors } from '@/store/global/selectors';
|
|
17
15
|
import { useSessionStore } from '@/store/session';
|
|
18
16
|
import { sessionMetaSelectors } from '@/store/session/selectors';
|
|
17
|
+
import { useUserStore } from '@/store/user';
|
|
18
|
+
import { settingsSelectors } from '@/store/user/selectors';
|
|
19
19
|
|
|
20
20
|
const SubmitAgentModal = memo<ModalProps>(({ open, onCancel }) => {
|
|
21
21
|
const { t } = useTranslation('setting');
|
|
@@ -23,7 +23,7 @@ const SubmitAgentModal = memo<ModalProps>(({ open, onCancel }) => {
|
|
|
23
23
|
const systemRole = useAgentStore(agentSelectors.currentAgentSystemRole);
|
|
24
24
|
const theme = useTheme();
|
|
25
25
|
const meta = useSessionStore(sessionMetaSelectors.currentAgentMeta, isEqual);
|
|
26
|
-
const language =
|
|
26
|
+
const language = useUserStore((s) => settingsSelectors.currentSettings(s).language);
|
|
27
27
|
|
|
28
28
|
const isMetaPass = Boolean(
|
|
29
29
|
meta && meta.title && meta.description && (meta.tags as string[])?.length > 0 && meta.avatar,
|
|
@@ -7,8 +7,8 @@ import { Center, Flexbox } from 'react-layout-kit';
|
|
|
7
7
|
|
|
8
8
|
import { CURRENT_VERSION } from '@/const/version';
|
|
9
9
|
import AvatarWithUpload from '@/features/AvatarWithUpload';
|
|
10
|
-
import {
|
|
11
|
-
import { commonSelectors } from '@/store/
|
|
10
|
+
import { useUserStore } from '@/store/user';
|
|
11
|
+
import { commonSelectors } from '@/store/user/selectors';
|
|
12
12
|
|
|
13
13
|
import SettingList from '../features/SettingList';
|
|
14
14
|
import AvatarBanner from './features/AvatarBanner';
|
|
@@ -26,7 +26,7 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
|
26
26
|
}));
|
|
27
27
|
|
|
28
28
|
const Setting = memo(() => {
|
|
29
|
-
const avatar =
|
|
29
|
+
const avatar = useUserStore(commonSelectors.userAvatar);
|
|
30
30
|
const { styles } = useStyles();
|
|
31
31
|
|
|
32
32
|
return (
|
|
@@ -4,14 +4,14 @@ import { useTranslation } from 'react-i18next';
|
|
|
4
4
|
import { Flexbox } from 'react-layout-kit';
|
|
5
5
|
|
|
6
6
|
import { useStyles } from '@/app/settings/about/style';
|
|
7
|
-
import {
|
|
8
|
-
import { preferenceSelectors } from '@/store/
|
|
7
|
+
import { useUserStore } from '@/store/user';
|
|
8
|
+
import { preferenceSelectors } from '@/store/user/selectors';
|
|
9
9
|
|
|
10
10
|
const Analytics = memo(() => {
|
|
11
11
|
const { t } = useTranslation('setting');
|
|
12
12
|
const { styles } = useStyles();
|
|
13
|
-
const checked =
|
|
14
|
-
const [updatePreference] =
|
|
13
|
+
const checked = useUserStore(preferenceSelectors.userAllowTrace);
|
|
14
|
+
const [updatePreference] = useUserStore((s) => [s.updatePreference]);
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<div className={styles.wrapper}>
|
|
@@ -5,13 +5,13 @@ import { INBOX_SESSION_ID } from '@/const/session';
|
|
|
5
5
|
import AgentSetting from '@/features/AgentSetting';
|
|
6
6
|
import { useAgentStore } from '@/store/agent';
|
|
7
7
|
import { agentSelectors } from '@/store/agent/selectors';
|
|
8
|
-
import {
|
|
9
|
-
import { settingsSelectors } from '@/store/
|
|
8
|
+
import { useUserStore } from '@/store/user';
|
|
9
|
+
import { settingsSelectors } from '@/store/user/selectors';
|
|
10
10
|
|
|
11
11
|
const Agent = memo(() => {
|
|
12
12
|
const config = useAgentStore(agentSelectors.defaultAgentConfig, isEqual);
|
|
13
|
-
const meta =
|
|
14
|
-
const [updateAgent] =
|
|
13
|
+
const meta = useUserStore(settingsSelectors.defaultAgentMeta, isEqual);
|
|
14
|
+
const [updateAgent] = useUserStore((s) => [s.updateDefaultAgent]);
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<AgentSetting
|
|
@@ -12,10 +12,10 @@ import { DEFAULT_SETTINGS } from '@/const/settings';
|
|
|
12
12
|
import { useOAuthSession } from '@/hooks/useOAuthSession';
|
|
13
13
|
import { useChatStore } from '@/store/chat';
|
|
14
14
|
import { useFileStore } from '@/store/file';
|
|
15
|
-
import { useGlobalStore } from '@/store/global';
|
|
16
|
-
import { settingsSelectors } from '@/store/global/selectors';
|
|
17
15
|
import { useSessionStore } from '@/store/session';
|
|
18
16
|
import { useToolStore } from '@/store/tool';
|
|
17
|
+
import { useUserStore } from '@/store/user';
|
|
18
|
+
import { settingsSelectors } from '@/store/user/selectors';
|
|
19
19
|
|
|
20
20
|
type SettingItemGroup = ItemGroup;
|
|
21
21
|
|
|
@@ -40,8 +40,8 @@ const Common = memo<SettingsCommonProps>(({ showAccessCodeConfig, showOAuthLogin
|
|
|
40
40
|
]);
|
|
41
41
|
const [removeAllFiles] = useFileStore((s) => [s.removeAllFiles]);
|
|
42
42
|
const removeAllPlugins = useToolStore((s) => s.removeAllPlugins);
|
|
43
|
-
const settings =
|
|
44
|
-
const [setSettings, resetSettings] =
|
|
43
|
+
const settings = useUserStore(settingsSelectors.currentSettings, isEqual);
|
|
44
|
+
const [setSettings, resetSettings] = useUserStore((s) => [s.setSettings, s.resetSettings]);
|
|
45
45
|
|
|
46
46
|
const { message, modal } = App.useApp();
|
|
47
47
|
|
|
@@ -10,8 +10,8 @@ import { FORM_STYLE } from '@/const/layoutTokens';
|
|
|
10
10
|
import { imageUrl } from '@/const/url';
|
|
11
11
|
import AvatarWithUpload from '@/features/AvatarWithUpload';
|
|
12
12
|
import { localeOptions } from '@/locales/resources';
|
|
13
|
-
import {
|
|
14
|
-
import { settingsSelectors } from '@/store/
|
|
13
|
+
import { useUserStore } from '@/store/user';
|
|
14
|
+
import { settingsSelectors } from '@/store/user/selectors';
|
|
15
15
|
import { switchLang } from '@/utils/client/switchLang';
|
|
16
16
|
|
|
17
17
|
import { ThemeSwatchesNeutral, ThemeSwatchesPrimary } from '../features/ThemeSwatches';
|
|
@@ -22,8 +22,8 @@ const Theme = memo(() => {
|
|
|
22
22
|
const { t } = useTranslation('setting');
|
|
23
23
|
const [form] = AntForm.useForm();
|
|
24
24
|
|
|
25
|
-
const settings =
|
|
26
|
-
const [setThemeMode, setSettings] =
|
|
25
|
+
const settings = useUserStore(settingsSelectors.currentSettings, isEqual);
|
|
26
|
+
const [setThemeMode, setSettings] = useUserStore((s) => [s.switchThemeMode, s.setSettings]);
|
|
27
27
|
|
|
28
28
|
useSyncSettings(form);
|
|
29
29
|
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
} from '@lobehub/ui';
|
|
8
8
|
import { memo } from 'react';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import { settingsSelectors } from '@/store/
|
|
10
|
+
import { useUserStore } from '@/store/user';
|
|
11
|
+
import { settingsSelectors } from '@/store/user/selectors';
|
|
12
12
|
|
|
13
13
|
const ThemeSwatchesNeutral = memo(() => {
|
|
14
|
-
const [neutralColor, setSettings] =
|
|
14
|
+
const [neutralColor, setSettings] = useUserStore((s) => [
|
|
15
15
|
settingsSelectors.currentSettings(s).neutralColor,
|
|
16
16
|
s.setSettings,
|
|
17
17
|
]);
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
} from '@lobehub/ui';
|
|
8
8
|
import { memo } from 'react';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import { settingsSelectors } from '@/store/
|
|
10
|
+
import { useUserStore } from '@/store/user';
|
|
11
|
+
import { settingsSelectors } from '@/store/user/selectors';
|
|
12
12
|
|
|
13
13
|
const ThemeSwatchesPrimary = memo(() => {
|
|
14
|
-
const [primaryColor, setSettings] =
|
|
14
|
+
const [primaryColor, setSettings] = useUserStore((s) => [
|
|
15
15
|
settingsSelectors.currentSettings(s).primaryColor,
|
|
16
16
|
s.setSettings,
|
|
17
17
|
]);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { FormInstance } from 'antd/es/form/hooks/useForm';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { useUserStore } from '@/store/user';
|
|
5
5
|
|
|
6
6
|
export const useSyncSettings = (form: FormInstance) => {
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
// set the first time
|
|
9
|
-
form.setFieldsValue(
|
|
9
|
+
form.setFieldsValue(useUserStore.getState().settings);
|
|
10
10
|
|
|
11
11
|
// sync with later updated settings
|
|
12
|
-
const unsubscribe =
|
|
12
|
+
const unsubscribe = useUserStore.subscribe(
|
|
13
13
|
(s) => s.settings,
|
|
14
14
|
(settings) => {
|
|
15
15
|
form.setFieldsValue(settings);
|
|
@@ -7,8 +7,8 @@ import { useTranslation } from 'react-i18next';
|
|
|
7
7
|
import { Flexbox } from 'react-layout-kit';
|
|
8
8
|
|
|
9
9
|
import { ModelProvider } from '@/libs/agent-runtime';
|
|
10
|
-
import {
|
|
11
|
-
import { modelProviderSelectors } from '@/store/
|
|
10
|
+
import { useUserStore } from '@/store/user';
|
|
11
|
+
import { modelProviderSelectors } from '@/store/user/selectors';
|
|
12
12
|
|
|
13
13
|
import ProviderConfig from '../components/ProviderConfig';
|
|
14
14
|
import { LLMProviderApiTokenKey, LLMProviderBaseUrlKey, LLMProviderConfigKey } from '../const';
|
|
@@ -33,7 +33,7 @@ const AzureOpenAIProvider = memo(() => {
|
|
|
33
33
|
const { styles } = useStyles();
|
|
34
34
|
|
|
35
35
|
// Get the first model card's deployment name as the check model
|
|
36
|
-
const checkModel =
|
|
36
|
+
const checkModel = useUserStore((s) => {
|
|
37
37
|
const chatModelCards = modelProviderSelectors.getModelCardsById(providerKey)(s);
|
|
38
38
|
|
|
39
39
|
if (chatModelCards.length > 0) {
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
LLMProviderModelListKey,
|
|
13
13
|
} from '@/app/settings/llm/const';
|
|
14
14
|
import { FORM_STYLE } from '@/const/layoutTokens';
|
|
15
|
-
import {
|
|
16
|
-
import { modelConfigSelectors } from '@/store/
|
|
15
|
+
import { useUserStore } from '@/store/user';
|
|
16
|
+
import { modelConfigSelectors } from '@/store/user/selectors';
|
|
17
17
|
import { GlobalLLMProviderKey } from '@/types/settings';
|
|
18
18
|
|
|
19
19
|
import Checker from '../Checker';
|
|
@@ -59,7 +59,7 @@ const ProviderConfig = memo<ProviderConfigProps>(
|
|
|
59
59
|
enabled,
|
|
60
60
|
isFetchOnClient,
|
|
61
61
|
isProviderEndpointNotEmpty,
|
|
62
|
-
] =
|
|
62
|
+
] = useUserStore((s) => [
|
|
63
63
|
s.toggleProviderEnabled,
|
|
64
64
|
s.setSettings,
|
|
65
65
|
modelConfigSelectors.isProviderEnabled(provider)(s),
|
|
@@ -8,8 +8,8 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
8
8
|
|
|
9
9
|
import ModelIcon from '@/components/ModelIcon';
|
|
10
10
|
import { ModelInfoTags } from '@/components/ModelSelect';
|
|
11
|
-
import {
|
|
12
|
-
import { modelConfigSelectors } from '@/store/
|
|
11
|
+
import { useUserStore } from '@/store/user';
|
|
12
|
+
import { modelConfigSelectors } from '@/store/user/selectors';
|
|
13
13
|
import { GlobalLLMProviderKey } from '@/types/settings';
|
|
14
14
|
|
|
15
15
|
interface CustomModelOptionProps {
|
|
@@ -23,12 +23,12 @@ const CustomModelOption = memo<CustomModelOptionProps>(({ id, provider }) => {
|
|
|
23
23
|
const { modal } = App.useApp();
|
|
24
24
|
|
|
25
25
|
const [dispatchCustomModelCards, toggleEditingCustomModelCard, removeEnabledModels] =
|
|
26
|
-
|
|
26
|
+
useUserStore((s) => [
|
|
27
27
|
s.dispatchCustomModelCards,
|
|
28
28
|
s.toggleEditingCustomModelCard,
|
|
29
29
|
s.removeEnabledModels,
|
|
30
30
|
]);
|
|
31
|
-
const modelCard =
|
|
31
|
+
const modelCard = useUserStore(
|
|
32
32
|
modelConfigSelectors.getCustomModelCard({ id, provider }),
|
|
33
33
|
isEqual,
|
|
34
34
|
);
|
|
@@ -4,8 +4,8 @@ import isEqual from 'fast-deep-equal';
|
|
|
4
4
|
import { memo } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { modelConfigSelectors } from '@/store/
|
|
7
|
+
import { useUserStore } from '@/store/user';
|
|
8
|
+
import { modelConfigSelectors } from '@/store/user/selectors';
|
|
9
9
|
|
|
10
10
|
import MaxTokenSlider from './MaxTokenSlider';
|
|
11
11
|
|
|
@@ -18,7 +18,7 @@ const ModelConfigModal = memo<ModelConfigModalProps>(({ showAzureDeployName, pro
|
|
|
18
18
|
const { t } = useTranslation('setting');
|
|
19
19
|
|
|
20
20
|
const [open, id, editingProvider, dispatchCustomModelCards, toggleEditingCustomModelCard] =
|
|
21
|
-
|
|
21
|
+
useUserStore((s) => [
|
|
22
22
|
!!s.editingCustomCardModel && provider === s.editingCustomCardModel?.provider,
|
|
23
23
|
s.editingCustomCardModel?.id,
|
|
24
24
|
s.editingCustomCardModel?.provider,
|
|
@@ -26,7 +26,7 @@ const ModelConfigModal = memo<ModelConfigModalProps>(({ showAzureDeployName, pro
|
|
|
26
26
|
s.toggleEditingCustomModelCard,
|
|
27
27
|
]);
|
|
28
28
|
|
|
29
|
-
const modelCard =
|
|
29
|
+
const modelCard = useUserStore(
|
|
30
30
|
modelConfigSelectors.getCustomModelCard({ id, provider: editingProvider }),
|
|
31
31
|
isEqual,
|
|
32
32
|
);
|
|
@@ -7,12 +7,12 @@ import { memo } from 'react';
|
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
import { Flexbox } from 'react-layout-kit';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { useUserStore } from '@/store/user';
|
|
11
11
|
import {
|
|
12
12
|
modelConfigSelectors,
|
|
13
13
|
modelProviderSelectors,
|
|
14
14
|
settingsSelectors,
|
|
15
|
-
} from '@/store/
|
|
15
|
+
} from '@/store/user/selectors';
|
|
16
16
|
import { GlobalLLMProviderKey } from '@/types/settings';
|
|
17
17
|
|
|
18
18
|
const useStyles = createStyles(({ css, token }) => ({
|
|
@@ -36,15 +36,15 @@ interface ModelFetcherProps {
|
|
|
36
36
|
const ModelFetcher = memo<ModelFetcherProps>(({ provider }) => {
|
|
37
37
|
const { styles } = useStyles();
|
|
38
38
|
const { t } = useTranslation('setting');
|
|
39
|
-
const [useFetchProviderModelList] =
|
|
39
|
+
const [useFetchProviderModelList] = useUserStore((s) => [
|
|
40
40
|
s.useFetchProviderModelList,
|
|
41
41
|
s.setModelProviderConfig,
|
|
42
42
|
]);
|
|
43
|
-
const enabledAutoFetch =
|
|
44
|
-
const latestFetchTime =
|
|
43
|
+
const enabledAutoFetch = useUserStore(modelConfigSelectors.isAutoFetchModelsEnabled(provider));
|
|
44
|
+
const latestFetchTime = useUserStore(
|
|
45
45
|
(s) => settingsSelectors.providerConfig(provider)(s)?.latestFetchTime,
|
|
46
46
|
);
|
|
47
|
-
const totalModels =
|
|
47
|
+
const totalModels = useUserStore(
|
|
48
48
|
(s) => modelProviderSelectors.getModelCardsById(provider)(s).length,
|
|
49
49
|
);
|
|
50
50
|
|
|
@@ -5,8 +5,8 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
5
5
|
|
|
6
6
|
import ModelIcon from '@/components/ModelIcon';
|
|
7
7
|
import { ModelInfoTags } from '@/components/ModelSelect';
|
|
8
|
-
import {
|
|
9
|
-
import { modelProviderSelectors } from '@/store/
|
|
8
|
+
import { useUserStore } from '@/store/user';
|
|
9
|
+
import { modelProviderSelectors } from '@/store/user/selectors';
|
|
10
10
|
import { GlobalLLMProviderKey } from '@/types/settings';
|
|
11
11
|
|
|
12
12
|
import CustomModelOption from './CustomModelOption';
|
|
@@ -18,7 +18,7 @@ interface OptionRenderProps {
|
|
|
18
18
|
provider: GlobalLLMProviderKey;
|
|
19
19
|
}
|
|
20
20
|
const OptionRender = memo<OptionRenderProps>(({ displayName, id, provider, isAzure }) => {
|
|
21
|
-
const model =
|
|
21
|
+
const model = useUserStore((s) => modelProviderSelectors.getModelCardById(id)(s), isEqual);
|
|
22
22
|
|
|
23
23
|
// if there is isCustom, it means it is a user defined custom model
|
|
24
24
|
if (model?.isCustom || isAzure) return <CustomModelOption id={id} provider={provider} />;
|