@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,170 @@
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 _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _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; }
4
+ 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); } }
5
+ 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); }); }; }
6
+ 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; }
7
+ 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; }
8
+ 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; }
9
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
+ 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); }
11
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
+ 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."); }
13
+ 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); }
14
+ 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; }
15
+ 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; } }
16
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
+ import React, { useRef } from 'react';
18
+ import { useProviderContext, ChatInput, Sender, Attachments } from "../..";
19
+ import cls from 'classnames';
20
+ import { useChatAnywhere } from "../hooks/ChatAnywhereProvider";
21
+ import { useInput } from "../hooks/useInput";
22
+ import "./index.less";
23
+ import { Button, Upload } from 'antd';
24
+ export default function () {
25
+ var _React$useState = React.useState(''),
26
+ _React$useState2 = _slicedToArray(_React$useState, 2),
27
+ content = _React$useState2[0],
28
+ setContent = _React$useState2[1];
29
+ var onUpload = useChatAnywhere(function (v) {
30
+ return v.onUpload;
31
+ });
32
+ var resetData = useRef(new Array((onUpload === null || onUpload === void 0 ? void 0 : onUpload.length) || 0).fill([]));
33
+ var _React$useState3 = React.useState(resetData.current),
34
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
35
+ attachedFiles = _React$useState4[0],
36
+ setAttachedFiles = _React$useState4[1];
37
+ var inputContext = useInput();
38
+ var uiConfig = useChatAnywhere(function (v) {
39
+ return v.uiConfig;
40
+ });
41
+ var _useProviderContext = useProviderContext(),
42
+ getPrefixCls = _useProviderContext.getPrefixCls;
43
+ var prefixCls = getPrefixCls('chat-anywhere-sender');
44
+ var onStop = useChatAnywhere(function (v) {
45
+ return v.onStop;
46
+ });
47
+ var onInput = useChatAnywhere(function (v) {
48
+ var defaultValue = {
49
+ morePrefixActions: undefined,
50
+ maxLength: undefined,
51
+ zoomable: true,
52
+ beforeSubmit: function beforeSubmit() {
53
+ return Promise.resolve(true);
54
+ },
55
+ header: [],
56
+ hide: false
57
+ };
58
+ return _objectSpread(_objectSpread({}, defaultValue), v.onInput);
59
+ });
60
+ if (onInput.hide) return null;
61
+ var handleFileChange = /*#__PURE__*/function () {
62
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(index, fileList) {
63
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
64
+ while (1) switch (_context.prev = _context.next) {
65
+ case 0:
66
+ setAttachedFiles(function (attachedFiles) {
67
+ return attachedFiles.map(function (item, i) {
68
+ if (i === index) {
69
+ return fileList;
70
+ }
71
+ return item;
72
+ });
73
+ });
74
+ case 1:
75
+ case "end":
76
+ return _context.stop();
77
+ }
78
+ }, _callee);
79
+ }));
80
+ return function handleFileChange(_x, _x2) {
81
+ return _ref.apply(this, arguments);
82
+ };
83
+ }();
84
+ var prefixNodes = onUpload !== null && onUpload !== void 0 && onUpload.length ? onUpload.map(function (item, index) {
85
+ return /*#__PURE__*/React.createElement(Upload, _extends({}, item, {
86
+ fileList: attachedFiles[index],
87
+ key: index,
88
+ onChange: function onChange(info) {
89
+ handleFileChange(index, info.fileList);
90
+ },
91
+ showUploadList: false
92
+ }), /*#__PURE__*/React.createElement(Button, {
93
+ type: "text",
94
+ icon: item.icon
95
+ }));
96
+ }) : [];
97
+ var senderHeader = /*#__PURE__*/React.createElement(Sender.Header, {
98
+ closable: false,
99
+ open: attachedFiles === null || attachedFiles === void 0 ? void 0 : attachedFiles.some(function (item) {
100
+ return item.length;
101
+ })
102
+ }, attachedFiles.map(function (files, index) {
103
+ if (!files.length) return null;
104
+ return /*#__PURE__*/React.createElement(Attachments, {
105
+ key: index,
106
+ items: files,
107
+ onChange: function onChange(info) {
108
+ return handleFileChange(index, info.fileList);
109
+ }
110
+ });
111
+ }));
112
+ var submitFileList = attachedFiles.map(function (files) {
113
+ return files.filter(function (file) {
114
+ return file.status === 'done';
115
+ });
116
+ });
117
+ var fileLoading = attachedFiles.some(function (files) {
118
+ return files.some(function (file) {
119
+ return file.status === 'uploading';
120
+ });
121
+ });
122
+ return /*#__PURE__*/React.createElement("div", {
123
+ className: cls("".concat(prefixCls, "-wrapper"))
124
+ }, uiConfig.quickInput && /*#__PURE__*/React.createElement("div", {
125
+ className: cls("".concat(prefixCls, "-wrapper-header"))
126
+ }, uiConfig.quickInput), /*#__PURE__*/React.createElement(ChatInput, {
127
+ value: content,
128
+ onChange: setContent,
129
+ maxLength: onInput.maxLength,
130
+ disabled: fileLoading || inputContext.disabled,
131
+ zoomable: (onInput === null || onInput === void 0 ? void 0 : onInput.zoomable) || true,
132
+ header: senderHeader,
133
+ prefix: /*#__PURE__*/React.createElement(React.Fragment, null, prefixNodes, onInput === null || onInput === void 0 ? void 0 : onInput.morePrefixActions),
134
+ onSubmit: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
135
+ var next;
136
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
137
+ while (1) switch (_context2.prev = _context2.next) {
138
+ case 0:
139
+ _context2.next = 2;
140
+ return (onInput.beforeSubmit || function () {
141
+ return Promise.resolve(true);
142
+ })();
143
+ case 2:
144
+ next = _context2.sent;
145
+ if (next) {
146
+ _context2.next = 5;
147
+ break;
148
+ }
149
+ return _context2.abrupt("return");
150
+ case 5:
151
+ // @ts-ignore
152
+ onInput.onSubmit({
153
+ query: content,
154
+ fileList: submitFileList
155
+ });
156
+ setContent('');
157
+ setAttachedFiles(resetData.current);
158
+ case 8:
159
+ case "end":
160
+ return _context2.stop();
161
+ }
162
+ }, _callee2);
163
+ })),
164
+ onCancel: function onCancel() {
165
+ onStop();
166
+ inputContext.setLoading(false);
167
+ },
168
+ loading: inputContext.loading
169
+ }));
170
+ }
@@ -0,0 +1,12 @@
1
+ @import '../../index.less';
2
+
3
+ .@{ant-prefix}-chat-anywhere-sender-wrapper {
4
+ position: relative;
5
+
6
+ &-header {
7
+ display: flex;
8
+ gap: 8px;
9
+ margin-bottom: 12px;
10
+ }
11
+ }
12
+
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface IProps {
4
+ top?: React.ReactNode;
5
+ left?: React.ReactNode;
6
+ right?: React.ReactNode;
7
+ }
8
+ export default function (props: IProps): React.JSX.Element;
9
+ export declare const isMobileHook: () => boolean;
10
+ export {};
@@ -0,0 +1,73 @@
1
+ import React, { useEffect } from 'react';
2
+ import "./index.less";
3
+ import classnames from 'classnames';
4
+ import { useProviderContext } from "../..";
5
+ import { Drawer } from 'antd';
6
+ import { useResponsive } from 'ahooks';
7
+ import { useChatAnywhere } from "../hooks/ChatAnywhereProvider";
8
+ function Left(props) {
9
+ var _useChatAnywhere = useChatAnywhere(function (v) {
10
+ return {
11
+ sessionListShow: v.sessionListShow,
12
+ setSessionListShow: v.setSessionListShow
13
+ };
14
+ }),
15
+ sessionListShow = _useChatAnywhere.sessionListShow,
16
+ setSessionListShow = _useChatAnywhere.setSessionListShow;
17
+ var _useProviderContext = useProviderContext(),
18
+ getPrefixCls = _useProviderContext.getPrefixCls;
19
+ var prefixCls = getPrefixCls('chat-anywhere-layout');
20
+ var isMobile = isMobileHook();
21
+ useEffect(function () {
22
+ setSessionListShow(!isMobile);
23
+ }, [isMobile]);
24
+ if (!props.left) return null;
25
+ if (!isMobile) return /*#__PURE__*/React.createElement("div", {
26
+ className: classnames("".concat(prefixCls, "-left"), sessionListShow ? '' : "".concat(prefixCls, "-left-hide"))
27
+ }, props.left);
28
+ return /*#__PURE__*/React.createElement(Drawer, {
29
+ width: "80vw",
30
+ styles: {
31
+ body: {
32
+ padding: 0
33
+ }
34
+ },
35
+ open: sessionListShow,
36
+ onClose: function onClose() {
37
+ setSessionListShow(false);
38
+ },
39
+ title: null,
40
+ closable: false,
41
+ placement: "left"
42
+ }, /*#__PURE__*/React.createElement("div", {
43
+ style: {
44
+ display: 'flex',
45
+ flexDirection: 'column'
46
+ }
47
+ }, props.left));
48
+ }
49
+ export default function (props) {
50
+ var _useProviderContext2 = useProviderContext(),
51
+ getPrefixCls = _useProviderContext2.getPrefixCls;
52
+ var prefixCls = getPrefixCls('chat-anywhere-layout');
53
+ var uiConfig = useChatAnywhere(function (state) {
54
+ return state.uiConfig;
55
+ });
56
+ return /*#__PURE__*/React.createElement("div", {
57
+ className: prefixCls
58
+ }, /*#__PURE__*/React.createElement("div", {
59
+ className: "".concat(prefixCls, "-main")
60
+ }, /*#__PURE__*/React.createElement(Left, props), /*#__PURE__*/React.createElement("div", {
61
+ className: "".concat(prefixCls, "-right"),
62
+ style: {
63
+ background: uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.background
64
+ }
65
+ }, props.top, props.right)));
66
+ }
67
+ export var isMobileHook = function isMobileHook() {
68
+ var responsive = useResponsive();
69
+ var uiConfig = useChatAnywhere(function (state) {
70
+ return state.uiConfig;
71
+ });
72
+ return !responsive.md || (uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.narrowScreen);
73
+ };
@@ -0,0 +1,61 @@
1
+ @import '../../index.less';
2
+
3
+ #root {
4
+ display: flex;
5
+ flex-direction: column;
6
+ height: 100vh;
7
+ }
8
+
9
+ .@{ant-prefix}-chat-anywhere-layout {
10
+ *::-webkit-scrollbar {
11
+ display: none;
12
+ }
13
+
14
+ font-family: e('var(--@{ant-prefix}-font-family)');
15
+ overflow: hidden;
16
+ position: relative;
17
+ height: 100%;
18
+ background: e('var(--@{ant-prefix}-color-bg-base)');
19
+
20
+ &-main {
21
+ display: flex;
22
+ height: 100%;
23
+ background: e('var(--@{ant-prefix}-color-bg-base)');
24
+ }
25
+
26
+ &-left {
27
+ display: flex;
28
+ flex-direction: column;
29
+ height: 100vh;
30
+ box-sizing: border-box;
31
+ background-color: e('var(--@{ant-prefix}-color-bg-base)');
32
+ width: 240px;
33
+ transition: all 0.2s;
34
+
35
+ &-hide {
36
+ margin-left: -168px;
37
+ background-color: transparent;
38
+ }
39
+ }
40
+
41
+ &-right {
42
+ position: relative;
43
+ width: 0;
44
+ flex: 1;
45
+ box-sizing: border-box;
46
+ background: e('var(--@{ant-prefix}-color-fill-tertiary)');
47
+ }
48
+ }
49
+
50
+ * {
51
+ box-sizing: border-box;
52
+ }
53
+
54
+ .i-icon,
55
+ .ant-btn-icon {
56
+ line-height: 1;
57
+ }
58
+
59
+ *[data-tauri-drag-region] {
60
+ -webkit-app-region: drag;
61
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export default function (): React.JSX.Element;
4
+ export declare function InnerSession(): React.JSX.Element;
5
+ export declare function InnerAdder(): React.JSX.Element;
@@ -0,0 +1,115 @@
1
+ import React, { useEffect } from 'react';
2
+ import { Conversations } from "../..";
3
+ import { MenuFoldOutlined, PlusOutlined, MenuUnfoldOutlined, DeleteOutlined } from '@ant-design/icons';
4
+ import "./index.less";
5
+ import cls from 'classnames';
6
+ import { useProviderContext } from "../..";
7
+ import { Button } from '@spark-ai/design';
8
+ import { useChatAnywhere } from "../hooks/ChatAnywhereProvider";
9
+ import { useSessionList } from "../hooks/useSessionList";
10
+ import { useMessages } from "../hooks/useMessages";
11
+ import { isMobileHook } from "../Layout";
12
+ export default function () {
13
+ var _useProviderContext = useProviderContext(),
14
+ getPrefixCls = _useProviderContext.getPrefixCls;
15
+ var prefixCls = getPrefixCls('chat-anywhere-session-list');
16
+ var sessionListShow = useChatAnywhere(function (v) {
17
+ return v.sessionListShow;
18
+ });
19
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
20
+ className: cls("".concat(prefixCls), sessionListShow ? '' : "".concat(prefixCls, "-hide"))
21
+ }, /*#__PURE__*/React.createElement(InnerAdder, null), /*#__PURE__*/React.createElement(InnerSession, null)));
22
+ }
23
+ export function InnerSession() {
24
+ var _useProviderContext2 = useProviderContext(),
25
+ getPrefixCls = _useProviderContext2.getPrefixCls;
26
+ var prefixCls = getPrefixCls('chat-anywhere-session-list');
27
+ var _useSessionList = useSessionList(),
28
+ currentSessionKey = _useSessionList.currentSessionKey,
29
+ setCurrentSessionKey = _useSessionList.setCurrentSessionKey,
30
+ currentRegenerateIndex = _useSessionList.currentRegenerateIndex,
31
+ sessionList = _useSessionList.sessionList,
32
+ getMessagesBySession = _useSessionList.getMessagesBySession,
33
+ setSessionListShow = _useSessionList.setSessionListShow;
34
+ var _useMessages = useMessages(),
35
+ setMessages = _useMessages.setMessages;
36
+ var getLoading = useChatAnywhere(function (v) {
37
+ return v.getLoading;
38
+ });
39
+ var onSessionKeyChange = useChatAnywhere(function (v) {
40
+ return v.onSessionKeyChange;
41
+ });
42
+ var isMobile = isMobileHook();
43
+ useEffect(function () {
44
+ var messages = getMessagesBySession(currentSessionKey, currentRegenerateIndex);
45
+ setMessages(messages);
46
+ }, [currentSessionKey, currentRegenerateIndex]);
47
+ return /*#__PURE__*/React.createElement("div", {
48
+ className: "".concat(prefixCls, "-session")
49
+ }, /*#__PURE__*/React.createElement(Conversations, {
50
+ menu: function menu(session) {
51
+ return {
52
+ items: [{
53
+ label: '删除',
54
+ key: 'delete',
55
+ icon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
56
+ danger: true
57
+ }],
58
+ onClick: function onClick(e) {
59
+ e.domEvent.stopPropagation();
60
+ }
61
+ };
62
+ },
63
+ activeKey: currentSessionKey,
64
+ items: sessionList,
65
+ onActiveChange: function onActiveChange(key) {
66
+ if (getLoading()) return;
67
+ if (isMobile) {
68
+ setSessionListShow(false);
69
+ }
70
+ requestIdleCallback(function () {
71
+ setCurrentSessionKey(key);
72
+ onSessionKeyChange(key);
73
+ });
74
+ }
75
+ }));
76
+ }
77
+ export function InnerAdder() {
78
+ var _useProviderContext3 = useProviderContext(),
79
+ getPrefixCls = _useProviderContext3.getPrefixCls;
80
+ var prefixCls = getPrefixCls('chat-anywhere-session-list');
81
+ var _useSessionList2 = useSessionList(),
82
+ currentSessionKey = _useSessionList2.currentSessionKey,
83
+ setCurrentSessionKey = _useSessionList2.setCurrentSessionKey,
84
+ deleteSession = _useSessionList2.deleteSession,
85
+ createSession = _useSessionList2.createSession,
86
+ sessionList = _useSessionList2.sessionList,
87
+ sessionListShow = _useSessionList2.sessionListShow,
88
+ setSessionListShow = _useSessionList2.setSessionListShow;
89
+ var uiConfig = useChatAnywhere(function (v) {
90
+ return v.uiConfig;
91
+ });
92
+ var isMobile = isMobileHook();
93
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
94
+ className: "".concat(prefixCls, "-logo")
95
+ }, uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.logo, /*#__PURE__*/React.createElement(Button, {
96
+ className: "".concat(prefixCls, "-toggle"),
97
+ type: "text",
98
+ onClick: function onClick() {
99
+ return setSessionListShow(!sessionListShow);
100
+ },
101
+ icon: !sessionListShow ? /*#__PURE__*/React.createElement(MenuUnfoldOutlined, null) : /*#__PURE__*/React.createElement(MenuFoldOutlined, null)
102
+ })), /*#__PURE__*/React.createElement("div", {
103
+ className: "".concat(prefixCls, "-adder")
104
+ }, /*#__PURE__*/React.createElement(Button, {
105
+ type: "primary",
106
+ block: true,
107
+ icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
108
+ onClick: function onClick() {
109
+ if (isMobile) {
110
+ setSessionListShow(false);
111
+ }
112
+ createSession();
113
+ }
114
+ }, "New Session")));
115
+ }
@@ -0,0 +1,52 @@
1
+ @import '../../index.less';
2
+
3
+ .@{ant-prefix}-chat-anywhere-session-list {
4
+ display: flex;
5
+ flex-direction: column;
6
+ height: 0;
7
+ flex: 1;
8
+ width: 100%;
9
+
10
+ .@{ant-prefix}-conversations {
11
+ // padding: 8px 20px;
12
+
13
+ height: 100%;
14
+ }
15
+
16
+ &-session {
17
+ height: 0;
18
+ flex: 1;
19
+ padding: 8px 20px;
20
+
21
+ }
22
+
23
+ &-logo {
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: space-between;
27
+ padding: 0 20px;
28
+ height: 64px;
29
+ }
30
+
31
+ &-adder {
32
+ padding: 0 20px 8px 20px;
33
+ button {
34
+ border-radius: 6px;
35
+ box-shadow: 15px 0px 30px -10px rgba(131, 88, 246, 0.4),
36
+ 0px 0px 30px -10px rgba(255, 142, 168, 0.4),
37
+ -15px 0px 30px -10px rgba(225, 163, 37, 0.4);
38
+ }
39
+ }
40
+
41
+ &-hide {
42
+ .@{ant-prefix}-chat-anywhere-session-list-adder-logo > div {
43
+ opacity: 0;
44
+ }
45
+ .@{ant-prefix}-chat-anywhere-session-list-adder {
46
+ opacity: 0;
47
+ }
48
+ .@{ant-prefix}-chat-anywhere-session-list-session {
49
+ opacity: 0;
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { TMessage, TSession, IChatAnywhereConfig } from './types';
3
+ import { useSessionList } from './useSessionList';
4
+ import { useMessages } from './useMessages';
5
+ import { useInput } from './useInput';
6
+ import { ScrollToBottomOptions } from 'use-stick-to-bottom';
7
+ export declare function ChatAnywhereProvider(props: IChatAnywhereConfig & {
8
+ children: React.ReactNode;
9
+ }): React.JSX.Element;
10
+ export declare const ChatAnywhereContext: import("use-context-selector").Context<IChatAnywhereContext>;
11
+ export declare function useChatAnywhere<Selected>(selector: (value: IChatAnywhereContext) => Selected): Selected;
12
+ export interface IChatAnywhereContext {
13
+ sessionList: TSession[];
14
+ setSessionList: React.Dispatch<React.SetStateAction<TSession[]>>;
15
+ getSessionList: () => TSession[];
16
+ currentSessionKey: string;
17
+ setCurrentSessionKey: React.Dispatch<React.SetStateAction<string>>;
18
+ getCurrentSessionKey: () => string;
19
+ messages: TMessage[];
20
+ setMessages: React.Dispatch<React.SetStateAction<TMessage[]>>;
21
+ getMessages: () => TMessage[];
22
+ loading: boolean;
23
+ setLoading: React.Dispatch<React.SetStateAction<boolean>>;
24
+ getLoading: () => boolean;
25
+ disabled: boolean;
26
+ setDisabled: React.Dispatch<React.SetStateAction<boolean>>;
27
+ getDisabled: () => boolean;
28
+ sessionListShow: boolean;
29
+ setSessionListShow: React.Dispatch<React.SetStateAction<boolean>>;
30
+ getSessionListShow: () => boolean;
31
+ currentRegenerateIndex: number;
32
+ setCurrentRegenerateIndex: React.Dispatch<React.SetStateAction<number>>;
33
+ getCurrentRegenerateIndex: () => number;
34
+ onInput?: IChatAnywhereConfig['onInput'];
35
+ onStop?: IChatAnywhereConfig['onStop'];
36
+ onUpload?: IChatAnywhereConfig['onUpload'];
37
+ onSessionKeyChange?: IChatAnywhereConfig['onSessionKeyChange'];
38
+ uiConfig?: IChatAnywhereConfig['uiConfig'];
39
+ }
40
+ export type ChatAnywhereRef = ReturnType<typeof useMessages> & ReturnType<typeof useInput> & ReturnType<typeof useSessionList> & {
41
+ scrollToBottom: (options?: ScrollToBottomOptions) => void;
42
+ reload: () => void;
43
+ };
@@ -0,0 +1,90 @@
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 = ["children"];
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 _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; }
9
+ 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; }
10
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
+ 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."); }
12
+ 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); }
13
+ 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; }
14
+ 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; } }
15
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
+ import React from 'react';
17
+ import { useGetState } from 'ahooks';
18
+ import { createContext, useContextSelector } from 'use-context-selector';
19
+ export function ChatAnywhereProvider(props) {
20
+ var _useGetState = useGetState([]),
21
+ _useGetState2 = _slicedToArray(_useGetState, 3),
22
+ sessionList = _useGetState2[0],
23
+ setSessionList = _useGetState2[1],
24
+ getSessionList = _useGetState2[2];
25
+ var _useGetState3 = useGetState('0'),
26
+ _useGetState4 = _slicedToArray(_useGetState3, 3),
27
+ currentSessionKey = _useGetState4[0],
28
+ setCurrentSessionKey = _useGetState4[1],
29
+ getCurrentSessionKey = _useGetState4[2];
30
+ var _useGetState5 = useGetState(0),
31
+ _useGetState6 = _slicedToArray(_useGetState5, 3),
32
+ currentRegenerateIndex = _useGetState6[0],
33
+ setCurrentRegenerateIndex = _useGetState6[1],
34
+ getCurrentRegenerateIndex = _useGetState6[2];
35
+ var _useGetState7 = useGetState([]),
36
+ _useGetState8 = _slicedToArray(_useGetState7, 3),
37
+ messages = _useGetState8[0],
38
+ setMessages = _useGetState8[1],
39
+ getMessages = _useGetState8[2];
40
+ var _useGetState9 = useGetState(false),
41
+ _useGetState10 = _slicedToArray(_useGetState9, 3),
42
+ loading = _useGetState10[0],
43
+ setLoading = _useGetState10[1],
44
+ getLoading = _useGetState10[2];
45
+ var _useGetState11 = useGetState(false),
46
+ _useGetState12 = _slicedToArray(_useGetState11, 3),
47
+ disabled = _useGetState12[0],
48
+ setDisabled = _useGetState12[1],
49
+ getDisabled = _useGetState12[2];
50
+ var _useGetState13 = useGetState(true),
51
+ _useGetState14 = _slicedToArray(_useGetState13, 3),
52
+ sessionListShow = _useGetState14[0],
53
+ setSessionListShow = _useGetState14[1],
54
+ getSessionListShow = _useGetState14[2];
55
+ var children = props.children,
56
+ rest = _objectWithoutProperties(props, _excluded);
57
+ var value = _objectSpread({
58
+ sessionList: sessionList,
59
+ setSessionList: setSessionList,
60
+ getSessionList: getSessionList,
61
+ currentSessionKey: currentSessionKey,
62
+ setCurrentSessionKey: setCurrentSessionKey,
63
+ getCurrentSessionKey: getCurrentSessionKey,
64
+ messages: messages,
65
+ setMessages: setMessages,
66
+ getMessages: getMessages,
67
+ loading: loading,
68
+ setLoading: setLoading,
69
+ getLoading: getLoading,
70
+ disabled: disabled,
71
+ setDisabled: setDisabled,
72
+ getDisabled: getDisabled,
73
+ sessionListShow: sessionListShow,
74
+ setSessionListShow: setSessionListShow,
75
+ getSessionListShow: getSessionListShow,
76
+ currentRegenerateIndex: currentRegenerateIndex,
77
+ setCurrentRegenerateIndex: setCurrentRegenerateIndex,
78
+ getCurrentRegenerateIndex: getCurrentRegenerateIndex
79
+ }, rest);
80
+ return /*#__PURE__*/React.createElement(ChatAnywhereContext.Provider, {
81
+ value: value
82
+ }, children);
83
+ }
84
+ export var ChatAnywhereContext = createContext(undefined);
85
+ export function useChatAnywhere(selector) {
86
+ var context = useContextSelector(ChatAnywhereContext, selector);
87
+ return context;
88
+ }
89
+ ;
90
+ ;