@lobehub/chat 0.161.7 → 0.161.8

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,23 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.161.8](https://github.com/lobehub/lobe-chat/compare/v0.161.7...v0.161.8)
6
+
7
+ <sup>Released on **2024-05-22**</sup>
8
+
9
+ <br/>
10
+
11
+ <details>
12
+ <summary><kbd>Improvements and Fixes</kbd></summary>
13
+
14
+ </details>
15
+
16
+ <div align="right">
17
+
18
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
19
+
20
+ </div>
21
+
5
22
  ### [Version 0.161.7](https://github.com/lobehub/lobe-chat/compare/v0.161.6...v0.161.7)
6
23
 
7
24
  <sup>Released on **2024-05-22**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.161.7",
3
+ "version": "0.161.8",
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",
@@ -1,9 +1,13 @@
1
+ import { Suspense, lazy } from 'react';
2
+
1
3
  import ServerLayout from '@/components/server/ServerLayout';
2
4
 
3
5
  import Desktop from './_layout/Desktop';
4
6
  import Mobile from './_layout/Mobile';
5
7
  import SessionHydration from './features/SessionHydration';
6
- import SessionListContent from './features/SessionListContent';
8
+ import SkeletonList from './features/SkeletonList';
9
+
10
+ const SessionListContent = lazy(() => import('./features/SessionListContent'));
7
11
 
8
12
  const Layout = ServerLayout({ Desktop, Mobile });
9
13
 
@@ -11,7 +15,9 @@ const Session = () => {
11
15
  return (
12
16
  <>
13
17
  <Layout>
14
- <SessionListContent />
18
+ <Suspense fallback={<SkeletonList />}>
19
+ <SessionListContent />
20
+ </Suspense>
15
21
  </Layout>
16
22
  <SessionHydration />
17
23
  </>
@@ -12,7 +12,7 @@ import { useSessionStore } from '@/store/session';
12
12
  import { sessionSelectors } from '@/store/session/selectors';
13
13
  import { LobeAgentSession } from '@/types/session';
14
14
 
15
- import SkeletonList from '../SkeletonList';
15
+ import SkeletonList from '../../SkeletonList';
16
16
  import AddButton from './AddButton';
17
17
  import SessionItem from './Item';
18
18
 
@@ -2,8 +2,8 @@ import { memo } from 'react';
2
2
 
3
3
  import { useSessionStore } from '@/store/session';
4
4
 
5
+ import SkeletonList from '../SkeletonList';
5
6
  import SessionList from './List';
6
- import SkeletonList from './SkeletonList';
7
7
 
8
8
  const SearchMode = memo(() => {
9
9
  const [sessionSearchKeywords, useSearchSessions] = useSessionStore((s) => [
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { Skeleton } from 'antd';
2
4
  import { createStyles } from 'antd-style';
3
5
  import { memo } from 'react';
@@ -194,6 +194,10 @@ export const createSessionSlice: StateCreator<
194
194
 
195
195
  useFetchSessions: () =>
196
196
  useClientDataSWR<ChatSessionList>(FETCH_SESSIONS_KEY, sessionService.getGroupedSessions, {
197
+ fallbackData: {
198
+ sessionGroups: [],
199
+ sessions: [],
200
+ },
197
201
  onSuccess: (data) => {
198
202
  if (
199
203
  get().isSessionsFirstFetchFinished &&
@@ -209,6 +213,7 @@ export const createSessionSlice: StateCreator<
209
213
  );
210
214
  set({ isSessionsFirstFetchFinished: true }, false, n('useFetchSessions/onSuccess', data));
211
215
  },
216
+ suspense: true,
212
217
  }),
213
218
  useSearchSessions: (keyword) =>
214
219
  useSWR<LobeSessions>(
@@ -1,4 +1,4 @@
1
- import { CustomSessionGroup, LobeAgentSession, LobeSessionGroups } from '@/types/session';
1
+ import { LobeAgentSession } from '@/types/session';
2
2
 
3
3
  export interface SessionState {
4
4
  /**
@@ -6,13 +6,11 @@ export interface SessionState {
6
6
  * @description 当前正在编辑或查看的会话
7
7
  */
8
8
  activeId: string;
9
- customSessionGroups: CustomSessionGroup[];
10
9
  defaultSessions: LobeAgentSession[];
11
10
  isSearching: boolean;
12
11
  isSessionsFirstFetchFinished: boolean;
13
12
  pinnedSessions: LobeAgentSession[];
14
13
  searchKeywords: string;
15
- sessionGroups: LobeSessionGroups;
16
14
  sessionSearchKeywords?: string;
17
15
  /**
18
16
  * it means defaultSessions
@@ -22,12 +20,10 @@ export interface SessionState {
22
20
 
23
21
  export const initialSessionState: SessionState = {
24
22
  activeId: 'inbox',
25
- customSessionGroups: [],
26
23
  defaultSessions: [],
27
24
  isSearching: false,
28
25
  isSessionsFirstFetchFinished: false,
29
26
  pinnedSessions: [],
30
27
  searchKeywords: '',
31
- sessionGroups: [],
32
28
  sessions: [],
33
29
  };
@@ -1,5 +1,12 @@
1
+ import { CustomSessionGroup, LobeSessionGroups } from '@/types/session';
2
+
1
3
  export interface SessionGroupState {
2
4
  activeGroupId?: string;
5
+ customSessionGroups: CustomSessionGroup[];
6
+ sessionGroups: LobeSessionGroups;
3
7
  }
4
8
 
5
- export const initSessionGroupState: SessionGroupState = {};
9
+ export const initSessionGroupState: SessionGroupState = {
10
+ customSessionGroups: [],
11
+ sessionGroups: [],
12
+ };