@lobehub/lobehub 2.0.0-next.272 → 2.0.0-next.274

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.
Files changed (296) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/changelog/v1.json +18 -0
  3. package/locales/ar/chat.json +7 -0
  4. package/locales/ar/common.json +1 -1
  5. package/locales/ar/discover.json +2 -2
  6. package/locales/ar/models.json +40 -12
  7. package/locales/ar/onboarding.json +1 -1
  8. package/locales/ar/plugin.json +22 -1
  9. package/locales/ar/providers.json +0 -1
  10. package/locales/bg-BG/chat.json +7 -0
  11. package/locales/bg-BG/common.json +2 -0
  12. package/locales/bg-BG/discover.json +2 -2
  13. package/locales/bg-BG/models.json +48 -13
  14. package/locales/bg-BG/onboarding.json +1 -1
  15. package/locales/bg-BG/plugin.json +22 -1
  16. package/locales/bg-BG/providers.json +0 -1
  17. package/locales/de-DE/chat.json +7 -0
  18. package/locales/de-DE/common.json +2 -0
  19. package/locales/de-DE/discover.json +2 -2
  20. package/locales/de-DE/models.json +37 -13
  21. package/locales/de-DE/onboarding.json +3 -0
  22. package/locales/de-DE/plugin.json +22 -1
  23. package/locales/de-DE/providers.json +0 -1
  24. package/locales/en-US/chat.json +7 -0
  25. package/locales/en-US/discover.json +2 -2
  26. package/locales/en-US/models.json +15 -15
  27. package/locales/en-US/plugin.json +22 -1
  28. package/locales/en-US/providers.json +0 -1
  29. package/locales/es-ES/chat.json +7 -0
  30. package/locales/es-ES/common.json +2 -0
  31. package/locales/es-ES/discover.json +2 -2
  32. package/locales/es-ES/models.json +32 -14
  33. package/locales/es-ES/onboarding.json +3 -0
  34. package/locales/es-ES/plugin.json +22 -1
  35. package/locales/es-ES/providers.json +0 -1
  36. package/locales/fa-IR/chat.json +7 -0
  37. package/locales/fa-IR/common.json +2 -0
  38. package/locales/fa-IR/discover.json +2 -2
  39. package/locales/fa-IR/models.json +36 -14
  40. package/locales/fa-IR/onboarding.json +3 -0
  41. package/locales/fa-IR/plugin.json +22 -1
  42. package/locales/fa-IR/providers.json +0 -1
  43. package/locales/fr-FR/chat.json +7 -0
  44. package/locales/fr-FR/common.json +2 -0
  45. package/locales/fr-FR/discover.json +2 -2
  46. package/locales/fr-FR/models.json +95 -13
  47. package/locales/fr-FR/onboarding.json +3 -0
  48. package/locales/fr-FR/plugin.json +22 -1
  49. package/locales/fr-FR/providers.json +0 -1
  50. package/locales/it-IT/chat.json +7 -0
  51. package/locales/it-IT/common.json +2 -0
  52. package/locales/it-IT/discover.json +2 -2
  53. package/locales/it-IT/models.json +8 -13
  54. package/locales/it-IT/onboarding.json +3 -0
  55. package/locales/it-IT/plugin.json +22 -1
  56. package/locales/it-IT/providers.json +0 -1
  57. package/locales/ja-JP/chat.json +7 -0
  58. package/locales/ja-JP/common.json +2 -0
  59. package/locales/ja-JP/discover.json +2 -2
  60. package/locales/ja-JP/models.json +76 -8
  61. package/locales/ja-JP/onboarding.json +3 -0
  62. package/locales/ja-JP/plugin.json +22 -1
  63. package/locales/ja-JP/providers.json +0 -1
  64. package/locales/ko-KR/chat.json +7 -0
  65. package/locales/ko-KR/common.json +2 -0
  66. package/locales/ko-KR/discover.json +2 -2
  67. package/locales/ko-KR/models.json +8 -15
  68. package/locales/ko-KR/onboarding.json +3 -0
  69. package/locales/ko-KR/plugin.json +22 -1
  70. package/locales/ko-KR/providers.json +0 -1
  71. package/locales/nl-NL/chat.json +7 -0
  72. package/locales/nl-NL/common.json +2 -0
  73. package/locales/nl-NL/discover.json +2 -2
  74. package/locales/nl-NL/models.json +98 -9
  75. package/locales/nl-NL/onboarding.json +3 -0
  76. package/locales/nl-NL/plugin.json +22 -1
  77. package/locales/nl-NL/providers.json +0 -1
  78. package/locales/pl-PL/chat.json +7 -0
  79. package/locales/pl-PL/common.json +2 -0
  80. package/locales/pl-PL/discover.json +2 -2
  81. package/locales/pl-PL/models.json +38 -13
  82. package/locales/pl-PL/onboarding.json +3 -0
  83. package/locales/pl-PL/plugin.json +22 -1
  84. package/locales/pl-PL/providers.json +0 -1
  85. package/locales/pt-BR/chat.json +7 -0
  86. package/locales/pt-BR/common.json +2 -0
  87. package/locales/pt-BR/discover.json +2 -2
  88. package/locales/pt-BR/models.json +50 -13
  89. package/locales/pt-BR/onboarding.json +3 -0
  90. package/locales/pt-BR/plugin.json +22 -1
  91. package/locales/pt-BR/providers.json +0 -1
  92. package/locales/ru-RU/chat.json +7 -0
  93. package/locales/ru-RU/common.json +2 -0
  94. package/locales/ru-RU/discover.json +2 -2
  95. package/locales/ru-RU/models.json +54 -13
  96. package/locales/ru-RU/onboarding.json +3 -0
  97. package/locales/ru-RU/plugin.json +22 -1
  98. package/locales/ru-RU/providers.json +0 -1
  99. package/locales/tr-TR/chat.json +7 -0
  100. package/locales/tr-TR/common.json +2 -0
  101. package/locales/tr-TR/discover.json +2 -2
  102. package/locales/tr-TR/models.json +40 -13
  103. package/locales/tr-TR/onboarding.json +3 -0
  104. package/locales/tr-TR/plugin.json +22 -1
  105. package/locales/tr-TR/providers.json +0 -1
  106. package/locales/vi-VN/chat.json +7 -0
  107. package/locales/vi-VN/common.json +2 -0
  108. package/locales/vi-VN/discover.json +2 -2
  109. package/locales/vi-VN/models.json +8 -8
  110. package/locales/vi-VN/onboarding.json +3 -0
  111. package/locales/vi-VN/plugin.json +22 -1
  112. package/locales/vi-VN/providers.json +0 -1
  113. package/locales/zh-CN/chat.json +7 -0
  114. package/locales/zh-CN/discover.json +2 -2
  115. package/locales/zh-CN/models.json +95 -13
  116. package/locales/zh-CN/onboarding.json +3 -0
  117. package/locales/zh-CN/plugin.json +22 -1
  118. package/locales/zh-CN/providers.json +0 -1
  119. package/locales/zh-TW/chat.json +7 -0
  120. package/locales/zh-TW/common.json +2 -0
  121. package/locales/zh-TW/discover.json +2 -2
  122. package/locales/zh-TW/models.json +86 -13
  123. package/locales/zh-TW/onboarding.json +3 -0
  124. package/locales/zh-TW/plugin.json +22 -1
  125. package/locales/zh-TW/providers.json +0 -1
  126. package/package.json +1 -1
  127. package/packages/builtin-tool-agent-builder/package.json +1 -0
  128. package/packages/builtin-tool-agent-builder/src/client/Inspector/GetAvailableModels/index.tsx +66 -0
  129. package/packages/builtin-tool-agent-builder/src/client/Inspector/InstallPlugin/index.tsx +63 -0
  130. package/packages/builtin-tool-agent-builder/src/client/Inspector/SearchMarketTools/index.tsx +64 -0
  131. package/packages/builtin-tool-agent-builder/src/client/Inspector/UpdateConfig/index.tsx +94 -0
  132. package/packages/builtin-tool-agent-builder/src/client/Inspector/UpdatePrompt/index.tsx +96 -0
  133. package/packages/builtin-tool-agent-builder/src/client/Inspector/index.ts +29 -0
  134. package/packages/builtin-tool-agent-builder/src/client/index.ts +13 -0
  135. package/packages/builtin-tool-agent-builder/src/executor.ts +132 -0
  136. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/ExecuteCode/index.tsx +5 -14
  137. package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/RunCommand/index.tsx +5 -13
  138. package/packages/builtin-tool-group-agent-builder/package.json +7 -1
  139. package/packages/builtin-tool-group-agent-builder/src/ExecutionRuntime/index.ts +331 -87
  140. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/BatchCreateAgents/index.tsx +110 -0
  141. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/CreateAgent/index.tsx +72 -0
  142. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/InviteAgent/index.tsx +57 -0
  143. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/RemoveAgent/index.tsx +57 -0
  144. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/SearchAgent/index.tsx +66 -0
  145. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateAgentPrompt/index.tsx +120 -0
  146. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateGroup/index.tsx +87 -0
  147. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateGroupPrompt/index.tsx +99 -0
  148. package/packages/builtin-tool-group-agent-builder/src/client/Inspector/index.ts +52 -0
  149. package/packages/builtin-tool-group-agent-builder/src/client/Render/BatchCreateAgents.tsx +103 -0
  150. package/packages/builtin-tool-group-agent-builder/src/client/Render/UpdateAgentPrompt/index.tsx +36 -0
  151. package/packages/builtin-tool-group-agent-builder/src/client/Render/UpdateGroupPrompt/index.tsx +36 -0
  152. package/packages/builtin-tool-group-agent-builder/src/client/Render/index.ts +16 -0
  153. package/packages/builtin-tool-group-agent-builder/src/client/Streaming/BatchCreateAgents/index.tsx +88 -0
  154. package/packages/builtin-tool-group-agent-builder/src/client/Streaming/UpdateAgentPrompt/index.tsx +37 -0
  155. package/packages/builtin-tool-group-agent-builder/src/client/Streaming/UpdateGroupPrompt/index.tsx +35 -0
  156. package/packages/builtin-tool-group-agent-builder/src/client/Streaming/index.ts +22 -0
  157. package/packages/builtin-tool-group-agent-builder/src/client/index.ts +26 -0
  158. package/packages/builtin-tool-group-agent-builder/src/executor.ts +284 -0
  159. package/packages/builtin-tool-group-agent-builder/src/index.ts +1 -14
  160. package/packages/builtin-tool-group-agent-builder/src/manifest.ts +160 -15
  161. package/packages/builtin-tool-group-agent-builder/src/systemRole.ts +232 -46
  162. package/packages/builtin-tool-group-agent-builder/src/types.ts +191 -41
  163. package/packages/builtin-tool-group-management/src/client/Inspector/Broadcast/index.tsx +2 -2
  164. package/packages/builtin-tool-group-management/src/manifest.ts +1 -1
  165. package/packages/builtin-tool-gtd/src/client/Inspector/ClearTodos/index.tsx +5 -11
  166. package/packages/builtin-tool-gtd/src/client/Inspector/CompleteTodos/index.tsx +3 -9
  167. package/packages/builtin-tool-gtd/src/client/Inspector/CreatePlan/index.tsx +6 -15
  168. package/packages/builtin-tool-gtd/src/client/Inspector/CreateTodos/index.tsx +3 -9
  169. package/packages/builtin-tool-gtd/src/client/Inspector/ExecTask/index.tsx +6 -17
  170. package/packages/builtin-tool-gtd/src/client/Inspector/RemoveTodos/index.tsx +3 -9
  171. package/packages/builtin-tool-gtd/src/client/Inspector/UpdatePlan/index.tsx +3 -9
  172. package/packages/builtin-tool-gtd/src/client/Inspector/UpdateTodos/index.tsx +3 -9
  173. package/packages/builtin-tool-knowledge-base/src/client/Inspector/ReadKnowledge/index.tsx +4 -16
  174. package/packages/builtin-tool-knowledge-base/src/client/Inspector/SearchKnowledgeBase/index.tsx +5 -16
  175. package/packages/builtin-tool-local-system/src/client/Inspector/EditLocalFile/index.tsx +4 -12
  176. package/packages/builtin-tool-local-system/src/client/Inspector/GlobLocalFiles/index.tsx +5 -13
  177. package/packages/builtin-tool-local-system/src/client/Inspector/GrepContent/index.tsx +5 -16
  178. package/packages/builtin-tool-local-system/src/client/Inspector/ListLocalFiles/index.tsx +5 -16
  179. package/packages/builtin-tool-local-system/src/client/Inspector/ReadLocalFile/index.tsx +5 -16
  180. package/packages/builtin-tool-local-system/src/client/Inspector/RenameLocalFile/index.tsx +5 -11
  181. package/packages/builtin-tool-local-system/src/client/Inspector/RunCommand/index.tsx +5 -13
  182. package/packages/builtin-tool-local-system/src/client/Inspector/SearchLocalFiles/index.tsx +5 -16
  183. package/packages/builtin-tool-local-system/src/client/Inspector/WriteLocalFile/index.tsx +6 -15
  184. package/packages/builtin-tool-notebook/src/client/Inspector/CreateDocument/index.tsx +7 -15
  185. package/packages/builtin-tool-page-agent/src/client/Inspector/EditTitle/index.tsx +5 -14
  186. package/packages/builtin-tool-page-agent/src/client/Inspector/GetPageContent/index.tsx +7 -8
  187. package/packages/builtin-tool-page-agent/src/client/Inspector/InitPage/index.tsx +4 -10
  188. package/packages/builtin-tool-page-agent/src/client/Inspector/ModifyNodes/index.tsx +3 -9
  189. package/packages/builtin-tool-page-agent/src/client/Inspector/ReplaceText/index.tsx +5 -11
  190. package/packages/builtin-tool-web-browsing/src/client/Inspector/CrawlMultiPages/index.tsx +6 -15
  191. package/packages/builtin-tool-web-browsing/src/client/Inspector/CrawlSinglePage/index.tsx +6 -15
  192. package/packages/builtin-tool-web-browsing/src/client/Inspector/Search/index.tsx +4 -15
  193. package/packages/database/src/models/chatGroup.ts +1 -1
  194. package/packages/model-bank/src/aiModels/aihubmix.ts +2 -1
  195. package/packages/model-bank/src/aiModels/google.ts +2 -1
  196. package/packages/model-bank/src/aiModels/infiniai.ts +9 -6
  197. package/packages/model-bank/src/aiModels/minimax.ts +9 -5
  198. package/packages/model-bank/src/aiModels/ollamacloud.ts +4 -2
  199. package/packages/model-bank/src/aiModels/vertexai.ts +2 -1
  200. package/packages/types/src/agentGroup/index.ts +8 -0
  201. package/patches/@upstash__qstash.patch +13 -1
  202. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Header/Nav.tsx +1 -1
  203. package/src/app/[variants]/(main)/agent/cron/[cronId]/index.tsx +4 -3
  204. package/src/app/[variants]/(main)/agent/profile/features/ProfileEditor/index.tsx +1 -1
  205. package/src/app/[variants]/(main)/agent/profile/features/store/action.ts +18 -21
  206. package/src/app/[variants]/(main)/group/_layout/GroupIdSync.tsx +6 -1
  207. package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/AgentProfilePopup.tsx +29 -21
  208. package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/GroupMember.tsx +1 -0
  209. package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/GroupMemberItem.tsx +35 -18
  210. package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/AddTopicButon.tsx +2 -10
  211. package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/Nav.tsx +10 -2
  212. package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/index.tsx +1 -2
  213. package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/AgentBuilderProvider.tsx +1 -0
  214. package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/TopicSelector.tsx +15 -9
  215. package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/index.tsx +12 -6
  216. package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor/AgentHeader.tsx → GroupProfile/GroupHeader.tsx} +22 -29
  217. package/src/app/[variants]/(main)/group/profile/features/GroupProfile/index.tsx +96 -0
  218. package/src/app/[variants]/(main)/group/profile/features/Header/AgentBuilderToggle.tsx +3 -4
  219. package/src/app/[variants]/(main)/group/profile/features/Header/AutoSaveHint.tsx +11 -7
  220. package/src/app/[variants]/(main)/group/profile/features/Header/ChromeTabs/index.tsx +147 -0
  221. package/src/app/[variants]/(main)/group/profile/features/Header/index.tsx +104 -13
  222. package/src/app/[variants]/(main)/group/profile/features/MemberProfile/AgentHeader.tsx +222 -0
  223. package/src/app/[variants]/(main)/group/profile/features/MemberProfile/index.tsx +155 -0
  224. package/src/app/[variants]/(main)/group/profile/features/ProfileHydration.tsx +63 -5
  225. package/src/app/[variants]/(main)/group/profile/index.tsx +34 -37
  226. package/src/app/[variants]/(mobile)/(home)/_layout/SessionHydration.tsx +1 -1
  227. package/src/app/[variants]/(mobile)/(home)/features/SessionListContent/List/Item/index.tsx +1 -1
  228. package/src/features/AgentBuilder/index.tsx +16 -1
  229. package/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/StatusIndicator.tsx +3 -2
  230. package/src/features/EditorCanvas/EditorCanvas.test.tsx +206 -0
  231. package/src/features/EditorCanvas/EditorDataMode.tsx +53 -19
  232. package/src/features/EditorModal/index.tsx +2 -2
  233. package/src/features/NavPanel/components/SessionHydration.tsx +1 -1
  234. package/src/features/ShareModal/ShareImage/ChatList/index.tsx +1 -1
  235. package/src/features/ShareModal/SharePdf/index.tsx +1 -1
  236. package/src/hooks/useBidirectionalQuerySync.ts +112 -0
  237. package/src/locales/default/chat.ts +10 -0
  238. package/src/locales/default/plugin.ts +22 -1
  239. package/src/server/modules/AgentRuntime/RuntimeExecutors.ts +45 -45
  240. package/src/server/modules/KeyVaultsEncrypt/index.ts +6 -6
  241. package/src/server/modules/S3/index.ts +1 -1
  242. package/src/server/routers/lambda/agent.ts +24 -0
  243. package/src/server/routers/lambda/agentGroup.ts +39 -0
  244. package/src/services/agent.ts +22 -0
  245. package/src/services/chatGroup/index.ts +14 -0
  246. package/src/store/agent/selectors/selectors.ts +3 -0
  247. package/src/store/agentGroup/initialState.ts +6 -0
  248. package/src/store/agentGroup/selectors/byId.ts +3 -1
  249. package/src/store/agentGroup/selectors/current.ts +2 -2
  250. package/src/store/agentGroup/slices/lifecycle.ts +18 -0
  251. package/src/store/chat/agents/__tests__/createAgentExecutors/fixtures/mockStore.ts +1 -1
  252. package/src/store/chat/slices/aiAgent/actions/__tests__/agentGroup.test.ts +4 -1
  253. package/src/store/chat/slices/aiAgent/actions/agentGroup.ts +1 -1
  254. package/src/store/chat/slices/aiChat/actions/__tests__/conversationLifecycle.test.ts +65 -0
  255. package/src/store/chat/slices/aiChat/actions/conversationLifecycle.ts +2 -1
  256. package/src/store/chat/slices/builtinTool/actions/__tests__/search.test.ts +1 -1
  257. package/src/store/chat/slices/builtinTool/actions/index.ts +1 -6
  258. package/src/store/chat/slices/message/action.test.ts +5 -5
  259. package/src/store/chat/slices/message/actions/publicApi.ts +5 -5
  260. package/src/store/chat/slices/message/initialState.ts +0 -5
  261. package/src/store/chat/slices/message/selectors/displayMessage.test.ts +4 -4
  262. package/src/store/chat/slices/plugin/action.test.ts +54 -19
  263. package/src/store/chat/slices/plugin/actions/pluginTypes.ts +15 -21
  264. package/src/store/chat/slices/topic/action.test.ts +74 -24
  265. package/src/store/chat/slices/topic/action.ts +21 -13
  266. package/src/store/chat/slices/topic/selectors.test.ts +1 -1
  267. package/src/store/global/initialState.ts +10 -0
  268. package/src/store/global/selectors/systemStatus.ts +5 -0
  269. package/src/store/groupProfile/action.ts +168 -0
  270. package/src/store/groupProfile/index.ts +16 -0
  271. package/src/{app/[variants]/(main)/group/profile/features/store → store/groupProfile}/initialState.ts +17 -0
  272. package/src/store/groupProfile/selectors.ts +13 -0
  273. package/src/store/tool/slices/builtin/executors/index.ts +4 -0
  274. package/src/styles/text.ts +16 -0
  275. package/src/tools/inspectors.ts +13 -0
  276. package/src/tools/renders.ts +3 -0
  277. package/src/tools/streamings.ts +8 -0
  278. package/src/app/[variants]/(main)/group/profile/features/EditorCanvas/TypoBar.tsx +0 -129
  279. package/src/app/[variants]/(main)/group/profile/features/EditorCanvas/index.tsx +0 -138
  280. package/src/app/[variants]/(main)/group/profile/features/EditorCanvas/useSlashItems.tsx +0 -139
  281. package/src/app/[variants]/(main)/group/profile/features/ProfileEditor/index.tsx +0 -82
  282. package/src/app/[variants]/(main)/group/profile/features/ProfileProvider.tsx +0 -20
  283. package/src/app/[variants]/(main)/group/profile/features/StoreUpdater.tsx +0 -24
  284. package/src/app/[variants]/(main)/group/profile/features/store/action.ts +0 -163
  285. package/src/app/[variants]/(main)/group/profile/features/store/index.ts +0 -23
  286. package/src/app/[variants]/(main)/group/profile/features/store/selectors.ts +0 -7
  287. package/src/features/EditorModal/EditorCanvas.tsx +0 -84
  288. package/src/features/EditorModal/Typobar.tsx +0 -139
  289. package/src/store/chat/slices/builtinTool/actions/agentBuilder.ts +0 -192
  290. package/src/store/chat/slices/builtinTool/actions/groupAgentBuilder.ts +0 -242
  291. package/src/tools/executionRuntimes.ts +0 -14
  292. /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/AgentTool.tsx +0 -0
  293. /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/MentionDropdown.tsx +0 -0
  294. /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/index.tsx +0 -0
  295. /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/types.ts +0 -0
  296. /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/useMentionItems.tsx +0 -0
