@lobehub/chat 0.162.19 → 0.162.21

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,48 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.162.21](https://github.com/lobehub/lobe-chat/compare/v0.162.20...v0.162.21)
6
+
7
+ <sup>Released on **2024-06-09**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Do not show noDescription in new sesstion.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Do not show noDescription in new sesstion, closes [#2749](https://github.com/lobehub/lobe-chat/issues/2749) ([30b00aa](https://github.com/lobehub/lobe-chat/commit/30b00aa))
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.162.20](https://github.com/lobehub/lobe-chat/compare/v0.162.19...v0.162.20)
31
+
32
+ <sup>Released on **2024-06-08**</sup>
33
+
34
+ <br/>
35
+
36
+ <details>
37
+ <summary><kbd>Improvements and Fixes</kbd></summary>
38
+
39
+ </details>
40
+
41
+ <div align="right">
42
+
43
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
44
+
45
+ </div>
46
+
5
47
  ### [Version 0.162.19](https://github.com/lobehub/lobe-chat/compare/v0.162.18...v0.162.19)
6
48
 
7
49
  <sup>Released on **2024-06-07**</sup>
package/README.md CHANGED
@@ -263,14 +263,14 @@ Our marketplace is not just a showcase platform but also a collaborative space.
263
263
 
264
264
  <!-- AGENT LIST -->
265
265
 
266
- | Recent Submits | Description |
267
- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
268
- | [Expert Response to Reviewer](https://chat-preview.lobehub.com/market?agent=academic-editor-en)<br/><sup>By **[Starlitnightly](https://github.com/Starlitnightly)** on **2024-06-03**</sup> | Specializing in natural academic editing, assisting authors in responding to reviewer comments in a scientific, courteous, and point-by-point manner.<br/>`academic-editing` `response-to-reviewer-comments` `scientific-writing` |
269
- | [Translation of Novels: English to Chinese](https://chat-preview.lobehub.com/market?agent=noveltranslation)<br/><sup>By **[xbtachlb](https://github.com/xbtachlb)** on **2024-06-03**</sup> | Secondary translation of novels<br/>`translation` |
270
- | [Convert Docker to Docker Compose](https://chat-preview.lobehub.com/market?agent=onekr-docker-2-compose)<br/><sup>By **[onekr-billy](https://github.com/onekr-billy)** on **2024-05-31**</sup> | Specialized in converting Docker run commands to Docker Compose configurations<br/>`docker` `docker-compose` `system-administration` `configuration-file` `conversion` |
271
- | [Java Class to MySQL](https://chat-preview.lobehub.com/market?agent=onekr-java-2-sql)<br/><sup>By **[onekr-billy](https://github.com/onekr-billy)** on **2024-05-31**</sup> | Specialized in generating SQL scripts that comply with MySQL specifications based on Java class files.<br/>`java-class-to-my-sql` `backend-development` `sql-scripts` `data-conversion` `databases` |
272
-
273
- > 📊 Total agents: [<kbd>**285**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
266
+ | Recent Submits | Description |
267
+ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
268
+ | [Popular Science Writing Assistant](https://chat-preview.lobehub.com/market?agent=popular-science-writer)<br/><sup>By **[ShinChven](https://github.com/ShinChven)** on **2024-06-08**</sup> | The popular science writing assistant uses everyday language to explain scientific concepts, tells stories, uses examples and metaphors to spark interest, and emphasizes importance.<br/>`science-writing` `science-popularization` `creative-expression` |
269
+ | [Expert Response to Reviewer](https://chat-preview.lobehub.com/market?agent=academic-editor-en)<br/><sup>By **[Starlitnightly](https://github.com/Starlitnightly)** on **2024-06-03**</sup> | Specializing in natural academic editing, assisting authors in responding to reviewer comments in a scientific, courteous, and point-by-point manner.<br/>`academic-editing` `response-to-reviewer-comments` `scientific-writing` |
270
+ | [Translation of Novels: English to Chinese](https://chat-preview.lobehub.com/market?agent=noveltranslation)<br/><sup>By **[xbtachlb](https://github.com/xbtachlb)** on **2024-06-03**</sup> | Secondary translation of novels<br/>`translation` |
271
+ | [Convert Docker to Docker Compose](https://chat-preview.lobehub.com/market?agent=onekr-docker-2-compose)<br/><sup>By **[onekr-billy](https://github.com/onekr-billy)** on **2024-05-31**</sup> | Specialized in converting Docker run commands to Docker Compose configurations<br/>`docker` `docker-compose` `system-administration` `configuration-file` `conversion` |
272
+
273
+ > 📊 Total agents: [<kbd>**286**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
274
274
 
275
275
  <!-- AGENT LIST -->
276
276
 
package/README.zh-CN.md CHANGED
@@ -251,14 +251,14 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
251
251
 
252
252
  <!-- AGENT LIST -->
253
253
 
254
- | 最近新增 | 助手说明 |
255
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
256
- | [审稿回复专家](https://chat-preview.lobehub.com/market?agent=academic-editor-en)<br/><sup>By **[Starlitnightly](https://github.com/Starlitnightly)** on **2024-06-03**</sup> | 擅长自然学术编辑,协助作者回复审稿人意见,科学、礼貌、逐点回应。<br/>`学术编辑` `审稿意见回复` `科学写作` |
257
- | [小说翻译 英译中](https://chat-preview.lobehub.com/market?agent=noveltranslation)<br/><sup>By **[xbtachlb](https://github.com/xbtachlb)** on **2024-06-03**</sup> | 小说二次翻译<br/>`翻译` |
258
- | [Docker 转 DockerCompose](https://chat-preview.lobehub.com/market?agent=onekr-docker-2-compose)<br/><sup>By **[onekr-billy](https://github.com/onekr-billy)** on **2024-05-31**</sup> | 擅长将 Docker run 命令转换为 Docker Compose 配置<br/>`docker` `docker-compose` `系统运维` `配置文件` `转换` |
259
- | [Java Class MySQL](https://chat-preview.lobehub.com/market?agent=onekr-java-2-sql)<br/><sup>By **[onekr-billy](https://github.com/onekr-billy)** on **2024-05-31**</sup> | 擅长根据 Java 类文件生成符合 MySQL 规范的 SQL 脚本<br/>`java-class转-my-sql` `后端开发` `sql脚本` `数据转换` `数据库` |
260
-
261
- > 📊 Total agents: [<kbd>**285**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
254
+ | 最近新增 | 助手说明 |
255
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
256
+ | [通俗科普创作助手](https://chat-preview.lobehub.com/market?agent=popular-science-writer)<br/><sup>By **[ShinChven](https://github.com/ShinChven)** on **2024-06-08**</sup> | 通俗科普创作助手,用生活化语言讲科学概念,讲故事、使用例子和比喻,激发兴趣,强调重要性。<br/>`科普写作` `科学普及` `创意表达` |
257
+ | [审稿回复专家](https://chat-preview.lobehub.com/market?agent=academic-editor-en)<br/><sup>By **[Starlitnightly](https://github.com/Starlitnightly)** on **2024-06-03**</sup> | 擅长自然学术编辑,协助作者回复审稿人意见,科学、礼貌、逐点回应。<br/>`学术编辑` `审稿意见回复` `科学写作` |
258
+ | [小说翻译 英译中](https://chat-preview.lobehub.com/market?agent=noveltranslation)<br/><sup>By **[xbtachlb](https://github.com/xbtachlb)** on **2024-06-03**</sup> | 小说二次翻译<br/>`翻译` |
259
+ | [DockerDockerCompose](https://chat-preview.lobehub.com/market?agent=onekr-docker-2-compose)<br/><sup>By **[onekr-billy](https://github.com/onekr-billy)** on **2024-05-31**</sup> | 擅长将 Docker run 命令转换为 Docker Compose 配置<br/>`docker` `docker-compose` `系统运维` `配置文件` `转换` |
260
+
261
+ > 📊 Total agents: [<kbd>**286**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
262
262
 
263
263
  <!-- AGENT LIST -->
264
264
 
@@ -35,3 +35,51 @@ You can use the subdomain provided by Zeabur, or choose to bind a custom domain.
35
35
 
36
36
  [deploy-button-image]: https://zeabur.com/button.svg
37
37
  [deploy-link]: https://zeabur.com/templates/VZGGTI
38
+
39
+ # Deploy LobeChat with Zeabur as serverless function
40
+
41
+ >Note: There are still issues with [middlewares and rewrites of next.js on Zeabur](https://github.com/lobehub/lobe-chat/pull/2775?notification_referrer_id=NT_kwDOAdi2DrQxMDkyODQ4MDc2NTozMDk3OTU5OA#issuecomment-2146713899), use at your own risk!
42
+
43
+ Since Zeabur does NOT officially support FREE users deploy containerized service, you may wish to deploy LobeChat as a serverless function service.
44
+ To deploy LobeChat as a serverless function service on Zeabur, you can follow the steps below:
45
+
46
+ ## Zeabur Deployment Process
47
+
48
+ <Steps>
49
+
50
+ ### Fork LobeChat
51
+
52
+ ### Add Zeabur pack config file
53
+
54
+ Add a `zbpack.json` configuration file with the following content to the root dir of your fork:
55
+ ```json
56
+ {
57
+ "serverless": true,
58
+ "ignore_dockerfile": true
59
+ }
60
+ ```
61
+
62
+ ### Prepare your OpenAI API Key
63
+
64
+ Go to [OpenAI API Key](https://platform.openai.com/account/api-keys) to get your OpenAI API Key.
65
+
66
+ ### Login to your [Zeabur dashboard](https://dash.zeabur.com)
67
+
68
+ If you do not already have an account, you will need to register one.
69
+
70
+ ### Create a project and service
71
+
72
+ Create a project, then create a service under this project.
73
+
74
+ ### Link your fork of LobeChat to the just created Zeabur service.
75
+
76
+ When adding service, choose github.
77
+ This may triger a oAuth depend on varies factors like how you login to Zeabur and if you have already authorized Zeabur to access all your repos
78
+
79
+ ### Bind a custom domain (optional)
80
+
81
+ You can create a subdomain provided by Zeabur, or choose to bind a custom domain. Currently, the domains provided by Zeabur have not been contaminated, and most regions can connect directly.
82
+
83
+ ### Zeabur shall start auto build and you should be able to access it by the domain of your choice after a while.
84
+
85
+ </Steps>
@@ -34,3 +34,51 @@ tags:
34
34
 
35
35
  [deploy-button-image]: https://zeabur.com/button.svg
36
36
  [deploy-link]: https://zeabur.com/templates/VZGGTI
37
+
38
+ # 使用 Zeabur 将 LobeChat 部署为无服务器函数
39
+
40
+ >**注意:** 仍然存在关于 [Zeabur 上 next.js 的中间件和重写问题](https://github.com/lobehub/lobe-chat/pull/2775?notification_referrer_id=NT_kwDOAdi2DrQxMDkyODQ4MDc2NTozMDk3OTU5OA#issuecomment-2146713899),请自担风险!
41
+
42
+ 由于 Zeabur 并未官方支持免费用户部署容器化服务,您可能希望将 LobeChat 部署为无服务器函数服务。
43
+ 要在 Zeabur 上将 LobeChat 部署为无服务器函数服务,您可以按照以下步骤操作:
44
+
45
+ ## Zeabur 部署流程
46
+
47
+ <Steps>
48
+
49
+ ### Fork LobeChat
50
+
51
+ ### 添加 Zeabur 打包配置文件
52
+
53
+ 在您的分支的根目录下添加一个 `zbpack.json` 配置文件,内容如下:
54
+ ```json
55
+ {
56
+ "serverless": true,
57
+ "ignore_dockerfile": true
58
+ }
59
+ ```
60
+
61
+ ### 准备您的 OpenAI API 密钥
62
+
63
+ 前往 [OpenAI API 密钥](https://platform.openai.com/account/api-keys) 获取您的 OpenAI API 密钥。
64
+
65
+ ### 登录到您的 [Zeabur 仪表板](https://dash.zeabur.com)
66
+
67
+ 如果您尚未拥有一个账号,您需要注册一个。
68
+
69
+ ### 创建项目与服务。
70
+
71
+ 创建一个项目,并再这个项目下新建一个服务。
72
+
73
+ ### 将您的 LobeChat 分支链接到刚创建的 Zeabur 服务。
74
+
75
+ 在添加服务时,选择 github。
76
+ 这可能会触发一个 oAuth,取决于诸如您如何登录到 Zeabur以及您是否已经授权 Zeabur 访问所有您的存储库等各种因素。
77
+
78
+ ### 绑定自定义域名(可选)
79
+
80
+ 您可以创建 Zeabur 提供的子域名,或选择绑定自定义域名。目前,Zeabur 提供的域名尚未受到污染,大多数地区可以直接连接。
81
+
82
+ ### Zeabur 将开始自动构建,您应该可以在一段时间后通过您选择的域名访问它。
83
+
84
+ </Steps>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.162.19",
3
+ "version": "0.162.21",
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",
@@ -190,7 +190,7 @@
190
190
  "@next/eslint-plugin-next": "^14.2.3",
191
191
  "@peculiar/webcrypto": "^1.4.6",
192
192
  "@testing-library/jest-dom": "^6.4.5",
193
- "@testing-library/react": "^15.0.7",
193
+ "@testing-library/react": "^16.0.0",
194
194
  "@types/chroma-js": "^2.4.4",
195
195
  "@types/debug": "^4.1.12",
196
196
  "@types/diff": "^5.2.1",
@@ -62,6 +62,10 @@ export const useCategory = () => {
62
62
  },
63
63
  ];
64
64
 
65
+ /* ↓ cloud slot ↓ */
66
+
67
+ /* ↑ cloud slot ↑ */
68
+
65
69
  const data: CellProps[] = [
66
70
  {
67
71
  icon: Database,
@@ -101,6 +105,9 @@ export const useCategory = () => {
101
105
  },
102
106
  ...(isLoginWithClerk ? profile : []),
103
107
  ...(enableAuth ? (isLoginWithAuth ? settings : []) : settingsWithoutAuth),
108
+ /* ↓ cloud slot ↓ */
109
+
110
+ /* ↑ cloud slot ↑ */
104
111
  ...(canInstall ? pwa : []),
105
112
  ...(isLogin ? data : []),
106
113
  ...helps,
@@ -8,6 +8,9 @@ const DesktopLayout = ({ children }: PropsWithChildren) => {
8
8
  <>
9
9
  <Header />
10
10
  <PanelBody>{children}</PanelBody>
11
+ {/* ↓ cloud slot ↓ */}
12
+
13
+ {/* ↑ cloud slot ↑ */}
11
14
  </>
12
15
  );
13
16
  };
@@ -12,6 +12,9 @@ const MobileLayout = ({ children }: PropsWithChildren) => {
12
12
  <SessionSearchBar mobile />
13
13
  </div>
14
14
  {children}
15
+ {/* ↓ cloud slot ↓ */}
16
+
17
+ {/* ↑ cloud slot ↑ */}
15
18
  </MobileContentLayout>
16
19
  );
17
20
  };
@@ -9,14 +9,23 @@ import { useServerConfigStore } from '@/store/serverConfig';
9
9
  import { useSessionStore } from '@/store/session';
10
10
 
11
11
  import ListItem from '../ListItem';
12
+ import { useSwitchSession } from '../useSwitchSession';
12
13
 
13
14
  const Inbox = memo(() => {
14
15
  const { t } = useTranslation('chat');
15
16
  const mobile = useServerConfigStore((s) => s.isMobile);
16
17
  const activeId = useSessionStore((s) => s.activeId);
18
+ const switchSession = useSwitchSession();
17
19
 
18
20
  return (
19
- <Link aria-label={t('inbox.title')} href={SESSION_CHAT_URL(INBOX_SESSION_ID, mobile)}>
21
+ <Link
22
+ aria-label={t('inbox.title')}
23
+ href={SESSION_CHAT_URL(INBOX_SESSION_ID, mobile)}
24
+ onClick={(e) => {
25
+ e.preventDefault();
26
+ switchSession(INBOX_SESSION_ID);
27
+ }}
28
+ >
20
29
  <ListItem
21
30
  active={activeId === INBOX_SESSION_ID}
22
31
  avatar={DEFAULT_INBOX_AVATAR}
@@ -13,6 +13,7 @@ import { sessionSelectors } from '@/store/session/selectors';
13
13
  import { LobeAgentSession } from '@/types/session';
14
14
 
15
15
  import SkeletonList from '../../SkeletonList';
16
+ import { useSwitchSession } from '../useSwitchSession';
16
17
  import AddButton from './AddButton';
17
18
  import SessionItem from './Item';
18
19
 
@@ -28,19 +29,28 @@ interface SessionListProps {
28
29
  }
29
30
  const SessionList = memo<SessionListProps>(({ dataSource, groupId, showAddButton = true }) => {
30
31
  const { t } = useTranslation('chat');
31
- const isInit = useSessionStore((s) => sessionSelectors.isSessionListInit(s));
32
- const { showCreateSession } = useServerConfigStore(featureFlagsSelectors);
33
-
34
32
  const { styles } = useStyles();
35
33
 
34
+ const isInit = useSessionStore(sessionSelectors.isSessionListInit);
35
+ const { showCreateSession } = useServerConfigStore(featureFlagsSelectors);
36
36
  const mobile = useServerConfigStore((s) => s.isMobile);
37
+
38
+ const switchSession = useSwitchSession();
39
+
37
40
  const isEmpty = !dataSource || dataSource.length === 0;
38
41
  return !isInit ? (
39
42
  <SkeletonList />
40
43
  ) : !isEmpty ? (
41
44
  dataSource.map(({ id }) => (
42
45
  <LazyLoad className={styles} key={id}>
43
- <Link aria-label={id} href={SESSION_CHAT_URL(id, mobile)}>
46
+ <Link
47
+ aria-label={id}
48
+ href={SESSION_CHAT_URL(id, mobile)}
49
+ onClick={(e) => {
50
+ e.preventDefault();
51
+ switchSession(id);
52
+ }}
53
+ >
44
54
  <SessionItem id={id} />
45
55
  </Link>
46
56
  </LazyLoad>
@@ -0,0 +1,26 @@
1
+ import { useCallback } from 'react';
2
+
3
+ import { useQueryRoute } from '@/hooks/useQueryRoute';
4
+ import { useServerConfigStore } from '@/store/serverConfig';
5
+ import { useSessionStore } from '@/store/session';
6
+
7
+ export const useSwitchSession = () => {
8
+ const switchSession = useSessionStore((s) => s.switchSession);
9
+ const mobile = useServerConfigStore((s) => s.isMobile);
10
+ const router = useQueryRoute();
11
+
12
+ return useCallback(
13
+ (id: string) => {
14
+ switchSession(id);
15
+
16
+ if (mobile) {
17
+ setTimeout(() => {
18
+ router.push('/chat', {
19
+ query: { session: id, showMobileWorkspace: 'true' },
20
+ });
21
+ }, 50);
22
+ }
23
+ },
24
+ [mobile],
25
+ );
26
+ };
@@ -35,6 +35,7 @@ const Layout = ({ children, detail }: LayoutProps) => {
35
35
  </Flexbox>
36
36
  </Flexbox>
37
37
  {/* ↓ cloud slot ↓ */}
38
+
38
39
  {/* ↑ cloud slot ↑ */}
39
40
  </>
40
41
  );
@@ -157,6 +157,10 @@ const ProviderConfig = memo<ProviderConfigProps>(
157
157
  },
158
158
  ].filter(Boolean) as FormItemProps[];
159
159
 
160
+ /* ↓ cloud slot ↓ */
161
+
162
+ /* ↑ cloud slot ↑ */
163
+
160
164
  const model: ItemGroup = {
161
165
  children: formItems,
162
166
 
@@ -99,6 +99,10 @@ export const useMenu = () => {
99
99
  },
100
100
  ];
101
101
 
102
+ /* ↓ cloud slot ↓ */
103
+
104
+ /* ↑ cloud slot ↑ */
105
+
102
106
  const pwa: MenuProps['items'] = [
103
107
  {
104
108
  icon: <Icon icon={Download} />,
@@ -207,6 +211,9 @@ export const useMenu = () => {
207
211
  },
208
212
  ...(isLoginWithClerk ? profile : []),
209
213
  ...(isLogin ? settings : []),
214
+ /* ↓ cloud slot ↓ */
215
+
216
+ /* ↑ cloud slot ↑ */
210
217
  ...(canInstall ? pwa : []),
211
218
  ...(isLogin ? data : []),
212
219
  ...helps,
@@ -141,7 +141,7 @@ describe('SessionAction', () => {
141
141
  const sessionId = 'active-session-id';
142
142
 
143
143
  act(() => {
144
- result.current.activeSession(sessionId);
144
+ result.current.switchSession(sessionId);
145
145
  });
146
146
 
147
147
  expect(result.current.activeId).toBe(sessionId);
@@ -35,10 +35,9 @@ const SEARCH_SESSIONS_KEY = 'searchSessions';
35
35
  /* eslint-disable typescript-sort-keys/interface */
36
36
  export interface SessionAction {
37
37
  /**
38
- * active the session
39
- * @param sessionId
38
+ * switch the session
40
39
  */
41
- activeSession: (sessionId: string) => void;
40
+ switchSession: (sessionId: string) => void;
42
41
  /**
43
42
  * reset sessions to default
44
43
  */
@@ -94,19 +93,13 @@ export const createSessionSlice: StateCreator<
94
93
  [],
95
94
  SessionAction
96
95
  > = (set, get) => ({
97
- activeSession: (sessionId) => {
98
- if (get().activeId === sessionId) return;
99
-
100
- set({ activeId: sessionId }, false, n(`activeSession/${sessionId}`));
101
- },
102
-
103
96
  clearSessions: async () => {
104
97
  await sessionService.removeAllSessions();
105
98
  await get().refreshSessions();
106
99
  },
107
100
 
108
101
  createSession: async (agent, isSwitchSession = true) => {
109
- const { activeSession, refreshSessions } = get();
102
+ const { switchSession, refreshSessions } = get();
110
103
 
111
104
  // merge the defaultAgent in settings
112
105
  const defaultAgent = merge(
@@ -120,12 +113,13 @@ export const createSessionSlice: StateCreator<
120
113
  await refreshSessions();
121
114
 
122
115
  // Whether to goto to the new session after creation, the default is to switch to
123
- if (isSwitchSession) activeSession(id);
116
+ if (isSwitchSession) switchSession(id);
124
117
 
125
118
  return id;
126
119
  },
120
+
127
121
  duplicateSession: async (id) => {
128
- const { activeSession, refreshSessions } = get();
122
+ const { switchSession, refreshSessions } = get();
129
123
  const session = sessionSelectors.getSessionById(id)(get());
130
124
 
131
125
  if (!session) return;
@@ -154,9 +148,8 @@ export const createSessionSlice: StateCreator<
154
148
  message.destroy(messageLoadingKey);
155
149
  message.success(t('duplicateSession.success', { ns: 'chat' }));
156
150
 
157
- activeSession(newId);
151
+ switchSession(newId);
158
152
  },
159
-
160
153
  pinSession: async (id, pinned) => {
161
154
  await get().internal_updateSession(id, { pinned });
162
155
  },
@@ -167,10 +160,16 @@ export const createSessionSlice: StateCreator<
167
160
 
168
161
  // If the active session deleted, switch to the inbox session
169
162
  if (sessionId === get().activeId) {
170
- get().activeSession(INBOX_SESSION_ID);
163
+ get().switchSession(INBOX_SESSION_ID);
171
164
  }
172
165
  },
173
166
 
167
+ switchSession: (sessionId) => {
168
+ if (get().activeId === sessionId) return;
169
+
170
+ set({ activeId: sessionId }, false, n(`activeSession/${sessionId}`));
171
+ },
172
+
174
173
  updateSearchKeywords: (keywords) => {
175
174
  set(
176
175
  { isSearching: !!keywords, sessionSearchKeywords: keywords },
@@ -102,7 +102,7 @@ describe('sessionMetaSelectors', () => {
102
102
  it('should return the default description if none is defined in the meta data', () => {
103
103
  const meta: MetaData = {};
104
104
  const description = sessionMetaSelectors.getDescription(meta);
105
- expect(description).toBe('noDescription'); // Assuming translation returns this key
105
+ expect(description).toBe(undefined); // Assuming translation returns this key
106
106
  });
107
107
  });
108
108
  });
@@ -14,7 +14,7 @@ const currentAgentMeta = (s: SessionStore): MetaData => {
14
14
  const defaultMeta = {
15
15
  avatar: isInbox ? DEFAULT_INBOX_AVATAR : DEFAULT_AVATAR,
16
16
  backgroundColor: DEFAULT_BACKGROUND_COLOR,
17
- description: isInbox ? t('inbox.desc', { ns: 'chat' }) : t('noDescription'),
17
+ description: isInbox ? t('inbox.desc', { ns: 'chat' }) : undefined,
18
18
  title: isInbox ? t('inbox.title', { ns: 'chat' }) : t('defaultSession'),
19
19
  };
20
20
 
@@ -30,8 +30,8 @@ const currentAgentBackgroundColor = (s: SessionStore) => currentAgentMeta(s).bac
30
30
 
31
31
  const getAvatar = (s: MetaData) => s.avatar || DEFAULT_AVATAR;
32
32
  const getTitle = (s: MetaData) => s.title || t('defaultSession', { ns: 'common' });
33
- export const getDescription = (s: MetaData) =>
34
- s.description || t('noDescription', { ns: 'common' });
33
+ // New session do not show 'noDescription'
34
+ export const getDescription = (s: MetaData) => s.description;
35
35
 
36
36
  export const sessionMetaSelectors = {
37
37
  currentAgentAvatar,