@agentscope-ai/chat 1.1.4

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 (476) hide show
  1. package/README.md +88 -0
  2. package/dist/_util/hooks/use-proxy-imperative-handle.d.ts +4 -0
  3. package/dist/_util/hooks/use-proxy-imperative-handle.js +18 -0
  4. package/dist/_util/type.d.ts +1 -0
  5. package/dist/_util/type.js +1 -0
  6. package/dist/_util/warning.d.ts +30 -0
  7. package/dist/_util/warning.js +63 -0
  8. package/dist/accordion/Accordion.d.ts +22 -0
  9. package/dist/accordion/Accordion.js +93 -0
  10. package/dist/accordion/BodyContent.d.ts +8 -0
  11. package/dist/accordion/BodyContent.js +18 -0
  12. package/dist/accordion/DeepThink.d.ts +7 -0
  13. package/dist/accordion/DeepThink.js +35 -0
  14. package/dist/accordion/index.d.ts +2 -0
  15. package/dist/accordion/index.js +1 -0
  16. package/dist/accordion/index.less +170 -0
  17. package/dist/attachments/DropArea.d.ts +8 -0
  18. package/dist/attachments/DropArea.js +87 -0
  19. package/dist/attachments/FileList/AudioIcon.d.ts +2 -0
  20. package/dist/attachments/FileList/AudioIcon.js +19 -0
  21. package/dist/attachments/FileList/FileListCard.d.ts +12 -0
  22. package/dist/attachments/FileList/FileListCard.js +229 -0
  23. package/dist/attachments/FileList/Progress.d.ts +6 -0
  24. package/dist/attachments/FileList/Progress.js +21 -0
  25. package/dist/attachments/FileList/VideoIcon.d.ts +2 -0
  26. package/dist/attachments/FileList/VideoIcon.js +19 -0
  27. package/dist/attachments/FileList/index.d.ts +16 -0
  28. package/dist/attachments/FileList/index.js +132 -0
  29. package/dist/attachments/PlaceholderUploader.d.ts +17 -0
  30. package/dist/attachments/PlaceholderUploader.js +79 -0
  31. package/dist/attachments/SilentUploader.d.ts +9 -0
  32. package/dist/attachments/SilentUploader.js +23 -0
  33. package/dist/attachments/context.d.ts +5 -0
  34. package/dist/attachments/context.js +2 -0
  35. package/dist/attachments/index.d.ts +33 -0
  36. package/dist/attachments/index.js +166 -0
  37. package/dist/attachments/style/fileCard.d.ts +4 -0
  38. package/dist/attachments/style/fileCard.js +124 -0
  39. package/dist/attachments/style/index.d.ts +10 -0
  40. package/dist/attachments/style/index.js +211 -0
  41. package/dist/attachments/util.d.ts +2 -0
  42. package/dist/attachments/util.js +53 -0
  43. package/dist/bubble/Avatar.d.ts +10 -0
  44. package/dist/bubble/Avatar.js +22 -0
  45. package/dist/bubble/Bubble.d.ts +11 -0
  46. package/dist/bubble/Bubble.js +102 -0
  47. package/dist/bubble/BubbleList.d.ts +15 -0
  48. package/dist/bubble/BubbleList.js +44 -0
  49. package/dist/bubble/Cards.d.ts +21 -0
  50. package/dist/bubble/Cards.js +47 -0
  51. package/dist/bubble/ScrollToBottom.d.ts +7 -0
  52. package/dist/bubble/ScrollToBottom.js +45 -0
  53. package/dist/bubble/Spin.d.ts +2 -0
  54. package/dist/bubble/Spin.js +18 -0
  55. package/dist/bubble/hooks/useDisplayData.d.ts +0 -0
  56. package/dist/bubble/hooks/useDisplayData.js +0 -0
  57. package/dist/bubble/hooks/useListData.d.ts +0 -0
  58. package/dist/bubble/hooks/useListData.js +0 -0
  59. package/dist/bubble/index.d.ts +8 -0
  60. package/dist/bubble/index.js +4 -0
  61. package/dist/bubble/interface.d.ts +26 -0
  62. package/dist/bubble/interface.js +1 -0
  63. package/dist/bubble/loading.d.ts +6 -0
  64. package/dist/bubble/loading.js +17 -0
  65. package/dist/bubble/style/avatar.less +40 -0
  66. package/dist/bubble/style/content.d.ts +4 -0
  67. package/dist/bubble/style/content.js +43 -0
  68. package/dist/bubble/style/index.d.ts +9 -0
  69. package/dist/bubble/style/index.js +53 -0
  70. package/dist/bubble/style/list.less +15 -0
  71. package/dist/bubble/style/scrollToBottom.less +174 -0
  72. package/dist/chat-anywhere/Chat/Ref.d.ts +3 -0
  73. package/dist/chat-anywhere/Chat/Ref.js +19 -0
  74. package/dist/chat-anywhere/Chat/index.d.ts +4 -0
  75. package/dist/chat-anywhere/Chat/index.js +65 -0
  76. package/dist/chat-anywhere/Chat/index.less +54 -0
  77. package/dist/chat-anywhere/Header/index.d.ts +3 -0
  78. package/dist/chat-anywhere/Header/index.js +32 -0
  79. package/dist/chat-anywhere/Header/index.less +24 -0
  80. package/dist/chat-anywhere/Input/index.d.ts +3 -0
  81. package/dist/chat-anywhere/Input/index.js +170 -0
  82. package/dist/chat-anywhere/Input/index.less +12 -0
  83. package/dist/chat-anywhere/Layout/index.d.ts +10 -0
  84. package/dist/chat-anywhere/Layout/index.js +73 -0
  85. package/dist/chat-anywhere/Layout/index.less +61 -0
  86. package/dist/chat-anywhere/SessionList/index.d.ts +5 -0
  87. package/dist/chat-anywhere/SessionList/index.js +115 -0
  88. package/dist/chat-anywhere/SessionList/index.less +52 -0
  89. package/dist/chat-anywhere/hooks/ChatAnywhereProvider.d.ts +43 -0
  90. package/dist/chat-anywhere/hooks/ChatAnywhereProvider.js +90 -0
  91. package/dist/chat-anywhere/hooks/types.d.ts +57 -0
  92. package/dist/chat-anywhere/hooks/types.js +1 -0
  93. package/dist/chat-anywhere/hooks/useInput.d.ts +7 -0
  94. package/dist/chat-anywhere/hooks/useInput.js +21 -0
  95. package/dist/chat-anywhere/hooks/useMessages.d.ts +11 -0
  96. package/dist/chat-anywhere/hooks/useMessages.js +56 -0
  97. package/dist/chat-anywhere/hooks/useSessionList.d.ts +24 -0
  98. package/dist/chat-anywhere/hooks/useSessionList.js +120 -0
  99. package/dist/chat-anywhere/index.d.ts +9 -0
  100. package/dist/chat-anywhere/index.js +58 -0
  101. package/dist/conversations/GroupTitle.d.ts +10 -0
  102. package/dist/conversations/GroupTitle.js +15 -0
  103. package/dist/conversations/Item.d.ts +14 -0
  104. package/dist/conversations/Item.js +96 -0
  105. package/dist/conversations/hooks/useGroupable.d.ts +9 -0
  106. package/dist/conversations/hooks/useGroupable.js +72 -0
  107. package/dist/conversations/index.d.ts +62 -0
  108. package/dist/conversations/index.js +124 -0
  109. package/dist/conversations/interface.d.ts +60 -0
  110. package/dist/conversations/interface.js +1 -0
  111. package/dist/conversations/style/index.d.ts +9 -0
  112. package/dist/conversations/style/index.js +80 -0
  113. package/dist/default-cards/Count/index.d.ts +3 -0
  114. package/dist/default-cards/Count/index.js +16 -0
  115. package/dist/default-cards/Count/index.less +19 -0
  116. package/dist/default-cards/DeepThink/index.d.ts +11 -0
  117. package/dist/default-cards/DeepThink/index.js +11 -0
  118. package/dist/default-cards/DeepThink/index.less +0 -0
  119. package/dist/default-cards/Files/index.d.ts +2 -0
  120. package/dist/default-cards/Files/index.js +18 -0
  121. package/dist/default-cards/Footer/index.d.ts +19 -0
  122. package/dist/default-cards/Footer/index.js +50 -0
  123. package/dist/default-cards/Footer/index.less +41 -0
  124. package/dist/default-cards/Images/index.d.ts +3 -0
  125. package/dist/default-cards/Images/index.js +33 -0
  126. package/dist/default-cards/Images/index.less +17 -0
  127. package/dist/default-cards/Interrupted/index.d.ts +11 -0
  128. package/dist/default-cards/Interrupted/index.js +40 -0
  129. package/dist/default-cards/Interrupted/index.less +57 -0
  130. package/dist/default-cards/Text/index.d.ts +2 -0
  131. package/dist/default-cards/Text/index.js +12 -0
  132. package/dist/default-cards/index.d.ts +6 -0
  133. package/dist/default-cards/index.js +6 -0
  134. package/dist/disclaimer/index.d.ts +11 -0
  135. package/dist/disclaimer/index.js +26 -0
  136. package/dist/docs/1896.async.js +457 -0
  137. package/dist/docs/2710.async.js +62 -0
  138. package/dist/docs/2863.async.js +400 -0
  139. package/dist/docs/3057.async.js +46 -0
  140. package/dist/docs/3364.async.js +25 -0
  141. package/dist/docs/404.html +15 -0
  142. package/dist/docs/4820.async.js +1381 -0
  143. package/dist/docs/5623.async.js +60 -0
  144. package/dist/docs/5757.async.js +1 -0
  145. package/dist/docs/5804.async.js +271 -0
  146. package/dist/docs/6198.async.js +18 -0
  147. package/dist/docs/6671.async.js +137 -0
  148. package/dist/docs/7195.async.js +1 -0
  149. package/dist/docs/7485.async.js +29 -0
  150. package/dist/docs/7931.async.js +19 -0
  151. package/dist/docs/7997.async.js +5 -0
  152. package/dist/docs/8156.async.js +110 -0
  153. package/dist/docs/8368.async.js +2 -0
  154. package/dist/docs/8480.async.js +1449 -0
  155. package/dist/docs/8618.async.js +246 -0
  156. package/dist/docs/9016.async.js +32 -0
  157. package/dist/docs/9016.chunk.css +1 -0
  158. package/dist/docs/9335.async.js +11 -0
  159. package/dist/docs/accordion__demos.async.js +9 -0
  160. package/dist/docs/attachments__demos.async.js +1 -0
  161. package/dist/docs/bubble__demos.async.js +50 -0
  162. package/dist/docs/components/accordion/index.html +15 -0
  163. package/dist/docs/components/accordion-cn/index.html +15 -0
  164. package/dist/docs/components/attachments/index.html +15 -0
  165. package/dist/docs/components/attachments-cn/index.html +15 -0
  166. package/dist/docs/components/bubble/index.html +15 -0
  167. package/dist/docs/components/bubble-cn/index.html +15 -0
  168. package/dist/docs/components/bubble-list/index.html +15 -0
  169. package/dist/docs/components/bubble-list-cn/index.html +15 -0
  170. package/dist/docs/components/conversations/index.html +15 -0
  171. package/dist/docs/components/conversations-cn/index.html +15 -0
  172. package/dist/docs/components/disclaimer/index.html +15 -0
  173. package/dist/docs/components/disclaimer-cn/index.html +15 -0
  174. package/dist/docs/components/footer/index.html +15 -0
  175. package/dist/docs/components/footer-cn/index.html +15 -0
  176. package/dist/docs/components/markdown/index.html +15 -0
  177. package/dist/docs/components/markdown-cn/index.html +15 -0
  178. package/dist/docs/components/sender/index.html +15 -0
  179. package/dist/docs/components/sender-cn/index.html +15 -0
  180. package/dist/docs/components/status/index.html +15 -0
  181. package/dist/docs/components/status-cn/index.html +15 -0
  182. package/dist/docs/components/welcome/index.html +15 -0
  183. package/dist/docs/components/welcome-cn/index.html +15 -0
  184. package/dist/docs/components__accordion__index.en-US.md.async.js +6 -0
  185. package/dist/docs/components__accordion__index.en-US.md.chunk.css +1 -0
  186. package/dist/docs/components__accordion__index.zh-CN.md.async.js +6 -0
  187. package/dist/docs/components__accordion__index.zh-CN.md.chunk.css +1 -0
  188. package/dist/docs/components__attachments__index.en-US.md.async.js +1 -0
  189. package/dist/docs/components__attachments__index.en-US.md.chunk.css +1 -0
  190. package/dist/docs/components__attachments__index.zh-CN.md.async.js +1 -0
  191. package/dist/docs/components__attachments__index.zh-CN.md.chunk.css +1 -0
  192. package/dist/docs/components__bubble-list__index.en-US.md.async.js +2 -0
  193. package/dist/docs/components__bubble-list__index.en-US.md.chunk.css +1 -0
  194. package/dist/docs/components__bubble-list__index.zh-CN.md.async.js +2 -0
  195. package/dist/docs/components__bubble-list__index.zh-CN.md.chunk.css +1 -0
  196. package/dist/docs/components__bubble__index.en-US.md.async.js +1 -0
  197. package/dist/docs/components__bubble__index.en-US.md.chunk.css +1 -0
  198. package/dist/docs/components__bubble__index.zh-CN.md.async.js +1 -0
  199. package/dist/docs/components__bubble__index.zh-CN.md.chunk.css +1 -0
  200. package/dist/docs/components__conversations__index.en-US.md.async.js +2 -0
  201. package/dist/docs/components__conversations__index.en-US.md.chunk.css +1 -0
  202. package/dist/docs/components__conversations__index.zh-CN.md.async.js +1 -0
  203. package/dist/docs/components__conversations__index.zh-CN.md.chunk.css +1 -0
  204. package/dist/docs/components__disclaimer__index.en-US.md.async.js +1 -0
  205. package/dist/docs/components__disclaimer__index.en-US.md.chunk.css +1 -0
  206. package/dist/docs/components__disclaimer__index.zh-CN.md.async.js +1 -0
  207. package/dist/docs/components__disclaimer__index.zh-CN.md.chunk.css +1 -0
  208. package/dist/docs/components__footer__index.en-US.md.async.js +1 -0
  209. package/dist/docs/components__footer__index.en-US.md.chunk.css +1 -0
  210. package/dist/docs/components__footer__index.zh-CN.md.async.js +2 -0
  211. package/dist/docs/components__footer__index.zh-CN.md.chunk.css +1 -0
  212. package/dist/docs/components__markdown__index.en-US.md.async.js +1 -0
  213. package/dist/docs/components__markdown__index.en-US.md.chunk.css +1 -0
  214. package/dist/docs/components__markdown__index.zh-CN.md.async.js +1 -0
  215. package/dist/docs/components__markdown__index.zh-CN.md.chunk.css +1 -0
  216. package/dist/docs/components__sender__index.en-US.md.async.js +1 -0
  217. package/dist/docs/components__sender__index.en-US.md.chunk.css +1 -0
  218. package/dist/docs/components__sender__index.zh-CN.md.async.js +1 -0
  219. package/dist/docs/components__sender__index.zh-CN.md.chunk.css +1 -0
  220. package/dist/docs/components__status__index.en-US.md.async.js +1 -0
  221. package/dist/docs/components__status__index.en-US.md.chunk.css +1 -0
  222. package/dist/docs/components__status__index.zh-CN.md.async.js +2 -0
  223. package/dist/docs/components__status__index.zh-CN.md.chunk.css +1 -0
  224. package/dist/docs/components__welcome__index.en-US.md.async.js +2 -0
  225. package/dist/docs/components__welcome__index.en-US.md.chunk.css +1 -0
  226. package/dist/docs/components__welcome__index.zh-CN.md.async.js +2 -0
  227. package/dist/docs/components__welcome__index.zh-CN.md.chunk.css +1 -0
  228. package/dist/docs/conversations__demos.async.js +1 -0
  229. package/dist/docs/demos.async.js +47 -0
  230. package/dist/docs/demos.chunk.css +1 -0
  231. package/dist/docs/disclaimer__demos.async.js +1 -0
  232. package/dist/docs/docs/development/ag-ui/index.html +15 -0
  233. package/dist/docs/docs/development/ag-ui-cn/index.html +15 -0
  234. package/dist/docs/docs/development/backend/index.html +15 -0
  235. package/dist/docs/docs/development/backend-cn/index.html +15 -0
  236. package/dist/docs/docs/development/cards/index.html +15 -0
  237. package/dist/docs/docs/development/cards-cn/index.html +15 -0
  238. package/dist/docs/docs/development/chatanywhere/index.html +15 -0
  239. package/dist/docs/docs/development/chatanywhere-api/index.html +15 -0
  240. package/dist/docs/docs/development/chatanywhere-api-cn/index.html +15 -0
  241. package/dist/docs/docs/development/chatanywhere-cn/index.html +15 -0
  242. package/dist/docs/docs/development/custom/index.html +15 -0
  243. package/dist/docs/docs/development/custom-cn/index.html +15 -0
  244. package/dist/docs/docs/development/overview/index.html +15 -0
  245. package/dist/docs/docs/development/overview-cn/index.html +15 -0
  246. package/dist/docs/docs/development/qwen/index.html +15 -0
  247. package/dist/docs/docs/development/qwen-cn/index.html +15 -0
  248. package/dist/docs/docs/templates/copilot/index.html +15 -0
  249. package/dist/docs/docs/templates/copilot-cn/index.html +15 -0
  250. package/dist/docs/docs/templates/native/index.html +15 -0
  251. package/dist/docs/docs/templates/native-cn/index.html +15 -0
  252. package/dist/docs/docs/templates/voice/index.html +15 -0
  253. package/dist/docs/docs/templates/voice-cn/index.html +15 -0
  254. package/dist/docs/docs__development__ag-ui.en-US.md.async.js +210 -0
  255. package/dist/docs/docs__development__ag-ui.en-US.md.chunk.css +1 -0
  256. package/dist/docs/docs__development__ag-ui.zh-CN.md.async.js +210 -0
  257. package/dist/docs/docs__development__ag-ui.zh-CN.md.chunk.css +1 -0
  258. package/dist/docs/docs__development__backend.en-US.md.async.js +12 -0
  259. package/dist/docs/docs__development__backend.en-US.md.chunk.css +1 -0
  260. package/dist/docs/docs__development__backend.zh-CN.md.async.js +12 -0
  261. package/dist/docs/docs__development__backend.zh-CN.md.chunk.css +1 -0
  262. package/dist/docs/docs__development__cards.en-US.md.async.js +27 -0
  263. package/dist/docs/docs__development__cards.en-US.md.chunk.css +1 -0
  264. package/dist/docs/docs__development__cards.zh-CN.md.async.js +27 -0
  265. package/dist/docs/docs__development__cards.zh-CN.md.chunk.css +1 -0
  266. package/dist/docs/docs__development__chatanywhere-api.en-US.md.async.js +69 -0
  267. package/dist/docs/docs__development__chatanywhere-api.en-US.md.chunk.css +1 -0
  268. package/dist/docs/docs__development__chatanywhere-api.zh-CN.md.async.js +69 -0
  269. package/dist/docs/docs__development__chatanywhere-api.zh-CN.md.chunk.css +1 -0
  270. package/dist/docs/docs__development__chatanywhere.en-US.md.async.js +77 -0
  271. package/dist/docs/docs__development__chatanywhere.en-US.md.chunk.css +1 -0
  272. package/dist/docs/docs__development__chatanywhere.zh-CN.md.async.js +77 -0
  273. package/dist/docs/docs__development__chatanywhere.zh-CN.md.chunk.css +1 -0
  274. package/dist/docs/docs__development__custom.en-US.md.async.js +22 -0
  275. package/dist/docs/docs__development__custom.en-US.md.chunk.css +1 -0
  276. package/dist/docs/docs__development__custom.zh-CN.md.async.js +22 -0
  277. package/dist/docs/docs__development__custom.zh-CN.md.chunk.css +1 -0
  278. package/dist/docs/docs__development__overview.en-US.md.async.js +21 -0
  279. package/dist/docs/docs__development__overview.en-US.md.chunk.css +1 -0
  280. package/dist/docs/docs__development__overview.zh-CN.md.async.js +21 -0
  281. package/dist/docs/docs__development__overview.zh-CN.md.chunk.css +1 -0
  282. package/dist/docs/docs__development__qwen.en-US.md.async.js +25 -0
  283. package/dist/docs/docs__development__qwen.en-US.md.chunk.css +1 -0
  284. package/dist/docs/docs__development__qwen.zh-CN.md.async.js +25 -0
  285. package/dist/docs/docs__development__qwen.zh-CN.md.chunk.css +1 -0
  286. package/dist/docs/docs__templates__copilot.en-US.md.async.js +1 -0
  287. package/dist/docs/docs__templates__copilot.en-US.md.chunk.css +1 -0
  288. package/dist/docs/docs__templates__copilot.zh-CN.md.async.js +1 -0
  289. package/dist/docs/docs__templates__copilot.zh-CN.md.chunk.css +1 -0
  290. package/dist/docs/docs__templates__native.en-US.md.async.js +1 -0
  291. package/dist/docs/docs__templates__native.en-US.md.chunk.css +1 -0
  292. package/dist/docs/docs__templates__native.zh-CN.md.async.js +1 -0
  293. package/dist/docs/docs__templates__native.zh-CN.md.chunk.css +1 -0
  294. package/dist/docs/docs__templates__voice.en-US.md.async.js +20 -0
  295. package/dist/docs/docs__templates__voice.en-US.md.chunk.css +1 -0
  296. package/dist/docs/docs__templates__voice.zh-CN.md.async.js +1 -0
  297. package/dist/docs/docs__templates__voice.zh-CN.md.chunk.css +1 -0
  298. package/dist/docs/dumi__pages__index__index.en-US.async.js +1 -0
  299. package/dist/docs/dumi__pages__index__index.en-US.chunk.css +1 -0
  300. package/dist/docs/dumi__pages__index__index.zh-CN.async.js +1 -0
  301. package/dist/docs/dumi__pages__index__index.zh-CN.chunk.css +1 -0
  302. package/dist/docs/dumi__theme__layouts__DocLayout__index.async.js +1 -0
  303. package/dist/docs/dumi__theme__layouts__DocLayout__index.chunk.css +1 -0
  304. package/dist/docs/dumi__theme__layouts__GlobalLayout__index.async.js +18 -0
  305. package/dist/docs/dumi__theme__layouts__GlobalLayout__index.chunk.css +1 -0
  306. package/dist/docs/dumi__tmp-production__dumi__theme__ContextWrapper.async.js +1 -0
  307. package/dist/docs/index/index.html +15 -0
  308. package/dist/docs/index-cn/index.html +15 -0
  309. package/dist/docs/markdown__demos.async.js +164 -0
  310. package/dist/docs/meta__components__en-US.async.js +9 -0
  311. package/dist/docs/meta__components__zh-CN.async.js +10 -0
  312. package/dist/docs/meta__docs__en-US.async.js +475 -0
  313. package/dist/docs/meta__docs__en-US.chunk.css +1 -0
  314. package/dist/docs/meta__docs__zh-CN.async.js +456 -0
  315. package/dist/docs/meta__docs__zh-CN.chunk.css +1 -0
  316. package/dist/docs/nm__dumi__dist__client__pages__404.async.js +1 -0
  317. package/dist/docs/nm__dumi__dist__client__pages__Demo__index.async.js +1 -0
  318. package/dist/docs/nm__dumi__dist__client__pages__Demo__index.chunk.css +1 -0
  319. package/dist/docs/preload_helper.js +1 -0
  320. package/dist/docs/sender__demos.async.js +1 -0
  321. package/dist/docs/umi.css +1 -0
  322. package/dist/docs/umi.js +107 -0
  323. package/dist/docs/welcome__demos.async.js +1 -0
  324. package/dist/docs/~demos/:id/index.html +15 -0
  325. package/dist/docs/~demos/accordion-demo-inline/index.html +15 -0
  326. package/dist/docs/~demos/accordion-demo-mutisteps/index.html +15 -0
  327. package/dist/docs/~demos/accordion-demo-thinking/index.html +15 -0
  328. package/dist/docs/~demos/attachments-demo-files/index.html +15 -0
  329. package/dist/docs/~demos/bubble-demo-basic/index.html +15 -0
  330. package/dist/docs/~demos/bubble-demo-havestopped/index.html +15 -0
  331. package/dist/docs/~demos/bubble-demo-userwithfile/index.html +15 -0
  332. package/dist/docs/~demos/bubble-demo-userwithimage/index.html +15 -0
  333. package/dist/docs/~demos/bubble-demo-userwithnormal/index.html +15 -0
  334. package/dist/docs/~demos/bubble-demo-withavatar/index.html +15 -0
  335. package/dist/docs/~demos/bubble-demo-withcode/index.html +15 -0
  336. package/dist/docs/~demos/bubble-demo-witherror/index.html +15 -0
  337. package/dist/docs/~demos/bubble-demo-witherrordetail/index.html +15 -0
  338. package/dist/docs/~demos/bubble-demo-withimage/index.html +15 -0
  339. package/dist/docs/~demos/bubble-demo-withusage/index.html +15 -0
  340. package/dist/docs/~demos/bubble-demo-withwaitingmessage/index.html +15 -0
  341. package/dist/docs/~demos/components-bubble-list-demo-basic/index.html +15 -0
  342. package/dist/docs/~demos/components-footer-demo-basic/index.html +15 -0
  343. package/dist/docs/~demos/components-footer-demo-withusage/index.html +15 -0
  344. package/dist/docs/~demos/components-status-demo-basic/index.html +15 -0
  345. package/dist/docs/~demos/conversations-demo-basic/index.html +15 -0
  346. package/dist/docs/~demos/disclaimer-demo-demo/index.html +15 -0
  347. package/dist/docs/~demos/disclaimer-demo-withlink/index.html +15 -0
  348. package/dist/docs/~demos/docs-development-ag-ui-demo-with-copilotkit/index.html +15 -0
  349. package/dist/docs/~demos/docs-development-cards-demo-file/index.html +15 -0
  350. package/dist/docs/~demos/docs-development-cards-demo-footer/index.html +15 -0
  351. package/dist/docs/~demos/docs-development-cards-demo-image/index.html +15 -0
  352. package/dist/docs/~demos/docs-development-cards-demo-text/index.html +15 -0
  353. package/dist/docs/~demos/docs-development-custom-demo-custom/index.html +15 -0
  354. package/dist/docs/~demos/docs-templates-copilot-demo-copilot/index.html +15 -0
  355. package/dist/docs/~demos/docs-templates-native-demo-basic/index.html +15 -0
  356. package/dist/docs/~demos/docs-templates-voice-demo-demo/index.html +15 -0
  357. package/dist/docs/~demos/markdown-demo-citations/index.html +15 -0
  358. package/dist/docs/~demos/markdown-demo-cursor/index.html +15 -0
  359. package/dist/docs/~demos/markdown-demo-mathjax/index.html +15 -0
  360. package/dist/docs/~demos/markdown-demo-md/index.html +15 -0
  361. package/dist/docs/~demos/sender-demo-basic/index.html +15 -0
  362. package/dist/docs/~demos/sender-demo-disabled/index.html +15 -0
  363. package/dist/docs/~demos/sender-demo-loading/index.html +15 -0
  364. package/dist/docs/~demos/sender-demo-moreprefixaction/index.html +15 -0
  365. package/dist/docs/~demos/sender-demo-withfile/index.html +15 -0
  366. package/dist/docs/~demos/welcome-demo-demo0/index.html +15 -0
  367. package/dist/docs/~demos/welcome-demo-demo1/index.html +15 -0
  368. package/dist/docs/~demos/welcome-demo-demo2/index.html +15 -0
  369. package/dist/index.d.ts +26 -0
  370. package/dist/index.js +20 -0
  371. package/dist/index.less +1 -0
  372. package/dist/markdown/Citation.d.ts +16 -0
  373. package/dist/markdown/Citation.js +55 -0
  374. package/dist/markdown/CodeBlock.d.ts +6 -0
  375. package/dist/markdown/CodeBlock.js +88 -0
  376. package/dist/markdown/ImageOrVideo.d.ts +2 -0
  377. package/dist/markdown/ImageOrVideo.js +81 -0
  378. package/dist/markdown/Link.d.ts +3 -0
  379. package/dist/markdown/Link.js +28 -0
  380. package/dist/markdown/Markdown.d.ts +4 -0
  381. package/dist/markdown/Markdown.js +121 -0
  382. package/dist/markdown/cursor/Blur.d.ts +3 -0
  383. package/dist/markdown/cursor/Blur.js +7 -0
  384. package/dist/markdown/cursor/Dot.d.ts +3 -0
  385. package/dist/markdown/cursor/Dot.js +16 -0
  386. package/dist/markdown/cursor/Underline.d.ts +3 -0
  387. package/dist/markdown/cursor/Underline.js +7 -0
  388. package/dist/markdown/cursor/index.less +124 -0
  389. package/dist/markdown/hooks/index.d.ts +1 -0
  390. package/dist/markdown/hooks/index.js +49 -0
  391. package/dist/markdown/hooks/useTypedEffect.d.ts +6 -0
  392. package/dist/markdown/hooks/useTypedEffect.js +56 -0
  393. package/dist/markdown/index.d.ts +16 -0
  394. package/dist/markdown/index.js +37 -0
  395. package/dist/markdown/index.less +204 -0
  396. package/dist/markdown/plugins/footnote.d.ts +2 -0
  397. package/dist/markdown/plugins/footnote.js +89 -0
  398. package/dist/markdown/plugins/katexDir.d.ts +1 -0
  399. package/dist/markdown/plugins/katexDir.js +15 -0
  400. package/dist/markdown/rehype/fadeIn.d.ts +2 -0
  401. package/dist/markdown/rehype/fadeIn.js +43 -0
  402. package/dist/markdown/type.d.ts +46 -0
  403. package/dist/markdown/type.js +1 -0
  404. package/dist/markdown/utils.d.ts +22 -0
  405. package/dist/markdown/utils.js +125 -0
  406. package/dist/provider/CustomCardsProvider.d.ts +15 -0
  407. package/dist/provider/CustomCardsProvider.js +18 -0
  408. package/dist/provider/GlobalProvider.d.ts +5 -0
  409. package/dist/provider/GlobalProvider.js +11 -0
  410. package/dist/provider/index.d.ts +8 -0
  411. package/dist/provider/index.js +20 -0
  412. package/dist/provider/types.d.ts +8 -0
  413. package/dist/provider/types.js +1 -0
  414. package/dist/sender/SenderHeader.d.ts +19 -0
  415. package/dist/sender/SenderHeader.js +79 -0
  416. package/dist/sender/StopLoading.d.ts +5 -0
  417. package/dist/sender/StopLoading.js +20 -0
  418. package/dist/sender/components/ActionButton.d.ts +22 -0
  419. package/dist/sender/components/ActionButton.js +39 -0
  420. package/dist/sender/components/ClearButton.d.ts +4 -0
  421. package/dist/sender/components/ClearButton.js +13 -0
  422. package/dist/sender/components/LoadingButton.d.ts +4 -0
  423. package/dist/sender/components/LoadingButton.js +22 -0
  424. package/dist/sender/components/SendButton.d.ts +4 -0
  425. package/dist/sender/components/SendButton.js +14 -0
  426. package/dist/sender/components/SpeechButton/RecordingIcon.d.ts +5 -0
  427. package/dist/sender/components/SpeechButton/RecordingIcon.js +49 -0
  428. package/dist/sender/components/SpeechButton/index.d.ts +4 -0
  429. package/dist/sender/components/SpeechButton/index.js +30 -0
  430. package/dist/sender/index.d.ts +61 -0
  431. package/dist/sender/index.js +307 -0
  432. package/dist/sender/style/header.d.ts +4 -0
  433. package/dist/sender/style/header.js +46 -0
  434. package/dist/sender/style/index.d.ts +10 -0
  435. package/dist/sender/style/index.js +123 -0
  436. package/dist/sender/useSpeech.d.ts +6 -0
  437. package/dist/sender/useSpeech.js +114 -0
  438. package/dist/stream/index.d.ts +34 -0
  439. package/dist/stream/index.en-US.md.bk +50 -0
  440. package/dist/stream/index.js +197 -0
  441. package/dist/stream/index.zh-CN.md.bk +51 -0
  442. package/dist/theme/components.d.ts +10 -0
  443. package/dist/theme/components.js +1 -0
  444. package/dist/theme/cssinjs-utils.d.ts +14 -0
  445. package/dist/theme/cssinjs-utils.js +1 -0
  446. package/dist/theme/genStyleUtils.d.ts +28 -0
  447. package/dist/theme/genStyleUtils.js +49 -0
  448. package/dist/theme/useToken.d.ts +18 -0
  449. package/dist/theme/useToken.js +110 -0
  450. package/dist/version/index.d.ts +2 -0
  451. package/dist/version/index.js +2 -0
  452. package/dist/voice-chat/Recorder/index.d.ts +26 -0
  453. package/dist/voice-chat/Recorder/index.js +168 -0
  454. package/dist/voice-chat/VoiceChatProvider/context.d.ts +22 -0
  455. package/dist/voice-chat/VoiceChatProvider/context.js +3 -0
  456. package/dist/voice-chat/VoiceChatProvider/hooks/useChatState.d.ts +1 -0
  457. package/dist/voice-chat/VoiceChatProvider/hooks/useChatState.js +5 -0
  458. package/dist/voice-chat/VoiceChatProvider/hooks/useMessages.d.ts +8 -0
  459. package/dist/voice-chat/VoiceChatProvider/hooks/useMessages.js +31 -0
  460. package/dist/voice-chat/VoiceChatProvider/hooks/useRecorder.d.ts +5 -0
  461. package/dist/voice-chat/VoiceChatProvider/hooks/useRecorder.js +48 -0
  462. package/dist/voice-chat/VoiceChatProvider/hooks/useVoiceChat.d.ts +4 -0
  463. package/dist/voice-chat/VoiceChatProvider/hooks/useVoiceChat.js +10 -0
  464. package/dist/voice-chat/VoiceChatProvider/index.d.ts +9 -0
  465. package/dist/voice-chat/VoiceChatProvider/index.js +55 -0
  466. package/dist/voice-chat/VoiceChatService/index.d.ts +34 -0
  467. package/dist/voice-chat/VoiceChatService/index.js +209 -0
  468. package/dist/voice-chat/index.d.ts +2 -0
  469. package/dist/voice-chat/index.js +2 -0
  470. package/dist/voice-chat/types/index.d.ts +12 -0
  471. package/dist/voice-chat/types/index.js +4 -0
  472. package/dist/welcome/icon.d.ts +2 -0
  473. package/dist/welcome/icon.js +38 -0
  474. package/dist/welcome/index.d.ts +9 -0
  475. package/dist/welcome/index.js +57 -0
  476. package/package.json +117 -0