@@ -1,15 +1,73 @@
1
- import { memo } from 'react';
1
+ 'use client';
2
2
 
3
- import { useRegisterFilesHotkeys, useSaveDocumentHotkey } from '@/hooks/useHotkeys';
3
+ import { useEditor, useEditorState } from '@lobehub/editor/react';
4
+ import { useUnmount } from 'ahooks';
5
+ import { memo, useEffect, useRef } from 'react';
6
+ import { createStoreUpdater } from 'zustand-utils';
4
7
 
5
- import { useProfileStore } from './store';
8
+ import { useRegisterFilesHotkeys, useSaveDocumentHotkey } from '@/hooks/useHotkeys';
9
+ import { parseAsString, useQueryState } from '@/hooks/useQueryParam';
10
+ import { useChatStore } from '@/store/chat';
11
+ import { useGroupProfileStore } from '@/store/groupProfile';
6
12
 
7
13
  const ProfileHydration = memo(() => {
8
- // Initialize agent builder builtin agent
9
- const flushSave = useProfileStore((s) => s.flushSave);
14
+ const editor = useEditor();
15
+ const editorState = useEditorState(editor);
16
+ const flushSave = useGroupProfileStore((s) => s.flushSave);
17
+
18
+ const storeUpdater = createStoreUpdater(useGroupProfileStore);
19
+
20
+ // Sync editor to store
21
+ storeUpdater('editor', editor);
22
+ // Sync editorState to store
23
+ storeUpdater('editorState', editorState);
24
+ // Sync tab query param to store
25
+ const [activeTabId] = useQueryState('tab', parseAsString.withDefault('group'));
26
+ storeUpdater('activeTabId', activeTabId);
27
+
28
+ // Bidirectional sync between URL query 'bt' and chatStore.activeTopicId
29
+ const [builderTopicId, setBuilderTopicId] = useQueryState('bt');
30
+ const activeTopicId = useChatStore((s) => s.activeTopicId);
31
+
32
+ // Track if the change came from URL to prevent sync loops
33
+ const isUrlChangeRef = useRef(false);
34
+
35
+ // Sync URL → Store (when URL changes)
36
+ useEffect(() => {
37
+ const urlTopicId = builderTopicId ?? undefined;
38
+ if (urlTopicId !== activeTopicId) {
39
+ isUrlChangeRef.current = true;
40
+ useChatStore.setState({ activeTopicId: urlTopicId });
41
+ }
42
+ }, [builderTopicId]);
43
+
44
+ // Sync Store → URL (when store changes, but not from URL)
45
+ useEffect(() => {
46
+ if (isUrlChangeRef.current) {
47
+ isUrlChangeRef.current = false;
48
+ return;
49
+ }
50
+ const urlTopicId = builderTopicId ?? undefined;
51
+ if (activeTopicId !== urlTopicId) {
52
+ setBuilderTopicId(activeTopicId ?? null);
53
+ }
54
+ }, [activeTopicId]);
55
+
56
+ // Register hotkeys
10
57
  useRegisterFilesHotkeys();
11
58
  useSaveDocumentHotkey(flushSave);
12
59
 
60
+ // Clear state when unmounting
61
+ useUnmount(() => {
62
+ useGroupProfileStore.setState({
63
+ activeTabId: 'group',
64
+ editor: undefined,
65
+ editorState: undefined,
66
+ saveStateMap: {},
67
+ });
68
+ useChatStore.setState({ activeTopicId: undefined });
69
+ });
70
+
13
71
  return null;
14
72
  });
