@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,208 @@
1
+ import { createGlobalStyle } from 'antd-style';
2
+
3
+ export default createGlobalStyle`
4
+ .${(p) => p.theme.prefixCls}-accordion-group {
5
+ width: 100%;
6
+
7
+ svg {
8
+ transform: scale(1.25);
9
+ }
10
+
11
+ .anticon-spin::before,
12
+ .anticon-spin {
13
+ animation-duration: 2s;
14
+ }
15
+ &-icon-success {
16
+ color: ${(p) => p.theme.colorSuccess};
17
+ }
18
+
19
+
20
+
21
+
22
+ @keyframes ${(p) => p.theme.prefixCls}-loading {
23
+ 0% {
24
+ transform: rotate(0deg);
25
+ }
26
+ 100% {
27
+ transform: rotate(360deg);
28
+ }
29
+ }
30
+
31
+ &-icon-error {
32
+ color: ${(p) => p.theme.colorError};
33
+ }
34
+
35
+ &-header {
36
+ display: flex;
37
+ align-items: center;
38
+ gap: 4px;
39
+ color: ${(p) => p.theme.colorTextSecondary};
40
+ padding: 6px 12px;
41
+ font-size: 12px;
42
+ cursor: pointer;
43
+ line-height: 20px;
44
+ background-color: ${(p) => p.theme.colorBgBase};
45
+
46
+ &-arrow {
47
+ display: flex;
48
+ align-items: center;
49
+ }
50
+
51
+ &-close {
52
+ border-radius: ${(p) => p.theme.borderRadiusLG}px;
53
+ border: 1px solid ${(p) => p.theme.colorBorderSecondary};
54
+ display: inline-flex;
55
+ }
56
+
57
+ &-icon {
58
+ position: relative;
59
+ display: flex;
60
+ width: 16px;
61
+ height: 16px;
62
+ align-items: center;
63
+ justify-content: center;
64
+ font-size: 14px;
65
+
66
+ &-line {
67
+ &::before,
68
+ &::after {
69
+ content: '';
70
+ position: absolute;
71
+ width: 1px;
72
+ height: 7px;
73
+ background-color: ${(p) => p.theme.colorBorder};
74
+ left: 50%;
75
+ transform: translateX(-50%);
76
+ }
77
+
78
+ &::before {
79
+ top: -9px;
80
+ }
81
+
82
+ &::after {
83
+ bottom: -9px;
84
+ }
85
+ }
86
+
87
+ &-last::after {
88
+ content: none;
89
+ }
90
+
91
+ &-first::before {
92
+ content: none;
93
+ }
94
+ }
95
+ }
96
+
97
+ &-open {
98
+ overflow: hidden;
99
+ border-radius: 8px;
100
+ border: 1px solid ${(p) => p.theme.colorBorderSecondary};
101
+ background-color: ${(p) => p.theme.colorBgBase};
102
+ }
103
+
104
+ &-body {
105
+ margin: 8px;
106
+ color: ${(p) => p.theme.colorText};
107
+ font-size: 12px;
108
+ border-radius: 8px;
109
+ overflow: hidden;
110
+
111
+ .${(p) => p.theme.prefixCls}-accordion-group-header {
112
+ background-color: transparent;
113
+ }
114
+
115
+
116
+
117
+ .${(p) => p.theme.prefixCls}-accordion-group-header-close,
118
+ .${(p) => p.theme.prefixCls}-accordion-group-open {
119
+ border: 0;
120
+ }
121
+
122
+ .${(p) => p.theme.prefixCls}-accordion-group-header-close {
123
+ display: flex;
124
+ }
125
+
126
+ &-inline {
127
+ padding: 8px 0;
128
+ margin: 0;
129
+ background-color: transparent;
130
+ }
131
+
132
+ > .${(p) => p.theme.prefixCls}-accordion-group {
133
+ background-color: ${(p) => p.theme.colorFillTertiary};
134
+
135
+ &-open {
136
+ border-radius: 0;
137
+ }
138
+ }
139
+
140
+ &-close {
141
+ height: 0;
142
+ padding: 0;
143
+ margin: 0;
144
+ }
145
+ }
146
+ }
147
+
148
+ .${(p) => p.theme.prefixCls}-accordion-deep-thinking {
149
+ font-size: 12px;
150
+ color: ${(p) => p.theme.colorTextSecondary};
151
+ text-align: left;
152
+ white-space: pre-wrap;
153
+ line-height: 20px;
154
+ padding: 0 12px;
155
+ border-left: 1px solid ${(p) => p.theme.colorBorderSecondary};
156
+ }
157
+
158
+ .${(p) => p.theme.prefixCls}-accordion-soft-light-title {
159
+ font-size: 12px;
160
+ position: relative;
161
+ display: inline-block;
162
+ top: 0;
163
+ left: 0;
164
+ width: 100%;
165
+ height: 100%;
166
+ mask-image: linear-gradient(
167
+ 270deg,
168
+ rgba(231, 231, 237, 0.88) 20%,
169
+ rgba(231, 231, 237, 0.5) 50%,
170
+ rgba(255, 255, 255, 0.4) 52%,
171
+ rgba(231, 231, 237, 0.5) 70%,
172
+ rgba(231, 231, 237, 0.88) 80%
173
+ );
174
+ mask-size: 200% 100%;
175
+ animation: softlight-text 3s linear infinite;
176
+ }
177
+
178
+
179
+ @keyframes softlight-text {
180
+ 0% {
181
+ mask-position: 100% 0;
182
+ }
183
+
184
+ 100% {
185
+ mask-position: -100% 0;
186
+ }
187
+ }
188
+
189
+ .${(p) => p.theme.prefixCls}-accordion-content-body {
190
+ border: 1px solid ${(p) => p.theme.colorBorderSecondary};
191
+ border-radius: 8px;
192
+ overflow: hidden;
193
+ &-header {
194
+ display: flex;
195
+ height: 24px;
196
+ align-items: center;
197
+ justify-content: space-between;
198
+ padding: 0 12px;
199
+ border-bottom: 1px solid ${(p) => p.theme.colorBorderSecondary};
200
+ background-color: ${(p) => p.theme.colorFillTertiary};
201
+ color: ${(p) => p.theme.colorText};
202
+ }
203
+
204
+ &-body {
205
+ background-color: ${(p) => p.theme.colorBgBase};
206
+ }
207
+ }
208
+ `;
@@ -0,0 +1,4 @@
1
+ import Demo from '../starter';
2
+
3
+
4
+ export default Demo
@@ -0,0 +1,3 @@
1
+ export { default } from './lib/ChatAnywhere';
2
+ export { default as Demo } from './starter';
3
+ export * from './lib/types';
@@ -0,0 +1,82 @@
1
+ import { IAgentScopeRuntimeWebUIInputData } from "@agentscope-ai/chat";
2
+ import { IAgentScopeRuntimeWebUIMessage } from "@agentscope-ai/chat";
3
+ import { AgentScopeRuntimeContentType, AgentScopeRuntimeMessageType, AgentScopeRuntimeRunStatus, IAgentScopeRuntimeRequest, IContent, IFileContent, IImageContent, ITextContent } from "../types";
4
+
5
+ class AgentScopeRuntimeRequestBuilder {
6
+ data: IAgentScopeRuntimeRequest;
7
+
8
+
9
+ static getHistoryMessages(messages: IAgentScopeRuntimeWebUIMessage[]) {
10
+ return messages.reduce((p, c) => {
11
+ if (!c.cards?.length) {
12
+ return p;
13
+ } else {
14
+ return p.concat(c.cards[0].data.input || c.cards[0].data.output)
15
+ }
16
+ }, [])
17
+ }
18
+
19
+
20
+ isImageFile(file: IAgentScopeRuntimeWebUIInputData['fileList'][number]) {
21
+ return file.type.indexOf('image/') === 0;
22
+ }
23
+
24
+
25
+ buildImageContent(imageFile: IAgentScopeRuntimeWebUIInputData['fileList'][number]): IImageContent {
26
+ return {
27
+ type: AgentScopeRuntimeContentType.IMAGE,
28
+ image_url: imageFile.response?.url,
29
+ status: AgentScopeRuntimeRunStatus.Created,
30
+ }
31
+ }
32
+
33
+ buildTextContent(text: string): ITextContent {
34
+ return {
35
+ type: AgentScopeRuntimeContentType.TEXT,
36
+ text: text,
37
+ status: AgentScopeRuntimeRunStatus.Created,
38
+ }
39
+ }
40
+
41
+ buildFileContent(file: IAgentScopeRuntimeWebUIInputData['fileList'][number]): IFileContent {
42
+ return {
43
+ type: AgentScopeRuntimeContentType.FILE,
44
+ file_url: file.response?.url,
45
+ file_name: file.name,
46
+ file_size: file.size,
47
+ status: AgentScopeRuntimeRunStatus.Created,
48
+ }
49
+ }
50
+
51
+
52
+
53
+ constructor(data: IAgentScopeRuntimeWebUIInputData) {
54
+ const content: IContent[] = [
55
+ this.buildTextContent(data.query),
56
+ ];
57
+
58
+ if (data.fileList?.length) {
59
+ data.fileList.forEach(item => {
60
+ if (this.isImageFile(item)) {
61
+ content.push(this.buildImageContent(item));
62
+ } else {
63
+ content.push(this.buildFileContent(item));
64
+ }
65
+ });
66
+ }
67
+
68
+ this.data = {
69
+ input: [
70
+ {
71
+ role: 'user',
72
+ type: AgentScopeRuntimeMessageType.MESSAGE,
73
+ content: content,
74
+ }
75
+ ],
76
+ };
77
+
78
+ }
79
+ }
80
+
81
+
82
+ export default AgentScopeRuntimeRequestBuilder;
@@ -0,0 +1,52 @@
1
+
2
+ import { AgentScopeRuntimeContentType, IAgentScopeRuntimeRequest } from '../types';
3
+ import { useMemo } from 'react';
4
+ import { Bubble } from '@agentscope-ai/chat';
5
+
6
+ export default function AgentScopeRuntimeRequestCard(props: {
7
+ data: IAgentScopeRuntimeRequest;
8
+ }) {
9
+
10
+ const cards = useMemo(() => {
11
+
12
+ return props.data.input[0].content.reduce<any>((p, c) => {
13
+ if (c.type === AgentScopeRuntimeContentType.TEXT) {
14
+ p.push({
15
+ code: 'Text',
16
+ data: {
17
+ content: c.text,
18
+ },
19
+ });
20
+ }
21
+
22
+ if (c.type === AgentScopeRuntimeContentType.IMAGE) {
23
+ const imageCard = p.find((item: any) => item.code === 'Image');
24
+ if (!imageCard) {
25
+ p.push({
26
+ code: 'Images',
27
+ data: [{ url: c.image_url }],
28
+ });
29
+
30
+ } else {
31
+ imageCard.data.push({ url: c.image_url });
32
+ }
33
+ }
34
+
35
+ if (c.type === AgentScopeRuntimeContentType.FILE) {
36
+ const fileCard = p.find((item: any) => item.code === 'Files');
37
+ if (!fileCard) {
38
+ p.push({
39
+ code: 'Files',
40
+ data: [{ url: c.file_url, name: c.file_name, size: c.file_size }],
41
+ });
42
+ } else {
43
+ fileCard.data.push({ url: c.file_url, name: c.file_name, size: c.file_size });
44
+ }
45
+ }
46
+ return p;
47
+ }, []);
48
+ }, [props.data.input]);
49
+
50
+ return <Bubble role="user" cards={cards}></Bubble>;
51
+ }
52
+
@@ -0,0 +1,39 @@
1
+ import { SparkCopyLine, SparkReplaceLine } from "@agentscope-ai/icons";
2
+ import { IAgentScopeRuntimeResponse } from "../types";
3
+ import AgentScopeRuntimeResponseBuilder from "./Builder";
4
+ import { Bubble } from "@agentscope-ai/chat";
5
+ import { copy, message } from "@agentscope-ai/design";
6
+ import compact from 'lodash/compact';
7
+ import { emit } from "../../Context/useChatAnywhereEventEmitter";
8
+
9
+
10
+ export default function Tools(props: {
11
+ data: IAgentScopeRuntimeResponse
12
+ isLast?: boolean;
13
+ }) {
14
+
15
+ const actions = compact([
16
+ {
17
+ icon: <SparkCopyLine />,
18
+ onClick: () => {
19
+ copy(JSON.stringify(props.data));
20
+ }
21
+ },
22
+ props.isLast ? {
23
+ icon: <SparkReplaceLine />,
24
+ onClick: () => {
25
+ emit({
26
+ type: 'handleReplace',
27
+ data: props,
28
+ })
29
+ }
30
+ } : null,
31
+ ]);
32
+
33
+
34
+ if (!AgentScopeRuntimeResponseBuilder.maybeDone(props.data)) return null;
35
+ return <Bubble.Footer
36
+ left={<Bubble.Footer.Actions data={actions} />}
37
+ />
38
+ }
39
+
@@ -0,0 +1,205 @@
1
+
2
+ import { produce } from "immer";
3
+ import { IAgentScopeRuntimeResponse, AgentScopeRuntimeRunStatus, IAgentScopeRuntimeMessage, IContent, AgentScopeRuntimeContentType, ITextContent, IImageContent, IDataContent, AgentScopeRuntimeMessageType } from "../types";
4
+ import { uuid } from "@agentscope-ai/chat";
5
+
6
+ class AgentScopeRuntimeResponseBuilder {
7
+
8
+ static mergeToolMessages(messages: IAgentScopeRuntimeMessage[]) {
9
+
10
+ const bufferMessagesMap = new Map<string, IDataContent>();
11
+ return messages.reduce<IAgentScopeRuntimeMessage[]>((p, c) => {
12
+
13
+ if (AgentScopeRuntimeResponseBuilder.maybeToolInput(c) && c.content?.length) {
14
+ const content = c.content[0] as IDataContent<{
15
+ name: string;
16
+ }>;
17
+ bufferMessagesMap.set(content.data.name, content);
18
+ return p;
19
+ }
20
+
21
+ if (AgentScopeRuntimeResponseBuilder.maybeToolOutput(c)) {
22
+ const content = c.content[0] as IDataContent<{
23
+ name: string;
24
+ }>;
25
+
26
+ const bufferContent = bufferMessagesMap.get(content.data.name);
27
+
28
+ if (bufferContent) {
29
+ bufferMessagesMap.delete(content.data.name);
30
+ return [...p, { ...c, content: [bufferContent, ...c.content] }];
31
+ } else {
32
+ return p;
33
+ }
34
+ }
35
+
36
+
37
+ return [...p, c]
38
+ }, []);
39
+ }
40
+
41
+
42
+ static maybeToolOutput(message: IAgentScopeRuntimeMessage) {
43
+ return [
44
+ AgentScopeRuntimeMessageType.FUNCTION_CALL_OUTPUT,
45
+ AgentScopeRuntimeMessageType.PLUGIN_CALL_OUTPUT,
46
+ AgentScopeRuntimeMessageType.COMPONENT_CALL_OUTPUT,
47
+ ].includes(message.type);
48
+ }
49
+
50
+ static maybeToolInput(message: IAgentScopeRuntimeMessage) {
51
+ return [
52
+ AgentScopeRuntimeMessageType.FUNCTION_CALL,
53
+ AgentScopeRuntimeMessageType.PLUGIN_CALL,
54
+ AgentScopeRuntimeMessageType.COMPONENT_CALL,
55
+ ].includes(message.type);
56
+ }
57
+
58
+ static maybeGenerating(data: { status: AgentScopeRuntimeRunStatus }) {
59
+ return [
60
+ AgentScopeRuntimeRunStatus.InProgress,
61
+ AgentScopeRuntimeRunStatus.Created,
62
+ ].includes(data.status);
63
+ }
64
+
65
+ static maybeDone(data: { status: AgentScopeRuntimeRunStatus }) {
66
+ return [
67
+ AgentScopeRuntimeRunStatus.Completed,
68
+ AgentScopeRuntimeRunStatus.Canceled,
69
+ AgentScopeRuntimeRunStatus.Failed,
70
+ ].includes(data.status);
71
+ }
72
+
73
+
74
+ data: IAgentScopeRuntimeResponse;
75
+
76
+ constructor({ id, status, created_at }: Pick<IAgentScopeRuntimeResponse, 'id' | 'status' | 'created_at'>) {
77
+ this.data = {
78
+ id: id,
79
+ output: [],
80
+ object: 'response',
81
+ status: status || AgentScopeRuntimeRunStatus.Created,
82
+ created_at: created_at || Date.now(),
83
+ };
84
+ }
85
+
86
+ handleResponse(data: IAgentScopeRuntimeResponse) {
87
+ this.data = produce(this.data, (draft) => {
88
+ if (!data.output) {
89
+ data.output = [];
90
+ }
91
+ Object.assign(draft, data);
92
+ });
93
+ }
94
+
95
+ handleMessage(data: IAgentScopeRuntimeMessage) {
96
+ this.data = produce(this.data, (draft) => {
97
+
98
+
99
+ if (!draft.output) {
100
+ draft.output = [];
101
+ }
102
+
103
+ const existingIndex = draft.output.findIndex(msg => msg.id === data.id);
104
+
105
+ if (existingIndex >= 0) {
106
+ const existingContent = draft.output[existingIndex].content;
107
+ Object.assign(draft.output[existingIndex], data);
108
+ if (!data.content || data.content.length === 0) {
109
+ draft.output[existingIndex].content = existingContent;
110
+ }
111
+ } else {
112
+ draft.output.push(data);
113
+ }
114
+ });
115
+ }
116
+
117
+ handleContent(data: IContent) {
118
+ this.data = produce(this.data, (draft) => {
119
+ const msg = draft.output.find(m => m.id === data.msg_id);
120
+
121
+ if (!msg) {
122
+ console.warn('Message not found for content:', data.msg_id);
123
+ return;
124
+ }
125
+
126
+ if (!msg.content) {
127
+ msg.content = [];
128
+ }
129
+
130
+ if (data.delta) {
131
+ const lastContent = msg.content[msg.content.length - 1];
132
+
133
+ if (lastContent && lastContent.delta) {
134
+ if (data.type === AgentScopeRuntimeContentType.TEXT && lastContent.type === AgentScopeRuntimeContentType.TEXT) {
135
+ (lastContent as ITextContent).text += (data as ITextContent).text;
136
+ } else if (data.type === AgentScopeRuntimeContentType.IMAGE) {
137
+ (lastContent as IImageContent).image_url = (data as IImageContent).image_url;
138
+ } else if (data.type === AgentScopeRuntimeContentType.DATA) {
139
+
140
+ }
141
+ } else {
142
+ msg.content.push(data);
143
+ }
144
+ } else {
145
+ Object.assign(msg.content[msg.content.length - 1], data);
146
+
147
+ }
148
+ });
149
+ }
150
+
151
+ handleError(data: IAgentScopeRuntimeMessage) {
152
+ this.data = produce(this.data, (draft) => {
153
+ draft.status = AgentScopeRuntimeRunStatus.Failed;
154
+
155
+ draft.output.push({
156
+ status: AgentScopeRuntimeRunStatus.Failed,
157
+ type: AgentScopeRuntimeMessageType.ERROR,
158
+ content: [],
159
+ id: uuid(),
160
+ role: 'assistant',
161
+ code: data.code,
162
+ message: typeof data.message === 'string' ? data.message : JSON.stringify(data.message),
163
+ })
164
+ });
165
+ }
166
+
167
+ handle(data: IAgentScopeRuntimeResponse | IAgentScopeRuntimeMessage | IContent) {
168
+ if (data.object === 'response') {
169
+ this.handleResponse(data);
170
+ } else if (data.object === 'message') {
171
+ this.handleMessage(data);
172
+ } else if (data.object === 'content') {
173
+ this.handleContent(data);
174
+ } else {
175
+ this.handleError(data);
176
+ }
177
+
178
+ return this.data;
179
+ }
180
+
181
+ cancel() {
182
+ this.data = produce(this.data, (draft) => {
183
+ if (AgentScopeRuntimeResponseBuilder.maybeGenerating(draft)) {
184
+ draft.status = AgentScopeRuntimeRunStatus.Canceled;
185
+ }
186
+ draft.output.forEach(msg => {
187
+ if (AgentScopeRuntimeResponseBuilder.maybeGenerating(msg)) {
188
+ msg.status = AgentScopeRuntimeRunStatus.Canceled;
189
+ msg.content.forEach(content => {
190
+ if (AgentScopeRuntimeResponseBuilder.maybeGenerating(content)) {
191
+ content.status = AgentScopeRuntimeRunStatus.Canceled;
192
+ }
193
+ });
194
+ }
195
+ });
196
+ });
197
+
198
+ return this.data;
199
+ }
200
+
201
+ }
202
+
203
+
204
+
205
+ export default AgentScopeRuntimeResponseBuilder;
@@ -0,0 +1,44 @@
1
+ import { useMemo } from "react";
2
+ import { AgentScopeRuntimeMessageType, IAgentScopeRuntimeResponse } from "../types";
3
+ import AgentScopeRuntimeResponseBuilder from "./Builder";
4
+ import Message from "./Message";
5
+ import Tool from "./Tool";
6
+ import Reasoning from "./Reasoning";
7
+ import Error from "./Error";
8
+ import { Bubble } from "@agentscope-ai/chat";
9
+ import Actions from "./Actions";
10
+
11
+ export default function AgentScopeRuntimeResponseCard(props: {
12
+ data: IAgentScopeRuntimeResponse;
13
+ isLast?: boolean;
14
+ }) {
15
+ const messages = useMemo(() => {
16
+ return AgentScopeRuntimeResponseBuilder.mergeToolMessages(props.data.output);
17
+ }, [props.data.output])
18
+
19
+
20
+ if (!messages?.length && AgentScopeRuntimeResponseBuilder.maybeGenerating(props.data)) return <Bubble.Spin />;
21
+
22
+ return <>{
23
+ messages.map(item => {
24
+ switch (item.type) {
25
+ case AgentScopeRuntimeMessageType.MESSAGE:
26
+ return <Message key={item.id} data={item} />
27
+ case AgentScopeRuntimeMessageType.PLUGIN_CALL:
28
+ case AgentScopeRuntimeMessageType.PLUGIN_CALL_OUTPUT:
29
+ return <Tool key={item.id} data={item} />
30
+ case AgentScopeRuntimeMessageType.REASONING:
31
+ return <Reasoning key={item.id} data={item} />
32
+ case AgentScopeRuntimeMessageType.ERROR:
33
+ return <Error key={item.id} data={item} />
34
+ case AgentScopeRuntimeMessageType.HEARTBEAT:
35
+ return null;
36
+ default:
37
+ console.warn(`[WIP] Unknown message type: ${item.type}`);
38
+ return null;
39
+ }
40
+ })
41
+ }
42
+ <Actions {...props} />
43
+ </>
44
+ }
@@ -0,0 +1,7 @@
1
+ import { IAgentScopeRuntimeMessage } from "../types";
2
+ import { Bubble } from "@agentscope-ai/chat";
3
+
4
+
5
+ export default function Error({ data }: { data: IAgentScopeRuntimeMessage }) {
6
+ return <Bubble.Interrupted type="error" title={data.code} desc={data.message} />;
7
+ }
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import { Markdown } from '@agentscope-ai/chat';
3
+ import { AgentScopeRuntimeContentType, AgentScopeRuntimeRunStatus, IAgentScopeRuntimeMessage } from "../types";
4
+
5
+ const Message = React.memo(function ({ data }: { data: IAgentScopeRuntimeMessage }) {
6
+ if (!data.content?.length) return null;
7
+
8
+ return <>
9
+ {
10
+ data.content.map((item, index) => {
11
+ switch (item.type) {
12
+ case AgentScopeRuntimeContentType.TEXT:
13
+ return <Markdown key={index} content={item.text} cursor={item.status === AgentScopeRuntimeRunStatus.InProgress ? true : false}></Markdown>
14
+ default:
15
+ return <div key={index}>{JSON.stringify(item)}</div>
16
+ }
17
+ })
18
+ }
19
+ </>
20
+ })
21
+
22
+ export default Message;
23
+
@@ -0,0 +1,16 @@
1
+ import { AgentScopeRuntimeRunStatus, IAgentScopeRuntimeMessage, ITextContent } from "../types";
2
+ import { Thinking } from "@agentscope-ai/chat";
3
+
4
+ export default function Reasoning({ data }: { data: IAgentScopeRuntimeMessage }) {
5
+
6
+ if (data.status === AgentScopeRuntimeRunStatus.Created) return null;
7
+
8
+ const content = data?.content?.[0] as ITextContent;
9
+ if (!content) return null;
10
+
11
+ return <Thinking
12
+ title="Thinking"
13
+ content={content.text}
14
+
15
+ ></Thinking>;
16
+ }