@lobehub/chat 0.162.13 → 0.162.14

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.162.14](https://github.com/lobehub/lobe-chat/compare/v0.162.13...v0.162.14)
6
+
7
+ <sup>Released on **2024-06-03**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Improve loading state.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Improve loading state, closes [#2767](https://github.com/lobehub/lobe-chat/issues/2767) ([fbdfde9](https://github.com/lobehub/lobe-chat/commit/fbdfde9))
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.162.13](https://github.com/lobehub/lobe-chat/compare/v0.162.12...v0.162.13)
6
31
 
7
32
  <sup>Released on **2024-06-01**</sup>
package/README.md CHANGED
@@ -223,14 +223,14 @@ In addition, these plugins are not limited to news aggregation, but can also ext
223
223
 
224
224
  <!-- PLUGIN LIST -->
225
225
 
226
- | Recent Submits | Description |
227
- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
228
- | [Space](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **automateyournetwork** on **2024-05-12**</sup> | Space data including NASA.<br/>`space` `nasa` |
229
- | [Search1API](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **fatwang2** on **2024-05-06**</sup> | Search aggregation service, specifically designed for LLMs<br/>`web` `search` |
230
- | [Search Google via Serper](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **Barry** on **2024-04-30**</sup> | Google search engine via Serper.dev free API (2500x🆓/month)<br/>`web` `search` |
231
- | [NFT Guru](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **swap** on **2024-04-03**</sup> | Discover current prices of NFTs across major platforms and keep track of the rapidly changing marketplace with real-time<br/>`crypto` `nft` |
226
+ | Recent Submits | Description |
227
+ | ------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
228
+ | [Social Search](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **say-apps** on **2024-06-02**</sup> | The Social Search provides access to tweets, users, followers, images, media and more.<br/>`social` `twitter` `x` `search` |
229
+ | [Space](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **automateyournetwork** on **2024-05-12**</sup> | Space data including NASA.<br/>`space` `nasa` |
230
+ | [Search1API](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **fatwang2** on **2024-05-06**</sup> | Search aggregation service, specifically designed for LLMs<br/>`web` `search` |
231
+ | [Search Google via Serper](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **Barry** on **2024-04-30**</sup> | Google search engine via Serper.dev free API (2500x🆓/month)<br/>`web` `search` |
232
232
 
233
- > 📊 Total plugins: [<kbd>**54**</kbd>](https://github.com/lobehub/lobe-chat-plugins)
233
+ > 📊 Total plugins: [<kbd>**55**</kbd>](https://github.com/lobehub/lobe-chat-plugins)
234
234
 
235
235
  <!-- PLUGIN LIST -->
236
236
 
@@ -264,12 +264,12 @@ Our marketplace is not just a showcase platform but also a collaborative space.
264
264
 
265
265
  | Recent Submits | Description |
266
266
  | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
267
+ | [Chinese History Lecturer](https://chat-preview.lobehub.com/market?agent=history-master)<br/><sup>By **[a562314](https://github.com/a562314)** on **2024-05-30**</sup> | Proficient in Chinese history, explaining historical issues in a simple and clear manner, emphasizing historical accuracy, and applying dialectical materialism.<br/>`historian` `teaching-ability` `dialectical-materialism` `simple-and-clear` `multiple-comparisons` `twenty-four-histories` |
267
268
  | [Dart/Flutter Dev](https://chat-preview.lobehub.com/market?agent=dart-flutter)<br/><sup>By **[rezmeplxrf](https://github.com/rezmeplxrf)** on **2024-05-28**</sup> | Dart/Flutter Expert. Never nest more than 3 levels deep. Use riverpod, flutter_riverpod, riverpod_hook, flutter_hook for state management.<br/>`dart` `flutter` `development` `state-management` `riverpod` |
268
269
  | [C# .NET Technology Expert](https://chat-preview.lobehub.com/market?agent=dotnet-expert)<br/><sup>By **[johnnyqian](https://github.com/johnnyqian)** on **2024-05-28**</sup> | C# .NET Technology Expert<br/>`net` `developer` `net-core` `azure` `c` `microsoft` `sql-server` `entity-framework` `ef` `ef-core` |
269
270
  | [Christian Missionary](https://chat-preview.lobehub.com/market?agent=jesus-missionary)<br/><sup>By **[epochaudio](https://github.com/epochaudio)** on **2024-05-28**</sup> | As a missionary of Jesus, I will enlighten your understanding and practical application of God's word based on the teachings of the Bible. Whether in times of confusion or seeking spiritual growth, I am here to serve you by this source of wisdom.<br/>`bible-teaching` `christian-mission` `theology-preaching` |
270
- | [Daily Assistant](https://chat-preview.lobehub.com/market?agent=junior-helper)<br/><sup>By **[Qinks6](https://github.com/Qinks6)** on **2024-05-28**</sup> | A cute little helper that can search and draw<br/>`assistant` `search` `drawing` `information-retrieval` `user-interaction` |
271
271
 
272
- > 📊 Total agents: [<kbd>**280**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
272
+ > 📊 Total agents: [<kbd>**281**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
273
273
 
274
274
  <!-- AGENT LIST -->
275
275
 
package/README.zh-CN.md CHANGED
@@ -215,14 +215,14 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
215
215
 
216
216
  <!-- PLUGIN LIST -->
217
217
 
218
- | 最近新增 | 插件描述 |
219
- | ------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
220
- | [空间](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **automateyournetwork** on **2024-05-12**</sup> | 包括 NASA 的空间数据。<br/>`空间` `nasa` |
221
- | [Search1API](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **fatwang2** on **2024-05-06**</sup> | 搜索聚合服务,专为 LLMs 设计<br/>`web` `search` |
222
- | [通过 Serper 搜索 Google](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **Barry** on **2024-04-30**</sup> | 通过 Serper.dev 免费 API 进行 Google 搜索引擎(每月 2500 次🆓)<br/>`网络` `搜索` |
223
- | [NFT Guru](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **swap** on **2024-04-03**</sup> | 发现主要平台上 NFT 的当前价格,并通过实时跟踪快速变化的市场了解情况<br/>`加密货币` `nft` |
218
+ | 最近新增 | 插件描述 |
219
+ | ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------- |
220
+ | [社交搜索](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **say-apps** on **2024-06-02**</sup> | 社交搜索提供访问推文、用户、关注者、图片、媒体等功能。<br/>`社交` `推特` `x` `搜索` |
221
+ | [空间](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **automateyournetwork** on **2024-05-12**</sup> | 包括 NASA 的空间数据。<br/>`空间` `nasa` |
222
+ | [Search1API](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **fatwang2** on **2024-05-06**</sup> | 搜索聚合服务,专为 LLMs 设计<br/>`web` `search` |
223
+ | [通过 Serper 搜索 Google](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **Barry** on **2024-04-30**</sup> | 通过 Serper.dev 免费 API 进行 Google 搜索引擎(每月 2500 次🆓)<br/>`网络` `搜索` |
224
224
 
225
- > 📊 Total plugins: [<kbd>**54**</kbd>](https://github.com/lobehub/lobe-chat-plugins)
225
+ > 📊 Total plugins: [<kbd>**55**</kbd>](https://github.com/lobehub/lobe-chat-plugins)
226
226
 
227
227
  <!-- PLUGIN LIST -->
228
228
 
@@ -252,12 +252,12 @@ LobeChat 的插件生态系统是其核心功能的重要扩展,它极大地
252
252
 
253
253
  | 最近新增 | 助手说明 |
254
254
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
255
+ | [国学历史讲师](https://chat-preview.lobehub.com/market?agent=history-master)<br/><sup>By **[a562314](https://github.com/a562314)** on **2024-05-30**</sup> | 精通中国历史,深入浅出解释历史问题,注重史实准确性,运用唯物辩证法。<br/>`历史学家` `教学能力` `唯物辩证法` `深入浅出` `多元对比` `二十四史` |
255
256
  | [Dart/Flutter Dev](https://chat-preview.lobehub.com/market?agent=dart-flutter)<br/><sup>By **[rezmeplxrf](https://github.com/rezmeplxrf)** on **2024-05-28**</sup> | Dart/Flutter 전문가. 3단계 이상 중첩하지 않음. 상태 관리에 riverpod, flutter_riverpod, riverpod_hook, flutter_hook 사용.<br/>`dart` `flutter` `개발` `상태-관리` `riverpod` |
256
257
  | [C# .NET 技术专家](https://chat-preview.lobehub.com/market?agent=dotnet-expert)<br/><sup>By **[johnnyqian](https://github.com/johnnyqian)** on **2024-05-28**</sup> | C# .NET 技术专家<br/>`net` `developer` `net-core` `azure` `c` `microsoft` `sql-server` `entity-framework` `ef` `ef-core` |
257
258
  | [基督传教士](https://chat-preview.lobehub.com/market?agent=jesus-missionary)<br/><sup>By **[epochaudio](https://github.com/epochaudio)** on **2024-05-28**</sup> | 作为一名耶稣传教士,我将依据圣经教导以启迪你对神的话语的理解和实际运用。无论是在困惑还是寻求灵性成长的过程中,我都在这智慧的源泉旁为你服务<br/>`圣经教学` `基督传教` `神学布道` |
258
- | [日常小助手](https://chat-preview.lobehub.com/market?agent=junior-helper)<br/><sup>By **[Qinks6](https://github.com/Qinks6)** on **2024-05-28**</sup> | 一个能搜索、能画图的小可爱<br/>`助手` `搜索` `绘图` `信息查询` `用户交互` |
259
259
 
260
- > 📊 Total agents: [<kbd>**280**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
260
+ > 📊 Total agents: [<kbd>**281**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
261
261
 
262
262
  <!-- AGENT LIST -->
263
263
 
@@ -61,8 +61,8 @@ The `DEFAULT_AGENT_CONFIG` is used to configure the default settings for the Lob
61
61
  | Array | `plugins=search-engine,lobe-image-designer` | Enable the `search-engine` and `lobe-image-designer` plugins. |
62
62
  | Chinese Comma | `plugins=search-engine,lobe-image-designer` | Same as above, demonstrating support for Chinese comma separation. |
63
63
  | Multiple Configurations | `model=glm-4;provider=zhipu` | Set the model to `glm-4` and the model provider to `zhipu`. |
64
- | Numeric Value | `params.max_tokens=300` | Set the maximum tokens to `300`. |
65
- | Boolean Value | `enableAutoCreateTopic=true` | Enable automatic topic creation. |
64
+ | Numeric Value | `params.max_tokens=300`, `chatConfig.historyCount=5` | Set the maximum tokens to `300`, Set the number of historical messages to 5. |
65
+ | Boolean Value | `chatConfig.enableAutoCreateTopic=true`, `chatConfig.enableCompressThreshold=true`, `chatConfig.enableHistoryCount=true` | Enable automatic topic creation, History length compression threshold, number of historical records. |
66
66
  | Special Characters | `inputTemplate="Hello; I am a bot;"` | Set the input template to `Hello; I am a bot;`. |
67
67
  | Error Handling | `model=gpt-4;maxToken` | Ignore invalid entry `maxToken` and only parse `model=gpt-4`. |
68
68
  | Value Override | `model=gpt-4;model=gpt-4-1106-preview` | If a key is repeated, use the value that appears last; in this case, the value of `model` is `gpt-4-1106-preview`. |
@@ -57,8 +57,8 @@ LobeChat 在部署时提供了一些额外的配置项,你可以使用环境
57
57
  | 数组 | `plugins=search-engine,lobe-image-designer` | 启用 `search-engine` 和 `lobe-image-designer` 插件。 |
58
58
  | 中文逗号 | `plugins=search-engine,lobe-image-designer` | 同上,演示支持中文逗号分隔。 |
59
59
  | 多个配置项 | `model=glm-4;provider=zhipu` | 设置模型为 `glm-4` 且模型服务商为 `zhipu`。 |
60
- | 数字值 | `params.max_tokens=300` | 设置最大令牌数为 `300`。 |
61
- | 布尔值 | `enableAutoCreateTopic=true` | 启用自动创建主题。 |
60
+ | 数字值 | `params.max_tokens=300`, `chatConfig.historyCount=5` | 设置最大令牌数为 `300`,设置历史消息条数为5。 |
61
+ | 布尔值 | `chatConfig.enableAutoCreateTopic=true`,`chatConfig.enableCompressThreshold=true`, `chatConfig.enableHistoryCount=true` | 启用自动创建主题,历史长度压缩阈值,历史记录条数。 |
62
62
  | 特殊字符 | `inputTemplate="Hello; I am a bot;"` | 设置输入模板为 `Hello; I am a bot;`。 |
63
63
  | 错误处理 | `model=gpt-4;maxToken` | 忽略无效条目 `maxToken`,仅解析出 `model=gpt-4`。 |
64
64
  | 值覆盖 | `model=gpt-4;model=gpt-4-1106-preview` | 如果键重复,使用最后一次出现的值,此处 `model` 的值为 `gpt-4-1106-preview`。 |
package/netlify.toml CHANGED
@@ -2,6 +2,8 @@
2
2
  command = "npm run build"
3
3
  publish = ".next"
4
4
 
5
+ [build.environment]
6
+ NODE_OPTIONS = "--max_old_space_size=8192"
5
7
 
6
8
  [template.environment]
7
9
  OPENAI_API_KEY = "set your OpenAI API Key"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.162.13",
3
+ "version": "0.162.14",
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",
@@ -13,7 +13,7 @@ import { useSendMessage } from '@/features/ChatInput/useSend';
13
13
  import { useAgentStore } from '@/store/agent';
14
14
  import { agentSelectors } from '@/store/agent/slices/chat';
15
15
  import { useChatStore } from '@/store/chat';
16
- import { chatSelectors } from '@/store/chat/selectors';
16
+ import { chatSelectors, topicSelectors } from '@/store/chat/selectors';
17
17
  import { filesSelectors, useFileStore } from '@/store/file';
18
18
  import { useUserStore } from '@/store/user';
19
19
  import { modelProviderSelectors, preferenceSelectors } from '@/store/user/selectors';
@@ -61,10 +61,20 @@ const Footer = memo<FooterProps>(({ setExpand }) => {
61
61
 
62
62
  const { theme, styles } = useStyles();
63
63
 
64
- const [isAIGenerating, stopGenerateMessage] = useChatStore((s) => [
64
+ const [
65
+ isAIGenerating,
66
+ isHasMessageLoading,
67
+ isCreatingMessage,
68
+ isCreatingTopic,
69
+ stopGenerateMessage,
70
+ ] = useChatStore((s) => [
65
71
  chatSelectors.isAIGenerating(s),
72
+ chatSelectors.isHasMessageLoading(s),
73
+ chatSelectors.isCreatingMessage(s),
74
+ topicSelectors.isCreatingTopic(s),
66
75
  s.stopGenerateMessage,
67
76
  ]);
77
+
68
78
  const isImageUploading = useFileStore(filesSelectors.isImageUploading);
69
79
 
70
80
  const model = useAgentStore(agentSelectors.currentAgentModel);
@@ -93,6 +103,9 @@ const Footer = memo<FooterProps>(({ setExpand }) => {
93
103
 
94
104
  const wrapperShortcut = useCmdEnterToSend ? enter : cmdEnter;
95
105
 
106
+ const buttonDisabled =
107
+ isImageUploading || isHasMessageLoading || isCreatingTopic || isCreatingMessage;
108
+
96
109
  return (
97
110
  <Flexbox
98
111
  align={'end'}
@@ -136,7 +149,8 @@ const Footer = memo<FooterProps>(({ setExpand }) => {
136
149
  ) : (
137
150
  <Space.Compact>
138
151
  <Button
139
- disabled={isImageUploading}
152
+ disabled={buttonDisabled}
153
+ loading={buttonDisabled}
140
154
  onClick={() => {
141
155
  sendMessage();
142
156
  setExpand?.(false);
@@ -145,7 +159,7 @@ const Footer = memo<FooterProps>(({ setExpand }) => {
145
159
  >
146
160
  {t('input.send')}
147
161
  </Button>
148
- <SendMore disabled={isImageUploading} />
162
+ <SendMore disabled={buttonDisabled} />
149
163
  </Space.Compact>
150
164
  )}
151
165
  </Flexbox>
@@ -20,13 +20,16 @@ const useStyles = createStyles(({ css, token, isDarkMode }) => ({
20
20
  container: css`
21
21
  cursor: pointer;
22
22
 
23
- width: calc(100% - 16px);
24
23
  margin-block: 2px;
25
24
  margin-inline: 8px;
26
25
  padding: 8px;
27
26
 
28
27
  border-radius: ${token.borderRadius}px;
29
28
 
29
+ &.topic-item {
30
+ width: calc(100% - 16px);
31
+ }
32
+
30
33
  &:hover {
31
34
  background: ${token.colorFillSecondary};
32
35
  }
@@ -52,7 +55,7 @@ const TopicItem = memo<ConfigCellProps>(({ title, active, id, fav }) => {
52
55
  return (
53
56
  <Flexbox
54
57
  align={'center'}
55
- className={cx(styles.container, active && styles.active)}
58
+ className={cx(styles.container, 'topic-item', active && styles.active)}
56
59
  distribution={'space-between'}
57
60
  horizontal
58
61
  onClick={() => {
@@ -232,6 +232,7 @@ export const chatMessage: StateCreator<
232
232
 
233
233
  // if message is empty or no files, then stop
234
234
  if (!message && isNoFile) return;
235
+ set({ isCreatingMessage: true }, false, 'creatingMessage/start');
235
236
 
236
237
  const newMessage: CreateMessageParams = {
237
238
  content: message,
@@ -310,9 +311,10 @@ export const chatMessage: StateCreator<
310
311
 
311
312
  // Get the current messages to generate AI response
312
313
  const messages = chatSelectors.currentChats(get());
313
-
314
314
  await internal_coreProcessMessage(messages, id, { isWelcomeQuestion });
315
315
 
316
+ set({ isCreatingMessage: false }, false, 'creatingMessage/stop');
317
+
316
318
  // if autoCreateTopic is false, then stop
317
319
  if (!agentConfig.enableAutoCreateTopic) return;
318
320
 
@@ -707,7 +709,6 @@ export const chatMessage: StateCreator<
707
709
  internal_createMessage: async (message, context) => {
708
710
  const { internal_createTmpMessage, refreshMessages, internal_toggleMessageLoading } = get();
709
711
  let tempId = context?.tempMessageId;
710
-
711
712
  if (!tempId) {
712
713
  // use optimistic update to avoid the slow waiting
713
714
  tempId = internal_createTmpMessage(message);
@@ -721,7 +722,6 @@ export const chatMessage: StateCreator<
721
722
  }
722
723
 
723
724
  internal_toggleMessageLoading(false, tempId);
724
-
725
725
  return id;
726
726
  },
727
727
 
@@ -12,6 +12,7 @@ export interface ChatMessageState {
12
12
  */
13
13
  chatLoadingIds: string[];
14
14
  inputMessage: string;
15
+ isCreatingMessage: boolean;
15
16
  /**
16
17
  * is the message is editing
17
18
  */
@@ -35,6 +36,7 @@ export const initialMessageState: ChatMessageState = {
35
36
  activeId: 'inbox',
36
37
  chatLoadingIds: [],
37
38
  inputMessage: '',
39
+ isCreatingMessage: false,
38
40
  messageEditingIds: [],
39
41
  messageLoadingIds: [],
40
42
  messagesInit: false,
@@ -125,6 +125,9 @@ const isCurrentChatLoaded = (s: ChatStore) => !!s.messagesMap[currentChatKey(s)]
125
125
 
126
126
  const isMessageEditing = (id: string) => (s: ChatStore) => s.messageEditingIds.includes(id);
127
127
  const isMessageLoading = (id: string) => (s: ChatStore) => s.messageLoadingIds.includes(id);
128
+ const isHasMessageLoading = (s: ChatStore) => s.messageLoadingIds.length > 0;
129
+ const isCreatingMessage = (s: ChatStore) => s.isCreatingMessage;
130
+
128
131
  const isMessageGenerating = (id: string) => (s: ChatStore) => s.chatLoadingIds.includes(id);
129
132
  const isToolCallStreaming = (id: string, index: number) => (s: ChatStore) => {
130
133
  const isLoading = s.toolCallingStreamIds[id];
@@ -146,7 +149,9 @@ export const chatSelectors = {
146
149
  getMessageById,
147
150
  getTraceIdByMessageId,
148
151
  isAIGenerating,
152
+ isCreatingMessage,
149
153
  isCurrentChatLoaded,
154
+ isHasMessageLoading,
150
155
  isMessageEditing,
151
156
  isMessageGenerating,
152
157
  isMessageLoading,
@@ -80,13 +80,14 @@ export const chatTopic: StateCreator<
80
80
  const { activeId, internal_createTopic } = get();
81
81
 
82
82
  const messages = chatSelectors.currentChats(get());
83
+
84
+ set({ creatingTopic: true }, false, n('creatingTopic/start'));
83
85
  const topicId = await internal_createTopic({
84
86
  sessionId: activeId,
85
87
  title: t('topic.defaultTitle', { ns: 'chat' }),
86
88
  messages: messages.map((m) => m.id),
87
89
  });
88
-
89
- // get().internal_updateTopicLoading(topicId, true);
90
+ set({ creatingTopic: false }, false, n('creatingTopic/end'));
90
91
 
91
92
  return topicId;
92
93
  },
@@ -3,6 +3,7 @@ import { ChatTopic } from '@/types/topic';
3
3
  export interface ChatTopicState {
4
4
  // TODO: need to add the null to the type
5
5
  activeTopicId?: string;
6
+ creatingTopic: boolean;
6
7
  isSearchingTopic: boolean;
7
8
  searchTopics: ChatTopic[];
8
9
  topicLoadingIds: string[];
@@ -17,6 +18,7 @@ export interface ChatTopicState {
17
18
 
18
19
  export const initialTopicState: ChatTopicState = {
19
20
  activeTopicId: null as any,
21
+ creatingTopic: false,
20
22
  isSearchingTopic: false,
21
23
  searchTopics: [],
22
24
  topicLoadingIds: [],
@@ -21,6 +21,7 @@ const getTopicById =
21
21
  (id: string) =>
22
22
  (s: ChatStore): ChatTopic | undefined =>
23
23
  currentTopics(s)?.find((topic) => topic.id === id);
24
+ const isCreatingTopic = (s: ChatStore) => s.creatingTopic;
24
25
 
25
26
  export const topicSelectors = {
26
27
  currentActiveTopic,
@@ -29,5 +30,6 @@ export const topicSelectors = {
29
30
  currentUnFavTopics,
30
31
  displayTopics,
31
32
  getTopicById,
33
+ isCreatingTopic,
32
34
  searchTopics,
33
35
  };