@@ -0,0 +1,211 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ import { mergeToken } from '@ant-design/cssinjs-utils';
8
+ import { FastColor } from '@ant-design/fast-color';
9
+ import { genStyleHooks } from "../../theme/genStyleUtils";
10
+ import genFileCardStyle from "./fileCard";
11
+
12
+ // biome-ignore lint/suspicious/noEmptyInterface: ComponentToken need to be empty by default
13
+
14
+ var anyBoxSizing = {
15
+ '&, *': {
16
+ boxSizing: 'border-box'
17
+ }
18
+ };
19
+ var genAttachmentsStyle = function genAttachmentsStyle(token) {
20
+ var componentCls = token.componentCls,
21
+ calc = token.calc,
22
+ antCls = token.antCls;
23
+ var dropAreaCls = "".concat(componentCls, "-drop-area");
24
+ var placeholderCls = "".concat(componentCls, "-placeholder");
25
+ return _defineProperty(_defineProperty({}, dropAreaCls, _objectSpread(_objectSpread({
26
+ position: 'absolute',
27
+ inset: 0,
28
+ zIndex: token.zIndexPopupBase
29
+ }, anyBoxSizing), {}, _defineProperty({
30
+ '&-on-body': {
31
+ position: 'fixed',
32
+ inset: 0
33
+ },
34
+ '&-hide-placement': _defineProperty({}, "".concat(placeholderCls, "-inner"), {
35
+ display: 'none'
36
+ })
37
+ }, placeholderCls, {
38
+ padding: 0
39
+ }))), '&', _defineProperty({}, placeholderCls, _objectSpread(_objectSpread({
40
+ height: '100%',
41
+ borderRadius: token.borderRadius,
42
+ borderWidth: token.lineWidthBold,
43
+ borderStyle: 'dashed',
44
+ borderColor: 'transparent',
45
+ padding: token.padding,
46
+ position: 'relative',
47
+ backdropFilter: 'blur(10px)',
48
+ background: token.colorBgPlaceholderHover
49
+ }, anyBoxSizing), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(antCls, "-upload-wrapper ").concat(antCls, "-upload").concat(antCls, "-upload-btn"), {
50
+ padding: 0
51
+ }), "&".concat(placeholderCls, "-drag-in"), {
52
+ borderColor: token.colorPrimaryHover
53
+ }), "&".concat(placeholderCls, "-disabled"), {
54
+ opacity: 0.25,
55
+ pointerEvents: 'none'
56
+ }), "".concat(placeholderCls, "-inner"), {
57
+ gap: calc(token.paddingXXS).div(2).equal()
58
+ }), "".concat(placeholderCls, "-icon"), {
59
+ fontSize: token.fontSizeHeading2,
60
+ lineHeight: 1
61
+ }), "".concat(placeholderCls, "-title").concat(placeholderCls, "-title"), {
62
+ margin: 0,
63
+ fontSize: token.fontSize,
64
+ lineHeight: token.lineHeight
65
+ }), "".concat(placeholderCls, "-description"), {}))));
66
+ };
67
+ var genFileListStyle = function genFileListStyle(token) {
68
+ var componentCls = token.componentCls,
69
+ calc = token.calc;
70
+ var fileListCls = "".concat(componentCls, "-list");
71
+ var cardHeight = calc(token.fontSize).mul(token.lineHeight).mul(2).add(token.paddingSM).add(token.paddingSM).equal();
72
+ return _defineProperty({}, componentCls, _objectSpread(_objectSpread({
73
+ position: 'relative',
74
+ width: '100%'
75
+ }, anyBoxSizing), {}, _defineProperty({}, fileListCls, {
76
+ display: 'flex',
77
+ gap: token.paddingSM,
78
+ fontSize: token.fontSize,
79
+ lineHeight: token.lineHeight,
80
+ color: token.colorText,
81
+ // flexWrap: 'wrap',
82
+ // paddingBlock: token.paddingSM,
83
+ // paddingInline: token.padding,
84
+ // background: token.colorBgContainer,
85
+ width: '100%',
86
+ overflow: 'auto',
87
+ padding: token.padding,
88
+ paddingBottom: 0,
89
+ // Hide scrollbar
90
+ scrollbarWidth: 'none',
91
+ '-ms-overflow-style': 'none',
92
+ '&::-webkit-scrollbar': {
93
+ display: 'none'
94
+ },
95
+ // Scroll
96
+ '&-overflow-scrollX, &-overflow-scrollY': {
97
+ '&:before, &:after': {
98
+ content: '""',
99
+ position: 'absolute',
100
+ opacity: 0,
101
+ transition: "opacity ".concat(token.motionDurationSlow),
102
+ zIndex: 1
103
+ }
104
+ },
105
+ '&-overflow-ping-start:before': {
106
+ opacity: 1
107
+ },
108
+ '&-overflow-ping-end:after': {
109
+ opacity: 1
110
+ },
111
+ '&-overflow-scrollX': {
112
+ overflowX: 'auto',
113
+ overflowY: 'hidden',
114
+ flexWrap: 'nowrap',
115
+ '&:before, &:after': {
116
+ insetBlock: 0,
117
+ width: 8
118
+ },
119
+ '&:before': {
120
+ insetInlineStart: 0,
121
+ background: "linear-gradient(to right, rgba(0,0,0,0.06), rgba(0,0,0,0));"
122
+ },
123
+ '&:after': {
124
+ insetInlineEnd: 0,
125
+ background: "linear-gradient(to left, rgba(0,0,0,0.06), rgba(0,0,0,0));"
126
+ },
127
+ '&:dir(rtl)': {
128
+ '&:before': {
129
+ background: "linear-gradient(to left, rgba(0,0,0,0.06), rgba(0,0,0,0));"
130
+ },
131
+ '&:after': {
132
+ background: "linear-gradient(to right, rgba(0,0,0,0.06), rgba(0,0,0,0));"
133
+ }
134
+ }
135
+ },
136
+ '&-overflow-scrollY': {
137
+ overflowX: 'hidden',
138
+ overflowY: 'auto',
139
+ maxHeight: calc(cardHeight).mul(3).equal(),
140
+ '&:before, &:after': {
141
+ insetInline: 0,
142
+ height: 8
143
+ },
144
+ '&:before': {
145
+ insetBlockStart: 0,
146
+ background: "linear-gradient(to bottom, rgba(0,0,0,0.06), rgba(0,0,0,0));"
147
+ },
148
+ '&:after': {
149
+ insetBlockEnd: 0,
150
+ background: "linear-gradient(to top, rgba(0,0,0,0.06), rgba(0,0,0,0));"
151
+ }
152
+ },
153
+ // ======================================================================
154
+ // == Upload ==
155
+ // ======================================================================
156
+ '&-upload-btn': {
157
+ width: cardHeight,
158
+ height: cardHeight,
159
+ fontSize: token.fontSizeHeading2,
160
+ color: '#999'
161
+ },
162
+ // ======================================================================
163
+ // == PrevNext ==
164
+ // ======================================================================
165
+ '&-prev-btn, &-next-btn': {
166
+ position: 'absolute',
167
+ top: '50%',
168
+ transform: 'translateY(-50%)',
169
+ boxShadow: token.boxShadowTertiary,
170
+ opacity: 0,
171
+ pointerEvents: 'none'
172
+ },
173
+ '&-prev-btn': {
174
+ left: {
175
+ _skip_check_: true,
176
+ value: token.padding
177
+ }
178
+ },
179
+ '&-next-btn': {
180
+ right: {
181
+ _skip_check_: true,
182
+ value: token.padding
183
+ }
184
+ },
185
+ '&:dir(ltr)': _defineProperty(_defineProperty({}, "&".concat(fileListCls, "-overflow-ping-start ").concat(fileListCls, "-prev-btn"), {
186
+ opacity: 1,
187
+ pointerEvents: 'auto'
188
+ }), "&".concat(fileListCls, "-overflow-ping-end ").concat(fileListCls, "-next-btn"), {
189
+ opacity: 1,
190
+ pointerEvents: 'auto'
191
+ }),
192
+ '&:dir(rtl)': _defineProperty(_defineProperty({}, "&".concat(fileListCls, "-overflow-ping-end ").concat(fileListCls, "-prev-btn"), {
193
+ opacity: 1,
194
+ pointerEvents: 'auto'
195
+ }), "&".concat(fileListCls, "-overflow-ping-start ").concat(fileListCls, "-next-btn"), {
196
+ opacity: 1,
197
+ pointerEvents: 'auto'
198
+ })
199
+ })));
200
+ };
201
+ export var prepareComponentToken = function prepareComponentToken(token) {
202
+ var colorBgContainer = token.colorBgContainer;
203
+ var colorBgPlaceholderHover = new FastColor(colorBgContainer).setA(0.85);
204
+ return {
205
+ colorBgPlaceholderHover: colorBgPlaceholderHover.toRgbString()
206
+ };
207
+ };
208
+ export default genStyleHooks('Attachments', function (token) {
209
+ var compToken = mergeToken(token, {});
210
+ return [genAttachmentsStyle(compToken), genFileListStyle(compToken), genFileCardStyle(compToken)];
211
+ }, prepareComponentToken);
@@ -0,0 +1,2 @@
1
+ export declare const isImageFileType: (type: string) => boolean;
2
+ export declare function previewImage(file: File | Blob): Promise<string>;
@@ -0,0 +1,53 @@
1
+ // Follow code is copy from `antd/components/upload/utils.ts`:
2
+
3
+ export var isImageFileType = function isImageFileType(type) {
4
+ return type.indexOf('image/') === 0;
5
+ };
6
+ var MEASURE_SIZE = 200;
7
+ export function previewImage(file) {
8
+ return new Promise(function (resolve) {
9
+ if (!file || !file.type || !isImageFileType(file.type)) {
10
+ resolve('');
11
+ return;
12
+ }
13
+ var img = new Image();
14
+ img.onload = function () {
15
+ var width = img.width,
16
+ height = img.height;
17
+ var ratio = width / height;
18
+ var MEASURE_SIZE_WIDTH = ratio > 1 ? MEASURE_SIZE : MEASURE_SIZE * ratio;
19
+ var MEASURE_SIZE_HEIGHT = ratio > 1 ? MEASURE_SIZE / ratio : MEASURE_SIZE;
20
+ var canvas = document.createElement('canvas');
21
+ canvas.width = MEASURE_SIZE_WIDTH;
22
+ canvas.height = MEASURE_SIZE_HEIGHT;
23
+ canvas.style.cssText = "position: fixed; left: 0; top: 0; width: ".concat(MEASURE_SIZE_WIDTH, "px; height: ").concat(MEASURE_SIZE_HEIGHT, "px; z-index: 9999; display: none;");
24
+ document.body.appendChild(canvas);
25
+ var ctx = canvas.getContext('2d');
26
+ ctx.drawImage(img, 0, 0, MEASURE_SIZE_WIDTH, MEASURE_SIZE_HEIGHT);
27
+ var dataURL = canvas.toDataURL();
28
+ document.body.removeChild(canvas);
29
+ window.URL.revokeObjectURL(img.src);
30
+ resolve(dataURL);
31
+ };
32
+ img.crossOrigin = 'anonymous';
33
+ if (file.type.startsWith('image/svg+xml')) {
34
+ var reader = new FileReader();
35
+ reader.onload = function () {
36
+ if (reader.result && typeof reader.result === 'string') {
37
+ img.src = reader.result;
38
+ }
39
+ };
40
+ reader.readAsDataURL(file);
41
+ } else if (file.type.startsWith('image/gif')) {
42
+ var _reader = new FileReader();
43
+ _reader.onload = function () {
44
+ if (_reader.result) {
45
+ resolve(_reader.result);
46
+ }
47
+ };
48
+ _reader.readAsDataURL(file);
49
+ } else {
50
+ img.src = window.URL.createObjectURL(file);
51
+ }
52
+ });
53
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { BubbleProps } from './interface';
3
+ import './style/avatar.less';
4
+ interface AvatarProps extends Pick<BubbleProps, 'avatar' | 'msgStatus' | 'prefixCls'> {
5
+ isAssistant?: boolean;
6
+ className?: string;
7
+ style?: React.CSSProperties;
8
+ }
9
+ declare const Avatar: React.FC<AvatarProps>;
10
+ export default Avatar;
@@ -0,0 +1,22 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ import { Avatar as AAvatar } from 'antd';
6
+ import classnames from 'classnames';
7
+ import React from 'react';
8
+ import "./style/avatar.less";
9
+ var Avatar = function Avatar(props) {
10
+ var avatar = props.avatar,
11
+ msgStatus = props.msgStatus,
12
+ isAssistant = props.isAssistant,
13
+ prefixCls = props.prefixCls,
14
+ className = props.className,
15
+ style = props.style;
16
+ var avatarNode = /*#__PURE__*/React.isValidElement(avatar) ? avatar : /*#__PURE__*/React.createElement(AAvatar, avatar);
17
+ return /*#__PURE__*/React.createElement("div", {
18
+ className: classnames("".concat(prefixCls, "-avatar"), _defineProperty({}, "".concat(prefixCls, "-avatar-loading"), isAssistant && msgStatus === 'generating'), className),
19
+ style: style
20
+ }, avatarNode);
21
+ };
22
+ export default Avatar;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { BubbleProps } from './interface';
3
+ export interface BubbleRef {
4
+ nativeElement: HTMLElement;
5
+ }
6
+ export interface BubbleContextProps {
7
+ onUpdate?: VoidFunction;
8
+ }
9
+ export declare const BubbleContext: React.Context<BubbleContextProps>;
10
+ declare const _default: React.NamedExoticComponent<BubbleProps<string>>;
11
+ export default _default;
@@ -0,0 +1,102 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ import classnames from 'classnames';
14
+ import React from 'react';
15
+ import { Space } from 'antd';
16
+ import useStyle from "./style";
17
+ import { Markdown, useProviderContext } from "./..";
18
+ import Cards from "./Cards";
19
+ import Spin from "./Spin";
20
+ import Avatar from "./Avatar";
21
+ export var BubbleContext = /*#__PURE__*/React.createContext({});
22
+ var Bubble = function Bubble(props) {
23
+ var customizePrefixCls = props.prefixCls,
24
+ className = props.className,
25
+ rootClassName = props.rootClassName,
26
+ style = props.style,
27
+ _props$classNames = props.classNames,
28
+ classNames = _props$classNames === void 0 ? {} : _props$classNames,
29
+ _props$styles = props.styles,
30
+ styles = _props$styles === void 0 ? {} : _props$styles,
31
+ avatar = props.avatar,
32
+ _props$content = props.content,
33
+ content = _props$content === void 0 ? '' : _props$content,
34
+ cards = props.cards,
35
+ variant = props.variant,
36
+ shape = props.shape,
37
+ msgStatus = props.msgStatus,
38
+ id = props.id,
39
+ role = props.role;
40
+ var placement = {
41
+ 'assistant': 'start',
42
+ 'user': 'end'
43
+ }[role] || 'start';
44
+ var _useProviderContext = useProviderContext(),
45
+ getPrefixCls = _useProviderContext.getPrefixCls;
46
+ var prefixCls = getPrefixCls('bubble', customizePrefixCls);
47
+ var _useStyle = useStyle(prefixCls),
48
+ _useStyle2 = _slicedToArray(_useStyle, 3),
49
+ wrapCSSVar = _useStyle2[0],
50
+ hashId = _useStyle2[1],
51
+ cssVarCls = _useStyle2[2];
52
+ var mergedCls = classnames(prefixCls, rootClassName, className, hashId, cssVarCls, "".concat(prefixCls, "-").concat(placement));
53
+ var contentNode;
54
+ // @ts-ignore
55
+ var isEmpty = !(content !== null && content !== void 0 && content.length) && !(cards !== null && cards !== void 0 && cards.length);
56
+ if (props.msgStatus === 'generating' && isEmpty) {
57
+ contentNode = /*#__PURE__*/React.createElement(Spin, null);
58
+ } else {
59
+ contentNode = content ? /*#__PURE__*/React.createElement(Markdown, {
60
+ typing: true,
61
+ content: content,
62
+ cursor: props.msgStatus === 'generating'
63
+ }) : null;
64
+ }
65
+ var isAssistant = placement === 'assistant' || placement === 'start';
66
+ var variantClassname = "".concat(prefixCls, "-content-").concat(variant || (isAssistant ? 'borderless' : 'filled'));
67
+ var fullContent = /*#__PURE__*/React.createElement(Space, {
68
+ direction: "vertical",
69
+ style: !isAssistant && contentNode ? {
70
+ flexDirection: 'column-reverse'
71
+ } : {},
72
+ className: "".concat(prefixCls, "-content-wrapper"),
73
+ classNames: {
74
+ item: "".concat(prefixCls, "-content-wrapper-card")
75
+ }
76
+ }, Cards({
77
+ cards: cards,
78
+ id: id,
79
+ className: classnames("".concat(prefixCls, "-content"), variantClassname, shape && "".concat(prefixCls, "-content-").concat(shape), classNames.content)
80
+ }), contentNode && /*#__PURE__*/React.createElement("div", {
81
+ style: _objectSpread({}, styles.content),
82
+ className: classnames("".concat(prefixCls, "-content"), variantClassname, shape && "".concat(prefixCls, "-content-").concat(shape), classNames.content)
83
+ }, contentNode));
84
+ var node = wrapCSSVar( /*#__PURE__*/React.createElement("div", {
85
+ style: style,
86
+ className: mergedCls,
87
+ id: id,
88
+ "data-role": role
89
+ }, avatar && /*#__PURE__*/React.createElement(Avatar, {
90
+ avatar: avatar,
91
+ msgStatus: msgStatus,
92
+ isAssistant: isAssistant,
93
+ prefixCls: prefixCls,
94
+ className: classNames.avatar,
95
+ style: styles.avatar
96
+ }), fullContent));
97
+ return node;
98
+ };
99
+ if (process.env.NODE_ENV !== 'production') {
100
+ Bubble.displayName = 'Bubble';
101
+ }
102
+ export default /*#__PURE__*/React.memo(Bubble);
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import type { BubbleProps } from './interface';
3
+ import './style/list.less';
4
+ export interface BubbleListRef {
5
+ scrollToBottom(): void;
6
+ }
7
+ export type BubbleDataType = BubbleProps & {
8
+ key?: string | number;
9
+ role?: string;
10
+ };
11
+ export interface BubbleListProps extends React.HTMLAttributes<HTMLDivElement> {
12
+ items?: BubbleDataType[];
13
+ }
14
+ declare const ForwardBubbleList: React.ForwardRefExoticComponent<BubbleListProps & React.RefAttributes<BubbleListRef>>;
15
+ export default ForwardBubbleList;
@@ -0,0 +1,44 @@
1
+ var _excluded = ["key"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
+ import * as React from 'react';
6
+ import { useProviderContext } from "./..";
7
+ import Bubble from "./Bubble";
8
+ import ScrollToBottom from "./ScrollToBottom";
9
+ import { StickToBottom } from 'use-stick-to-bottom';
10
+ import "./style/list.less";
11
+ var BubbleList = function BubbleList(props, ref) {
12
+ var _props$items = props.items,
13
+ items = _props$items === void 0 ? [] : _props$items;
14
+ var scrollToBottomRef = React.useRef();
15
+ var _useProviderContext = useProviderContext(),
16
+ getPrefixCls = _useProviderContext.getPrefixCls;
17
+ var prefixCls = getPrefixCls('bubble-list');
18
+ React.useImperativeHandle(ref, function () {
19
+ return {
20
+ scrollToBottom: function scrollToBottom() {
21
+ // @ts-ignore
22
+ scrollToBottomRef.current.scrollToBottom();
23
+ }
24
+ };
25
+ });
26
+ return /*#__PURE__*/React.createElement(StickToBottom, {
27
+ className: "".concat(prefixCls, "-wrapper"),
28
+ resize: "smooth",
29
+ initial: "smooth",
30
+ style: props.style
31
+ }, /*#__PURE__*/React.createElement(StickToBottom.Content, {
32
+ className: "".concat(prefixCls)
33
+ }, items.map(function (_ref) {
34
+ var key = _ref.key,
35
+ bubble = _objectWithoutProperties(_ref, _excluded);
36
+ return /*#__PURE__*/React.createElement(Bubble, _extends({}, bubble, {
37
+ key: bubble.id || key
38
+ }));
39
+ })), /*#__PURE__*/React.createElement(ScrollToBottom, {
40
+ ref: scrollToBottomRef
41
+ }));
42
+ };
43
+ var ForwardBubbleList = /*#__PURE__*/React.forwardRef(BubbleList);
44
+ export default ForwardBubbleList;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export declare function Card(props: {
3
+ code: string;
4
+ component?: React.FC;
5
+ data?: string | any;
6
+ index: number;
7
+ id: string;
8
+ }): any;
9
+ export default function Cards(props: {
10
+ cards: {
11
+ code: string;
12
+ component?: React.FC;
13
+ data?: string | any;
14
+ }[];
15
+ id: string;
16
+ className?: string;
17
+ }): React.JSX.Element[];
18
+ export declare function createCard(code: string, data: any): {
19
+ code: string;
20
+ data: any;
21
+ };
@@ -0,0 +1,47 @@
1
+ import React, { useMemo } from 'react';
2
+ import { useCustomCardsContext } from "./..";
3
+ export function Card(props) {
4
+ var cardConfig = useCustomCardsContext();
5
+ var Component = useMemo(function () {
6
+ if (props.component) return props.component;
7
+ var cardConfigMap = cardConfig;
8
+ return (cardConfigMap === null || cardConfigMap === void 0 ? void 0 : cardConfigMap[props.code]) || function () {
9
+ return "".concat(props.code, " not found");
10
+ };
11
+ }, []);
12
+ if (typeof Component === 'function') {
13
+ return /*#__PURE__*/React.createElement(Component, {
14
+ code: props.code,
15
+ data: props.data,
16
+ index: props.index,
17
+ id: props.id
18
+ });
19
+ } else {
20
+ return Component;
21
+ }
22
+ }
23
+ export default function Cards(props) {
24
+ var cards = props.cards;
25
+ if (!(cards !== null && cards !== void 0 && cards.length)) return null;
26
+ return cards.map(function (card, index) {
27
+ var cardComp = /*#__PURE__*/React.createElement(Card, {
28
+ key: index,
29
+ code: card.code,
30
+ component: card.component,
31
+ data: card.data,
32
+ index: index,
33
+ id: props.id
34
+ });
35
+ if (card.code === 'Text') return /*#__PURE__*/React.createElement("div", {
36
+ className: props.className,
37
+ key: index
38
+ }, cardComp);
39
+ return cardComp;
40
+ });
41
+ }
42
+ export function createCard(code, data) {
43
+ return {
44
+ code: code,
45
+ data: data
46
+ };
47
+ }
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import './style/scrollToBottom.less';
3
+ import { ScrollToBottomOptions } from 'use-stick-to-bottom';
4
+ declare const _default: React.ForwardRefExoticComponent<React.RefAttributes<{
5
+ scrollToBottom(options?: ScrollToBottomOptions): void;
6
+ }>>;
7
+ export default _default;
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import { useProviderContext } from "./..";
3
+ import "./style/scrollToBottom.less";
4
+ import { Button } from 'antd';
5
+ import { ArrowDownOutlined } from '@ant-design/icons';
6
+ import cls from 'classnames';
7
+ import { useStickToBottomContext } from 'use-stick-to-bottom';
8
+ var ScrollToBottomButton = function ScrollToBottomButton(_, ref) {
9
+ var _useProviderContext = useProviderContext(),
10
+ getPrefixCls = _useProviderContext.getPrefixCls;
11
+ var _useStickToBottomCont = useStickToBottomContext(),
12
+ isAtBottom = _useStickToBottomCont.isAtBottom,
13
+ scrollToBottom = _useStickToBottomCont.scrollToBottom;
14
+ React.useImperativeHandle(ref, function () {
15
+ return {
16
+ scrollToBottom: function (_scrollToBottom) {
17
+ function scrollToBottom(_x) {
18
+ return _scrollToBottom.apply(this, arguments);
19
+ }
20
+ scrollToBottom.toString = function () {
21
+ return _scrollToBottom.toString();
22
+ };
23
+ return scrollToBottom;
24
+ }(function (options) {
25
+ options = options || {
26
+ animation: 'instant'
27
+ };
28
+ scrollToBottom(options);
29
+ })
30
+ };
31
+ });
32
+ var prefixCls = getPrefixCls('bubble-list-scroll-to-bottom');
33
+ return /*#__PURE__*/React.createElement("div", {
34
+ className: cls(prefixCls, "".concat(prefixCls, "-").concat(!isAtBottom ? 'show' : 'hide'))
35
+ }, /*#__PURE__*/React.createElement(Button, {
36
+ onClick: function onClick() {
37
+ return scrollToBottom({
38
+ animation: 'instant'
39
+ });
40
+ },
41
+ icon: /*#__PURE__*/React.createElement(ArrowDownOutlined, null),
42
+ shape: "circle"
43
+ }));
44
+ };
45
+ export default /*#__PURE__*/React.forwardRef(ScrollToBottomButton);
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export default function (): React.JSX.Element;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { useProviderContext } from "./..";
3
+ export default function () {
4
+ var _useProviderContext = useProviderContext(),
5
+ getPrefixCls = _useProviderContext.getPrefixCls;
6
+ var prefixCls = getPrefixCls('bubble-loading');
7
+ return /*#__PURE__*/React.createElement("div", {
8
+ className: prefixCls
9
+ }, /*#__PURE__*/React.createElement("div", {
10
+ className: "".concat(prefixCls, "-dot1")
11
+ }), /*#__PURE__*/React.createElement("div", {
12
+ className: "".concat(prefixCls, "-dot2")
13
+ }), /*#__PURE__*/React.createElement("div", {
14
+ className: "".concat(prefixCls, "-dot3")
15
+ }), /*#__PURE__*/React.createElement("div", {
16
+ className: "".concat(prefixCls, "-text")
17
+ }, "-"));
18
+ }
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,8 @@
1
+ import Bubble from './Bubble';
2
+ import List from './BubbleList';
3
+ export type { BubbleProps } from './interface';
4
+ type BubbleType = typeof Bubble & {
5
+ List: typeof List;
6
+ };
7
+ declare const _default: BubbleType;
8
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import Bubble from "./Bubble";
2
+ import List from "./BubbleList";
3
+ Bubble.List = List;
4
+ export default Bubble;