@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,209 @@
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ 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; }
6
+ 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; }
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ 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; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
+ 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); }
13
+ import RecorderCore from 'recorder-core';
14
+ import 'recorder-core/src/extensions/buffer_stream.player.js';
15
+ import { v4 as uuid } from 'uuid';
16
+ var noop = function noop(data) {
17
+ return data && console.log(data);
18
+ };
19
+ var VoiceChatService = /*#__PURE__*/function () {
20
+ function VoiceChatService(props) {
21
+ var _this = this;
22
+ _classCallCheck(this, VoiceChatService);
23
+ _defineProperty(this, "_wsURL", void 0);
24
+ _defineProperty(this, "_ws", void 0);
25
+ _defineProperty(this, "_stream", void 0);
26
+ _defineProperty(this, "_rec", void 0);
27
+ _defineProperty(this, "onProcessResponseText", void 0);
28
+ _defineProperty(this, "onProcessASR", void 0);
29
+ _defineProperty(this, "onProcessTTS", void 0);
30
+ _defineProperty(this, "chatState", void 0);
31
+ _defineProperty(this, "initPlayer", function () {
32
+ _this._stream = RecorderCore.BufferStreamPlayer({
33
+ decode: false,
34
+ play: true,
35
+ realtime: {
36
+ discardAll: true,
37
+ maxDelay: 300
38
+ },
39
+ transform: function transform(arrayBuffer, sampleRate, True) {
40
+ True(new Int16Array(arrayBuffer), 16000);
41
+ },
42
+ sampleRate: 16000
43
+ });
44
+ var wave;
45
+ _this._stream.start(function () {
46
+ _this._rec = RecorderCore({
47
+ type: 'unknown',
48
+ sourceStream: _this._stream.getMediaStream(),
49
+ onProcess: function onProcess(buffers, powerLevel, bufferDuration, bufferSampleRate) {
50
+ var buffer = buffers[buffers.length - 1];
51
+ wave && wave.input(buffer, powerLevel, bufferSampleRate);
52
+ }
53
+ });
54
+ _this._rec.open(function () {
55
+ wave = RecorderCore.WaveView({
56
+ elem: '.tts',
57
+ width: 165,
58
+ height: 45
59
+ });
60
+ _this._rec.start();
61
+ });
62
+ });
63
+ });
64
+ _defineProperty(this, "_asrCache", {
65
+ event: 'AudioTranscript'
66
+ });
67
+ _defineProperty(this, "_responseTextCache", {
68
+ event: 'ResponseText'
69
+ });
70
+ _defineProperty(this, "processByCache", function (key) {
71
+ return function (jsonData) {
72
+ if (!_this[key].payload) _this[key].payload = {
73
+ text: '',
74
+ finished: true
75
+ };
76
+ if (_this[key].payload.finished) {
77
+ _this[key].payload.text = jsonData.payload.text;
78
+ _this[key].payload._id = uuid();
79
+ } else {
80
+ _this[key].payload.text += jsonData.payload.text;
81
+ }
82
+ _this[key].payload.finished = jsonData.payload.finished;
83
+ return _objectSpread({}, _this[key]);
84
+ };
85
+ });
86
+ this._wsURL = props.wsURL;
87
+ this.chatState = props.chatState;
88
+ this.onProcessResponseText = props.onProcessResponseText || noop;
89
+ this.onProcessASR = props.onProcessASR || noop;
90
+ this.onProcessTTS = props.onProcessTTS || noop;
91
+ }
92
+ _createClass(VoiceChatService, [{
93
+ key: "closePlayer",
94
+ value: function closePlayer() {
95
+ var _this$_stream;
96
+ (_this$_stream = this._stream) === null || _this$_stream === void 0 || _this$_stream.stop(undefined, undefined, true);
97
+ }
98
+ }, {
99
+ key: "connect",
100
+ value: function () {
101
+ var _connect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
102
+ var _this2 = this;
103
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
104
+ while (1) switch (_context.prev = _context.next) {
105
+ case 0:
106
+ return _context.abrupt("return", new Promise(function (resolve, reject) {
107
+ var ws = new WebSocket(_this2._wsURL);
108
+ ws.onopen = function () {
109
+ _this2._ws = ws;
110
+ _this2.start();
111
+ resolve(ws);
112
+ };
113
+ ws.onerror = function (e) {
114
+ reject(e);
115
+ };
116
+ ws.onmessage = function (e) {
117
+ return _this2.onMessage(e);
118
+ };
119
+ }));
120
+ case 1:
121
+ case "end":
122
+ return _context.stop();
123
+ }
124
+ }, _callee);
125
+ }));
126
+ function connect() {
127
+ return _connect.apply(this, arguments);
128
+ }
129
+ return connect;
130
+ }()
131
+ }, {
132
+ key: "close",
133
+ value: function close() {
134
+ var _this$_ws;
135
+ this.send({
136
+ directive: 'SessionStop'
137
+ });
138
+ (_this$_ws = this._ws) === null || _this$_ws === void 0 || _this$_ws.close();
139
+ this.closePlayer();
140
+ }
141
+ }, {
142
+ key: "start",
143
+ value: function start() {
144
+ this.initPlayer();
145
+ this.send({
146
+ directive: 'SessionStart',
147
+ payload: {
148
+ downstream: {
149
+ tts_options: {
150
+ voice: 'longcheng_v2'
151
+ }
152
+ }
153
+ }
154
+ });
155
+ }
156
+ }, {
157
+ key: "send",
158
+ value: function send(data) {
159
+ if (!this._ws) {
160
+ console.error('WebSocket is not connected.');
161
+ return;
162
+ }
163
+ if (data instanceof ArrayBuffer) {
164
+ this._ws.send(data);
165
+ } else {
166
+ this._ws.send(JSON.stringify(data));
167
+ }
168
+ }
169
+ }, {
170
+ key: "processASR",
171
+ value: function processASR(jsonData) {
172
+ this.onProcessASR(this.processByCache('_asrCache')(jsonData));
173
+ }
174
+ }, {
175
+ key: "processResponseText",
176
+ value: function processResponseText(jsonData) {
177
+ this.onProcessResponseText(this.processByCache('_responseTextCache')(jsonData));
178
+ }
179
+ }, {
180
+ key: "processTTS",
181
+ value: function processTTS(event) {
182
+ var _this3 = this;
183
+ event.data.arrayBuffer().then(function (buffer) {
184
+ _this3._stream.input(buffer);
185
+ });
186
+ }
187
+ }, {
188
+ key: "onMessage",
189
+ value: function onMessage(event) {
190
+ try {
191
+ if (typeof event.data === 'string') {
192
+ try {
193
+ var jsonData = JSON.parse(event.data);
194
+ if (jsonData.event === 'AudioTranscript') return this.processASR(jsonData);
195
+ if (jsonData.event === 'ResponseText') return this.processResponseText(jsonData);
196
+ } catch (parseError) {
197
+ console.error(parseError);
198
+ }
199
+ } else {
200
+ this.processTTS(event);
201
+ }
202
+ } catch (e) {
203
+ console.error(e);
204
+ }
205
+ }
206
+ }]);
207
+ return VoiceChatService;
208
+ }();
209
+ export { VoiceChatService as default };
@@ -0,0 +1,2 @@
1
+ export * from './VoiceChatProvider';
2
+ export { default as useVoiceChat } from './VoiceChatProvider/hooks/useVoiceChat';
@@ -0,0 +1,2 @@
1
+ export * from "./VoiceChatProvider";
2
+ export { default as useVoiceChat } from "./VoiceChatProvider/hooks/useVoiceChat";
@@ -0,0 +1,12 @@
1
+ export type WebResponse = {
2
+ event: 'SessionStarted' | 'SessionStopped' | 'AudioTranscript' | 'ResponseText' | 'ResponseAudioStarted' | 'ResponseAudioEnded';
3
+ payload?: Record<string, any>;
4
+ };
5
+ export type WebRequest = {
6
+ directive: 'SessionStart' | 'SessionStop';
7
+ payload?: Record<string, any>;
8
+ };
9
+ export declare const SAMPLE_RATE = 16000;
10
+ export declare const BIT_RATE = 16;
11
+ export declare const TIME_SLICE = 100;
12
+ export declare const FRAME_SIZE: number;
@@ -0,0 +1,4 @@
1
+ export var SAMPLE_RATE = 16000;
2
+ export var BIT_RATE = 16;
3
+ export var TIME_SLICE = 100; //ms
4
+ export var FRAME_SIZE = SAMPLE_RATE * (BIT_RATE / 8) * TIME_SLICE / 1000;
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export default function (): React.JSX.Element;
@@ -0,0 +1,38 @@
1
+ import React from "react";
2
+ export default function () {
3
+ return /*#__PURE__*/React.createElement("div", {
4
+ style: {
5
+ marginRight: 10
6
+ }
7
+ }, /*#__PURE__*/React.createElement("svg", {
8
+ fill: "none",
9
+ version: "1.1",
10
+ width: "56",
11
+ height: "56",
12
+ viewBox: "0 0 56 56"
13
+ }, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
14
+ id: "master_svg0_142_20591/142_20770"
15
+ }, /*#__PURE__*/React.createElement("rect", {
16
+ x: "0",
17
+ y: "0",
18
+ width: "56",
19
+ height: "56",
20
+ rx: "12"
21
+ }))), /*#__PURE__*/React.createElement("g", {
22
+ "clip-path": "url(#master_svg0_142_20591/142_20770)"
23
+ }, /*#__PURE__*/React.createElement("rect", {
24
+ x: "0",
25
+ y: "0",
26
+ width: "56",
27
+ height: "56",
28
+ rx: "12",
29
+ fill: "var(--spc-color-primary)",
30
+ "fill-opacity": "1"
31
+ }), /*#__PURE__*/React.createElement("g", {
32
+ transform: "matrix(0.7071067690849304,-0.7071067690849304,0.7071067690849304,0.7071067690849304,-21.237072837107917,11.28196548247979)"
33
+ }, /*#__PURE__*/React.createElement("path", {
34
+ d: "M3,47.271897705078125L14.5204,49.366897705078124C17.8001,49.963297705078126,20.4169,52.442697705078125,21.189,55.68569770507813L22.9944,63.26819770507812L24.7998,55.68579770507813C25.572,52.44279770507812,28.1888,49.963297705078126,31.4686,49.366897705078124L42.9888,47.272097705078124L31.4687,45.177497705078125C28.1888,44.581197705078125,25.572,42.101697705078124,24.7998,38.85867770507812L22.9944,31.276397705078125L21.1891,38.858617705078125C20.4169,42.101697705078124,17.8,44.581197705078125,14.5201,45.177497705078125L3,47.271897705078125Z",
35
+ fill: "#FFFFFF",
36
+ "fill-opacity": "1"
37
+ })))));
38
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface IProps {
3
+ title?: React.ReactNode | string;
4
+ desc?: React.ReactNode | string;
5
+ logo?: React.ReactNode | string;
6
+ style?: React.CSSProperties;
7
+ }
8
+ export default function (props: IProps): React.JSX.Element;
9
+ export {};
@@ -0,0 +1,57 @@
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 _templateObject, _templateObject2, _templateObject3, _templateObject4;
3
+ 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; }
4
+ 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; }
5
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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); }
8
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
9
+ import React, { useMemo } from 'react';
10
+ import { createStyles } from 'antd-style';
11
+ import Icon from "./icon";
12
+ var useStyles = createStyles(function (_ref) {
13
+ var css = _ref.css,
14
+ token = _ref.token;
15
+ return {
16
+ container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n "]))),
17
+ logo: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 56px;\n height: 56px;\n margin-right: 20px\n "]))),
18
+ title: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-size: 24px;\n font-weight: 600;\n line-height: 36px;\n color: ", ";\n "])), token.colorText),
19
+ desc: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: 24px;\n line-height: 36px;\n color: ", ";\n\n "])), token.colorTextSecondary)
20
+ };
21
+ });
22
+ export default function (props) {
23
+ var _useStyles = useStyles(),
24
+ styles = _useStyles.styles;
25
+ var _props$logo = props.logo,
26
+ logo = _props$logo === void 0 ? /*#__PURE__*/React.createElement(Icon, null) : _props$logo,
27
+ _props$title = props.title,
28
+ title = _props$title === void 0 ? 'Nice to meet you!' : _props$title,
29
+ _props$desc = props.desc,
30
+ desc = _props$desc === void 0 ? 'How can I help you today?' : _props$desc;
31
+ var logoEle = useMemo(function () {
32
+ if (typeof logo === 'string') return /*#__PURE__*/React.createElement("img", {
33
+ className: styles.logo,
34
+ src: logo
35
+ });
36
+ if (logo) return logo;
37
+ return null;
38
+ }, [logo, styles]);
39
+ var titleEle = useMemo(function () {
40
+ if (typeof props.title === 'string') return /*#__PURE__*/React.createElement("div", {
41
+ className: styles.title
42
+ }, title);
43
+ if (title) return title;
44
+ return null;
45
+ }, [title, styles]);
46
+ var descEle = useMemo(function () {
47
+ if (typeof props.desc === 'string') return /*#__PURE__*/React.createElement("div", {
48
+ className: styles.desc
49
+ }, desc);
50
+ if (desc) return desc;
51
+ return null;
52
+ }, [desc, styles]);
53
+ return /*#__PURE__*/React.createElement("div", {
54
+ className: styles.container,
55
+ style: _objectSpread({}, props.style)
56
+ }, logoEle, /*#__PURE__*/React.createElement("div", null, titleEle, descEle));
57
+ }
package/package.json ADDED
@@ -0,0 +1,117 @@
1
+ {
2
+ "name": "@agentscope-ai/chat",
3
+ "version": "1.1.4",
4
+ "description": "a free and open-source chat framework for building excellent LLM-powered chat experiences",
5
+ "sideEffects": [
6
+ "*.less",
7
+ "*.css",
8
+ "*.scss"
9
+ ],
10
+ "module": "dist/index.js",
11
+ "types": "dist/index.d.ts",
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "scripts": {
16
+ "build": "npm run src:build && npm run docs:build",
17
+ "build:watch": "father dev",
18
+ "dev": "dumi dev",
19
+ "docs:build": "dumi build",
20
+ "docs:preview": "dumi preview",
21
+ "doctor": "father doctor",
22
+ "lint": "npm run lint:es && npm run lint:css",
23
+ "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
24
+ "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
25
+ "prepare": "husky install && dumi setup",
26
+ "prepublishOnly": "npm run build",
27
+ "src:build": "father build",
28
+ "start": "npm run dev"
29
+ },
30
+ "commitlint": {
31
+ "extends": [
32
+ "@commitlint/config-conventional"
33
+ ]
34
+ },
35
+ "lint-staged": {
36
+ "*.{md,json}": [
37
+ "prettier --write --no-error-on-unmatched-pattern"
38
+ ],
39
+ "*.{css,less}": [
40
+ "stylelint --fix",
41
+ "prettier --write"
42
+ ],
43
+ "*.{js,jsx}": [
44
+ "eslint --fix",
45
+ "prettier --write"
46
+ ],
47
+ "*.{ts,tsx}": [
48
+ "eslint --fix",
49
+ "prettier --parser=typescript --write"
50
+ ]
51
+ },
52
+ "dependencies": {
53
+ "@ant-design/cssinjs-utils": "^1.1.3",
54
+ "@ant-design/icons": "^5.0.1",
55
+ "@ant-design/pro-components": "^2.8.4",
56
+ "@emotion/server": "^11.11.0",
57
+ "ahooks": "^3.8.4",
58
+ "antd-style": "^3.7.1",
59
+ "antd-token-previewer": "^2.0.8",
60
+ "copy-to-clipboard": "^3.3.3",
61
+ "cross-fetch": "^4.1.0",
62
+ "framer-motion": "^12.12.1",
63
+ "immer": "^10.1.1",
64
+ "lodash": "^4.17.21",
65
+ "pcm-player": "^0.0.18",
66
+ "react-infinite-scroll-component": "^6.1.0",
67
+ "react-markdown": "^10.1.0",
68
+ "recorder-core": "^1.3.25011100",
69
+ "rehype-katex": "^7.0.1",
70
+ "rehype-raw": "^7.0.0",
71
+ "remark-breaks": "^4.0.0",
72
+ "remark-gfm": "^4.0.1",
73
+ "remark-math": "^6.0.0",
74
+ "unified": "^11.0.5",
75
+ "unist-util-visit": "^5.0.0",
76
+ "use-context-selector": "^2.0.0",
77
+ "use-stick-to-bottom": "^1.1.1",
78
+ "uuid": "^11.0.5",
79
+ "xstate": "^5.19.4",
80
+ "zustand": "^5.0.3"
81
+ },
82
+ "devDependencies": {
83
+ "@spark-ai/design": "^1.0.3",
84
+ "@commitlint/cli": "^17.1.2",
85
+ "@commitlint/config-conventional": "^17.1.0",
86
+ "@copilotkit/react-core": "1.8.12-next.4",
87
+ "@copilotkit/runtime": "1.8.12-next.4",
88
+ "@copilotkit/runtime-client-gql": "1.8.12-next.4",
89
+ "@types/react": "^18.0.0",
90
+ "@types/react-dom": "^18.0.0",
91
+ "@umijs/lint": "^4.0.0",
92
+ "@umijs/plugins": "^4.4.11",
93
+ "antd": "^5.18.0",
94
+ "dumi": "^2.4.13",
95
+ "eslint": "^8.23.0",
96
+ "father": "^4.1.0",
97
+ "husky": "^8.0.1",
98
+ "lint-staged": "^13.0.3",
99
+ "openai": "^4.98.0",
100
+ "prettier": "^2.7.1",
101
+ "prettier-plugin-organize-imports": "^3.0.0",
102
+ "prettier-plugin-packagejson": "^2.2.18",
103
+ "react": "^18.0.0",
104
+ "react-dom": "^18.0.0",
105
+ "stylelint": "^14.9.1",
106
+ "tailwindcss": "^3.4.17"
107
+ },
108
+ "peerDependencies": {
109
+ "@spark-ai/design": "^1.0.3",
110
+ "@ant-design/icons": "^5.0.1",
111
+ "antd": "^5.18.0",
112
+ "classnames": "^2.5.1",
113
+ "react": ">=16.9.0",
114
+ "react-dom": ">=16.9.0"
115
+ },
116
+ "authors": []
117
+ }