@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,30 @@
1
+ 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); }
2
+ import { AudioMutedOutlined, AudioOutlined } from '@ant-design/icons';
3
+ import * as React from 'react';
4
+ import ActionButton, { ActionButtonContext } from "../ActionButton";
5
+ import RecordingIcon from "./RecordingIcon";
6
+ function SpeechButton(props, ref) {
7
+ var _React$useContext = React.useContext(ActionButtonContext),
8
+ speechRecording = _React$useContext.speechRecording,
9
+ onSpeechDisabled = _React$useContext.onSpeechDisabled,
10
+ prefixCls = _React$useContext.prefixCls;
11
+ var icon = null;
12
+ if (speechRecording) {
13
+ icon = /*#__PURE__*/React.createElement(RecordingIcon, {
14
+ className: "".concat(prefixCls, "-recording-icon")
15
+ });
16
+ } else if (onSpeechDisabled) {
17
+ icon = /*#__PURE__*/React.createElement(AudioMutedOutlined, null);
18
+ } else {
19
+ icon = /*#__PURE__*/React.createElement(AudioOutlined, null);
20
+ }
21
+ return /*#__PURE__*/React.createElement(ActionButton, _extends({
22
+ icon: icon,
23
+ color: "primary",
24
+ variant: "text"
25
+ }, props, {
26
+ action: "onSpeech",
27
+ ref: ref
28
+ }));
29
+ }
30
+ export default /*#__PURE__*/React.forwardRef(SpeechButton);
@@ -0,0 +1,61 @@
1
+ import { Input } from 'antd';
2
+ import React from 'react';
3
+ import SenderHeader from './SenderHeader';
4
+ import { type AllowSpeech } from './useSpeech';
5
+ import type { InputRef as AntdInputRef, ButtonProps, GetProps } from 'antd';
6
+ export type SubmitType = 'enter' | 'shiftEnter' | false;
7
+ type TextareaProps = GetProps<typeof Input.TextArea>;
8
+ export interface SenderComponents {
9
+ input?: React.ComponentType<TextareaProps>;
10
+ }
11
+ export type ActionsRender = (ori: React.ReactNode, info: {
12
+ components: {
13
+ SendButton: React.ComponentType<ButtonProps>;
14
+ ClearButton: React.ComponentType<ButtonProps>;
15
+ LoadingButton: React.ComponentType<ButtonProps>;
16
+ };
17
+ }) => React.ReactNode;
18
+ export interface SenderProps extends Pick<TextareaProps, 'placeholder' | 'onKeyPress'> {
19
+ prefixCls?: string;
20
+ defaultValue?: string;
21
+ value?: string;
22
+ loading?: boolean;
23
+ readOnly?: boolean;
24
+ submitType?: SubmitType;
25
+ disabled?: boolean;
26
+ onSubmit?: (message: string) => void;
27
+ onChange?: (value: string, event?: React.FormEvent<HTMLTextAreaElement> | React.ChangeEvent<HTMLTextAreaElement>) => void;
28
+ onCancel?: VoidFunction;
29
+ onKeyDown?: React.KeyboardEventHandler<any>;
30
+ onPaste?: React.ClipboardEventHandler<HTMLElement>;
31
+ onPasteFile?: (file: File) => void;
32
+ components?: SenderComponents;
33
+ styles?: {
34
+ prefix?: React.CSSProperties;
35
+ input?: React.CSSProperties;
36
+ actions?: React.CSSProperties;
37
+ };
38
+ rootClassName?: string;
39
+ classNames?: {
40
+ prefix?: string;
41
+ input?: string;
42
+ actions?: string;
43
+ };
44
+ style?: React.CSSProperties;
45
+ className?: string;
46
+ actions?: React.ReactNode | ActionsRender;
47
+ allowSpeech?: AllowSpeech;
48
+ prefix?: React.ReactNode | React.ReactNode[];
49
+ header?: React.ReactNode;
50
+ maxLength?: number;
51
+ zoomable?: boolean;
52
+ }
53
+ export type SenderRef = {
54
+ nativeElement: HTMLDivElement;
55
+ } & Pick<AntdInputRef, 'focus' | 'blur'>;
56
+ declare const ForwardSender: React.ForwardRefExoticComponent<SenderProps & React.RefAttributes<SenderRef>>;
57
+ type CompoundedSender = typeof ForwardSender & {
58
+ Header: typeof SenderHeader;
59
+ };
60
+ declare const Sender: CompoundedSender;
61
+ export default Sender;
@@ -0,0 +1,307 @@
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
+ var _excluded = ["prefixCls", "styles", "classNames", "className", "rootClassName", "style", "defaultValue", "value", "readOnly", "submitType", "onSubmit", "loading", "components", "onCancel", "onChange", "actions", "onKeyPress", "onKeyDown", "disabled", "allowSpeech", "header", "onPaste", "onPasteFile"];
3
+ 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); }
4
+ 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; }
5
+ 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; }
6
+ 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; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
+ 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); }
9
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
10
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
13
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
+ 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."); }
15
+ 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); }
16
+ 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; }
17
+ 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; } }
18
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
+ 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; }
20
+ 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; }
21
+ import { Button, Flex, Input } from 'antd';
22
+ import classnames from 'classnames';
23
+ import { useMergedState } from 'rc-util';
24
+ import pickAttrs from 'rc-util/lib/pickAttrs';
25
+ import getValue from 'rc-util/lib/utils/get';
26
+ import React, { useState } from 'react';
27
+ import useProxyImperativeHandle from "../_util/hooks/use-proxy-imperative-handle";
28
+ import { useProviderContext } from "./..";
29
+ import SenderHeader, { SendHeaderContext } from "./SenderHeader";
30
+ import { ActionButtonContext } from "./components/ActionButton";
31
+ import ClearButton from "./components/ClearButton";
32
+ import LoadingButton from "./components/LoadingButton";
33
+ import SendButton from "./components/SendButton";
34
+ import SpeechButton from "./components/SpeechButton";
35
+ import useStyle from "./style";
36
+ import useSpeech from "./useSpeech";
37
+ import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons';
38
+ function getComponent(components, path, defaultComponent) {
39
+ return getValue(components, path) || defaultComponent;
40
+ }
41
+ var ForwardSender = /*#__PURE__*/React.forwardRef(function (props, ref) {
42
+ var customizePrefixCls = props.prefixCls,
43
+ _props$styles = props.styles,
44
+ styles = _props$styles === void 0 ? {} : _props$styles,
45
+ _props$classNames = props.classNames,
46
+ classNames = _props$classNames === void 0 ? {} : _props$classNames,
47
+ className = props.className,
48
+ rootClassName = props.rootClassName,
49
+ style = props.style,
50
+ defaultValue = props.defaultValue,
51
+ value = props.value,
52
+ readOnly = props.readOnly,
53
+ _props$submitType = props.submitType,
54
+ submitType = _props$submitType === void 0 ? 'enter' : _props$submitType,
55
+ onSubmit = props.onSubmit,
56
+ loading = props.loading,
57
+ components = props.components,
58
+ onCancel = props.onCancel,
59
+ onChange = props.onChange,
60
+ actions = props.actions,
61
+ onKeyPress = props.onKeyPress,
62
+ onKeyDown = props.onKeyDown,
63
+ disabled = props.disabled,
64
+ allowSpeech = props.allowSpeech,
65
+ header = props.header,
66
+ onPaste = props.onPaste,
67
+ onPasteFile = props.onPasteFile,
68
+ rest = _objectWithoutProperties(props, _excluded);
69
+ var _useState = useState(props.zoomable ? false : undefined),
70
+ _useState2 = _slicedToArray(_useState, 2),
71
+ zoom = _useState2[0],
72
+ setZoom = _useState2[1];
73
+ var autoSize = React.useMemo(function () {
74
+ return zoom ? {
75
+ maxRows: 8,
76
+ minRows: 8
77
+ } : {
78
+ maxRows: 2,
79
+ minRows: 2
80
+ };
81
+ }, [props.zoomable, zoom]);
82
+ var prefix = React.useMemo(function () {
83
+ var nodes = Array.isArray(props.prefix) ? _toConsumableArray(props.prefix) : [props.prefix];
84
+ if (props.zoomable) {
85
+ nodes.push( /*#__PURE__*/React.createElement(Button, {
86
+ key: "zoom",
87
+ onClick: function onClick() {
88
+ return setZoom(!zoom);
89
+ },
90
+ type: "text",
91
+ icon: zoom ? /*#__PURE__*/React.createElement(FullscreenExitOutlined, null) : /*#__PURE__*/React.createElement(FullscreenOutlined, null)
92
+ }));
93
+ }
94
+ return nodes;
95
+ }, [props.prefix, props.zoomable, zoom]);
96
+
97
+ // ============================= MISC =============================
98
+ var _useProviderContext = useProviderContext(),
99
+ direction = _useProviderContext.direction,
100
+ getPrefixCls = _useProviderContext.getPrefixCls;
101
+ var prefixCls = getPrefixCls('sender', customizePrefixCls);
102
+
103
+ // ============================= Refs =============================
104
+ var containerRef = React.useRef(null);
105
+ var inputRef = React.useRef(null);
106
+ useProxyImperativeHandle(ref, function () {
107
+ var _inputRef$current, _inputRef$current2;
108
+ return {
109
+ nativeElement: containerRef.current,
110
+ focus: (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus,
111
+ blur: (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.blur
112
+ };
113
+ });
114
+ var inputCls = "".concat(prefixCls, "-input");
115
+
116
+ // ============================ Styles ============================
117
+ var _useStyle = useStyle(prefixCls),
118
+ _useStyle2 = _slicedToArray(_useStyle, 3),
119
+ wrapCSSVar = _useStyle2[0],
120
+ hashId = _useStyle2[1],
121
+ cssVarCls = _useStyle2[2];
122
+ var mergedCls = classnames(prefixCls, className, rootClassName, hashId, cssVarCls, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'), "".concat(prefixCls, "-disabled"), disabled));
123
+ var actionBtnCls = "".concat(prefixCls, "-actions-btn");
124
+ var actionListCls = "".concat(prefixCls, "-actions-list");
125
+
126
+ // ============================ Value =============================
127
+ var _useMergedState = useMergedState(defaultValue || '', {
128
+ value: value
129
+ }),
130
+ _useMergedState2 = _slicedToArray(_useMergedState, 2),
131
+ innerValue = _useMergedState2[0],
132
+ setInnerValue = _useMergedState2[1];
133
+ var triggerValueChange = function triggerValueChange(nextValue, event) {
134
+ setInnerValue(nextValue);
135
+ if (onChange) {
136
+ onChange(nextValue, event);
137
+ }
138
+ };
139
+
140
+ // ============================ Speech ============================
141
+ var _useSpeech = useSpeech(function (transcript) {
142
+ triggerValueChange("".concat(innerValue, " ").concat(transcript));
143
+ }, allowSpeech),
144
+ _useSpeech2 = _slicedToArray(_useSpeech, 3),
145
+ speechPermission = _useSpeech2[0],
146
+ triggerSpeech = _useSpeech2[1],
147
+ speechRecording = _useSpeech2[2];
148
+
149
+ // ========================== Components ==========================
150
+ var InputTextArea = getComponent(components, ['input'], Input.TextArea);
151
+ var domProps = pickAttrs(rest, {
152
+ attr: true,
153
+ aria: true,
154
+ data: true
155
+ });
156
+ var inputProps = _objectSpread(_objectSpread({}, domProps), {}, {
157
+ ref: inputRef
158
+ });
159
+
160
+ // ============================ Events ============================
161
+ var triggerSend = function triggerSend() {
162
+ if (innerValue && onSubmit && !loading) {
163
+ onSubmit(innerValue);
164
+ }
165
+ };
166
+ var triggerClear = function triggerClear() {
167
+ triggerValueChange('');
168
+ };
169
+
170
+ // ============================ Submit ============================
171
+ var isCompositionRef = React.useRef(false);
172
+ var onInternalCompositionStart = function onInternalCompositionStart() {
173
+ isCompositionRef.current = true;
174
+ };
175
+ var onInternalCompositionEnd = function onInternalCompositionEnd() {
176
+ isCompositionRef.current = false;
177
+ };
178
+ var onInternalKeyPress = function onInternalKeyPress(e) {
179
+ var canSubmit = e.key === 'Enter' && !isCompositionRef.current;
180
+
181
+ // Check for `submitType` to submit
182
+ switch (submitType) {
183
+ case 'enter':
184
+ if (canSubmit && !e.shiftKey) {
185
+ e.preventDefault();
186
+ triggerSend();
187
+ }
188
+ break;
189
+ case 'shiftEnter':
190
+ if (canSubmit && e.shiftKey) {
191
+ e.preventDefault();
192
+ triggerSend();
193
+ }
194
+ break;
195
+ }
196
+ if (onKeyPress) {
197
+ onKeyPress(e);
198
+ }
199
+ };
200
+
201
+ // ============================ Paste =============================
202
+ var onInternalPaste = function onInternalPaste(e) {
203
+ var _e$clipboardData;
204
+ // Get file
205
+ var file = (_e$clipboardData = e.clipboardData) === null || _e$clipboardData === void 0 ? void 0 : _e$clipboardData.files[0];
206
+ if (file && onPasteFile) {
207
+ onPasteFile(file);
208
+ e.preventDefault();
209
+ }
210
+ onPaste === null || onPaste === void 0 || onPaste(e);
211
+ };
212
+
213
+ // ============================ Focus =============================
214
+ var onContentMouseDown = function onContentMouseDown(e) {
215
+ var _containerRef$current, _inputRef$current3;
216
+ // If input focused but click on the container,
217
+ // input will lose focus.
218
+ // We call `preventDefault` to prevent this behavior
219
+ if (e.target !== ((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector(".".concat(inputCls)))) {
220
+ e.preventDefault();
221
+ }
222
+ (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 || _inputRef$current3.focus();
223
+ };
224
+
225
+ // ============================ Action ============================
226
+ var actionNode = /*#__PURE__*/React.createElement(Flex, {
227
+ className: "".concat(actionListCls, "-presets")
228
+ }, allowSpeech && /*#__PURE__*/React.createElement(SpeechButton, null), loading ? /*#__PURE__*/React.createElement(LoadingButton, null) : /*#__PURE__*/React.createElement(SendButton, null));
229
+
230
+ // Custom actions
231
+ if (typeof actions === 'function') {
232
+ actionNode = actions(actionNode, {
233
+ components: {
234
+ SendButton: SendButton,
235
+ ClearButton: ClearButton,
236
+ LoadingButton: LoadingButton
237
+ }
238
+ });
239
+ } else if (actions) {
240
+ actionNode = actions;
241
+ }
242
+
243
+ // ============================ Render ============================
244
+ return wrapCSSVar( /*#__PURE__*/React.createElement("div", {
245
+ ref: containerRef,
246
+ className: mergedCls,
247
+ style: style
248
+ }, header && /*#__PURE__*/React.createElement(SendHeaderContext.Provider, {
249
+ value: {
250
+ prefixCls: prefixCls
251
+ }
252
+ }, header), /*#__PURE__*/React.createElement("div", {
253
+ className: "".concat(prefixCls, "-content"),
254
+ onMouseDown: onContentMouseDown
255
+ }, /*#__PURE__*/React.createElement(InputTextArea, _extends({}, inputProps, {
256
+ disabled: disabled,
257
+ style: styles.input,
258
+ className: classnames(inputCls, classNames.input),
259
+ autoSize: autoSize,
260
+ value: innerValue.slice(0, props.maxLength || Number.MAX_SAFE_INTEGER),
261
+ onChange: function onChange(event) {
262
+ triggerValueChange(event.target.value, event);
263
+ triggerSpeech(true);
264
+ },
265
+ onPressEnter: onInternalKeyPress,
266
+ onCompositionStart: onInternalCompositionStart,
267
+ onCompositionEnd: onInternalCompositionEnd,
268
+ onKeyDown: onKeyDown,
269
+ onPaste: onInternalPaste,
270
+ variant: "borderless",
271
+ readOnly: readOnly
272
+ })), /*#__PURE__*/React.createElement("div", {
273
+ className: "".concat(prefixCls, "-content-bottom")
274
+ }, prefix.length > 0 && /*#__PURE__*/React.createElement("div", {
275
+ className: classnames("".concat(prefixCls, "-prefix"), classNames.prefix),
276
+ style: styles.prefix
277
+ }, /*#__PURE__*/React.createElement(Flex, {
278
+ gap: 8
279
+ }, prefix)), /*#__PURE__*/React.createElement("div", {
280
+ className: classnames(actionListCls, classNames.actions),
281
+ style: styles.actions
282
+ }, props.maxLength ? /*#__PURE__*/React.createElement("div", {
283
+ className: "".concat(actionListCls, "-length")
284
+ }, innerValue.length, "/", props.maxLength) : null, /*#__PURE__*/React.createElement(ActionButtonContext.Provider, {
285
+ value: {
286
+ prefixCls: actionBtnCls,
287
+ onSend: triggerSend,
288
+ onSendDisabled: !innerValue,
289
+ onClear: triggerClear,
290
+ onClearDisabled: !innerValue,
291
+ onCancel: onCancel,
292
+ onCancelDisabled: !loading,
293
+ onSpeech: function onSpeech() {
294
+ return triggerSpeech(false);
295
+ },
296
+ onSpeechDisabled: !speechPermission,
297
+ speechRecording: speechRecording,
298
+ disabled: disabled
299
+ }
300
+ }, actionNode))))));
301
+ });
302
+ var Sender = ForwardSender;
303
+ if (process.env.NODE_ENV !== 'production') {
304
+ Sender.displayName = 'Sender';
305
+ }
306
+ Sender.Header = SenderHeader;
307
+ export default Sender;
@@ -0,0 +1,4 @@
1
+ import type { SenderToken } from '.';
2
+ import type { GenerateStyle } from '../../theme/cssinjs-utils';
3
+ declare const genSenderHeaderStyle: GenerateStyle<SenderToken>;
4
+ export default genSenderHeaderStyle;
@@ -0,0 +1,46 @@
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
+ var genSenderHeaderStyle = function genSenderHeaderStyle(token) {
6
+ var componentCls = token.componentCls,
7
+ calc = token.calc;
8
+ var headerCls = "".concat(componentCls, "-header");
9
+ return _defineProperty({}, componentCls, _defineProperty({}, headerCls, {
10
+ // borderBottomWidth: token.lineWidth,
11
+ // borderBottomStyle: 'solid',
12
+ // borderBottomColor: token.colorBorder,
13
+
14
+ // ======================== Header ========================
15
+ '&-header': _defineProperty({
16
+ background: token.colorFillAlter,
17
+ fontSize: token.fontSize,
18
+ lineHeight: token.lineHeight,
19
+ paddingBlock: calc(token.paddingSM).sub(token.lineWidthBold).equal(),
20
+ paddingInlineStart: token.padding,
21
+ paddingInlineEnd: token.paddingXS,
22
+ display: 'flex'
23
+ }, "".concat(headerCls, "-title"), {
24
+ flex: 'auto',
25
+ color: token.colorText
26
+ }),
27
+ // ======================= Content ========================
28
+ '&-content': {
29
+ // padding: token.padding,
30
+ },
31
+ // ======================== Motion ========================
32
+ '&-motion': {
33
+ transition: ['height', 'border'].map(function (prop) {
34
+ return "".concat(prop, " ").concat(token.motionDurationSlow);
35
+ }).join(','),
36
+ overflow: 'hidden',
37
+ '&-enter-start, &-leave-active': {
38
+ borderBottomColor: 'transparent'
39
+ },
40
+ '&-hidden': {
41
+ display: 'none'
42
+ }
43
+ }
44
+ }));
45
+ };
46
+ export default genSenderHeaderStyle;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import type { FullToken, GetDefaultToken } from '../../theme/cssinjs-utils';
3
+ export interface ComponentToken {
4
+ }
5
+ export interface SenderToken extends FullToken<'Sender'> {
6
+ SenderContentMaxWidth: number | string;
7
+ }
8
+ export declare const prepareComponentToken: GetDefaultToken<'Sender'>;
9
+ declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>, string, string];
10
+ export default _default;
@@ -0,0 +1,123 @@
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 { unit } from '@ant-design/cssinjs';
6
+ import { mergeToken } from '@ant-design/cssinjs-utils';
7
+ import { genStyleHooks } from "../../theme/genStyleUtils";
8
+ import genSenderHeaderStyle from "./header";
9
+ var genSenderStyle = function genSenderStyle(token) {
10
+ var componentCls = token.componentCls,
11
+ padding = token.padding,
12
+ paddingSM = token.paddingSM,
13
+ paddingXS = token.paddingXS,
14
+ lineWidth = token.lineWidth,
15
+ lineWidthBold = token.lineWidthBold,
16
+ calc = token.calc;
17
+ return _defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
18
+ position: 'relative',
19
+ width: '100%',
20
+ boxSizing: 'border-box',
21
+ boxShadow: '0px 12px 24px -16px rgba(54, 54, 73, 0.04),0px 12px 40px 0px rgba(51, 51, 71, 0.08),0px 0px 1px 0px rgba(44, 44, 54, 0.02)',
22
+ transition: "background ".concat(token.motionDurationSlow),
23
+ backgroundColor: token.colorBgBase,
24
+ // Border
25
+ borderRadius: {
26
+ _skip_check_: true,
27
+ value: 8
28
+ },
29
+ borderColor: token.colorBorder,
30
+ borderWidth: 0,
31
+ borderStyle: 'solid',
32
+ // Border
33
+ '&:after': {
34
+ content: '""',
35
+ position: 'absolute',
36
+ inset: 0,
37
+ pointerEvents: 'none',
38
+ transition: "border-color ".concat(token.motionDurationSlow),
39
+ borderRadius: {
40
+ _skip_check_: true,
41
+ value: 'inherit'
42
+ },
43
+ borderStyle: 'inherit',
44
+ borderColor: 'inherit',
45
+ borderWidth: lineWidth
46
+ },
47
+ // Focus
48
+ '&:focus-within': {
49
+ boxShadow: "0px 12px 24px -16px rgba(54, 54, 73, 0.04),0px 12px 40px 0px rgba(51, 51, 71, 0.08),0px 0px 1px 0px rgba(44, 44, 54, 0.02)",
50
+ borderColor: token.colorPrimaryHover,
51
+ '&:after': {
52
+ borderWidth: lineWidth
53
+ }
54
+ },
55
+ '&-disabled': {
56
+ background: token.colorBgContainerDisabled
57
+ }
58
+ }, "&".concat(componentCls, "-rtl"), {
59
+ direction: 'rtl'
60
+ }), "".concat(componentCls, "-content"), {
61
+ width: '100%',
62
+ padding: 8,
63
+ boxSizing: 'border-box',
64
+ overflow: 'hidden',
65
+ borderRadius: 10
66
+ }), "".concat(componentCls, "-content-bottom"), {
67
+ display: 'flex',
68
+ marginTop: 8
69
+ }), "".concat(componentCls, "-prefix"), {
70
+ // flex: 'none',
71
+ flex: 1
72
+ }), "".concat(componentCls, "-input"), {
73
+ padding: '6px 8px',
74
+ borderRadius: 0,
75
+ alignSelf: 'center',
76
+ fontSize: 14,
77
+ lineHeight: 1.7
78
+ }), "".concat(componentCls, "-actions-list"), {
79
+ flex: 'none',
80
+ display: 'flex',
81
+ margin: '0 0 0 auto',
82
+ '&-presets': {
83
+ gap: token.paddingXS
84
+ },
85
+ '&-length': {
86
+ fontSize: 12,
87
+ lineHeight: 1,
88
+ display: 'flex',
89
+ alignItems: 'center',
90
+ padding: '0 12px',
91
+ color: token.colorTextTertiary
92
+ }
93
+ }), "".concat(componentCls, "-actions-btn"), {
94
+ '&-disabled': {
95
+ opacity: 0.45
96
+ },
97
+ '&-loading-button': {
98
+ padding: 0,
99
+ border: 0
100
+ },
101
+ '&-loading-icon': {
102
+ height: token.controlHeight,
103
+ width: token.controlHeight,
104
+ verticalAlign: 'top'
105
+ },
106
+ '&-recording-icon': {
107
+ height: '1.2em',
108
+ width: '1.2em',
109
+ verticalAlign: 'top'
110
+ }
111
+ }));
112
+ };
113
+ export var prepareComponentToken = function prepareComponentToken() {
114
+ return {};
115
+ };
116
+ export default genStyleHooks('Sender', function (token) {
117
+ var paddingXS = token.paddingXS,
118
+ calc = token.calc;
119
+ var SenderToken = mergeToken(token, {
120
+ SenderContentMaxWidth: "calc(100% - ".concat(unit(calc(paddingXS).add(32).equal()), ")")
121
+ });
122
+ return [genSenderStyle(SenderToken), genSenderHeaderStyle(SenderToken)];
123
+ }, prepareComponentToken);
@@ -0,0 +1,6 @@
1
+ export type ControlledSpeechConfig = {
2
+ recording?: boolean;
3
+ onRecordingChange: (recording: boolean) => void;
4
+ };
5
+ export type AllowSpeech = boolean | ControlledSpeechConfig;
6
+ export default function useSpeech(onSpeech: (transcript: string) => void, allowSpeech?: AllowSpeech): readonly [boolean, (forceBreak: boolean) => void, boolean];