@lobehub/chat 0.96.9 → 0.97.1

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,64 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.97.1](https://github.com/lobehub/lobe-chat/compare/v0.97.0...v0.97.1)
6
+
7
+ <sup>Released on **2023-11-06**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Use pnpm to fix docker release.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Use pnpm to fix docker release ([886cc3b](https://github.com/lobehub/lobe-chat/commit/886cc3b))
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.97.0](https://github.com/lobehub/lobe-chat/compare/v0.96.9...v0.97.0)
31
+
32
+ <sup>Released on **2023-11-05**</sup>
33
+
34
+ #### ✨ Features
35
+
36
+ - **misc**: Add open new topic when open a topic.
37
+
38
+ #### 🐛 Bug Fixes
39
+
40
+ - **misc**: Fix toggle back to default topic when clearing topic.
41
+
42
+ <br/>
43
+
44
+ <details>
45
+ <summary><kbd>Improvements and Fixes</kbd></summary>
46
+
47
+ #### What's improved
48
+
49
+ - **misc**: Add open new topic when open a topic ([4df6384](https://github.com/lobehub/lobe-chat/commit/4df6384))
50
+
51
+ #### What's fixed
52
+
53
+ - **misc**: Fix toggle back to default topic when clearing topic ([6fe0a5c](https://github.com/lobehub/lobe-chat/commit/6fe0a5c))
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.96.9](https://github.com/lobehub/lobe-chat/compare/v0.96.8...v0.96.9)
6
64
 
7
65
  <sup>Released on **2023-11-04**</sup>
package/Dockerfile CHANGED
@@ -10,10 +10,9 @@ WORKDIR /app
10
10
 
11
11
  COPY package.json ./
12
12
 
13
- RUN pnpm i -g bun
14
13
  # If you want to build docker in China
15
14
  #RUN npm config set registry https://registry.npmmirror.com/
16
- RUN bun i
15
+ RUN pnpm i
17
16
 
18
17
  COPY . .
19
18
  RUN pnpm run build:docker # run build standalone for docker version
package/README.md CHANGED
@@ -122,14 +122,14 @@ In our agent market. We have accumulated a large number of practical, prompt age
122
122
 
123
123
  <!-- AGENT LIST -->
124
124
 
125
- | Recent Submits | Description |
126
- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
127
- | [Sketch Feature Summary Expert](https://chat-preview.lobehub.com/market?agent=sketch-changelog-highlighter)<br/><sup>By **[arvinxx](https://github.com/arvinxx)** on **2023-11-02**</sup> | Skilled at extracting key changes from Sketch release notes<br/>`experience-design` `sketch` `update` `feature` `text-summary` |
128
- | [Master of Debating](https://chat-preview.lobehub.com/market?agent=tqg-20231026)<br/><sup>By **[cake79](https://github.com/cake79)** on **2023-10-26**</sup> | Simulates people who enjoy debating and can express counterarguments to any user input<br/>`writing` `dialogue` |
129
- | [Graph Generator](https://chat-preview.lobehub.com/market?agent=graph-generator)<br/><sup>By **[choldrim](https://github.com/choldrim)** on **2023-10-23**</sup> | Automatic Graph Generator<br/>`graph` |
130
- | [Master of Naming](https://chat-preview.lobehub.com/market?agent=meaningful-name)<br/><sup>By **[yingxirz](https://github.com/yingxirz)** on **2023-10-18**</sup> | Provides concise and meaningful names for your artistic creations.<br/>`naming` `creative` |
131
-
132
- > 📊 Total agents: [<kbd>**37**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
125
+ | Recent Submits | Description |
126
+ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
127
+ | [LobeChat Technical Documentation Expert](https://chat-preview.lobehub.com/market?agent=lobe-chat-develop-doc-writter)<br/><sup>By **[arvinxx](https://github.com/arvinxx)** on **2023-11-05**</sup> | LobeChat is an AI conversation application built with the Next.js framework. I will help you write the development documentation for LobeChat.<br/>`development-documentation` `technical-introduction` `next-js` `react` `lobe-chat` |
128
+ | [Sketch Feature Summary Expert](https://chat-preview.lobehub.com/market?agent=sketch-changelog-highlighter)<br/><sup>By **[arvinxx](https://github.com/arvinxx)** on **2023-11-02**</sup> | Skilled at extracting key changes from Sketch release notes<br/>`experience-design` `sketch` `update` `feature` `text-summary` |
129
+ | [Master of Debating](https://chat-preview.lobehub.com/market?agent=tqg-20231026)<br/><sup>By **[cake79](https://github.com/cake79)** on **2023-10-26**</sup> | Simulates people who enjoy debating and can express counterarguments to any user input<br/>`writing` `dialogue` |
130
+ | [Graph Generator](https://chat-preview.lobehub.com/market?agent=graph-generator)<br/><sup>By **[choldrim](https://github.com/choldrim)** on **2023-10-23**</sup> | Automatic Graph Generator<br/>`graph` |
131
+
132
+ > 📊 Total agents: [<kbd>**38**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
133
133
 
134
134
  <!-- AGENT LIST -->
135
135
 
package/README.zh-CN.md CHANGED
@@ -122,14 +122,14 @@ LobeChat 是一个开源的、可扩展的([Function Calling][fc-link])高
122
122
 
123
123
  <!-- AGENT LIST -->
124
124
 
125
- | 最近新增 | 助手说明 |
126
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
127
- | [Sketch 特性总结专家](https://chat-preview.lobehub.com/market?agent=sketch-changelog-highlighter)<br/><sup>By **[arvinxx](https://github.com/arvinxx)** on **2023-11-02**</sup> | 擅长从 Sketch 的更新日志中提取关键变更要点<br/>`体验设计` `sketch` `更新` `特性` `文本总结` |
128
- | [抬杠高手](https://chat-preview.lobehub.com/market?agent=tqg-20231026)<br/><sup>By **[cake79](https://github.com/cake79)** on **2023-10-26**</sup> | 模拟那些喜欢抬杠的人, 能对用户输入的任何观点进行抬杠表达的角色<br/>`写作` `对话` |
129
- | [图表生成器](https://chat-preview.lobehub.com/market?agent=graph-generator)<br/><sup>By **[choldrim](https://github.com/choldrim)** on **2023-10-23**</sup> | 自动图表生成器<br/>`图表` |
130
- | [作品命名大师](https://chat-preview.lobehub.com/market?agent=meaningful-name)<br/><sup>By **[yingxirz](https://github.com/yingxirz)** on **2023-10-18**</sup> | 为您的艺术创作提供简洁而富有内涵的名称。<br/>`起名` `创意` |
131
-
132
- > 📊 Total agents: [<kbd>**37**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
125
+ | 最近新增 | 助手说明 |
126
+ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
127
+ | [LobeChat 技术文档专家](https://chat-preview.lobehub.com/market?agent=lobe-chat-develop-doc-writter)<br/><sup>By **[arvinxx](https://github.com/arvinxx)** on **2023-11-05**</sup> | LobeChat是一个Next.js框架构建的AI会话应用,我将会帮你一起书写 LobeChat 的开发文档<br/>`开发文档` `技术介绍` `next-js` `react` `lobe-chat` |
128
+ | [Sketch 特性总结专家](https://chat-preview.lobehub.com/market?agent=sketch-changelog-highlighter)<br/><sup>By **[arvinxx](https://github.com/arvinxx)** on **2023-11-02**</sup> | 擅长从 Sketch 的更新日志中提取关键变更要点<br/>`体验设计` `sketch` `更新` `特性` `文本总结` |
129
+ | [抬杠高手](https://chat-preview.lobehub.com/market?agent=tqg-20231026)<br/><sup>By **[cake79](https://github.com/cake79)** on **2023-10-26**</sup> | 模拟那些喜欢抬杠的人, 能对用户输入的任何观点进行抬杠表达的角色<br/>`写作` `对话` |
130
+ | [图表生成器](https://chat-preview.lobehub.com/market?agent=graph-generator)<br/><sup>By **[choldrim](https://github.com/choldrim)** on **2023-10-23**</sup> | 自动图表生成器<br/>`图表` |
131
+
132
+ > 📊 Total agents: [<kbd>**38**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
133
133
 
134
134
  <!-- AGENT LIST -->
135
135
 
@@ -53,7 +53,8 @@
53
53
  "confirmRemoveAll": "All topics will be deleted and cannot be recovered. Please proceed with caution.",
54
54
  "confirmRemoveUnstarred": "All unstarred topics will be deleted and cannot be recovered. Please proceed with caution.",
55
55
  "removeAll": "Remove All Topics",
56
- "removeUnstarred": "Remove Unstarred Topics"
56
+ "removeUnstarred": "Remove Unstarred Topics",
57
+ "openNewTopic": "Open a new topic"
57
58
  },
58
59
  "translate": {
59
60
  "clear": "Clear Translation"
@@ -53,7 +53,8 @@
53
53
  "confirmRemoveAll": "すべてのトピックを削除します。削除後は元に戻すことはできませんので、注意して操作してください。",
54
54
  "confirmRemoveUnstarred": "スターをつけていないトピックを削除します。削除後は元に戻すことはできませんので、注意して操作してください。",
55
55
  "removeAll": "すべてのトピックを削除",
56
- "removeUnstarred": "スターをつけていないトピックを削除"
56
+ "removeUnstarred": "スターをつけていないトピックを削除",
57
+ "openNewTopic": "新しいトピックを開く"
57
58
  },
58
59
  "translate": {
59
60
  "clear": "翻訳をクリア"
@@ -53,7 +53,8 @@
53
53
  "confirmRemoveAll": "모든 주제를 삭제하려고 합니다. 삭제 후에는 복구할 수 없으므로 신중하게 작업하십시오.",
54
54
  "confirmRemoveUnstarred": "스타를 지정하지 않은 주제를 삭제하려고 합니다. 삭제 후에는 복구할 수 없으므로 신중하게 작업하십시오.",
55
55
  "removeAll": "모든 주제 삭제",
56
- "removeUnstarred": "스타를 지정하지 않은 주제 삭제"
56
+ "removeUnstarred": "스타를 지정하지 않은 주제 삭제",
57
+ "openNewTopic": "새로운 주제 열기"
57
58
  },
58
59
  "translate": {
59
60
  "clear": "번역 지우기"
@@ -53,7 +53,8 @@
53
53
  "confirmRemoveAll": "Вы собираетесь удалить все темы. После удаления их будет невозможно восстановить. Пожалуйста, будьте осторожны.",
54
54
  "confirmRemoveUnstarred": "Вы собираетесь удалить неотмеченные темы. После удаления их будет невозможно восстановить. Пожалуйста, будьте осторожны.",
55
55
  "removeAll": "Удалить все темы",
56
- "removeUnstarred": "Удалить неотмеченные темы"
56
+ "removeUnstarred": "Удалить неотмеченные темы",
57
+ "openNewTopic": "Открыть новую тему"
57
58
  },
58
59
  "translate": {
59
60
  "clear": "Очистить перевод"
@@ -47,6 +47,7 @@
47
47
  "confirmRemoveTopic": "即将删除该话题,删除后将不可恢复,请谨慎操作。",
48
48
  "confirmRemoveUnstarred": "即将删除未收藏话题,删除后将不可恢复,请谨慎操作。",
49
49
  "defaultTitle": "默认话题",
50
+ "openNewTopic": "开启新话题",
50
51
  "removeAll": "删除全部话题",
51
52
  "removeUnstarred": "删除未收藏话题",
52
53
  "saveCurrentMessages": "将当前会话保存为话题",
@@ -53,7 +53,8 @@
53
53
  "confirmRemoveAll": "即將刪除全部話題,刪除後將無法恢復,請謹慎操作。",
54
54
  "confirmRemoveUnstarred": "即將刪除未收藏話題,刪除後將無法恢復,請謹慎操作。",
55
55
  "removeAll": "刪除全部話題",
56
- "removeUnstarred": "刪除未收藏話題"
56
+ "removeUnstarred": "刪除未收藏話題",
57
+ "openNewTopic": "開啟新話題"
57
58
  },
58
59
  "translate": {
59
60
  "clear": "刪除翻譯"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.96.9",
3
+ "version": "0.97.1",
4
4
  "description": "An open-source, extensible (Function Calling), high-performance chatbot framework. It supports one-click free deployment of your private ChatGPT/LLM web application",
5
5
  "keywords": [
6
6
  "chatbot",
@@ -5,7 +5,7 @@ import { memo } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { Flexbox } from 'react-layout-kit';
7
7
 
8
- import SaveTopic from './SaveTopic';
8
+ import SaveTopic from '../../../features/ChatInputContent/Topic';
9
9
 
10
10
  const Footer = memo(() => {
11
11
  const theme = useTheme();
@@ -4,7 +4,8 @@ import { memo, useState } from 'react';
4
4
  import { CHAT_TEXTAREA_HEIGHT, HEADER_HEIGHT } from '@/const/layoutTokens';
5
5
  import { useGlobalStore } from '@/store/global';
6
6
 
7
- import ChatInputContent from '../../features/ChatInputContent';
7
+ import ChatInputContent from '../../../features/ChatInputContent';
8
+ import Footer from './Footer';
8
9
 
9
10
  const ChatInputDesktopLayout = memo(() => {
10
11
  const [expand, setExpand] = useState<boolean>(false);
@@ -29,7 +30,7 @@ const ChatInputDesktopLayout = memo(() => {
29
30
  size={{ height: inputHeight, width: '100%' }}
30
31
  style={{ zIndex: 10 }}
31
32
  >
32
- <ChatInputContent expand={expand} onExpandChange={setExpand} />
33
+ <ChatInputContent expand={expand} footer={<Footer />} onExpandChange={setExpand} />
33
34
  </DraggablePanel>
34
35
  );
35
36
  });
@@ -10,7 +10,7 @@ import HotKeys from '@/components/HotKeys';
10
10
  import { CLEAN_MESSAGE_KEY, PREFIX_KEY } from '@/const/hotkeys';
11
11
  import { useSessionStore } from '@/store/session';
12
12
 
13
- import SaveTopic from '../Footer/SaveTopic';
13
+ import SaveTopic from '../Topic';
14
14
 
15
15
  const ActionsRight = memo(() => {
16
16
  const { t } = useTranslation('setting');
@@ -1,7 +1,7 @@
1
1
  import { ActionIcon, Icon, Tooltip } from '@lobehub/ui';
2
2
  import { Button } from 'antd';
3
3
  import { useResponsive } from 'antd-style';
4
- import { LucideGalleryVerticalEnd } from 'lucide-react';
4
+ import { LucideGalleryVerticalEnd, LucideMessageSquarePlus } from 'lucide-react';
5
5
  import { memo } from 'react';
6
6
  import { useHotkeys } from 'react-hotkeys-hook';
7
7
  import { useTranslation } from 'react-i18next';
@@ -12,23 +12,25 @@ import { useSessionStore } from '@/store/session';
12
12
 
13
13
  const SaveTopic = memo(() => {
14
14
  const { t } = useTranslation('chat');
15
- const [hasTopic, saveToTopic] = useSessionStore((s) => [!!s.activeTopicId, s.saveToTopic]);
15
+ const [hasTopic, openNewTopicOrSaveTopic] = useSessionStore((s) => [
16
+ !!s.activeTopicId,
17
+ s.openNewTopicOrSaveTopic,
18
+ ]);
16
19
  const { mobile } = useResponsive();
17
20
 
18
- const hotkeys = [PREFIX_KEY, SAVE_TOPIC_KEY].join('+');
21
+ const icon = hasTopic ? LucideMessageSquarePlus : LucideGalleryVerticalEnd;
22
+ const Render = mobile ? ActionIcon : Button;
23
+ const iconRender: any = mobile ? icon : <Icon icon={icon} />;
24
+ const desc = t(hasTopic ? 'topic.openNewTopic' : 'topic.saveCurrentMessages');
19
25
 
20
- useHotkeys(hotkeys, saveToTopic, {
26
+ const hotkeys = [PREFIX_KEY, SAVE_TOPIC_KEY].join('+');
27
+ useHotkeys(hotkeys, openNewTopicOrSaveTopic, {
21
28
  preventDefault: true,
22
29
  });
23
30
 
24
- if (hasTopic) return undefined;
25
-
26
- const Render = mobile ? ActionIcon : Button;
27
- const icon: any = mobile ? LucideGalleryVerticalEnd : <Icon icon={LucideGalleryVerticalEnd} />;
28
-
29
31
  return (
30
- <Tooltip title={<HotKeys desc={t('topic.saveCurrentMessages')} keys={hotkeys} />}>
31
- <Render aria-label={t('topic.saveCurrentMessages')} icon={icon} onClick={saveToTopic} />
32
+ <Tooltip title={<HotKeys desc={desc} keys={hotkeys} />}>
33
+ <Render aria-label={desc} icon={iconRender} onClick={openNewTopicOrSaveTopic} />
32
34
  </Tooltip>
33
35
  );
34
36
  });
@@ -1,7 +1,7 @@
1
1
  import { ChatInputArea } from '@lobehub/ui';
2
2
  import { useResponsive } from 'antd-style';
3
3
  import dynamic from 'next/dynamic';
4
- import { Suspense, memo, useState } from 'react';
4
+ import { ReactNode, Suspense, memo, useState } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
7
  import { CHAT_TEXTAREA_HEIGHT } from '@/const/layoutTokens';
@@ -10,18 +10,18 @@ import { agentSelectors } from '@/store/session/selectors';
10
10
 
11
11
  import ActionLeft from './ActionBar/ActionLeft';
12
12
  import ActionsRight from './ActionBar/ActionRight';
13
- import Footer from './Footer';
14
13
 
15
14
  const Token = dynamic(() => import('./ActionBar/Token'), { ssr: false });
16
15
 
17
16
  interface ChatContentProps {
18
17
  expand?: boolean;
18
+ footer?: ReactNode;
19
19
  mobile?: boolean;
20
20
  onExpandChange?: (expand: boolean) => void;
21
21
  }
22
22
 
23
23
  const ChatInputContent = memo<ChatContentProps>(
24
- ({ expand, onExpandChange, mobile: defaultMobile }) => {
24
+ ({ expand, onExpandChange, mobile: defaultMobile, footer }) => {
25
25
  const { t } = useTranslation('common');
26
26
 
27
27
  const [message, setMessage] = useState('');
@@ -50,7 +50,7 @@ const ChatInputContent = memo<ChatContentProps>(
50
50
  }
51
51
  actionsRight={<ActionsRight />}
52
52
  expand={expand}
53
- footer={<Footer />}
53
+ footer={footer}
54
54
  loading={isLoading}
55
55
  minHeight={mobile ? 0 : CHAT_TEXTAREA_HEIGHT}
56
56
  onExpandChange={onExpandChange}
@@ -50,6 +50,7 @@ export default {
50
50
  confirmRemoveTopic: '即将删除该话题,删除后将不可恢复,请谨慎操作。',
51
51
  confirmRemoveUnstarred: '即将删除未收藏话题,删除后将不可恢复,请谨慎操作。',
52
52
  defaultTitle: '默认话题',
53
+ openNewTopic: '开启新话题',
53
54
  removeAll: '删除全部话题',
54
55
  removeUnstarred: '删除未收藏话题',
55
56
  saveCurrentMessages: '将当前会话保存为话题',
@@ -83,13 +83,16 @@ export const chatMessage: StateCreator<
83
83
  ChatMessageAction
84
84
  > = (set, get) => ({
85
85
  clearMessage: () => {
86
- const { dispatchMessage, activeTopicId, dispatchTopic } = get();
86
+ const { dispatchMessage, activeTopicId, dispatchTopic, toggleTopic } = get();
87
87
 
88
88
  dispatchMessage({ topicId: activeTopicId, type: 'resetMessages' });
89
89
 
90
90
  if (activeTopicId) {
91
91
  dispatchTopic({ id: activeTopicId, type: 'deleteChatTopic' });
92
92
  }
93
+
94
+ // after remove topic , go back to default topic
95
+ toggleTopic();
93
96
  },
94
97
 
95
98
  coreProcessMessage: async (messages, userMessageId) => {
@@ -18,6 +18,7 @@ export interface ChatTopicAction {
18
18
  * @param payload - 要分发的主题
19
19
  */
20
20
  dispatchTopic: (payload: ChatTopicDispatch) => void;
21
+ openNewTopicOrSaveTopic: () => void;
21
22
  /**
22
23
  * 移出所有话题
23
24
  */
@@ -62,6 +63,15 @@ export const chatTopic: StateCreator<
62
63
 
63
64
  get().dispatchSession({ id: activeId, topics, type: 'updateSessionTopic' });
64
65
  },
66
+ openNewTopicOrSaveTopic: () => {
67
+ const { toggleTopic, saveToTopic, activeTopicId } = get();
68
+ const hasTopic = !!activeTopicId;
69
+
70
+ if (hasTopic) toggleTopic();
71
+ else {
72
+ saveToTopic();
73
+ }
74
+ },
65
75
  removeAllTopic: () => {
66
76
  const { removeTopic, toggleTopic } = get();
67
77
  const topics = topicSelectors.currentTopics(get());
@@ -79,10 +89,7 @@ export const chatTopic: StateCreator<
79
89
  // 移除关联的 message
80
90
  const messages = topicSelectors.getTopicMessages(id)(get());
81
91
  for (const m of messages) {
82
- dispatchMessage({
83
- id: m.id,
84
- type: 'deleteMessage',
85
- });
92
+ dispatchMessage({ id: m.id, type: 'deleteMessage' });
86
93
  }
87
94
 
88
95
  // 最后移除 topic
@@ -107,9 +114,12 @@ export const chatTopic: StateCreator<
107
114
  if (!session) return;
108
115
 
109
116
  const { dispatchTopic, dispatchMessage, updateTopicLoading } = get();
110
- // 获取当前的 messages
117
+ // get current messages
111
118
  const messages = chatSelectors.currentChats(get());
112
119
 
120
+ // if there is no message, stop saving
121
+ if (messages.length === 0) return;
122
+
113
123
  const topicId = nanoid();
114
124
 
115
125
  const defaultTitle = '默认话题';
@@ -154,6 +164,7 @@ export const chatTopic: StateCreator<
154
164
  toggleTopic: (id) => {
155
165
  set({ activeTopicId: id }, false, t('toggleTopic'));
156
166
  },
167
+
157
168
  updateTopicLoading: (id) => {
158
169
  set({ topicLoadingId: id }, false, t('updateTopicLoading'));
159
170
  },