@lobehub/chat 0.149.4 → 0.149.6

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.
Files changed (83) hide show
  1. package/.github/FUNDING.yml +1 -1
  2. package/CHANGELOG.md +58 -0
  3. package/docs/self-hosting/platform/docker-compose.zh-CN.mdx +15 -21
  4. package/package.json +1 -1
  5. package/src/app/chat/(desktop)/features/ChatHeader/Main.tsx +5 -5
  6. package/src/app/chat/(desktop)/features/ChatHeader/Tags.tsx +3 -3
  7. package/src/app/chat/(desktop)/features/ChatInput/Footer/DragUpload.tsx +9 -9
  8. package/src/app/chat/(desktop)/features/ChatInput/Footer/index.tsx +3 -3
  9. package/src/app/chat/(desktop)/features/SideBar/SystemRole/index.tsx +8 -3
  10. package/src/app/chat/(mobile)/mobile/ChatHeader/ChatHeaderTitle.tsx +2 -2
  11. package/src/app/chat/(mobile)/mobile/page.tsx +0 -6
  12. package/src/app/chat/_layout/Desktop/SessionList.tsx +2 -0
  13. package/src/app/chat/features/PageTitle/index.tsx +3 -3
  14. package/src/app/chat/features/PluginTag/PluginStatus.tsx +2 -2
  15. package/src/app/chat/features/SessionListContent/DefaultMode.tsx +4 -2
  16. package/src/app/chat/features/SessionListContent/List/Item/index.tsx +10 -17
  17. package/src/app/chat/features/SessionListContent/index.tsx +2 -0
  18. package/src/app/chat/features/ShareButton/Preview.tsx +15 -11
  19. package/src/app/chat/features/ShareButton/useScreenshot.ts +2 -2
  20. package/src/app/chat/settings/features/EditPage.tsx +10 -7
  21. package/src/app/chat/settings/features/SubmitAgentButton/SubmitAgentModal.tsx +5 -3
  22. package/src/app/metadata.ts +3 -3
  23. package/src/app/settings/(mobile)/features/AvatarBanner.tsx +1 -0
  24. package/src/config/modelProviders/ollama.ts +11 -12
  25. package/src/const/session.ts +1 -0
  26. package/src/database/client/models/session.ts +1 -0
  27. package/src/database/client/models/user.ts +6 -0
  28. package/src/features/ChatInput/ActionBar/FileUpload.tsx +11 -5
  29. package/src/features/ChatInput/ActionBar/History.tsx +3 -3
  30. package/src/features/ChatInput/ActionBar/ModelSwitch.tsx +2 -0
  31. package/src/features/ChatInput/ActionBar/Temperature.tsx +3 -3
  32. package/src/features/ChatInput/ActionBar/Token/TokenTag.tsx +4 -4
  33. package/src/features/ChatInput/ActionBar/Token/index.tsx +3 -3
  34. package/src/features/ChatInput/ActionBar/Tools/ToolItem.tsx +3 -3
  35. package/src/features/ChatInput/ActionBar/Tools/index.tsx +4 -4
  36. package/src/features/ChatInput/STT/browser.tsx +3 -3
  37. package/src/features/ChatInput/STT/openai.tsx +3 -3
  38. package/src/features/ChatInput/useChatInput.ts +3 -3
  39. package/src/features/Conversation/Extras/Assistant.test.tsx +7 -7
  40. package/src/features/Conversation/Extras/Assistant.tsx +3 -3
  41. package/src/features/Conversation/Extras/TTS/index.tsx +3 -3
  42. package/src/features/Conversation/components/ChatItem/ActionsBar.tsx +2 -2
  43. package/src/features/Conversation/components/ChatItem/index.tsx +6 -4
  44. package/src/features/Conversation/hooks/useInitConversation.ts +10 -7
  45. package/src/features/Conversation/index.tsx +6 -3
  46. package/src/features/ModelSwitchPanel/index.tsx +6 -4
  47. package/src/hooks/useTTS.ts +4 -4
  48. package/src/libs/agent-runtime/ollama/index.ts +1 -1
  49. package/src/services/chat.ts +3 -3
  50. package/src/services/ollama.ts +1 -2
  51. package/src/services/session/client.ts +19 -0
  52. package/src/services/session/type.ts +2 -0
  53. package/src/store/agent/index.ts +2 -0
  54. package/src/store/agent/initialState.ts +7 -0
  55. package/src/store/agent/selectors.ts +1 -0
  56. package/src/store/{session/slices/agent → agent/slices/chat}/action.test.ts +26 -63
  57. package/src/store/agent/slices/chat/action.ts +107 -0
  58. package/src/store/agent/slices/chat/initialState.ts +14 -0
  59. package/src/store/agent/slices/chat/selectors.test.ts +82 -0
  60. package/src/store/agent/slices/chat/selectors.ts +81 -0
  61. package/src/store/agent/store.ts +27 -0
  62. package/src/store/chat/slices/message/action.test.ts +3 -2
  63. package/src/store/chat/slices/message/action.ts +3 -3
  64. package/src/store/chat/slices/message/selectors.test.ts +9 -2
  65. package/src/store/chat/slices/message/selectors.ts +6 -4
  66. package/src/store/chat/slices/share/action.ts +5 -3
  67. package/src/store/global/slices/preference/selectors.ts +3 -1
  68. package/src/store/session/selectors.ts +1 -2
  69. package/src/store/session/slices/session/action.test.ts +43 -0
  70. package/src/store/session/slices/session/action.ts +28 -18
  71. package/src/store/session/slices/session/helpers.ts +2 -3
  72. package/src/store/session/slices/session/initialState.ts +1 -17
  73. package/src/store/session/slices/session/selectors/index.ts +1 -0
  74. package/src/store/session/slices/session/selectors/list.test.ts +5 -3
  75. package/src/store/session/slices/session/selectors/list.ts +2 -3
  76. package/src/store/session/slices/session/selectors/meta.test.ts +108 -0
  77. package/src/store/session/slices/session/selectors/meta.ts +45 -0
  78. package/src/store/session/store.ts +1 -7
  79. package/src/types/session.ts +1 -0
  80. package/src/store/session/slices/agent/action.ts +0 -84
  81. package/src/store/session/slices/agent/selectors.test.ts +0 -180
  82. package/src/store/session/slices/agent/selectors.ts +0 -129
  83. /package/src/store/{session/slices/agent → agent/slices/chat}/index.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  # These are supported funding model platforms