15
73
 
@@ -7,58 +7,55 @@ import Loading from '@/components/Loading/BrandTextLoading';
7
7
  import WideScreenContainer from '@/features/WideScreenContainer';
8
8
  import { useAgentGroupStore } from '@/store/agentGroup';
9
9
  import { agentGroupSelectors } from '@/store/agentGroup/selectors';
10
+ import { useGroupProfileStore } from '@/store/groupProfile';
10
11
 
11
12
  import AgentBuilder from './features/AgentBuilder';
13
+ import GroupProfileSettings from './features/GroupProfile';
12
14
  import Header from './features/Header';
13
- import ProfileEditor from './features/ProfileEditor';
15
+ import MemberProfile from './features/MemberProfile';
14
16
  import ProfileHydration from './features/ProfileHydration';
15
- import ProfileProvider from './features/ProfileProvider';
16
- import { useProfileStore } from './features/store';
17
17
 
18
18
  const ProfileArea = memo(() => {
19
- const editor = useProfileStore((s) => s.editor);
19
+ const editor = useGroupProfileStore((s) => s.editor);
20
+ const activeTabId = useGroupProfileStore((s) => s.activeTabId);
20
21
  const isGroupsLoading = useAgentGroupStore(agentGroupSelectors.isGroupsInit);
21
22
 
23
+ const isGroupTab = activeTabId === 'group';
24
+
22
25
  return (
23
- <>
24
- <Flexbox flex={1} height={'100%'}>
25
- {isGroupsLoading ? (
26
- <Loading debugId="ProfileArea" />
27
- ) : (
28
- <>
29
- <Header />
30
- <Flexbox
31
- height={'100%'}
32
- horizontal
33
- onClick={() => {
34
- editor?.focus();
35
- }}
36
- style={{ cursor: 'text', display: 'flex', overflowY: 'auto', position: 'relative' }}
37
- width={'100%'}
38
- >
39
- <WideScreenContainer>
40
- <ProfileEditor />
41
- </WideScreenContainer>
42
- </Flexbox>
43
- </>
44
- )}
45
- </Flexbox>
46
- <Suspense fallback={null}>
47
- <ProfileHydration />
48
- </Suspense>
49
- </>
26
+ <Flexbox flex={1} height={'100%'} style={{ minWidth: 0, overflow: 'hidden' }}>
27
+ {isGroupsLoading ? (
28
+ <Loading debugId="ProfileArea" />
29
+ ) : (
30
+ <>
31
+ <Header />
32
+ <Flexbox
33
+ height={'100%'}
34
+ horizontal
35
+ onClick={() => {
36
+ editor?.focus();
37
+ }}
38
+ style={{ cursor: 'text', display: 'flex', overflowY: 'auto', position: 'relative' }}
39
+ width={'100%'}
40
+ >
41
+ <WideScreenContainer>
42
+ {isGroupTab ? <GroupProfileSettings /> : <MemberProfile />}
43
+ </WideScreenContainer>
44
+ </Flexbox>
45
+ </>
46
+ )}
47
+ </Flexbox>
50
48
  );
51
49
  });
