@agentscope-ai/chat 1.1.20 → 1.1.22

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 (335) hide show
  1. package/bin/client.js +1 -1
  2. package/components/AGUI/components/HelpModal/icons.tsx +68 -0
  3. package/components/AGUI/components/HelpModal/index.tsx +1 -0
  4. package/components/AGUI/components/HelpModal/modal.tsx +101 -0
  5. package/components/AGUI/components/chat/Button.tsx +18 -0
  6. package/components/AGUI/components/chat/Chat.tsx +780 -0
  7. package/components/AGUI/components/chat/ChatContext.tsx +248 -0
  8. package/components/AGUI/components/chat/CodeBlock.tsx +406 -0
  9. package/components/AGUI/components/chat/Header.tsx +22 -0
  10. package/components/AGUI/components/chat/Icons.tsx +237 -0
  11. package/components/AGUI/components/chat/ImageUploadQueue.tsx +77 -0
  12. package/components/AGUI/components/chat/Input.tsx +24 -0
  13. package/components/AGUI/components/chat/Markdown.tsx +134 -0
  14. package/components/AGUI/components/chat/Messages.tsx +259 -0
  15. package/components/AGUI/components/chat/Modal.tsx +133 -0
  16. package/components/AGUI/components/chat/Popup.tsx +57 -0
  17. package/components/AGUI/components/chat/PoweredByTag.tsx +29 -0
  18. package/components/AGUI/components/chat/Sidebar.tsx +74 -0
  19. package/components/AGUI/components/chat/Suggestion.tsx +132 -0
  20. package/components/AGUI/components/chat/Suggestions.tsx +20 -0
  21. package/components/AGUI/components/chat/Textarea.tsx +61 -0
  22. package/components/AGUI/components/chat/Window.tsx +152 -0
  23. package/components/AGUI/components/chat/index.tsx +11 -0
  24. package/components/AGUI/components/chat/messages/AssistantMessage.tsx +69 -0
  25. package/components/AGUI/components/chat/messages/RenderActionExecutionMessage.tsx +129 -0
  26. package/components/AGUI/components/chat/messages/RenderAgentStateMessage.tsx +116 -0
  27. package/components/AGUI/components/chat/messages/RenderImageMessage.tsx +64 -0
  28. package/components/AGUI/components/chat/messages/RenderResultMessage.tsx +26 -0
  29. package/components/AGUI/components/chat/messages/RenderTextMessage.tsx +51 -0
  30. package/components/AGUI/components/chat/messages/UserMessage.tsx +10 -0
  31. package/components/AGUI/components/chat/props.ts +186 -0
  32. package/components/AGUI/components/index.ts +1 -0
  33. package/components/AGUI/context/index.ts +1 -0
  34. package/components/AGUI/hooks/index.ts +1 -0
  35. package/components/AGUI/hooks/use-copilot-chat-suggestions.tsx +122 -0
  36. package/components/AGUI/hooks/use-copy-to-clipboard.tsx +29 -0
  37. package/components/AGUI/hooks/use-dark-mode.ts +10 -0
  38. package/components/AGUI/hooks/use-push-to-talk.tsx +166 -0
  39. package/components/AGUI/index.tsx +4 -0
  40. package/components/AGUI/lib/utils.test.ts +7 -0
  41. package/components/AGUI/lib/utils.ts +27 -0
  42. package/components/AGUI/styles.css +0 -0
  43. package/components/AGUI/types/css.ts +0 -0
  44. package/components/AGUI/types/index.ts +1 -0
  45. package/components/AGUI/types/suggestions.ts +6 -0
  46. package/components/Accordion/Accordion.tsx +203 -0
  47. package/components/Accordion/BodyContent.tsx +28 -0
  48. package/components/Accordion/DeepThinking.tsx +91 -0
  49. package/components/Accordion/SoftLightTitle.tsx +13 -0
  50. package/components/Accordion/demo/search.tsx +39 -0
  51. package/components/Accordion/demo/steps.tsx +135 -0
  52. package/components/Accordion/demo/thinking.tsx +62 -0
  53. package/components/Accordion/index.en-US.md +34 -0
  54. package/components/Accordion/index.tsx +3 -0
  55. package/components/Accordion/index.zh-CN.md +34 -0
  56. package/components/Accordion/style.ts +208 -0
  57. package/components/AgentScopeRuntimeWebUI/demo/index.tsx +4 -0
  58. package/components/AgentScopeRuntimeWebUI/index.tsx +3 -0
  59. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Request/Builder.tsx +82 -0
  60. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Request/Card.tsx +52 -0
  61. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Actions.tsx +39 -0
  62. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Builder.tsx +205 -0
  63. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Card.tsx +44 -0
  64. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Error.tsx +7 -0
  65. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Message.tsx +23 -0
  66. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Reasoning.tsx +16 -0
  67. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Tool.tsx +19 -0
  68. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/index.tsx +0 -0
  69. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/types.tsx +100 -0
  70. package/components/AgentScopeRuntimeWebUI/lib/Chat/Input/index.tsx +77 -0
  71. package/components/AgentScopeRuntimeWebUI/lib/Chat/Input/useAttachments.tsx +53 -0
  72. package/components/AgentScopeRuntimeWebUI/lib/Chat/MessageList/index.tsx +30 -0
  73. package/components/AgentScopeRuntimeWebUI/lib/Chat/Welcome/index.tsx +66 -0
  74. package/components/AgentScopeRuntimeWebUI/lib/Chat/Welcome/styles.ts +51 -0
  75. package/components/AgentScopeRuntimeWebUI/lib/Chat/hooks/index.tsx +5 -0
  76. package/components/AgentScopeRuntimeWebUI/lib/Chat/hooks/useChatController.tsx +130 -0
  77. package/components/AgentScopeRuntimeWebUI/lib/Chat/hooks/useChatMessageHandler.tsx +87 -0
  78. package/components/AgentScopeRuntimeWebUI/lib/Chat/hooks/useChatRequest.tsx +114 -0
  79. package/components/AgentScopeRuntimeWebUI/lib/Chat/hooks/useChatSessionHandler.tsx +50 -0
  80. package/components/AgentScopeRuntimeWebUI/lib/Chat/index.tsx +18 -0
  81. package/components/AgentScopeRuntimeWebUI/lib/Chat/styles.tsx +59 -0
  82. package/components/AgentScopeRuntimeWebUI/lib/ChatAnywhere/ComposedProvider.tsx +27 -0
  83. package/components/AgentScopeRuntimeWebUI/lib/ChatAnywhere/index.tsx +29 -0
  84. package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereControl.tsx +0 -0
  85. package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereInputContext.tsx +27 -0
  86. package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereLayoutContext.tsx +27 -0
  87. package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereMessagesContext.tsx +82 -0
  88. package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereOptionsContext.tsx +76 -0
  89. package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereSessionsContext.tsx +111 -0
  90. package/components/AgentScopeRuntimeWebUI/lib/Context/useChatAnywhereEventEmitter.tsx +30 -0
  91. package/components/AgentScopeRuntimeWebUI/lib/Header/index.tsx +45 -0
  92. package/components/AgentScopeRuntimeWebUI/lib/Header/styles.ts +23 -0
  93. package/components/AgentScopeRuntimeWebUI/lib/Layout/index.tsx +45 -0
  94. package/components/AgentScopeRuntimeWebUI/lib/Layout/styles.tsx +104 -0
  95. package/components/AgentScopeRuntimeWebUI/lib/Sessions/index.tsx +114 -0
  96. package/components/AgentScopeRuntimeWebUI/lib/Sessions/styles.tsx +0 -0
  97. package/components/AgentScopeRuntimeWebUI/lib/demo/OptionsPanel/FormItem.tsx +37 -0
  98. package/components/AgentScopeRuntimeWebUI/lib/demo/OptionsPanel/OptionsEditor.tsx +163 -0
  99. package/components/AgentScopeRuntimeWebUI/lib/demo/OptionsPanel/defaultConfig.ts +43 -0
  100. package/components/AgentScopeRuntimeWebUI/lib/demo/OptionsPanel/index.tsx +27 -0
  101. package/components/AgentScopeRuntimeWebUI/lib/demo/index.tsx +57 -0
  102. package/components/AgentScopeRuntimeWebUI/lib/demo/sessionApi/index.ts +51 -0
  103. package/components/AgentScopeRuntimeWebUI/lib/types/IChatAnywhere.ts +358 -0
  104. package/components/AgentScopeRuntimeWebUI/lib/types/IMessages.tsx +52 -0
  105. package/components/AgentScopeRuntimeWebUI/lib/types/ISessions.tsx +29 -0
  106. package/components/AgentScopeRuntimeWebUI/lib/types/index.tsx +3 -0
  107. package/components/AgentScopeRuntimeWebUI/starter/OptionsPanel/FormItem.tsx +37 -0
  108. package/components/AgentScopeRuntimeWebUI/starter/OptionsPanel/OptionsEditor.tsx +163 -0
  109. package/components/AgentScopeRuntimeWebUI/starter/OptionsPanel/defaultConfig.ts +43 -0
  110. package/components/AgentScopeRuntimeWebUI/starter/OptionsPanel/index.tsx +27 -0
  111. package/components/AgentScopeRuntimeWebUI/starter/index.tsx +57 -0
  112. package/components/AgentScopeRuntimeWebUI/starter/sessionApi/index.ts +51 -0
  113. package/components/Attachments/DropArea.tsx +97 -0
  114. package/components/Attachments/FileList/AudioIcon.tsx +20 -0
  115. package/components/Attachments/FileList/FileListCard.tsx +270 -0
  116. package/components/Attachments/FileList/Progress.tsx +30 -0
  117. package/components/Attachments/FileList/VideoIcon.tsx +20 -0
  118. package/components/Attachments/FileList/index.tsx +201 -0
  119. package/components/Attachments/PlaceholderUploader.tsx +124 -0
  120. package/components/Attachments/SilentUploader.tsx +39 -0
  121. package/components/Attachments/context.tsx +11 -0
  122. package/components/Attachments/demo/basic.tsx +71 -0
  123. package/components/Attachments/index.en-US.md.bk +10 -0
  124. package/components/Attachments/index.tsx +274 -0
  125. package/components/Attachments/index.zh-CN.md.bk +10 -0
  126. package/components/Attachments/style/fileCard.ts +163 -0
  127. package/components/Attachments/style/index.ts +232 -0
  128. package/components/Attachments/util.ts +56 -0
  129. package/components/Bubble/Avatar.tsx +39 -0
  130. package/components/Bubble/Bubble.tsx +131 -0
  131. package/components/Bubble/BubbleList.tsx +105 -0
  132. package/components/Bubble/Cards.tsx +61 -0
  133. package/components/Bubble/Footer.tsx +55 -0
  134. package/components/Bubble/Interrupted.tsx +82 -0
  135. package/components/Bubble/ScrollToBottom.tsx +42 -0
  136. package/components/Bubble/Spin.tsx +13 -0
  137. package/components/Bubble/demo/assistantWithCode.tsx +60 -0
  138. package/components/Bubble/demo/assistantWithErrorStatus.tsx +102 -0
  139. package/components/Bubble/demo/assistantWithImage.tsx +46 -0
  140. package/components/Bubble/demo/assistantWithProcess.tsx +103 -0
  141. package/components/Bubble/demo/assistantWithSearch.tsx +69 -0
  142. package/components/Bubble/demo/assistantWithThinking.tsx +54 -0
  143. package/components/Bubble/demo/basic.tsx +55 -0
  144. package/components/Bubble/demo/userWithFile.tsx +27 -0
  145. package/components/Bubble/demo/userWithImage.tsx +26 -0
  146. package/components/Bubble/hooks/useDisplayData.ts +0 -0
  147. package/components/Bubble/hooks/useListData.ts +0 -0
  148. package/components/Bubble/index.en-US.md +33 -0
  149. package/components/Bubble/index.tsx +21 -0
  150. package/components/Bubble/index.zh-CN.md +33 -0
  151. package/components/Bubble/interface.ts +71 -0
  152. package/components/Bubble/loading.tsx +15 -0
  153. package/components/Bubble/style/avatar.ts +43 -0
  154. package/components/Bubble/style/footer.ts +45 -0
  155. package/components/Bubble/style/index.ts +192 -0
  156. package/components/Bubble/style/list.ts +51 -0
  157. package/components/ChatAnywhere/Chat/Ref.tsx +20 -0
  158. package/components/ChatAnywhere/Chat/index.tsx +56 -0
  159. package/components/ChatAnywhere/Chat/style.ts +59 -0
  160. package/components/ChatAnywhere/Header/index.tsx +37 -0
  161. package/components/ChatAnywhere/Header/style.ts +27 -0
  162. package/components/ChatAnywhere/Input/index.tsx +158 -0
  163. package/components/ChatAnywhere/Input/style.ts +14 -0
  164. package/components/ChatAnywhere/Layout/index.tsx +70 -0
  165. package/components/ChatAnywhere/Layout/style.ts +51 -0
  166. package/components/ChatAnywhere/SessionList/index.tsx +122 -0
  167. package/components/ChatAnywhere/SessionList/style.ts +53 -0
  168. package/components/ChatAnywhere/hooks/ChatAnywhereProvider.tsx +219 -0
  169. package/components/ChatAnywhere/hooks/types.ts +333 -0
  170. package/components/ChatAnywhere/hooks/useInput.tsx +22 -0
  171. package/components/ChatAnywhere/hooks/useMessages.tsx +63 -0
  172. package/components/ChatAnywhere/hooks/useSessionList.tsx +123 -0
  173. package/components/ChatAnywhere/index.tsx +49 -0
  174. package/components/Conversations/GroupTitle.tsx +28 -0
  175. package/components/Conversations/Item.tsx +189 -0
  176. package/components/Conversations/demo/basic.tsx +107 -0
  177. package/components/Conversations/demo/timeline.tsx +111 -0
  178. package/components/Conversations/demo/timestamp.tsx +110 -0
  179. package/components/Conversations/hooks/useGroupable.ts +81 -0
  180. package/components/Conversations/index.en-US.md +32 -0
  181. package/components/Conversations/index.tsx +176 -0
  182. package/components/Conversations/index.zh-CN.md +31 -0
  183. package/components/Conversations/interface.ts +69 -0
  184. package/components/Conversations/style.ts +153 -0
  185. package/components/DefaultCards/DeepThinking/index.tsx +33 -0
  186. package/components/DefaultCards/Files/index.tsx +69 -0
  187. package/components/DefaultCards/Footer/index.tsx +16 -0
  188. package/components/DefaultCards/Images/index.tsx +53 -0
  189. package/components/DefaultCards/Interrupted/index.tsx +13 -0
  190. package/components/DefaultCards/Text/index.tsx +13 -0
  191. package/components/DefaultCards/index.tsx +6 -0
  192. package/components/DeviceAction/actionMap.tsx +100 -0
  193. package/components/DeviceAction/demo/index.tsx +132 -0
  194. package/components/DeviceAction/index.en-US.md +19 -0
  195. package/components/DeviceAction/index.tsx +75 -0
  196. package/components/DeviceAction/index.zh-CN.md +19 -0
  197. package/components/Disclaimer/demo/index.tsx +4 -0
  198. package/components/Disclaimer/demo/withLink.tsx +4 -0
  199. package/components/Disclaimer/index.en-US.md +23 -0
  200. package/components/Disclaimer/index.tsx +42 -0
  201. package/components/Disclaimer/index.zh-CN.md +24 -0
  202. package/components/Disclaimer/style.ts +17 -0
  203. package/components/ImageGenerator/demo/basic.tsx +23 -0
  204. package/components/ImageGenerator/demo/custom.tsx +56 -0
  205. package/components/ImageGenerator/demo/size.tsx +15 -0
  206. package/components/ImageGenerator/index.en-US.md +23 -0
  207. package/components/ImageGenerator/index.tsx +124 -0
  208. package/components/ImageGenerator/index.zh-CN.md +23 -0
  209. package/components/ImageGenerator/style.ts +99 -0
  210. package/components/Markdown/Markdown/AnimationNode.tsx +89 -0
  211. package/components/Markdown/Markdown/Markdown.tsx +61 -0
  212. package/components/Markdown/Markdown/core/Parser.ts +52 -0
  213. package/components/Markdown/Markdown/core/Renderer.ts +121 -0
  214. package/components/Markdown/Markdown/core/index.ts +4 -0
  215. package/components/Markdown/Markdown/defaultComponents/CodeBlock.tsx +113 -0
  216. package/components/Markdown/Markdown/defaultComponents/DisabledImage.tsx +3 -0
  217. package/components/Markdown/Markdown/defaultComponents/Media.tsx +71 -0
  218. package/components/Markdown/Markdown/hooks/index.ts +4 -0
  219. package/components/Markdown/Markdown/hooks/useAnimation.tsx +27 -0
  220. package/components/Markdown/Markdown/hooks/useCitationsData.tsx +36 -0
  221. package/components/Markdown/Markdown/hooks/useStreaming.ts +503 -0
  222. package/components/Markdown/Markdown/hooks/useTyping.ts +22 -0
  223. package/components/Markdown/Markdown/index.tsx +198 -0
  224. package/components/Markdown/Markdown/interface.ts +217 -0
  225. package/components/Markdown/Markdown/style.ts +152 -0
  226. package/components/Markdown/demo/basic.tsx +107 -0
  227. package/components/Markdown/demo/citations.tsx +47 -0
  228. package/components/Markdown/demo/cursor.tsx +9 -0
  229. package/components/Markdown/demo/latex.tsx +77 -0
  230. package/components/Markdown/demo/typing.tsx +82 -0
  231. package/components/Markdown/index.en-US.md +27 -0
  232. package/components/Markdown/index.ts +1 -0
  233. package/components/Markdown/index.zh-CN.md +28 -0
  234. package/components/Markdown/plugins/citations/CitationComponent.tsx +72 -0
  235. package/components/Markdown/plugins/citations/index.tsx +37 -0
  236. package/components/Markdown/plugins/cursor/Dot.tsx +106 -0
  237. package/components/Markdown/plugins/cursor/Underline.tsx +38 -0
  238. package/components/Markdown/plugins/cursor/index.tsx +59 -0
  239. package/components/Markdown/plugins/latex/index.ts +109 -0
  240. package/components/Markdown/plugins/type.ts +71 -0
  241. package/components/Mermaid/demo/basic.tsx +12 -0
  242. package/components/Mermaid/demo/class.tsx +31 -0
  243. package/components/Mermaid/demo/flowchart.tsx +13 -0
  244. package/components/Mermaid/demo/sequence.tsx +18 -0
  245. package/components/Mermaid/demo/state.tsx +16 -0
  246. package/components/Mermaid/demo/timeline.tsx +15 -0
  247. package/components/Mermaid/index.en-US.md +27 -0
  248. package/components/Mermaid/index.tsx +118 -0
  249. package/components/Mermaid/index.zh-CN.md +27 -0
  250. package/components/OperateCard/OperateCard.tsx +93 -0
  251. package/components/OperateCard/demo/index.tsx +35 -0
  252. package/components/OperateCard/demo/rag.tsx +19 -0
  253. package/components/OperateCard/demo/thinking.tsx +17 -0
  254. package/components/OperateCard/demo/todo.tsx +28 -0
  255. package/components/OperateCard/demo/toolCall.tsx +14 -0
  256. package/components/OperateCard/demo/webSearch.tsx +12 -0
  257. package/components/OperateCard/index.en-US.md +51 -0
  258. package/components/OperateCard/index.tsx +1 -0
  259. package/components/OperateCard/index.zh-CN.md +51 -0
  260. package/components/OperateCard/preset/Rag.tsx +90 -0
  261. package/components/OperateCard/preset/Thinking.tsx +45 -0
  262. package/components/OperateCard/preset/TodoList.tsx +73 -0
  263. package/components/OperateCard/preset/ToolCall.tsx +67 -0
  264. package/components/OperateCard/preset/WebSearch.tsx +65 -0
  265. package/components/OperateCard/preset/index.tsx +5 -0
  266. package/components/OperateCard/style.ts +268 -0
  267. package/components/Provider/CustomCardsProvider.tsx +17 -0
  268. package/components/Provider/GlobalProvider.tsx +17 -0
  269. package/components/Provider/index.tsx +33 -0
  270. package/components/Provider/types.ts +23 -0
  271. package/components/ResponsesAPI/index.tsx +0 -0
  272. package/components/Sender/ModeSelect/index.tsx +160 -0
  273. package/components/Sender/ModeSelect/styles.ts +0 -0
  274. package/components/Sender/SenderHeader.tsx +164 -0
  275. package/components/Sender/StopLoading.tsx +48 -0
  276. package/components/Sender/components/ActionButton.tsx +106 -0
  277. package/components/Sender/components/ClearButton.tsx +10 -0
  278. package/components/Sender/components/LoadingButton.tsx +26 -0
  279. package/components/Sender/components/SendButton.tsx +22 -0
  280. package/components/Sender/components/SpeechButton/RecordingIcon.tsx +68 -0
  281. package/components/Sender/components/SpeechButton/index.tsx +30 -0
  282. package/components/Sender/demo/asr.tsx +7 -0
  283. package/components/Sender/demo/basic.tsx +7 -0
  284. package/components/Sender/demo/loading.tsx +5 -0
  285. package/components/Sender/demo/moreMode.tsx +45 -0
  286. package/components/Sender/demo/morePrefixAction.tsx +40 -0
  287. package/components/Sender/demo/withFile.tsx +54 -0
  288. package/components/Sender/demo/withImage.tsx +52 -0
  289. package/components/Sender/index.en-US.md +29 -0
  290. package/components/Sender/index.tsx +491 -0
  291. package/components/Sender/index.zh-CN.md +30 -0
  292. package/components/Sender/style/index.ts +150 -0
  293. package/components/Sender/useSpeech.ts +133 -0
  294. package/components/StatusCard/demo/index.tsx +32 -0
  295. package/components/StatusCard/index.en-US.md +30 -0
  296. package/components/StatusCard/index.tsx +162 -0
  297. package/components/StatusCard/index.zh-CN.md +27 -0
  298. package/components/StatusCard/style.ts +119 -0
  299. package/components/Stream/index.ts +203 -0
  300. package/components/Util/hooks/use-proxy-imperative-handle.ts +25 -0
  301. package/components/Util/sleep.ts +3 -0
  302. package/components/Util/type.ts +1 -0
  303. package/components/Util/warning.ts +118 -0
  304. package/components/Version/index.ts +3 -0
  305. package/components/Voice/Recorder.tsx +3 -0
  306. package/components/Voice/demo/index.tsx +0 -0
  307. package/components/Voice/index.en-US.md +8 -0
  308. package/components/Voice/index.tsx +0 -0
  309. package/components/Voice/index.zh-CN.md +9 -0
  310. package/components/Welcome/demo/EyeFollower.tsx +161 -0
  311. package/components/Welcome/demo/demo0.tsx +14 -0
  312. package/components/Welcome/demo/demo1.tsx +16 -0
  313. package/components/Welcome/demo/demo2.tsx +30 -0
  314. package/components/Welcome/demo/demo3.tsx +16 -0
  315. package/components/Welcome/index.en-US.md +28 -0
  316. package/components/Welcome/index.tsx +72 -0
  317. package/components/Welcome/index.zh-CN.md +28 -0
  318. package/components/index.ts +88 -0
  319. package/components/overview.en-US.md +10 -0
  320. package/components/overview.zh-CN.md +10 -0
  321. package/lib/AgentScopeRuntimeWebUI/index.d.ts +1 -0
  322. package/lib/AgentScopeRuntimeWebUI/index.js +1 -0
  323. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/FormItem.d.ts +9 -0
  324. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/FormItem.js +33 -0
  325. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/OptionsEditor.d.ts +7 -0
  326. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/OptionsEditor.js +188 -0
  327. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/defaultConfig.d.ts +29 -0
  328. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/defaultConfig.js +35 -0
  329. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/index.d.ts +6 -0
  330. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/index.js +49 -0
  331. package/lib/AgentScopeRuntimeWebUI/starter/index.d.ts +1 -0
  332. package/lib/AgentScopeRuntimeWebUI/starter/index.js +70 -0
  333. package/lib/AgentScopeRuntimeWebUI/starter/sessionApi/index.d.ts +14 -0
  334. package/lib/AgentScopeRuntimeWebUI/starter/sessionApi/index.js +143 -0
  335. package/package.json +3 -2
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { AgentScopeRuntimeRunStatus, IAgentScopeRuntimeMessage, IDataContent } from "../types";
3
+ import { Bubble, ToolCall } from '@agentscope-ai/chat';
4
+
5
+ const Tool = React.memo(function ({ data }: { data: IAgentScopeRuntimeMessage }) {
6
+
7
+ if (data.status === AgentScopeRuntimeRunStatus.InProgress || data.status === AgentScopeRuntimeRunStatus.Created) return null;
8
+ const content = data.content as IDataContent<{
9
+ name: string;
10
+ arguments: Record<string, any>;
11
+ output: Record<string, any>;
12
+ }>[];
13
+ const toolName = content[0].data.name;
14
+
15
+ return <ToolCall title={toolName} input={content[0].data.arguments} output={content[1].data.output}></ToolCall>
16
+ })
17
+
18
+ export default Tool;
19
+
@@ -0,0 +1,100 @@
1
+ export enum AgentScopeRuntimeRunStatus {
2
+ Created = "created",
3
+ InProgress = "in_progress",
4
+ Completed = "completed",
5
+ Canceled = "canceled",
6
+ Failed = "failed",
7
+ Rejected = "rejected",
8
+ Unknown = "unknown",
9
+ }
10
+
11
+ export enum AgentScopeRuntimeMessageRole {
12
+ ASSISTANT = "assistant",
13
+ USER = "user",
14
+ SYSTEM = "system",
15
+ }
16
+
17
+ export enum AgentScopeRuntimeMessageType {
18
+ MESSAGE = "message",
19
+ REASONING = "reasoning",
20
+ PLUGIN_CALL = "plugin_call",
21
+ PLUGIN_CALL_OUTPUT = "plugin_call_output",
22
+ FUNCTION_CALL = "function_call",
23
+ FUNCTION_CALL_OUTPUT = "function_call_output",
24
+ COMPONENT_CALL = "component_call",
25
+ COMPONENT_CALL_OUTPUT = "component_call_output",
26
+ MCP_LIST_TOOLS = "mcp_list_tools",
27
+ MCP_APPROVAL_REQUEST = "mcp_approval_request",
28
+ MCP_TOOL_CALL = "mcp_call",
29
+ MCP_APPROVAL_RESPONSE = "mcp_approval_response",
30
+ HEARTBEAT = "heartbeat",
31
+ ERROR = "error",
32
+ }
33
+
34
+ export enum AgentScopeRuntimeContentType {
35
+ TEXT = "text",
36
+ DATA = "data",
37
+ IMAGE = "image",
38
+ AUDIO = "audio",
39
+ FILE = "file",
40
+ }
41
+
42
+ export interface IBaseContent {
43
+ type: string;
44
+ object?: 'content';
45
+ delta?: boolean | null;
46
+ msg_id?: string;
47
+ status: AgentScopeRuntimeRunStatus;
48
+ }
49
+
50
+ export interface ITextContent extends IBaseContent {
51
+ type: AgentScopeRuntimeContentType.TEXT,
52
+ text: string;
53
+ }
54
+ export interface IImageContent extends IBaseContent {
55
+ type: AgentScopeRuntimeContentType.IMAGE,
56
+ image_url: string;
57
+ }
58
+
59
+ export interface IFileContent extends IBaseContent {
60
+ type: AgentScopeRuntimeContentType.FILE,
61
+ file_url: string;
62
+ file_name?: string;
63
+ file_size?: number;
64
+ }
65
+
66
+ export interface IDataContent<T = Record<string, any>> extends IBaseContent {
67
+ type: AgentScopeRuntimeContentType.DATA,
68
+ data: T;
69
+ }
70
+
71
+ export type IContent = ITextContent | IImageContent | IDataContent | IFileContent;
72
+
73
+ export interface IAgentScopeRuntimeMessage {
74
+ id: string;
75
+ object?: 'message';
76
+ role: AgentScopeRuntimeMessageRole | string;
77
+ type: AgentScopeRuntimeMessageType;
78
+ content: IContent[];
79
+ status: AgentScopeRuntimeRunStatus;
80
+ code?: string;
81
+ message?: string;
82
+ }
83
+
84
+ export interface IAgentScopeRuntimeResponse {
85
+ id: string;
86
+ object?: 'response';
87
+ status: AgentScopeRuntimeRunStatus;
88
+ created_at: number;
89
+ completed_at?: number;
90
+ output: IAgentScopeRuntimeMessage[];
91
+ usage?: Record<string, any>;
92
+ }
93
+
94
+ export interface IAgentScopeRuntimeRequest {
95
+ input: {
96
+ role: AgentScopeRuntimeMessageRole | string;
97
+ type: AgentScopeRuntimeMessageType;
98
+ content: IContent[];
99
+ }[]
100
+ }
@@ -0,0 +1,77 @@
1
+ import React, { useCallback } from "react";
2
+ import { useProviderContext, ChatInput, Disclaimer } from '@agentscope-ai/chat';
3
+ import { useChatAnywhereOptions } from "../../Context/ChatAnywhereOptionsContext";
4
+ import { useGetState } from 'ahooks';
5
+ import { useChatAnywhereInput } from "../../Context/ChatAnywhereInputContext";
6
+ import useAttachments from "./useAttachments";
7
+ import { IAgentScopeRuntimeWebUIInputData } from "@agentscope-ai/chat";
8
+
9
+ export interface InputProps {
10
+ onCancel: () => void;
11
+ onSubmit: (data: IAgentScopeRuntimeWebUIInputData) => void;
12
+ }
13
+
14
+ export default function Input(props: InputProps) {
15
+ const [content, setContent, getContent] = useGetState('');
16
+ const prefixCls = useProviderContext().getPrefixCls('chat-anywhere-input');
17
+ const senderOptions = useChatAnywhereOptions(v => v.sender);
18
+ const inputContext = useChatAnywhereInput(v => v);
19
+
20
+ const {
21
+ placeholder = '',
22
+ disclaimer = '',
23
+ maxLength,
24
+ beforeSubmit = () => Promise.resolve(true),
25
+ beforeUI,
26
+ afterUI,
27
+ scalable = true,
28
+ attachments
29
+ } = senderOptions || {};
30
+
31
+ const {
32
+ getFileList,
33
+ setFileList,
34
+ uploadIconButton,
35
+ uploadFileListHeader
36
+ } = useAttachments(attachments);
37
+
38
+
39
+
40
+
41
+ const handleSubmit = useCallback(async () => {
42
+ const next = await beforeSubmit();
43
+ if (!next) return;
44
+
45
+ props.onSubmit({ query: getContent(), fileList: getFileList?.() || [] });
46
+ setContent('');
47
+ setFileList && setFileList([]);
48
+ }, []);
49
+
50
+ const handleCancel = useCallback(() => {
51
+ props.onCancel();
52
+ }, []);
53
+
54
+ return <div className={prefixCls}>
55
+ <div className={`${prefixCls}-wrapper`}>
56
+ {beforeUI}
57
+ <ChatInput
58
+ loading={inputContext.loading}
59
+ scalable={scalable}
60
+ placeholder={placeholder}
61
+ value={content}
62
+ prefix={<>
63
+ {uploadIconButton}
64
+ </>}
65
+ header={uploadFileListHeader}
66
+ onChange={setContent}
67
+ maxLength={maxLength}
68
+ onSubmit={handleSubmit}
69
+ onCancel={handleCancel}
70
+ />
71
+ {afterUI}
72
+ </div>
73
+ {
74
+ disclaimer ? <Disclaimer desc={disclaimer} /> : <div className={`${prefixCls}-blank`}></div>
75
+ }
76
+ </div>;
77
+ }
@@ -0,0 +1,53 @@
1
+ import { IAgentScopeRuntimeWebUISenderAttachmentsOptions } from "@agentscope-ai/chat";
2
+ import { Upload } from 'antd';
3
+ import { IconButton } from "@agentscope-ai/design";
4
+ import { SparkAttachmentLine } from "@agentscope-ai/icons";
5
+ import { Sender, Attachments } from '@agentscope-ai/chat';
6
+ import { useGetState } from "ahooks";
7
+
8
+ export default function useAttachments(
9
+ attachments: IAgentScopeRuntimeWebUISenderAttachmentsOptions
10
+ ) {
11
+ const [fileList, setFileList, getFileList] = useGetState([]);
12
+
13
+ if (attachments?.customRequest) {
14
+ const uploadIconButton = <Upload
15
+ customRequest={attachments.customRequest}
16
+ fileList={fileList}
17
+ showUploadList={false}
18
+ onChange={(info) => {
19
+ setFileList(info.fileList);
20
+ }}
21
+ >
22
+ <IconButton
23
+ icon={<SparkAttachmentLine />}
24
+ bordered={false}
25
+ />
26
+ </Upload>
27
+
28
+
29
+ const uploadFileListHeader = <Sender.Header
30
+ closable={false}
31
+ open={fileList?.length > 0}
32
+ >
33
+ <Attachments
34
+ items={fileList}
35
+ onChange={(info) => setFileList(info.fileList)}
36
+ />
37
+ </Sender.Header>
38
+
39
+
40
+ return {
41
+ fileList,
42
+ getFileList,
43
+ setFileList,
44
+ uploadIconButton,
45
+ uploadFileListHeader
46
+ }
47
+
48
+ } else {
49
+ return {
50
+ enabled: false,
51
+ };
52
+ }
53
+ }
@@ -0,0 +1,30 @@
1
+ import { Bubble, useProviderContext } from "@agentscope-ai/chat";
2
+ import { ChatAnywhereMessagesContext } from "../../Context/ChatAnywhereMessagesContext";
3
+ import { useContextSelector } from "use-context-selector";
4
+ import { ChatAnywhereSessionsContext } from "../../Context/ChatAnywhereSessionsContext";
5
+ import cls from 'classnames';
6
+ import Welcome from "../Welcome";
7
+ import { ChatAnywhereInputContext } from "../../Context/ChatAnywhereInputContext";
8
+
9
+
10
+ export default function MessageList(props: { onSubmit: (data: { query: string; fileList?: any[] }) => void }) {
11
+ const loading = useContextSelector(ChatAnywhereInputContext, v => v.loading);
12
+ const messages = useContextSelector(ChatAnywhereMessagesContext, v => v.messages);
13
+ const prefixCls = useProviderContext().getPrefixCls('chat-anywhere-message-list');
14
+ const currentSessionId = useContextSelector(ChatAnywhereSessionsContext, v => v.currentSessionId);
15
+
16
+ if (messages.length === 0) return <div className={cls(prefixCls, `${prefixCls}-welcome`)}>
17
+ <Welcome onSubmit={props.onSubmit} />
18
+ </div>;
19
+
20
+ return <>
21
+ <Bubble.List
22
+ smooth={loading}
23
+ key={currentSessionId}
24
+ classNames={{
25
+ wrapper: prefixCls,
26
+ }}
27
+ items={messages}
28
+ />
29
+ </>;
30
+ }
@@ -0,0 +1,66 @@
1
+ import { useProviderContext } from "@agentscope-ai/chat";
2
+ import { useChatAnywhereOptions } from "../../Context/ChatAnywhereOptionsContext";
3
+ import { Avatar } from 'antd';
4
+ import Style from './styles';
5
+ import { SparkRightArrowLine } from "@agentscope-ai/icons";
6
+
7
+ export default function Welcome(props: { onSubmit: (data: { query: string; fileList?: any[] }) => void }) {
8
+ const welcomeOptions = useChatAnywhereOptions(v => v.welcome);
9
+ const prefixCls = useProviderContext().getPrefixCls('chat-anywhere-welcome-default');
10
+
11
+ if (!welcomeOptions) return null;
12
+
13
+ const { render, ...otherWelcomeOptions } = welcomeOptions;
14
+
15
+ if (render) return welcomeOptions.render({
16
+ greeting: welcomeOptions.greeting,
17
+ avatar: welcomeOptions.avatar,
18
+ description: welcomeOptions.description,
19
+ prompts: welcomeOptions.prompts,
20
+ onSubmit: props.onSubmit,
21
+ });
22
+
23
+
24
+ const { greeting, avatar, prompts, description } = otherWelcomeOptions;
25
+
26
+ return <>
27
+ <Style />
28
+ <div className={prefixCls}>
29
+ {
30
+ avatar && <Avatar src={avatar} shape="square" size={72} />
31
+ }
32
+ {
33
+ greeting && <div className={`${prefixCls}-greeting`}>{greeting}</div>
34
+ }
35
+ {
36
+ description && <div className={`${prefixCls}-description`}>{description}</div>
37
+ }
38
+ {
39
+ prompts?.length > 0 && <div className={`${prefixCls}-prompts`}>
40
+ {
41
+ prompts.map(item => {
42
+ const prompt = typeof item === 'string' ? { label: item, value: item } : {
43
+ ...item,
44
+ label: item.label || item.value,
45
+ value: item.value,
46
+ };
47
+
48
+ return <Prompt key={prompt.value} prompt={prompt} onSubmit={props.onSubmit} />
49
+ })
50
+ }
51
+ </div>
52
+ }
53
+ </div>
54
+ </>;
55
+ }
56
+
57
+ function Prompt(props: { prompt: { label: string; value: string; icon?: React.ReactElement }, onSubmit: (data: { query: string; fileList?: any[] }) => void }) {
58
+ const prefixCls = useProviderContext().getPrefixCls('chat-anywhere-welcome-default');
59
+
60
+ return <div className={`${prefixCls}-prompt`} onClick={() => props.onSubmit({ query: props.prompt.value })}>
61
+ <span>
62
+ {props.prompt.label}
63
+ </span>
64
+ <SparkRightArrowLine />
65
+ </div>
66
+ }
@@ -0,0 +1,51 @@
1
+ import { createGlobalStyle } from 'antd-style';
2
+
3
+ export default createGlobalStyle`
4
+ .${(p) => p.theme.prefixCls}-chat-anywhere-welcome-default {
5
+ display: flex;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ gap: 12px;
9
+
10
+ &-greeting {
11
+ color: ${({ theme }) => theme.colorText};
12
+ font-size: 16px;
13
+ line-height: 26px;
14
+ font-weight: 500;
15
+ }
16
+
17
+ &-description {
18
+ color: ${({ theme }) => theme.colorTextSecondary};
19
+ font-size: 12px;
20
+ line-height: 18px;
21
+ margin-top: -10px;
22
+ }
23
+
24
+ &-prompts {
25
+ display: flex;
26
+ flex-direction: column;
27
+ gap: 10px;
28
+ margin-top: 10px;
29
+ }
30
+
31
+ &-prompt {
32
+ height: 42px;
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: space-between;
36
+ background-color: ${({ theme }) => theme.colorFillQuaternary};
37
+ color: ${({ theme }) => theme.colorText};
38
+ font-size: 14px;
39
+ padding: 10px 16px;
40
+ border-radius: 8px;
41
+ cursor: pointer;
42
+ gap: 20px;
43
+
44
+
45
+ &:hover {
46
+ background-color: ${({ theme }) => theme.colorFillTertiary};
47
+ }
48
+
49
+ }
50
+ }
51
+ `;
@@ -0,0 +1,5 @@
1
+ export { default as useChatController } from './useChatController';
2
+ export { default as useChatRequest } from './useChatRequest';
3
+ export { default as useChatMessageHandler } from './useChatMessageHandler';
4
+ export { default as useChatSessionHandler } from './useChatSessionHandler';
5
+
@@ -0,0 +1,130 @@
1
+ import { sleep } from "@agentscope-ai/chat";
2
+ import { useCallback, useEffect, useRef } from "react";
3
+ import { useContextSelector } from "use-context-selector";
4
+ import { ChatAnywhereInputContext } from "../../Context/ChatAnywhereInputContext";
5
+ import { ChatAnywhereSessionsContext } from "../../Context/ChatAnywhereSessionsContext";
6
+ import useChatAnywhereEventEmitter from "../../Context/useChatAnywhereEventEmitter";
7
+ import { IAgentScopeRuntimeWebUIMessage } from "@agentscope-ai/chat";
8
+ import { InputProps } from "../Input";
9
+ import useChatMessageHandler from "./useChatMessageHandler";
10
+ import useChatRequest from "./useChatRequest";
11
+ import useChatSessionHandler from "./useChatSessionHandler";
12
+ import ReactDOM from "react-dom";
13
+
14
+ /**
15
+ * 聊天控制器 Hook - 协调所有聊天相关操作
16
+ */
17
+ export default function useChatController() {
18
+ const setLoading = useContextSelector(ChatAnywhereInputContext, v => v.setLoading);
19
+ const currentSessionId = useContextSelector(ChatAnywhereSessionsContext, v => v.currentSessionId);
20
+
21
+ const currentQARef = useRef<{
22
+ request?: IAgentScopeRuntimeWebUIMessage;
23
+ response?: IAgentScopeRuntimeWebUIMessage;
24
+ abortController?: AbortController;
25
+ }>({});
26
+
27
+ // 消息处理
28
+ const messageHandler = useChatMessageHandler({ currentQARef });
29
+
30
+ // 会话处理
31
+ const sessionHandler = useChatSessionHandler();
32
+
33
+ /**
34
+ * 完成响应
35
+ */
36
+ const finishResponse = useCallback((status: 'finished' | 'interrupted' = 'finished') => {
37
+ if (!currentQARef.current.response) return;
38
+
39
+ currentQARef.current.response.msgStatus = status;
40
+ setLoading(false);
41
+ ReactDOM.flushSync(() => {
42
+ messageHandler.updateMessage(currentQARef.current.response);
43
+ });
44
+
45
+ sessionHandler.syncSessionMessages(messageHandler.getMessages());
46
+ }, [setLoading, messageHandler, sessionHandler]);
47
+
48
+ // API 请求处理
49
+ const { request } = useChatRequest({
50
+ currentQARef,
51
+ updateMessage: messageHandler.updateMessage,
52
+ getCurrentSessionId: sessionHandler.getCurrentSessionId,
53
+ onFinish: () => finishResponse('finished'),
54
+ });
55
+
56
+ /**
57
+ * 处理用户提交
58
+ */
59
+ const handleSubmit = useCallback<InputProps['onSubmit']>(async (data) => {
60
+ // 1. 确保会话存在
61
+ await sessionHandler.ensureSession(data.query);
62
+
63
+ // 2. 更新会话名称(如果是第一条消息)
64
+ const messages = messageHandler.getMessages();
65
+ if (sessionHandler.getCurrentSessionId()) {
66
+ await sessionHandler.updateSessionName(data.query, messages);
67
+ }
68
+
69
+ // 3. 创建用户请求消息
70
+ messageHandler.createRequestMessage(data);
71
+ setLoading(true);
72
+
73
+ await sleep(100);
74
+
75
+ // 4. 创建助手响应消息
76
+ messageHandler.createResponseMessage();
77
+
78
+ // 5. 获取历史消息并发起请求
79
+ const historyMessages = messageHandler.getHistoryMessages();
80
+ await sessionHandler.syncSessionMessages(messageHandler.getMessages());
81
+
82
+ await request(historyMessages);
83
+ }, [messageHandler, sessionHandler, request]);
84
+
85
+ /**
86
+ * 处理取消
87
+ */
88
+ const handleCancel = useCallback(() => {
89
+ finishResponse('interrupted');
90
+ }, [finishResponse]);
91
+
92
+ /**
93
+ * 处理重新生成
94
+ */
95
+ const handleRegenerate = useCallback(async (messageId: string) => {
96
+ // 1. 移除旧消息
97
+ messageHandler.removeMessageById(messageId);
98
+
99
+ // 2. 创建新的响应消息
100
+ currentQARef.current.abortController = new AbortController();
101
+ messageHandler.createResponseMessage();
102
+
103
+ // 3. 发起请求
104
+ const historyMessages = messageHandler.getHistoryMessages();
105
+ await request(historyMessages);
106
+ }, [messageHandler, request]);
107
+
108
+ // 监听会话切换,重置状态
109
+ useEffect(() => {
110
+ currentQARef.current = {
111
+ request: undefined,
112
+ response: undefined,
113
+ abortController: undefined
114
+ };
115
+ }, [currentSessionId]);
116
+
117
+ // 监听重新生成事件
118
+ useChatAnywhereEventEmitter({
119
+ type: 'handleReplace',
120
+ callback: async (data) => {
121
+ await handleRegenerate(data.detail.id);
122
+ }
123
+ });
124
+
125
+ return {
126
+ handleSubmit,
127
+ handleCancel,
128
+ };
129
+ }
130
+
@@ -0,0 +1,87 @@
1
+ import { uuid } from "@agentscope-ai/chat";
2
+ import { useCallback } from "react";
3
+ import ReactDOM from "react-dom";
4
+ import { IAgentScopeRuntimeWebUIMessage } from "@agentscope-ai/chat";
5
+ import { useChatAnywhereMessages } from "../../Context/ChatAnywhereMessagesContext";
6
+ import AgentScopeRuntimeRequestBuilder from "../../AgentScopeRuntime/Request/Builder";
7
+ import { InputProps } from "../Input";
8
+
9
+ interface UseChatMessageHandlerOptions {
10
+ currentQARef: React.MutableRefObject<{
11
+ request?: IAgentScopeRuntimeWebUIMessage;
12
+ response?: IAgentScopeRuntimeWebUIMessage;
13
+ abortController?: AbortController;
14
+ }>;
15
+ }
16
+
17
+ /**
18
+ * 处理消息创建和更新的 Hook
19
+ */
20
+ export default function useChatMessageHandler(options: UseChatMessageHandlerOptions) {
21
+ const { currentQARef } = options;
22
+ const { updateMessage, getMessages, removeMessage } = useChatAnywhereMessages();
23
+
24
+ /**
25
+ * 创建用户请求消息
26
+ */
27
+ const createRequestMessage = useCallback((data: Parameters<InputProps['onSubmit']>[0]) => {
28
+
29
+ currentQARef.current.abortController = new AbortController();
30
+ currentQARef.current.request = {
31
+ id: uuid(),
32
+ role: 'user',
33
+ cards: [{
34
+ code: 'AgentScopeRuntimeRequestCard',
35
+ data: new AgentScopeRuntimeRequestBuilder(data).data,
36
+ }]
37
+ };
38
+
39
+ ReactDOM.flushSync(() => {
40
+ updateMessage(currentQARef.current.request!);
41
+ });
42
+
43
+ return currentQARef.current.request;
44
+ }, [currentQARef, updateMessage]);
45
+
46
+ /**
47
+ * 创建助手响应消息
48
+ */
49
+ const createResponseMessage = useCallback(() => {
50
+ currentQARef.current.response = {
51
+ id: uuid(),
52
+ role: 'assistant',
53
+ cards: [],
54
+ msgStatus: 'generating',
55
+ };
56
+
57
+ updateMessage(currentQARef.current.response);
58
+
59
+ return currentQARef.current.response;
60
+ }, [currentQARef, updateMessage]);
61
+
62
+ /**
63
+ * 获取历史消息(用于 API 请求)
64
+ */
65
+ const getHistoryMessages = useCallback(() => {
66
+ return AgentScopeRuntimeRequestBuilder.getHistoryMessages(getMessages());
67
+ }, [getMessages]);
68
+
69
+ /**
70
+ * 移除指定消息
71
+ */
72
+ const removeMessageById = useCallback((id: string) => {
73
+ ReactDOM.flushSync(() => {
74
+ removeMessage({ id });
75
+ });
76
+ }, [removeMessage]);
77
+
78
+ return {
79
+ createRequestMessage,
80
+ createResponseMessage,
81
+ getHistoryMessages,
82
+ updateMessage,
83
+ removeMessageById,
84
+ getMessages,
85
+ };
86
+ }
87
+