2
2
 
3
- github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
3
+ github: lobehub
4
4
  patreon: # Replace with a single Patreon username
5
5
  open_collective: lobehub
6
6
  ko_fi: # Replace with a single Ko-fi username
package/CHANGELOG.md CHANGED
@@ -2,6 +2,64 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.149.6](https://github.com/lobehub/lobe-chat/compare/v0.149.5...v0.149.6)
6
+
7
+ <sup>Released on **2024-04-26**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix ollama host issue.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix ollama host issue, closes [#2210](https://github.com/lobehub/lobe-chat/issues/2210) ([c49d4c7](https://github.com/lobehub/lobe-chat/commit/c49d4c7))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
30
+ ### [Version 0.149.5](https://github.com/lobehub/lobe-chat/compare/v0.149.4...v0.149.5)
31
+
32
+ <sup>Released on **2024-04-25**</sup>
33
+
34
+ #### ♻ Code Refactoring
35
+
36
+ - **misc**: Sperate SessionStore to a new AgentStore.
37
+
38
+ #### 🐛 Bug Fixes
39
+
40
+ - **misc**: Fix not handle ollama error correctly.
41
+
42
+ <br/>
43
+
44
+ <details>
45
+ <summary><kbd>Improvements and Fixes</kbd></summary>
46
+
47
+ #### Code refactoring
48
+
49
+ - **misc**: Sperate SessionStore to a new AgentStore, closes [#2197](https://github.com/lobehub/lobe-chat/issues/2197) ([49c0ba6](https://github.com/lobehub/lobe-chat/commit/49c0ba6))
50
+
51
+ #### What's fixed
52
+
53
+ - **misc**: Fix not handle ollama error correctly ([efdf174](https://github.com/lobehub/lobe-chat/commit/efdf174))
54
+
55
+ </details>
56
+
57
+ <div align="right">
58
+
59
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
60
+
61
+ </div>
62
+
5
63
  ### [Version 0.149.4](https://github.com/lobehub/lobe-chat/compare/v0.149.3...v0.149.4)
6
64
 
7
65
  <sup>Released on **2024-04-25**</sup>
@@ -13,15 +13,15 @@ tags:
13
13
 
14
14
  <div style={{display:"flex", gap: 4}}>
15
15
 
16
- [![][docker-release-shield]][docker-release-link]
16
+ [![](https://img.shields.io/docker/v/lobehub/lobe-chat?color=369eff&label=docker&labelColor=black&logo=docker&logoColor=white&style=flat-square)](https://hub.docker.com/r/lobehub/lobe-chat)
17
17
 
18
- [![][docker-size-shield]][docker-size-link]
18
+ [![](https://img.shields.io/docker/image-size/lobehub/lobe-chat?color=369eff&labelColor=black&style=flat-square)](https://img.shields.io/docker/image-size/lobehub/lobe-chat?color=369eff&labelColor=black&style=flat-square)
19
19
 
20
- [![][docker-pulls-shield]][docker-pulls-link]
20
+ [![](https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11&labelColor=black&style=flat-square)](https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11&labelColor=black&style=flat-square)
21
21
 
22
22
  </div>
23
23
 
24
- 我们提供了 [Docker 镜像][docker-release-link],供你在自己的私有设备上部署 LobeChat 服务。
24
+ 我们提供了 [Docker 镜像](https://hub.docker.com/r/lobehub/lobe-chat) ,供你在自己的私有设备上部署 LobeChat 服务。
25
25
 
26
26
  <Steps>
27
27
 
@@ -57,16 +57,17 @@ $ yum install docker
57
57
  version: '3.8'
58
58
 
59
59
  services:
60
- lobe-chat:
61
- image: lobehub/lobe-chat
62
- container_name: lobe-chat
63
- restart: always
64
- ports:
65
- - '3210:3210'
66
- environment:
67
- OPENAI_API_KEY: sk-xxxx
68
- OPENAI_PROXY_URL: https://api-proxy.com/v1
69
- ACCESS_CODE: lobe66
60
+ lobe-chat:
61
+ image: lobehub/lobe-chat
62
+ container_name: lobe-chat
63
+ restart: always
64
+ ports:
65
+ - '3210:3210'
66
+ environment:
67
+ OPENAI_API_KEY: sk-xxxx
68
+ OPENAI_PROXY_URL: https://api-proxy.com/v1
69
+ ACCESS_CODE: lobe66
70
+
70
71
  ```
71
72
 
72
73
  运行以下命令启动 Lobe Chat 服务:
@@ -131,10 +132,3 @@ Configure Crontab to execute the script every 5 minutes:
131
132
  ```
132
133
 
133
134
  </Steps>
134
-
135
- [docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
136
- [docker-pulls-shield]: https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11&labelColor=black&style=flat-square
137
- [docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
138
- [docker-release-shield]: https://img.shields.io/docker/v/lobehub/lobe-chat?color=369eff&label=docker&labelColor=black&logo=docker&logoColor=white&style=flat-square
139
- [docker-size-link]: https://hub.docker.com/r/lobehub/lobe-chat
140
- [docker-size-shield]: https://img.shields.io/docker/image-size/lobehub/lobe-chat?color=369eff&labelColor=black&style=flat-square
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.149.4",
3
+ "version": "0.149.6",
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",
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
6
6
  import { Flexbox } from 'react-layout-kit';
7
7
 
8
8
  import { useSessionStore } from '@/store/session';
9
- import { agentSelectors, sessionSelectors } from '@/store/session/selectors';
9
+ import { sessionMetaSelectors, sessionSelectors } from '@/store/session/selectors';
10
10
  import { pathString } from '@/utils/url';
11
11
 
12
12
  import Tags from './Tags';
@@ -19,10 +19,10 @@ const Main = memo(() => {
19
19
  const [init, isInbox, title, description, avatar, backgroundColor] = useSessionStore((s) => [
20
20
  sessionSelectors.isSomeSessionActive(s),
21
21
  sessionSelectors.isInboxSession(s),
22
- agentSelectors.currentAgentTitle(s),
23
- agentSelectors.currentAgentDescription(s),
24
- agentSelectors.currentAgentAvatar(s),
25
- agentSelectors.currentAgentBackgroundColor(s),
22
+ sessionMetaSelectors.currentAgentTitle(s),
23
+ sessionMetaSelectors.currentAgentDescription(s),
24
+ sessionMetaSelectors.currentAgentAvatar(s),
25
+ sessionMetaSelectors.currentAgentBackgroundColor(s),
26
26
  ]);
27
27
 
28
28
  const displayTitle = isInbox ? t('inbox.title') : title;
@@ -3,15 +3,15 @@ import { Flexbox } from 'react-layout-kit';
3
3
 
4
4
  import ModelTag from '@/components/ModelTag';
5
5
  import ModelSwitchPanel from '@/features/ModelSwitchPanel';
6
+ import { useAgentStore } from '@/store/agent';
7
+ import { agentSelectors } from '@/store/agent/selectors';
6
8
  import { useGlobalStore } from '@/store/global';
7
9
  import { modelProviderSelectors } from '@/store/global/selectors';
8
- import { useSessionStore } from '@/store/session';
9
- import { agentSelectors } from '@/store/session/selectors';
10
10
 
11
11
  import PluginTag from '../../../features/PluginTag';
12
12
 
13
13
  const TitleTags = memo(() => {
14
- const [model, plugins] = useSessionStore((s) => [
14
+ const [model, plugins] = useAgentStore((s) => [
15
15
  agentSelectors.currentAgentModel(s),
16
16
  agentSelectors.currentAgentPlugins(s),
17
17
  ]);
@@ -6,11 +6,11 @@ import { memo, useEffect, useRef, useState } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { Center, Flexbox } from 'react-layout-kit';
8
8
 
9
+ import { useAgentStore } from '@/store/agent';
10
+ import { agentSelectors } from '@/store/agent/selectors';
9
11
  import { useFileStore } from '@/store/file';
10
12
  import { useGlobalStore } from '@/store/global';
11
13
  import { modelProviderSelectors } from '@/store/global/selectors';
12
- import { useSessionStore } from '@/store/session';
13
- import { agentSelectors } from '@/store/session/selectors';
14
14
 
15
15
  const useStyles = createStyles(({ css, token, stylish }) => {
16
16
  return {
@@ -60,8 +60,6 @@ const useStyles = createStyles(({ css, token, stylish }) => {
60
60
  };
61
61
  });
62
62
 
63
-
64
-
65
63
  const handleDragOver = (e: DragEvent) => {
66
64
  e.preventDefault();
67
65
  };
@@ -77,7 +75,7 @@ const DragUpload = memo(() => {
77
75
 
78
76
  const uploadFile = useFileStore((s) => s.uploadFile);
79
77
 
80
- const model = useSessionStore(agentSelectors.currentAgentModel);
78
+ const model = useAgentStore(agentSelectors.currentAgentModel);
81
79
 
82
80
  const enabledFiles = useGlobalStore(modelProviderSelectors.isModelEnabledFiles(model));
83
81
 
@@ -136,7 +134,6 @@ const DragUpload = memo(() => {
136
134
  uploadImages(files);
137
135
  };
138
136
 
139
-
140
137
  useEffect(() => {
141
138
  window.addEventListener('dragenter', handleDragEnter);
142
139
  window.addEventListener('dragover', handleDragOver);
@@ -164,8 +161,12 @@ const DragUpload = memo(() => {
164
161
  <Icon icon={FileText} size={{ fontSize: 64, strokeWidth: 1 }} />
165
162
  </Flexbox>
166
163
  <Flexbox align={'center'} gap={8} style={{ textAlign: 'center' }}>
167
- <Flexbox className={styles.title}>{t(enabledFiles ? 'upload.dragFileTitle' : 'upload.dragTitle')}</Flexbox>
168
- <Flexbox className={styles.desc}>{t(enabledFiles ? 'upload.dragFileDesc' : 'upload.dragDesc')}</Flexbox>
164
+ <Flexbox className={styles.title}>
165
+ {t(enabledFiles ? 'upload.dragFileTitle' : 'upload.dragTitle')}
166
+ </Flexbox>
167
+ <Flexbox className={styles.desc}>
168
+ {t(enabledFiles ? 'upload.dragFileDesc' : 'upload.dragDesc')}
169
+ </Flexbox>
169
170
  </Flexbox>
170
171
  </Center>
171
172
  </div>
@@ -175,4 +176,3 @@ const DragUpload = memo(() => {
175
176
  });
176
177
 
177
178
  export default DragUpload;
178
-
@@ -10,11 +10,11 @@ import { Center, Flexbox } from 'react-layout-kit';
10
10
  import StopLoadingIcon from '@/components/StopLoading';
11
11
  import SaveTopic from '@/features/ChatInput/Topic';
12
12
  import { useSendMessage } from '@/features/ChatInput/useSend';
13
+ import { useAgentStore } from '@/store/agent';
14
+ import { agentSelectors } from '@/store/agent/slices/chat';
13
15
  import { useChatStore } from '@/store/chat';
14
16
  import { useGlobalStore } from '@/store/global';
15
17
  import { modelProviderSelectors, preferenceSelectors } from '@/store/global/selectors';
16
- import { useSessionStore } from '@/store/session';
17
- import { agentSelectors } from '@/store/session/selectors';
18
18
  import { isMacOS } from '@/utils/platform';
19
19
 
20
20
  import DragUpload from './DragUpload';
@@ -64,7 +64,7 @@ const Footer = memo<FooterProps>(({ setExpand }) => {
64
64
  s.stopGenerateMessage,
65
65
  ]);
66
66
 
67
- const model = useSessionStore(agentSelectors.currentAgentModel);
67
+ const model = useAgentStore(agentSelectors.currentAgentModel);
68
68
 
69
69
  const [useCmdEnterToSend, canUpload] = useGlobalStore((s) => [
70
70
  preferenceSelectors.useCmdEnterToSend(s),
@@ -8,9 +8,11 @@ import { Flexbox } from 'react-layout-kit';
8
8
  import useMergeState from 'use-merge-value';
9
9
 
10
10
  import AgentInfo from '@/features/AgentInfo';
11
+ import { useAgentStore } from '@/store/agent';
12
+ import { agentSelectors } from '@/store/agent/selectors';
11
13
  import { useGlobalStore } from '@/store/global';
12
14
  import { useSessionStore } from '@/store/session';
13
- import { agentSelectors, sessionSelectors } from '@/store/session/selectors';
15
+ import { sessionMetaSelectors, sessionSelectors } from '@/store/session/selectors';
14
16
  import { pathString } from '@/utils/url';
15
17
 
16
18
  import SidebarHeader from '../../../../components/SidebarHeader';
@@ -21,10 +23,13 @@ const SystemRole = memo(() => {
21
23
  const [editing, setEditing] = useState(false);
22
24
  const { styles } = useStyles();
23
25
 
24
- const [init, systemRole, meta, updateAgentConfig] = useSessionStore((s) => [
26
+ const [init, meta] = useSessionStore((s) => [
25
27
  sessionSelectors.isSomeSessionActive(s),
28
+ sessionMetaSelectors.currentAgentMeta(s),
29
+ ]);
30
+
31
+ const [systemRole, updateAgentConfig] = useAgentStore((s) => [
26
32
  agentSelectors.currentAgentSystemRole(s),
27
- agentSelectors.currentAgentMeta(s),
28
33
  s.updateAgentConfig,
29
34
  ]);
30
35
 
@@ -9,7 +9,7 @@ import { useChatStore } from '@/store/chat';
9
9
  import { topicSelectors } from '@/store/chat/selectors';
10
10
  import { useGlobalStore } from '@/store/global';
11
11
  import { useSessionStore } from '@/store/session';
12
- import { agentSelectors, sessionSelectors } from '@/store/session/selectors';
12
+ import { sessionMetaSelectors, sessionSelectors } from '@/store/session/selectors';
13
13
 
14
14
  const ChatHeaderTitle = memo(() => {
15
15
  const { t } = useTranslation('chat');
@@ -20,7 +20,7 @@ const ChatHeaderTitle = memo(() => {
20
20
  ]);
21
21
  const [isInbox, title] = useSessionStore((s) => [
22
22
  sessionSelectors.isInboxSession(s),
23
- agentSelectors.currentAgentTitle(s),
23
+ sessionMetaSelectors.currentAgentTitle(s),
24
24
  ]);
25
25
  const theme = useTheme();
26
26
 
@@ -5,7 +5,6 @@ import { memo } from 'react';
5
5
  import { Flexbox } from 'react-layout-kit';
6
6
 
7
7
  import Conversation from '@/features/Conversation';
8
- import { useSessionStore } from '@/store/session';
9
8
 
10
9
  import SessionHydration from '../../components/SessionHydration';
11
10
  import TelemetryNotification from '../../features/TelemetryNotification';
@@ -15,11 +14,6 @@ import ChatHeader from './ChatHeader';
15
14
  const TopicList = dynamic(() => import('../features/TopicList'));
16
15
 
17
16
  const Chat = memo(() => {
18
- // due to mobile side don't have sessionList, so we need to fetch sessions here
19
- // refs: https://github.com/lobehub/lobe-chat/pull/541
20
- const useFetchSessions = useSessionStore((s) => s.useFetchSessions);
21
- useFetchSessions();
22
-
23
17
  return (
24
18
  <>
25
19
  <ChatHeader />
@@ -34,4 +34,6 @@ const Sessions = memo(() => {
34
34
  );
35
35
  });
36
36
 
37
+ Sessions.displayName = 'SessionsList';
38
+
37
39
  export default Sessions;
@@ -4,12 +4,12 @@ import { memo } from 'react';
4
4
 
5
5
  import PageTitle from '@/components/PageTitle';
6
6
  import { useSessionStore } from '@/store/session';
7
- import { agentSelectors } from '@/store/session/selectors';
7
+ import { sessionMetaSelectors } from '@/store/session/selectors';
8
8
 
9
9
  const Title = memo(() => {
10
10
  const [avatar, title] = useSessionStore((s) => [
11
- agentSelectors.currentAgentAvatar(s),
12
- agentSelectors.currentAgentTitle(s),
11
+ sessionMetaSelectors.currentAgentAvatar(s),
12
+ sessionMetaSelectors.currentAgentTitle(s),
13
13
  ]);
14
14
 
15
15
  return <PageTitle title={[avatar, title].filter(Boolean).join(' ')} />;
@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next';
7
7
  import { Flexbox } from 'react-layout-kit';
8
8
 
9
9
  import ManifestPreviewer from '@/components/ManifestPreviewer';
10
- import { useSessionStore } from '@/store/session';
10
+ import { useAgentStore } from '@/store/agent';
11
11
  import { useToolStore } from '@/store/tool';
12
12
  import { customPluginSelectors, toolSelectors } from '@/store/tool/selectors';
13
13
 
@@ -26,7 +26,7 @@ const PluginStatus = memo<PluginStatusProps>(({ title, id, deprecated }) => {
26
26
 
27
27
  const manifest = useToolStore(toolSelectors.getManifestById(id), isEqual);
28
28
 
29
- const removePlugin = useSessionStore((s) => s.removePlugin);
29
+ const removePlugin = useAgentStore((s) => s.removePlugin);
30
30
 
31
31
  const renderStatus = useMemo(() => {
32
32
  switch (status) {
@@ -16,7 +16,7 @@ import SessionList from './List';
16
16
  import ConfigGroupModal from './Modals/ConfigGroupModal';
17
17
  import RenameGroupModal from './Modals/RenameGroupModal';
18
18
 
19
- const SessionListContent = memo(() => {
19
+ const SessionDefaultMode = memo(() => {
20
20
  const { t } = useTranslation('chat');
21
21
 
22
22
  const [activeGroupId, setActiveGroupId] = useState<string>();
@@ -98,4 +98,6 @@ const SessionListContent = memo(() => {
98
98
  );
99
99
  });
100
100
 
101
- export default SessionListContent;
101
+ SessionDefaultMode.displayName = 'SessionDefaultMode';
102
+
103
+ export default SessionDefaultMode;
@@ -4,11 +4,9 @@ import { shallow } from 'zustand/shallow';
4
4
 
5
5
  import ModelTag from '@/components/ModelTag';
6
6
  import { useChatStore } from '@/store/chat';
7
- import { useGlobalStore } from '@/store/global';
8
- import { settingsSelectors } from '@/store/global/selectors';
9
7
  import { useSessionStore } from '@/store/session';
10
8
  import { sessionHelpers } from '@/store/session/helpers';
11
- import { agentSelectors, sessionSelectors } from '@/store/session/selectors';
9
+ import { sessionMetaSelectors, sessionSelectors } from '@/store/session/selectors';
12
10
 
13
11
  import ListItem from '../../ListItem';
14
12
  import CreateGroupModal from '../../Modals/CreateGroupModal';
@@ -22,31 +20,26 @@ const SessionItem = memo<SessionItemProps>(({ id }) => {
22
20
  const [open, setOpen] = useState(false);
23
21
  const [createGroupModalOpen, setCreateGroupModalOpen] = useState(false);
24
22
 
25
- const [defaultModel] = useGlobalStore((s) => [settingsSelectors.defaultAgentConfig(s).model]);
26
23
  const [active] = useSessionStore((s) => [s.activeId === id]);
27
24
  const [loading] = useChatStore((s) => [!!s.chatLoadingId && id === s.activeId]);
28
25
 
29
- const [pin, title, description, systemRole, avatar, avatarBackground, updateAt, model, group] =
26
+ const [pin, title, description, avatar, avatarBackground, updateAt, model, group] =
30
27
  useSessionStore((s) => {
31
28
  const session = sessionSelectors.getSessionById(id)(s);
32
29
  const meta = session.meta;
33
- const systemRole = session.config.systemRole;
34
30
 
35
31
  return [
36
32
  sessionHelpers.getSessionPinned(session),
37
- agentSelectors.getTitle(meta),
38
- agentSelectors.getDescription(meta),
39
- systemRole,
40
- agentSelectors.getAvatar(meta),
33
+ sessionMetaSelectors.getTitle(meta),
34
+ sessionMetaSelectors.getDescription(meta),
35
+ sessionMetaSelectors.getAvatar(meta),
41
36
  meta.backgroundColor,
42
37
  session?.updatedAt,
43
- session.config.model,
38
+ session.model,
44
39
  session?.group,
45
40
  ];
46
41
  });
47
42
 
48
- const showModel = model !== defaultModel;
49
-
50
43
  const actions = useMemo(
51
44
  () => (
52
45
  <Actions
@@ -61,12 +54,12 @@ const SessionItem = memo<SessionItemProps>(({ id }) => {
61
54
 
62
55
  const addon = useMemo(
63
56
  () =>
64
- !showModel ? undefined : (
57
+ model && (
65
58
  <Flexbox gap={4} horizontal style={{ flexWrap: 'wrap' }}>
66
- {showModel && <ModelTag model={model} />}
59
+ <ModelTag model={model} />
67
60
  </Flexbox>
68
61
  ),
69
- [showModel, model],
62
+ [model],
70
63
  );
71
64
 
72
65
  return (
@@ -78,7 +71,7 @@ const SessionItem = memo<SessionItemProps>(({ id }) => {
78
71
  avatar={avatar}
79
72
  avatarBackground={avatarBackground}
80
73
  date={updateAt}
81
- description={description || systemRole}
74
+ description={description}
82
75
  loading={loading}
83
76
  pin={pin}
84
77
  showAction={open}
@@ -11,4 +11,6 @@ const SessionListContent = memo(() => {
11
11
  return isSearching ? <SearchMode /> : <DefaultMode />;
12
12
  });
13
13
 
14
+ SessionListContent.displayName = 'SessionListContent';
15
+
14
16
  export default SessionListContent;
@@ -6,8 +6,10 @@ import { Flexbox } from 'react-layout-kit';
6
6
  import pkg from '@/../package.json';
7
7
  import ModelTag from '@/components/ModelTag';
8
8
  import ChatList from '@/features/Conversation/components/ChatList';
9
+ import { useAgentStore } from '@/store/agent';
10
+ import { agentSelectors } from '@/store/agent/selectors';
9
11
  import { useSessionStore } from '@/store/session';
10
- import { agentSelectors, sessionSelectors } from '@/store/session/selectors';
12
+ import { sessionMetaSelectors, sessionSelectors } from '@/store/session/selectors';
11
13
 
12
14
  import PluginTag from '../PluginTag';
13
15
  import { useStyles } from './style';
@@ -15,16 +17,18 @@ import { FieldType } from './type';
15
17
 
16
18
  const Preview = memo<FieldType & { title?: string }>(
17
19
  ({ title, withSystemRole, withBackground, withFooter }) => {
18
- const [isInbox, description, avatar, backgroundColor, model, plugins, systemRole] =
19
- useSessionStore((s) => [
20
- sessionSelectors.isInboxSession(s),
21
- agentSelectors.currentAgentDescription(s),
22
- agentSelectors.currentAgentAvatar(s),
23
- agentSelectors.currentAgentBackgroundColor(s),
24
- agentSelectors.currentAgentModel(s),
25
- agentSelectors.currentAgentPlugins(s),
26
- agentSelectors.currentAgentSystemRole(s),
27
- ]);
20
+ const [model, plugins, systemRole] = useAgentStore((s) => [
21
+ agentSelectors.currentAgentModel(s),
22
+ agentSelectors.currentAgentPlugins(s),
23
+ agentSelectors.currentAgentSystemRole(s),
24
+ ]);
25
+ const [isInbox, description, avatar, backgroundColor] = useSessionStore((s) => [
26
+ sessionSelectors.isInboxSession(s),
27
+ sessionMetaSelectors.currentAgentDescription(s),
28
+ sessionMetaSelectors.currentAgentAvatar(s),
29
+ sessionMetaSelectors.currentAgentBackgroundColor(s),
30
+ ]);
31
+
28
32
  const { t } = useTranslation('chat');
29
33
  const { styles } = useStyles(withBackground);
30
34
 
@@ -3,13 +3,13 @@ import { domToJpeg, domToPng, domToSvg, domToWebp } from 'modern-screenshot';
3
3
  import { useCallback, useState } from 'react';
4
4
 
5
5
  import { useSessionStore } from '@/store/session';
6
- import { agentSelectors } from '@/store/session/selectors';
6
+ import { sessionMetaSelectors } from '@/store/session/selectors';
7
7
 
8
8
  import { ImageType } from './type';
9
9
 
10
10
  export const useScreenshot = (imageType: ImageType) => {
11
11
  const [loading, setLoading] = useState(false);
12
- const title = useSessionStore(agentSelectors.currentAgentTitle);
12
+ const title = useSessionStore(sessionMetaSelectors.currentAgentTitle);
13
13
 
14
14
  const handleDownload = useCallback(async () => {
15
15
  setLoading(true);
@@ -6,18 +6,21 @@ import { useTranslation } from 'react-i18next';
6
6
 
7
7
  import PageTitle from '@/components/PageTitle';
8
8
  import AgentSetting from '@/features/AgentSetting';
9
+ import { useAgentStore } from '@/store/agent';
10
+ import { agentSelectors } from '@/store/agent/selectors';
9
11
  import { useSessionStore } from '@/store/session';
10
- import { agentSelectors } from '@/store/session/selectors';
12
+ import { sessionMetaSelectors } from '@/store/session/selectors';
11
13
 
12
14
  const EditPage = memo(() => {
13
15
  const { t } = useTranslation('setting');
14
16
  const id = useSessionStore((s) => s.activeId);
15
- const config = useSessionStore(agentSelectors.currentAgentConfig, isEqual);
16
- const meta = useSessionStore(agentSelectors.currentAgentMeta, isEqual);
17
- const [updateAgentConfig, updateAgentMeta, title] = useSessionStore((s) => [
18
- s.updateAgentConfig,
19
- s.updateAgentMeta,
20
- agentSelectors.currentAgentTitle(s),
17
+ const config = useAgentStore(agentSelectors.currentAgentConfig, isEqual);
18
+ const meta = useSessionStore(sessionMetaSelectors.currentAgentMeta, isEqual);
19
+ const [updateAgentConfig] = useAgentStore((s) => [s.updateAgentConfig]);
20
+
21
+ const [updateAgentMeta, title] = useSessionStore((s) => [
22
+ s.updateSessionMeta,
23
+ sessionMetaSelectors.currentAgentTitle(s),
21
24
  ]);
22
25
 
23
26
  return (
@@ -10,17 +10,19 @@ import { Flexbox } from 'react-layout-kit';
10
10
 
11
11
  import { AGENTS_INDEX_GITHUB_ISSUE } from '@/const/url';
12
12
  import AgentInfo from '@/features/AgentInfo';
13
+ import { useAgentStore } from '@/store/agent';
14
+ import { agentSelectors } from '@/store/agent/selectors';
13
15
  import { useGlobalStore } from '@/store/global';
14
16
  import { settingsSelectors } from '@/store/global/selectors';
15
17
  import { useSessionStore } from '@/store/session';
16
- import { agentSelectors } from '@/store/session/selectors';
18
+ import { sessionMetaSelectors } from '@/store/session/selectors';
17
19
 
18
20
  const SubmitAgentModal = memo<ModalProps>(({ open, onCancel }) => {
19
21
  const { t } = useTranslation('setting');
20
22
  const [identifier, setIdentifier] = useState('');
21
- const systemRole = useSessionStore(agentSelectors.currentAgentSystemRole);
23
+ const systemRole = useAgentStore(agentSelectors.currentAgentSystemRole);
22
24
  const theme = useTheme();
23
- const meta = useSessionStore(agentSelectors.currentAgentMeta, isEqual);
25
+ const meta = useSessionStore(sessionMetaSelectors.currentAgentMeta, isEqual);
24
26
  const language = useGlobalStore((s) => settingsSelectors.currentSettings(s).language);
25
27
 
26
28
  const isMetaPass = Boolean(
@@ -22,9 +22,9 @@ const metadata: Metadata = {
22
22
  },
23
23
  description,
24
24
  icons: {
25
- apple:'icons/apple-touch-icon.png',
26
- icon:'favicon.ico',
27
- shortcut:'favicon-32x32.ico',
25
+ apple: '/icons/apple-touch-icon.png',
26
+ icon: '/favicon.ico',
27
+ shortcut: '/favicon-32x32.ico',
28
28
  },
29
29
  manifest: noManifest ? undefined : '/manifest.json',
30
30
  metadataBase: new URL(SITE_URL),
@@ -55,6 +55,7 @@ const AvatarBanner = memo<AgentCardBannerProps>(
55
55
  className={styles.bannerImg}
56
56
  height={size}
57
57
  src={avatar || DEFAULT_USER_AVATAR_URL}
58
+ unoptimized
58
59
  width={size}
59
60
  />
60
61
  </Flexbox>