52
50
 
53
51
  const GroupProfile: FC = () => {
54
52
  return (
55
53
  <Suspense fallback={<Loading debugId="GroupProfile" />}>
56
- <ProfileProvider>
57
- <Flexbox height={'100%'} horizontal width={'100%'}>
58
- <ProfileArea />
59
- <AgentBuilder />
60
- </Flexbox>
61
- </ProfileProvider>
54
+ <ProfileHydration />
55
+ <Flexbox height={'100%'} horizontal width={'100%'}>
56
+ <ProfileArea />
57
+ <AgentBuilder />
58
+ </Flexbox>
62
59
  </Suspense>
63
60
  );
64
61
  };
@@ -22,7 +22,7 @@ const SessionHydration = memo(() => {
22
22
  });
23
23
 
24
24
  useStoreUpdater('activeId', session);
25
- useChatStoreUpdater('activeId', session);
25
+ useChatStoreUpdater('activeAgentId', session);
26
26
 
27
27
  useEffect(() => {
28
28
  const unsubscribe = useSessionStore.subscribe(
@@ -32,7 +32,7 @@ const SessionItem = memo<SessionItemProps>(({ id }) => {
32
32
 
33
33
  const [active] = useSessionStore((s) => [s.activeId === id]);
34
34
  const [loading] = useChatStore((s) => [
35
- operationSelectors.isAgentRuntimeRunning(s) && id === s.activeId,
35
+ operationSelectors.isAgentRuntimeRunning(s) && id === s.activeAgentId,
36
36
  ]);
37
37
 
38
38
  const [pin, title, avatar, avatarBackground, updateAt, members, model, group, sessionType] =
@@ -5,6 +5,8 @@ import Loading from '@/components/Loading/BrandTextLoading';
5
5
  import RightPanel from '@/features/RightPanel';
6
6
  import { useAgentStore } from '@/store/agent';
7
7
  import { builtinAgentSelectors } from '@/store/agent/selectors';
8
+ import { useGlobalStore } from '@/store/global';
9
+ import { systemStatusSelectors } from '@/store/global/selectors';
8
10
 
9
11
  import AgentBuilderConversation from './AgentBuilderConversation';
10
12
  import AgentBuilderProvider from './AgentBuilderProvider';
@@ -13,11 +15,24 @@ const AgentBuilder = memo(() => {
13
15
  const agentId = useAgentStore((s) => s.activeAgentId);
14
16
  const agentBuilderId = useAgentStore(builtinAgentSelectors.agentBuilderId);
15
17
 
18
+ const [width, updateSystemStatus] = useGlobalStore((s) => [
19
+ systemStatusSelectors.agentBuilderPanelWidth(s),
20
+ s.updateSystemStatus,
21
+ ]);
22
+
16
23
  const useInitBuiltinAgent = useAgentStore((s) => s.useInitBuiltinAgent);
17
24
  useInitBuiltinAgent(BUILTIN_AGENT_SLUGS.agentBuilder);
18
25
 
19
26
  return (
20
- <RightPanel>
27
+ <RightPanel
28
+ defaultWidth={width}
29
+ onSizeChange={(size) => {
30
+ if (size?.width) {
31
+ const w = typeof size.width === 'string' ? Number.parseInt(size.width) : size.width;
32
+ if (!!w) updateSystemStatus({ agentBuilderPanelWidth: w });
33
+ }
34
+ }}
35
+ >
21
36
  {agentId && agentBuilderId ? (
22
37
  <AgentBuilderProvider agentId={agentBuilderId}>
23
38
  <AgentBuilderConversation agentId={agentBuilderId} />
@@ -1,10 +1,11 @@
1
1
  import { type ToolIntervention } from '@lobechat/types';
2
2
  import { Block, Icon, Tooltip } from '@lobehub/ui';
3
3
  import { cssVar } from 'antd-style';
4
- import { Ban, Check, HandIcon, Loader2Icon, PauseIcon, X } from 'lucide-react';
4
+ import { Ban, Check, HandIcon, PauseIcon, X } from 'lucide-react';
5
5
  import { memo } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
 
8
+ import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';
8
9
  import { LOADING_FLAT } from '@/const/message';
9
10
 
10
11
  interface StatusIndicatorProps {
@@ -43,7 +44,7 @@ const StatusIndicator = memo<StatusIndicatorProps>(({ intervention, result }) =>
43
44
  } else if (hasResult) {
44
45
  icon = <Icon color={cssVar.colorSuccess} icon={Check} />;
45
46
  } else {
46
- icon = <Icon color={cssVar.colorTextDescription} icon={Loader2Icon} spin />;
47
+ icon = <NeuralNetworkLoading size={16} />;
47
48
  }
48
49
 
49
50
  return (
@@ -0,0 +1,206 @@
1
+ /**
2
+ * @vitest-environment happy-dom
3
+ */
4
+ import { type IEditor } from '@lobehub/editor';
5
+ import { cleanup, render, screen } from '@testing-library/react';
6
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
7
+
8
+ import { EditorCanvas } from './EditorCanvas';
9
+
10
+ // Mock DocumentIdMode
11
+ vi.mock('./DocumentIdMode', () => ({
12
+ default: vi.fn(({ documentId }) => (
13
+ <div data-testid="document-id-mode">DocumentIdMode: {documentId}</div>
14
+ )),
15
+ }));
16
+
17
+ // Mock EditorDataMode
18
+ vi.mock('./EditorDataMode', () => ({
19
+ default: vi.fn(({ editorData }) => (
20
+ <div data-testid="editor-data-mode">EditorDataMode: {editorData?.content}</div>
21
+ )),
22
+ }));
23
+
24
+ // Mock InternalEditor
25
+ vi.mock('./InternalEditor', () => ({
26
+ default: vi.fn(() => <div data-testid="internal-editor">InternalEditor</div>),
27
+ }));
28
+
29
+ // Mock ErrorBoundary to pass through children
30
+ vi.mock('./ErrorBoundary', () => ({
31
+ EditorErrorBoundary: vi.fn(({ children }) => <>{children}</>),
32
+ }));
33
+
34
+ describe('EditorCanvas', () => {
35
+ let mockEditor: IEditor;
36
+
37
+ beforeEach(() => {
38
+ mockEditor = {
39
+ getDocument: vi.fn(),
40
+ setDocument: vi.fn(),
41
+ focus: vi.fn(),
42
+ } as unknown as IEditor;
43
+ });
44
+
45
+ afterEach(() => {
46
+ cleanup();
47
+ vi.clearAllMocks();
48
+ });
49
+
50
+ describe('mode selection', () => {
51
+ it('should render DocumentIdMode when documentId is provided', () => {
52
+ render(<EditorCanvas documentId="doc-123" editor={mockEditor} />);
53
+
54
+ expect(screen.getByTestId('document-id-mode')).toBeInTheDocument();
55
+ expect(screen.getByText('DocumentIdMode: doc-123')).toBeInTheDocument();
56
+ expect(screen.queryByTestId('editor-data-mode')).not.toBeInTheDocument();
57
+ expect(screen.queryByTestId('internal-editor')).not.toBeInTheDocument();
58
+ });
59
+
60
+ it('should render EditorDataMode when editorData is provided', () => {
61
+ render(<EditorCanvas editor={mockEditor} editorData={{ content: 'test content' }} />);
62
+
63
+ expect(screen.getByTestId('editor-data-mode')).toBeInTheDocument();
64
+ expect(screen.getByText('EditorDataMode: test content')).toBeInTheDocument();
65
+ expect(screen.queryByTestId('document-id-mode')).not.toBeInTheDocument();
66
+ expect(screen.queryByTestId('internal-editor')).not.toBeInTheDocument();
67
+ });
68
+
69
+ it('should render InternalEditor in basic mode (no documentId or editorData)', () => {
70
+ render(<EditorCanvas editor={mockEditor} />);
71
+
72
+ expect(screen.getByTestId('internal-editor')).toBeInTheDocument();
73
+ expect(screen.queryByTestId('document-id-mode')).not.toBeInTheDocument();
74
+ expect(screen.queryByTestId('editor-data-mode')).not.toBeInTheDocument();
75
+ });
76
+
77
+ it('should return null in basic mode when editor is undefined', () => {
78
+ const { container } = render(<EditorCanvas editor={undefined} />);
79
+
80
+ expect(container.firstChild).toBeNull();
81
+ });
82
+ });
83
+
84
+ describe('mode priority', () => {
85
+ it('should prioritize documentId over editorData when both are provided', () => {
86
+ render(
87
+ <EditorCanvas
88
+ documentId="doc-123"
89
+ editor={mockEditor}
90
+ editorData={{ content: 'test content' }}
91
+ />,
92
+ );
93
+
94
+ expect(screen.getByTestId('document-id-mode')).toBeInTheDocument();
95
+ expect(screen.queryByTestId('editor-data-mode')).not.toBeInTheDocument();
96
+ });
97
+ });
98
+
99
+ describe('props forwarding', () => {
100
+ it('should forward props to DocumentIdMode', async () => {
101
+ const onContentChange = vi.fn();
102
+ const onInit = vi.fn();
103
+
104
+ render(
105
+ <EditorCanvas
106
+ autoSave={false}
107
+ documentId="doc-123"
108
+ editor={mockEditor}
109
+ onContentChange={onContentChange}
110
+ onInit={onInit}
111
+ placeholder="Custom placeholder"
112
+ sourceType="notebook"
113
+ />,
114
+ );
115
+
116
+ const DocumentIdMode = await vi.importMock('./DocumentIdMode');
117
+ const lastCall = (DocumentIdMode.default as ReturnType<typeof vi.fn>).mock.calls.at(-1);
118
+
119
+ expect(lastCall?.[0]).toMatchObject({
120
+ autoSave: false,
121
+ documentId: 'doc-123',
122
+ editor: mockEditor,
123
+ onContentChange,
124
+ onInit,
125
+ placeholder: 'Custom placeholder',
126
+ sourceType: 'notebook',
127
+ });
128
+ });
129
+
130
+ it('should forward props to EditorDataMode', async () => {
131
+ const onContentChange = vi.fn();
132
+ const onInit = vi.fn();
133
+ const editorData = { content: 'test', editorData: { blocks: [] } };
134
+
135
+ render(
136
+ <EditorCanvas
137
+ editor={mockEditor}
138
+ editorData={editorData}
139
+ onContentChange={onContentChange}
140
+ onInit={onInit}
141
+ placeholder="Custom placeholder"
142
+ />,
143
+ );
144
+
145
+ const EditorDataMode = await vi.importMock('./EditorDataMode');
146
+ const lastCall = (EditorDataMode.default as ReturnType<typeof vi.fn>).mock.calls.at(-1);
147
+
148
+ expect(lastCall?.[0]).toMatchObject({
149
+ editor: mockEditor,
150
+ editorData,
151
+ onContentChange,
152
+ onInit,
153
+ placeholder: 'Custom placeholder',
154
+ });
155
+ });
156
+
157
+ it('should forward props to InternalEditor in basic mode', async () => {
158
+ const onContentChange = vi.fn();
159
+ const onInit = vi.fn();
160
+
161
+ render(
162
+ <EditorCanvas
163
+ editor={mockEditor}
164
+ floatingToolbar={false}
165
+ onContentChange={onContentChange}
166
+ onInit={onInit}
167
+ placeholder="Custom placeholder"
168
+ />,
169
+ );
170
+
171
+ const InternalEditor = await vi.importMock('./InternalEditor');
172
+ const lastCall = (InternalEditor.default as ReturnType<typeof vi.fn>).mock.calls.at(-1);
173
+
174
+ expect(lastCall?.[0]).toMatchObject({
175
+ editor: mockEditor,
176
+ floatingToolbar: false,
177
+ onContentChange,
178
+ onInit,
179
+ placeholder: 'Custom placeholder',
180
+ });
181
+ });
182
+ });
183
+
184
+ describe('error boundary wrapping', () => {
185
+ it('should wrap DocumentIdMode with ErrorBoundary', async () => {
186
+ render(<EditorCanvas documentId="doc-123" editor={mockEditor} />);
187
+
188
+ const ErrorBoundary = await vi.importMock('./ErrorBoundary');
189
+ expect(ErrorBoundary.EditorErrorBoundary).toHaveBeenCalled();
190
+ });
191
+
192
+ it('should wrap EditorDataMode with ErrorBoundary', async () => {
193
+ render(<EditorCanvas editor={mockEditor} editorData={{ content: 'test' }} />);
194
+
195
+ const ErrorBoundary = await vi.importMock('./ErrorBoundary');
196
+ expect(ErrorBoundary.EditorErrorBoundary).toHaveBeenCalled();
197
+ });
198
+
199
+ it('should wrap InternalEditor with ErrorBoundary in basic mode', async () => {
200
+ render(<EditorCanvas editor={mockEditor} />);
201
+
202
+ const ErrorBoundary = await vi.importMock('./ErrorBoundary');
203
+ expect(ErrorBoundary.EditorErrorBoundary).toHaveBeenCalled();
204
+ });
205
+ });
206
+ });
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { type IEditor } from '@lobehub/editor';
4
- import { memo, useEffect, useState } from 'react';
4
+ import { memo, useCallback, useEffect, useRef } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
7
  import type { EditorCanvasProps } from './EditorCanvas';
@@ -12,37 +12,70 @@ export interface EditorDataModeProps extends EditorCanvasProps {
12
12
  editorData: NonNullable<EditorCanvasProps['editorData']>;
13
13
  }
14
14
 
15
+ const loadEditorContent = (
16
+ editorInstance: IEditor,
17
+ editorData: EditorDataModeProps['editorData'],
18
+ ): boolean => {
19
+ const hasValidEditorData =
20
+ editorData.editorData &&
21
+ typeof editorData.editorData === 'object' &&
22
+ Object.keys(editorData.editorData as object).length > 0;
23
+
24
+ if (hasValidEditorData) {
25
+ editorInstance.setDocument('json', JSON.stringify(editorData.editorData));
26
+ return true;
27
+ } else if (editorData.content?.trim()) {
28
+ editorInstance.setDocument('markdown', editorData.content, { keepId: true });
29
+ return true;
30
+ }
31
+ return false;
32
+ };
33
+
15
34
  /**
16
35
  * EditorCanvas with editorData mode - uses provided data directly
17
36
  */
18
37
  const EditorDataMode = memo<EditorDataModeProps>(
19
- ({ editor, editorData, onContentChange, style, ...editorProps }) => {
38
+ ({ editor, editorData, onContentChange, onInit, style, ...editorProps }) => {
20
39
  const { t } = useTranslation('file');
21
- const [isInitialized, setIsInitialized] = useState(false);
40
+ const isEditorReadyRef = useRef(false);
41
+ // Track loaded content to support re-loading when data changes
42
+ const loadedContentRef = useRef<string | undefined>(undefined);
22
43
 
23
- // Load content into editor on mount
24
- useEffect(() => {
25
- if (!editor || isInitialized) return;
44
+ // Check if content has actually changed
45
+ const hasDataChanged = loadedContentRef.current !== editorData.content;
26
46
 
27
- const hasValidEditorData =
28
- editorData.editorData &&
29
- typeof editorData.editorData === 'object' &&
30
- Object.keys(editorData.editorData as object).length > 0;
47
+ const handleInit = useCallback(
48
+ (editorInstance: IEditor) => {
49
+ isEditorReadyRef.current = true;
31
50
 
32
- try {
33
- if (hasValidEditorData) {
34
- editor.setDocument('json', JSON.stringify(editorData.editorData));
35
- } else if (editorData.content?.trim()) {
36
- editor.setDocument('markdown', editorData.content, { keepId: true });
37
- } else {
38
- console.error('[EditorCanvas] load content error:', editorData);
51
+ // Try to load content if editorData is available and hasn't been loaded yet
52
+ if (hasDataChanged) {
53
+ try {
54
+ if (loadEditorContent(editorInstance, editorData)) {
55
+ loadedContentRef.current = editorData.content;
56
+ }
57
+ } catch (err) {
58
+ console.error('[EditorCanvas] Failed to load content:', err);
59
+ }
39
60
  }
40
61
 
41
- setIsInitialized(true);
62
+ onInit?.(editorInstance);
63
+ },
64
+ [editorData, hasDataChanged, onInit],
65
+ );
66
+
67
+ // Load content when editorData changes after editor is ready
68
+ useEffect(() => {
69
+ if (!editor || !isEditorReadyRef.current || !hasDataChanged) return;
70
+
71
+ try {
72
+ if (loadEditorContent(editor, editorData)) {
73
+ loadedContentRef.current = editorData.content;
74
+ }
42
75
  } catch (err) {
43
76
  console.error('[EditorCanvas] Failed to load content:', err);
44
77
  }
45
- }, [editorData, editor, isInitialized]);
78
+ }, [editor, editorData, hasDataChanged]);
46
79
 
47
80
  if (!editor) return null;
48
81
 
@@ -51,6 +84,7 @@ const EditorDataMode = memo<EditorDataModeProps>(
51
84
  <InternalEditor
52
85
  editor={editor}
53
86
  onContentChange={onContentChange}
87
+ onInit={handleInit}
54
88
  placeholder={editorProps.placeholder || t('pageEditor.editorPlaceholder')}
55
89
  {...editorProps}
56
90
  />
@@ -3,7 +3,7 @@ import { Modal, ModalProps, createRawModal } from '@lobehub/ui';
3
3
  import { memo, useState } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
 
6
- import EditorCanvas from './EditorCanvas';
6
+ import { EditorCanvas } from '@/features/EditorCanvas';
7
7
 
8
8
  interface EditorModalProps extends ModalProps {
9
9
  onConfirm?: (value: string) => Promise<void>;
@@ -43,7 +43,7 @@ export const EditorModal = memo<EditorModalProps>(({ value, onConfirm, ...rest }
43
43
  width={'min(90vw, 920px)'}
44
44
  {...rest}
45
45
  >
46
- <EditorCanvas defaultValue={value} editor={editor} />
46
+ <EditorCanvas editor={editor} editorData={{ content: value }} />
47
47
  </Modal>
48
48
  );
49
49
  });
@@ -22,7 +22,7 @@ const SessionHydration = memo(() => {
22
22
  });
23
23
 
24
24
  useStoreUpdater('activeId', session);
25
- useChatStoreUpdater('activeId', session);
25
+ useChatStoreUpdater('activeAgentId', session);
26
26
 
27
27
  useEffect(() => {
28
28
  const unsubscribe = useSessionStore.subscribe(
@@ -8,7 +8,7 @@ import { chatSelectors } from '@/store/chat/selectors';
8
8
  const ChatList = memo(() => {
9
9
  const ids = useChatStore(chatSelectors.mainDisplayChatIDs);
10
10
  const messages = useChatStore(chatSelectors.activeBaseChats);
11
- const agentId = useChatStore((s) => s.activeId);
11
+ const agentId = useChatStore((s) => s.activeAgentId);
12
12
  const topicId = useChatStore((s) => s.activeTopicId);
13
13
 
14
14
  return (
@@ -75,7 +75,7 @@ const SharePdf = memo((props: { message?: UIChatMessage }) => {
75
75
  const [systemRole] = useAgentStore((s) => [agentSelectors.currentAgentSystemRole(s)]);
76
76
  const messages = useChatStore(chatSelectors.activeBaseChats, isEqual);
77
77
  const topic = useChatStore(topicSelectors.currentActiveTopic, isEqual);
78
- const activeId = useChatStore((s) => s.activeId);
78
+ const activeId = useChatStore((s) => s.activeAgentId);
79
79
  const topicId = useChatStore((s) => s.activeTopicId);
80
80
 
81
81
  const title = topic?.title || t('shareModal.exportTitle');