@lobehub/chat 0.122.7 → 0.122.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,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.122.8](https://github.com/lobehub/lobe-chat/compare/v0.122.7...v0.122.8)
6
+
7
+ <sup>Released on **2024-02-03**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Allow user to add agent without redirection.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Allow user to add agent without redirection, closes [#1199](https://github.com/lobehub/lobe-chat/issues/1199) ([6577ca1](https://github.com/lobehub/lobe-chat/commit/6577ca1))
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
+
5
30
  ### [Version 0.122.7](https://github.com/lobehub/lobe-chat/compare/v0.122.6...v0.122.7)
6
31
 
7
32
  <sup>Released on **2024-02-02**</sup>
package/README.md CHANGED
@@ -186,14 +186,14 @@ e-commerce platform data access, and various third-party services.
186
186
 
187
187
  <!-- PLUGIN LIST -->
188
188
 
189
- | Recent Submits | Description |
190
- | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
191
- | [TokenInsights](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **feednews** on **2024-01-27**</sup> | Get realtime crypto price, BTC, ETH, BNB, and the latest insights.The latest coin news and airdrop opportunities.<br/>`crypto` `btc` `eth` `bnb` |
192
- | [Bilibili](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **LobeHub** on **2024-01-27**</sup> | Dive into Bilibili's vast content with features like keyword video search, replay access, interactive danmaku, trending video recommendations, and hot-search insights, all at your fingertips.<br/>`video` `bilibili` `search` |
193
- | [Steam](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **LobeHub** on **2024-01-27**</sup> | Obtain game information and user reviews from Steam.<br/>`steam` `game` |
194
- | [Current Time Assistant](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **cc** on **2024-01-26**</sup> | A plugin to provide current time information<br/>`time` |
195
-
196
- > 📊 Total plugins: [<kbd>**60**</kbd>](https://github.com/lobehub/lobe-chat-plugins)
189
+ | Recent Submits | Description |
190
+ | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
191
+ | [Social Search](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **say-apps** on **2024-02-02**</sup> | The Social Search provides access to tweets, users, followers, images, media and more.<br/>`social` `twitter` `x` `search` |
192
+ | [TokenInsights](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **feednews** on **2024-01-27**</sup> | Get realtime crypto price, BTC, ETH, BNB, and the latest insights.The latest coin news and airdrop opportunities.<br/>`crypto` `btc` `eth` `bnb` |
193
+ | [Bilibili](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **LobeHub** on **2024-01-27**</sup> | Dive into Bilibili's vast content with features like keyword video search, replay access, interactive danmaku, trending video recommendations, and hot-search insights, all at your fingertips.<br/>`video` `bilibili` `search` |
194
+ | [Steam](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **LobeHub** on **2024-01-27**</sup> | Obtain game information and user reviews from Steam.<br/>`steam` `game` |
195
+
196
+ > 📊 Total plugins: [<kbd>**61**</kbd>](https://github.com/lobehub/lobe-chat-plugins)
197
197
 
198
198
  <!-- PLUGIN LIST -->
199
199
 
package/README.zh-CN.md CHANGED
@@ -172,12 +172,12 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
172
172
 
173
173
  | 最近新增 | 插件描述 |
174
174
  | ----------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
175
+ | [社交搜索](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **say-apps** on **2024-02-02**</sup> | 社交搜索提供访问推文、用户、关注者、图片、媒体等功能。<br/>`社交` `推特` `x` `搜索` |
175
176
  | [TokenInsights](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **feednews** on **2024-01-27**</sup> | 获取实时加密货币价格,BTC,ETH,BNB 和最新见解。最新的币新闻和空投机会。<br/>`加密货币` `btc` `eth` `bnb` |
176
177
  | [哔哩哔哩](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **LobeHub** on **2024-01-27**</sup> | 通过关键词视频搜索、回放访问、互动弹幕、热门视频推荐和热搜洞察等功能,深入体验哔哩哔哩丰富的内容,尽在您的指尖。<br/>`视频` `哔哩哔哩` `搜索` |
177
178
  | [Steam](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **LobeHub** on **2024-01-27**</sup> | 从 Steam 获取游戏信息和用户评论。<br/>`steam` `game` |
178
- | [当前时间助手](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **cc** on **2024-01-26**</sup> | 提供当前时间信息的插件<br/>`时间` |
179
179
 
180
- > 📊 Total plugins: [<kbd>**60**</kbd>](https://github.com/lobehub/lobe-chat-plugins)
180
+ > 📊 Total plugins: [<kbd>**61**</kbd>](https://github.com/lobehub/lobe-chat-plugins)
181
181
 
182
182
  <!-- PLUGIN LIST -->
183
183
 
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "إضافة وكيل",
3
+ "addAgentAndConverse": "إضافة وكيل وبدء المحادثة",
4
+ "addAgentSuccess": "تمت الإضافة بنجاح",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "في نافذة الدردشة، انتقل إلى صفحة إعدادات الوكيل التي ترغب في تقديمها من الزاوية اليمنى العلوية.",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "Helfer hinzufügen",
3
+ "addAgentAndConverse": "Assistent hinzufügen und Konversation starten",
4
+ "addAgentSuccess": "Erfolgreich hinzugefügt",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "Gehen Sie im Chatfenster über das Einstellungssymbol oben rechts zur Seite, auf der Sie die Einstellungen für Ihren Helfer einreichen können.",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "Add Agent",
3
+ "addAgentAndConverse": "Add Agent and Converse",
4
+ "addAgentSuccess": "Successfully Added",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "Enter the settings page you want to submit to the assistant by clicking on the settings icon in the upper right corner of the chat window.",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "Añadir asistente",
3
+ "addAgentAndConverse": "Agregar agente y conversar",
4
+ "addAgentSuccess": "Agente agregado con éxito",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "En la ventana de chat, accede a la página de configuración del asistente a través del icono de ajustes en la esquina superior derecha.",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "Ajouter un assistant",
3
+ "addAgentAndConverse": "Ajouter un agent et converser",
4
+ "addAgentSuccess": "Ajout réussi",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "Accédez à la page de configuration de l'assistant que vous souhaitez soumettre en cliquant sur l'icône Paramètres en haut à droite de la fenêtre de conversation.",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "Aggiungi assistente",
3
+ "addAgentAndConverse": "Aggiungi assistente e avvia la conversazione",
4
+ "addAgentSuccess": "Aggiunta riuscita",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "Nella finestra di chat, accedi alle impostazioni nell'angolo in alto a destra per accedere alla pagina di configurazione dell'assistente che desideri inviare;",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "エージェントを追加する",
3
+ "addAgentAndConverse": "エージェントを追加して会話する",
4
+ "addAgentSuccess": "追加に成功しました",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "セッションウィンドウで右上隅の設定にアクセスして、アシスタントの設定ページに移動します。",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "보조 프로그램 추가",
3
+ "addAgentAndConverse": "에이전트 추가 및 대화",
4
+ "addAgentSuccess": "추가 성공",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "세션 창에서 오른쪽 상단 설정으로 이동하여 도우미를 제출할 설정 페이지로 이동합니다.",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "Voeg een assistent toe",
3
+ "addAgentAndConverse": "Voeg een assistent toe en start een gesprek",
4
+ "addAgentSuccess": "Succesvol toegevoegd",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "Ga naar de instellingen in de rechterbovenhoek van het chatvenster om naar de pagina te gaan waar je de assistent kunt toevoegen.",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "Dodaj asystenta",
3
+ "addAgentAndConverse": "Dodaj asystenta i rozpocznij rozmowę",
4
+ "addAgentSuccess": "Dodano pomyślnie",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "Przejdź do strony ustawień, klikając prawy górny róg okna rozmowy, aby przejść do strony ustawień asystenta, którego chcesz złożyć.",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "Adicionar assistente",
3
+ "addAgentAndConverse": "Adicionar assistente e conversar",
4
+ "addAgentSuccess": "Adição bem-sucedida",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "Na janela de conversa, acesse a página de configurações que você deseja enviar para o assistente através do ícone no canto superior direito;",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "Добавить агента",
3
+ "addAgentAndConverse": "Добавить агента и начать разговор",
4
+ "addAgentSuccess": "Агент успешно добавлен",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "Перейдите на страницу настроек, нажав на значок в правом верхнем углу окна сеанса.",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "Asistan Ekle",
3
+ "addAgentAndConverse": "Asistan Ekle ve Konuşma Başlat",
4
+ "addAgentSuccess": "Ekleme Başarılı",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "Sohbet penceresinin sağ üst köşesindeki ayarlar simgesine tıklayarak asistana göndermek istediğiniz ayarlar sayfasına girin.",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "Thêm trợ lý",
3
+ "addAgentAndConverse": "Thêm trợ lý và trò chuyện",
4
+ "addAgentSuccess": "Thêm thành công",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "Trong cửa sổ trò chuyện, nhấp vào cài đặt ở góc trên bên phải để vào trang cài đặt trợ lý bạn muốn gửi;",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "添加助手",
3
+ "addAgentAndConverse": "添加助手并会话",
4
+ "addAgentSuccess": "添加成功",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "在会话窗口中通过右上角设置进入你想提交助手的设置页面;",
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "addAgent": "新增助理",
3
+ "addAgentAndConverse": "新增助理並開始對話",
4
+ "addAgentSuccess": "新增成功",
3
5
  "guide": {
4
6
  "func1": {
5
7
  "desc1": "在會話視窗中通過右上角設置進入你想提交助手的設置頁面;",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.122.7",
3
+ "version": "0.122.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,5 +1,5 @@
1
1
  import { Avatar, Tag } from '@lobehub/ui';
2
- import { Button, Typography } from 'antd';
2
+ import { App, Button, Typography } from 'antd';
3
3
  import { startCase } from 'lodash-es';
4
4
  import { memo } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
@@ -20,6 +20,7 @@ const Header = memo(() => {
20
20
  const createSession = useSessionStore((s) => s.createSession);
21
21
  const switchSideBar = useGlobalStore((s) => s.switchSideBar);
22
22
  const agentItem = useMarketStore(agentMarketSelectors.currentAgentItem);
23
+ const { message } = App.useApp();
23
24
 
24
25
  const { meta, createAt, author, homepage, config } = agentItem;
25
26
  const { avatar, title, description, tags, backgroundColor } = meta;
@@ -58,6 +59,17 @@ const Header = memo(() => {
58
59
  switchSideBar(SidebarTabKey.Chat);
59
60
  }}
60
61
  type={'primary'}
62
+ >
63
+ {t('addAgentAndConverse')}
64
+ </Button>
65
+ <Button
66
+ block
67
+ onClick={() => {
68
+ if (!agentItem) return;
69
+
70
+ createSession({ config, meta }, false);
71
+ message.success(t('addAgentSuccess'));
72
+ }}
61
73
  >
62
74
  {t('addAgent')}
63
75
  </Button>
@@ -31,6 +31,7 @@ const Loading = memo(() => {
31
31
  }}
32
32
  />
33
33
  <Skeleton.Button active block />
34
+ <Skeleton.Button active block />
34
35
  <Skeleton
35
36
  active
36
37
  className={styles.loading}
@@ -1,5 +1,7 @@
1
1
  export default {
2
2
  addAgent: '添加助手',
3
+ addAgentAndConverse: '添加助手并会话',
4
+ addAgentSuccess: '添加成功',
3
5
  guide: {
4
6
  func1: {
5
7
  desc1: '在会话窗口中通过右上角设置进入你想提交助手的设置页面;',
@@ -76,6 +76,30 @@ describe('SessionAction', () => {
76
76
  SESSION_CHAT_URL(newSessionId, result.current.isMobile),
77
77
  );
78
78
  });
79
+
80
+ it('should create a new session but not switch to it if isSwitchSession is false', async () => {
81
+ const { result } = renderHook(() => useSessionStore());
82
+ const newSessionId = 'new-session-id';
83
+ vi.mocked(sessionService.createNewSession).mockResolvedValue(newSessionId);
84
+
85
+ let createdSessionId;
86
+
87
+ await act(async () => {
88
+ createdSessionId = await result.current.createSession(
89
+ { config: { displayMode: 'docs' } },
90
+ false,
91
+ );
92
+ });
93
+
94
+ const call = vi.mocked(sessionService.createNewSession).mock.calls[0];
95
+ expect(call[0]).toEqual(LobeSessionType.Agent);
96
+ expect(call[1]).toMatchObject({ config: { displayMode: 'docs' } });
97
+
98
+ expect(createdSessionId).toBe(newSessionId);
99
+ expect(mockRouterPush).not.toHaveBeenCalledWith(
100
+ SESSION_CHAT_URL(newSessionId, result.current.isMobile),
101
+ );
102
+ });
79
103
  });
80
104
 
81
105
  describe('duplicateSession', () => {
@@ -10,12 +10,7 @@ import { sessionService } from '@/services/session';
10
10
  import { useGlobalStore } from '@/store/global';
11
11
  import { settingsSelectors } from '@/store/global/selectors';
12
12
  import { SessionStore } from '@/store/session';
13
- import {
14
- ChatSessionList,
15
- LobeAgentSession,
16
- LobeSessionType,
17
- LobeSessions,
18
- } from '@/types/session';
13
+ import { ChatSessionList, LobeAgentSession, LobeSessionType, LobeSessions } from '@/types/session';
19
14
  import { merge } from '@/utils/merge';
20
15
  import { setNamespace } from '@/utils/storeDebug';
21
16
 
@@ -42,7 +37,10 @@ export interface SessionAction {
42
37
  * @param agent
43
38
  * @returns sessionId
44
39
  */
45
- createSession: (session?: DeepPartial<LobeAgentSession>) => Promise<string>;
40
+ createSession: (
41
+ session?: DeepPartial<LobeAgentSession>,
42
+ isSwitchSession?: boolean,
43
+ ) => Promise<string>;
46
44
  duplicateSession: (id: string) => Promise<void>;
47
45
  /**
48
46
  * Pins or unpins a session.
@@ -86,7 +84,7 @@ export const createSessionSlice: StateCreator<
86
84
  get().refreshSessions();
87
85
  },
88
86
 
89
- createSession: async (agent) => {
87
+ createSession: async (agent, isSwitchSession = true) => {
90
88
  const { switchSession, refreshSessions } = get();
91
89
 
92
90
  // 合并 settings 里的 defaultAgent
@@ -100,7 +98,8 @@ export const createSessionSlice: StateCreator<
100
98
  const id = await sessionService.createNewSession(LobeSessionType.Agent, newSession);
101
99
  await refreshSessions();
102
100
 
103
- switchSession(id);
101
+ // 创建后是否跳转到对应会话,默认跳转
102
+ if (isSwitchSession) switchSession(id);
104
103
 
105
104
  return id;
106
105
  },