@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.
- package/README.md +88 -0
- package/dist/_util/hooks/use-proxy-imperative-handle.d.ts +4 -0
- package/dist/_util/hooks/use-proxy-imperative-handle.js +18 -0
- package/dist/_util/type.d.ts +1 -0
- package/dist/_util/type.js +1 -0
- package/dist/_util/warning.d.ts +30 -0
- package/dist/_util/warning.js +63 -0
- package/dist/accordion/Accordion.d.ts +22 -0
- package/dist/accordion/Accordion.js +93 -0
- package/dist/accordion/BodyContent.d.ts +8 -0
- package/dist/accordion/BodyContent.js +18 -0
- package/dist/accordion/DeepThink.d.ts +7 -0
- package/dist/accordion/DeepThink.js +35 -0
- package/dist/accordion/index.d.ts +2 -0
- package/dist/accordion/index.js +1 -0
- package/dist/accordion/index.less +170 -0
- package/dist/attachments/DropArea.d.ts +8 -0
- package/dist/attachments/DropArea.js +87 -0
- package/dist/attachments/FileList/AudioIcon.d.ts +2 -0
- package/dist/attachments/FileList/AudioIcon.js +19 -0
- package/dist/attachments/FileList/FileListCard.d.ts +12 -0
- package/dist/attachments/FileList/FileListCard.js +229 -0
- package/dist/attachments/FileList/Progress.d.ts +6 -0
- package/dist/attachments/FileList/Progress.js +21 -0
- package/dist/attachments/FileList/VideoIcon.d.ts +2 -0
- package/dist/attachments/FileList/VideoIcon.js +19 -0
- package/dist/attachments/FileList/index.d.ts +16 -0
- package/dist/attachments/FileList/index.js +132 -0
- package/dist/attachments/PlaceholderUploader.d.ts +17 -0
- package/dist/attachments/PlaceholderUploader.js +79 -0
- package/dist/attachments/SilentUploader.d.ts +9 -0
- package/dist/attachments/SilentUploader.js +23 -0
- package/dist/attachments/context.d.ts +5 -0
- package/dist/attachments/context.js +2 -0
- package/dist/attachments/index.d.ts +33 -0
- package/dist/attachments/index.js +166 -0
- package/dist/attachments/style/fileCard.d.ts +4 -0
- package/dist/attachments/style/fileCard.js +124 -0
- package/dist/attachments/style/index.d.ts +10 -0
- package/dist/attachments/style/index.js +211 -0
- package/dist/attachments/util.d.ts +2 -0
- package/dist/attachments/util.js +53 -0
- package/dist/bubble/Avatar.d.ts +10 -0
- package/dist/bubble/Avatar.js +22 -0
- package/dist/bubble/Bubble.d.ts +11 -0
- package/dist/bubble/Bubble.js +102 -0
- package/dist/bubble/BubbleList.d.ts +15 -0
- package/dist/bubble/BubbleList.js +44 -0
- package/dist/bubble/Cards.d.ts +21 -0
- package/dist/bubble/Cards.js +47 -0
- package/dist/bubble/ScrollToBottom.d.ts +7 -0
- package/dist/bubble/ScrollToBottom.js +45 -0
- package/dist/bubble/Spin.d.ts +2 -0
- package/dist/bubble/Spin.js +18 -0
- package/dist/bubble/hooks/useDisplayData.d.ts +0 -0
- package/dist/bubble/hooks/useDisplayData.js +0 -0
- package/dist/bubble/hooks/useListData.d.ts +0 -0
- package/dist/bubble/hooks/useListData.js +0 -0
- package/dist/bubble/index.d.ts +8 -0
- package/dist/bubble/index.js +4 -0
- package/dist/bubble/interface.d.ts +26 -0
- package/dist/bubble/interface.js +1 -0
- package/dist/bubble/loading.d.ts +6 -0
- package/dist/bubble/loading.js +17 -0
- package/dist/bubble/style/avatar.less +40 -0
- package/dist/bubble/style/content.d.ts +4 -0
- package/dist/bubble/style/content.js +43 -0
- package/dist/bubble/style/index.d.ts +9 -0
- package/dist/bubble/style/index.js +53 -0
- package/dist/bubble/style/list.less +15 -0
- package/dist/bubble/style/scrollToBottom.less +174 -0
- package/dist/chat-anywhere/Chat/Ref.d.ts +3 -0
- package/dist/chat-anywhere/Chat/Ref.js +19 -0
- package/dist/chat-anywhere/Chat/index.d.ts +4 -0
- package/dist/chat-anywhere/Chat/index.js +65 -0
- package/dist/chat-anywhere/Chat/index.less +54 -0
- package/dist/chat-anywhere/Header/index.d.ts +3 -0
- package/dist/chat-anywhere/Header/index.js +32 -0
- package/dist/chat-anywhere/Header/index.less +24 -0
- package/dist/chat-anywhere/Input/index.d.ts +3 -0
- package/dist/chat-anywhere/Input/index.js +170 -0
- package/dist/chat-anywhere/Input/index.less +12 -0
- package/dist/chat-anywhere/Layout/index.d.ts +10 -0
- package/dist/chat-anywhere/Layout/index.js +73 -0
- package/dist/chat-anywhere/Layout/index.less +61 -0
- package/dist/chat-anywhere/SessionList/index.d.ts +5 -0
- package/dist/chat-anywhere/SessionList/index.js +115 -0
- package/dist/chat-anywhere/SessionList/index.less +52 -0
- package/dist/chat-anywhere/hooks/ChatAnywhereProvider.d.ts +43 -0
- package/dist/chat-anywhere/hooks/ChatAnywhereProvider.js +90 -0
- package/dist/chat-anywhere/hooks/types.d.ts +57 -0
- package/dist/chat-anywhere/hooks/types.js +1 -0
- package/dist/chat-anywhere/hooks/useInput.d.ts +7 -0
- package/dist/chat-anywhere/hooks/useInput.js +21 -0
- package/dist/chat-anywhere/hooks/useMessages.d.ts +11 -0
- package/dist/chat-anywhere/hooks/useMessages.js +56 -0
- package/dist/chat-anywhere/hooks/useSessionList.d.ts +24 -0
- package/dist/chat-anywhere/hooks/useSessionList.js +120 -0
- package/dist/chat-anywhere/index.d.ts +9 -0
- package/dist/chat-anywhere/index.js +58 -0
- package/dist/conversations/GroupTitle.d.ts +10 -0
- package/dist/conversations/GroupTitle.js +15 -0
- package/dist/conversations/Item.d.ts +14 -0
- package/dist/conversations/Item.js +96 -0
- package/dist/conversations/hooks/useGroupable.d.ts +9 -0
- package/dist/conversations/hooks/useGroupable.js +72 -0
- package/dist/conversations/index.d.ts +62 -0
- package/dist/conversations/index.js +124 -0
- package/dist/conversations/interface.d.ts +60 -0
- package/dist/conversations/interface.js +1 -0
- package/dist/conversations/style/index.d.ts +9 -0
- package/dist/conversations/style/index.js +80 -0
- package/dist/default-cards/Count/index.d.ts +3 -0
- package/dist/default-cards/Count/index.js +16 -0
- package/dist/default-cards/Count/index.less +19 -0
- package/dist/default-cards/DeepThink/index.d.ts +11 -0
- package/dist/default-cards/DeepThink/index.js +11 -0
- package/dist/default-cards/DeepThink/index.less +0 -0
- package/dist/default-cards/Files/index.d.ts +2 -0
- package/dist/default-cards/Files/index.js +18 -0
- package/dist/default-cards/Footer/index.d.ts +19 -0
- package/dist/default-cards/Footer/index.js +50 -0
- package/dist/default-cards/Footer/index.less +41 -0
- package/dist/default-cards/Images/index.d.ts +3 -0
- package/dist/default-cards/Images/index.js +33 -0
- package/dist/default-cards/Images/index.less +17 -0
- package/dist/default-cards/Interrupted/index.d.ts +11 -0
- package/dist/default-cards/Interrupted/index.js +40 -0
- package/dist/default-cards/Interrupted/index.less +57 -0
- package/dist/default-cards/Text/index.d.ts +2 -0
- package/dist/default-cards/Text/index.js +12 -0
- package/dist/default-cards/index.d.ts +6 -0
- package/dist/default-cards/index.js +6 -0
- package/dist/disclaimer/index.d.ts +11 -0
- package/dist/disclaimer/index.js +26 -0
- package/dist/docs/1896.async.js +457 -0
- package/dist/docs/2710.async.js +62 -0
- package/dist/docs/2863.async.js +400 -0
- package/dist/docs/3057.async.js +46 -0
- package/dist/docs/3364.async.js +25 -0
- package/dist/docs/404.html +15 -0
- package/dist/docs/4820.async.js +1381 -0
- package/dist/docs/5623.async.js +60 -0
- package/dist/docs/5757.async.js +1 -0
- package/dist/docs/5804.async.js +271 -0
- package/dist/docs/6198.async.js +18 -0
- package/dist/docs/6671.async.js +137 -0
- package/dist/docs/7195.async.js +1 -0
- package/dist/docs/7485.async.js +29 -0
- package/dist/docs/7931.async.js +19 -0
- package/dist/docs/7997.async.js +5 -0
- package/dist/docs/8156.async.js +110 -0
- package/dist/docs/8368.async.js +2 -0
- package/dist/docs/8480.async.js +1449 -0
- package/dist/docs/8618.async.js +246 -0
- package/dist/docs/9016.async.js +32 -0
- package/dist/docs/9016.chunk.css +1 -0
- package/dist/docs/9335.async.js +11 -0
- package/dist/docs/accordion__demos.async.js +9 -0
- package/dist/docs/attachments__demos.async.js +1 -0
- package/dist/docs/bubble__demos.async.js +50 -0
- package/dist/docs/components/accordion/index.html +15 -0
- package/dist/docs/components/accordion-cn/index.html +15 -0
- package/dist/docs/components/attachments/index.html +15 -0
- package/dist/docs/components/attachments-cn/index.html +15 -0
- package/dist/docs/components/bubble/index.html +15 -0
- package/dist/docs/components/bubble-cn/index.html +15 -0
- package/dist/docs/components/bubble-list/index.html +15 -0
- package/dist/docs/components/bubble-list-cn/index.html +15 -0
- package/dist/docs/components/conversations/index.html +15 -0
- package/dist/docs/components/conversations-cn/index.html +15 -0
- package/dist/docs/components/disclaimer/index.html +15 -0
- package/dist/docs/components/disclaimer-cn/index.html +15 -0
- package/dist/docs/components/footer/index.html +15 -0
- package/dist/docs/components/footer-cn/index.html +15 -0
- package/dist/docs/components/markdown/index.html +15 -0
- package/dist/docs/components/markdown-cn/index.html +15 -0
- package/dist/docs/components/sender/index.html +15 -0
- package/dist/docs/components/sender-cn/index.html +15 -0
- package/dist/docs/components/status/index.html +15 -0
- package/dist/docs/components/status-cn/index.html +15 -0
- package/dist/docs/components/welcome/index.html +15 -0
- package/dist/docs/components/welcome-cn/index.html +15 -0
- package/dist/docs/components__accordion__index.en-US.md.async.js +6 -0
- package/dist/docs/components__accordion__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__accordion__index.zh-CN.md.async.js +6 -0
- package/dist/docs/components__accordion__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__attachments__index.en-US.md.async.js +1 -0
- package/dist/docs/components__attachments__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__attachments__index.zh-CN.md.async.js +1 -0
- package/dist/docs/components__attachments__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__bubble-list__index.en-US.md.async.js +2 -0
- package/dist/docs/components__bubble-list__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__bubble-list__index.zh-CN.md.async.js +2 -0
- package/dist/docs/components__bubble-list__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__bubble__index.en-US.md.async.js +1 -0
- package/dist/docs/components__bubble__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__bubble__index.zh-CN.md.async.js +1 -0
- package/dist/docs/components__bubble__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__conversations__index.en-US.md.async.js +2 -0
- package/dist/docs/components__conversations__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__conversations__index.zh-CN.md.async.js +1 -0
- package/dist/docs/components__conversations__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__disclaimer__index.en-US.md.async.js +1 -0
- package/dist/docs/components__disclaimer__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__disclaimer__index.zh-CN.md.async.js +1 -0
- package/dist/docs/components__disclaimer__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__footer__index.en-US.md.async.js +1 -0
- package/dist/docs/components__footer__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__footer__index.zh-CN.md.async.js +2 -0
- package/dist/docs/components__footer__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__markdown__index.en-US.md.async.js +1 -0
- package/dist/docs/components__markdown__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__markdown__index.zh-CN.md.async.js +1 -0
- package/dist/docs/components__markdown__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__sender__index.en-US.md.async.js +1 -0
- package/dist/docs/components__sender__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__sender__index.zh-CN.md.async.js +1 -0
- package/dist/docs/components__sender__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__status__index.en-US.md.async.js +1 -0
- package/dist/docs/components__status__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__status__index.zh-CN.md.async.js +2 -0
- package/dist/docs/components__status__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/components__welcome__index.en-US.md.async.js +2 -0
- package/dist/docs/components__welcome__index.en-US.md.chunk.css +1 -0
- package/dist/docs/components__welcome__index.zh-CN.md.async.js +2 -0
- package/dist/docs/components__welcome__index.zh-CN.md.chunk.css +1 -0
- package/dist/docs/conversations__demos.async.js +1 -0
- package/dist/docs/demos.async.js +47 -0
- package/dist/docs/demos.chunk.css +1 -0
- package/dist/docs/disclaimer__demos.async.js +1 -0
- package/dist/docs/docs/development/ag-ui/index.html +15 -0
- package/dist/docs/docs/development/ag-ui-cn/index.html +15 -0
- package/dist/docs/docs/development/backend/index.html +15 -0
- package/dist/docs/docs/development/backend-cn/index.html +15 -0
- package/dist/docs/docs/development/cards/index.html +15 -0
- package/dist/docs/docs/development/cards-cn/index.html +15 -0
- package/dist/docs/docs/development/chatanywhere/index.html +15 -0
- package/dist/docs/docs/development/chatanywhere-api/index.html +15 -0
- package/dist/docs/docs/development/chatanywhere-api-cn/index.html +15 -0
- package/dist/docs/docs/development/chatanywhere-cn/index.html +15 -0
- package/dist/docs/docs/development/custom/index.html +15 -0
- package/dist/docs/docs/development/custom-cn/index.html +15 -0
- package/dist/docs/docs/development/overview/index.html +15 -0
- package/dist/docs/docs/development/overview-cn/index.html +15 -0
- package/dist/docs/docs/development/qwen/index.html +15 -0
- package/dist/docs/docs/development/qwen-cn/index.html +15 -0
- package/dist/docs/docs/templates/copilot/index.html +15 -0
- package/dist/docs/docs/templates/copilot-cn/index.html +15 -0
- package/dist/docs/docs/templates/native/index.html +15 -0
- package/dist/docs/docs/templates/native-cn/index.html +15 -0
- package/dist/docs/docs/templates/voice/index.html +15 -0
- package/dist/docs/docs/templates/voice-cn/index.html +15 -0
- package/dist/docs/docs__development__ag-ui.en-US.md.async.js +210 -0
- package/dist/docs/docs__development__ag-ui.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__ag-ui.zh-CN.md.async.js +210 -0
- package/dist/docs/docs__development__ag-ui.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__development__backend.en-US.md.async.js +12 -0
- package/dist/docs/docs__development__backend.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__backend.zh-CN.md.async.js +12 -0
- package/dist/docs/docs__development__backend.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__development__cards.en-US.md.async.js +27 -0
- package/dist/docs/docs__development__cards.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__cards.zh-CN.md.async.js +27 -0
- package/dist/docs/docs__development__cards.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__development__chatanywhere-api.en-US.md.async.js +69 -0
- package/dist/docs/docs__development__chatanywhere-api.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__chatanywhere-api.zh-CN.md.async.js +69 -0
- package/dist/docs/docs__development__chatanywhere-api.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__development__chatanywhere.en-US.md.async.js +77 -0
- package/dist/docs/docs__development__chatanywhere.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__chatanywhere.zh-CN.md.async.js +77 -0
- package/dist/docs/docs__development__chatanywhere.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__development__custom.en-US.md.async.js +22 -0
- package/dist/docs/docs__development__custom.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__custom.zh-CN.md.async.js +22 -0
- package/dist/docs/docs__development__custom.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__development__overview.en-US.md.async.js +21 -0
- package/dist/docs/docs__development__overview.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__overview.zh-CN.md.async.js +21 -0
- package/dist/docs/docs__development__overview.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__development__qwen.en-US.md.async.js +25 -0
- package/dist/docs/docs__development__qwen.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__development__qwen.zh-CN.md.async.js +25 -0
- package/dist/docs/docs__development__qwen.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__templates__copilot.en-US.md.async.js +1 -0
- package/dist/docs/docs__templates__copilot.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__templates__copilot.zh-CN.md.async.js +1 -0
- package/dist/docs/docs__templates__copilot.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__templates__native.en-US.md.async.js +1 -0
- package/dist/docs/docs__templates__native.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__templates__native.zh-CN.md.async.js +1 -0
- package/dist/docs/docs__templates__native.zh-CN.md.chunk.css +1 -0
- package/dist/docs/docs__templates__voice.en-US.md.async.js +20 -0
- package/dist/docs/docs__templates__voice.en-US.md.chunk.css +1 -0
- package/dist/docs/docs__templates__voice.zh-CN.md.async.js +1 -0
- package/dist/docs/docs__templates__voice.zh-CN.md.chunk.css +1 -0
- package/dist/docs/dumi__pages__index__index.en-US.async.js +1 -0
- package/dist/docs/dumi__pages__index__index.en-US.chunk.css +1 -0
- package/dist/docs/dumi__pages__index__index.zh-CN.async.js +1 -0
- package/dist/docs/dumi__pages__index__index.zh-CN.chunk.css +1 -0
- package/dist/docs/dumi__theme__layouts__DocLayout__index.async.js +1 -0
- package/dist/docs/dumi__theme__layouts__DocLayout__index.chunk.css +1 -0
- package/dist/docs/dumi__theme__layouts__GlobalLayout__index.async.js +18 -0
- package/dist/docs/dumi__theme__layouts__GlobalLayout__index.chunk.css +1 -0
- package/dist/docs/dumi__tmp-production__dumi__theme__ContextWrapper.async.js +1 -0
- package/dist/docs/index/index.html +15 -0
- package/dist/docs/index-cn/index.html +15 -0
- package/dist/docs/markdown__demos.async.js +164 -0
- package/dist/docs/meta__components__en-US.async.js +9 -0
- package/dist/docs/meta__components__zh-CN.async.js +10 -0
- package/dist/docs/meta__docs__en-US.async.js +475 -0
- package/dist/docs/meta__docs__en-US.chunk.css +1 -0
- package/dist/docs/meta__docs__zh-CN.async.js +456 -0
- package/dist/docs/meta__docs__zh-CN.chunk.css +1 -0
- package/dist/docs/nm__dumi__dist__client__pages__404.async.js +1 -0
- package/dist/docs/nm__dumi__dist__client__pages__Demo__index.async.js +1 -0
- package/dist/docs/nm__dumi__dist__client__pages__Demo__index.chunk.css +1 -0
- package/dist/docs/preload_helper.js +1 -0
- package/dist/docs/sender__demos.async.js +1 -0
- package/dist/docs/umi.css +1 -0
- package/dist/docs/umi.js +107 -0
- package/dist/docs/welcome__demos.async.js +1 -0
- package/dist/docs/~demos/:id/index.html +15 -0
- package/dist/docs/~demos/accordion-demo-inline/index.html +15 -0
- package/dist/docs/~demos/accordion-demo-mutisteps/index.html +15 -0
- package/dist/docs/~demos/accordion-demo-thinking/index.html +15 -0
- package/dist/docs/~demos/attachments-demo-files/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-basic/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-havestopped/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-userwithfile/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-userwithimage/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-userwithnormal/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-withavatar/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-withcode/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-witherror/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-witherrordetail/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-withimage/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-withusage/index.html +15 -0
- package/dist/docs/~demos/bubble-demo-withwaitingmessage/index.html +15 -0
- package/dist/docs/~demos/components-bubble-list-demo-basic/index.html +15 -0
- package/dist/docs/~demos/components-footer-demo-basic/index.html +15 -0
- package/dist/docs/~demos/components-footer-demo-withusage/index.html +15 -0
- package/dist/docs/~demos/components-status-demo-basic/index.html +15 -0
- package/dist/docs/~demos/conversations-demo-basic/index.html +15 -0
- package/dist/docs/~demos/disclaimer-demo-demo/index.html +15 -0
- package/dist/docs/~demos/disclaimer-demo-withlink/index.html +15 -0
- package/dist/docs/~demos/docs-development-ag-ui-demo-with-copilotkit/index.html +15 -0
- package/dist/docs/~demos/docs-development-cards-demo-file/index.html +15 -0
- package/dist/docs/~demos/docs-development-cards-demo-footer/index.html +15 -0
- package/dist/docs/~demos/docs-development-cards-demo-image/index.html +15 -0
- package/dist/docs/~demos/docs-development-cards-demo-text/index.html +15 -0
- package/dist/docs/~demos/docs-development-custom-demo-custom/index.html +15 -0
- package/dist/docs/~demos/docs-templates-copilot-demo-copilot/index.html +15 -0
- package/dist/docs/~demos/docs-templates-native-demo-basic/index.html +15 -0
- package/dist/docs/~demos/docs-templates-voice-demo-demo/index.html +15 -0
- package/dist/docs/~demos/markdown-demo-citations/index.html +15 -0
- package/dist/docs/~demos/markdown-demo-cursor/index.html +15 -0
- package/dist/docs/~demos/markdown-demo-mathjax/index.html +15 -0
- package/dist/docs/~demos/markdown-demo-md/index.html +15 -0
- package/dist/docs/~demos/sender-demo-basic/index.html +15 -0
- package/dist/docs/~demos/sender-demo-disabled/index.html +15 -0
- package/dist/docs/~demos/sender-demo-loading/index.html +15 -0
- package/dist/docs/~demos/sender-demo-moreprefixaction/index.html +15 -0
- package/dist/docs/~demos/sender-demo-withfile/index.html +15 -0
- package/dist/docs/~demos/welcome-demo-demo0/index.html +15 -0
- package/dist/docs/~demos/welcome-demo-demo1/index.html +15 -0
- package/dist/docs/~demos/welcome-demo-demo2/index.html +15 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +20 -0
- package/dist/index.less +1 -0
- package/dist/markdown/Citation.d.ts +16 -0
- package/dist/markdown/Citation.js +55 -0
- package/dist/markdown/CodeBlock.d.ts +6 -0
- package/dist/markdown/CodeBlock.js +88 -0
- package/dist/markdown/ImageOrVideo.d.ts +2 -0
- package/dist/markdown/ImageOrVideo.js +81 -0
- package/dist/markdown/Link.d.ts +3 -0
- package/dist/markdown/Link.js +28 -0
- package/dist/markdown/Markdown.d.ts +4 -0
- package/dist/markdown/Markdown.js +121 -0
- package/dist/markdown/cursor/Blur.d.ts +3 -0
- package/dist/markdown/cursor/Blur.js +7 -0
- package/dist/markdown/cursor/Dot.d.ts +3 -0
- package/dist/markdown/cursor/Dot.js +16 -0
- package/dist/markdown/cursor/Underline.d.ts +3 -0
- package/dist/markdown/cursor/Underline.js +7 -0
- package/dist/markdown/cursor/index.less +124 -0
- package/dist/markdown/hooks/index.d.ts +1 -0
- package/dist/markdown/hooks/index.js +49 -0
- package/dist/markdown/hooks/useTypedEffect.d.ts +6 -0
- package/dist/markdown/hooks/useTypedEffect.js +56 -0
- package/dist/markdown/index.d.ts +16 -0
- package/dist/markdown/index.js +37 -0
- package/dist/markdown/index.less +204 -0
- package/dist/markdown/plugins/footnote.d.ts +2 -0
- package/dist/markdown/plugins/footnote.js +89 -0
- package/dist/markdown/plugins/katexDir.d.ts +1 -0
- package/dist/markdown/plugins/katexDir.js +15 -0
- package/dist/markdown/rehype/fadeIn.d.ts +2 -0
- package/dist/markdown/rehype/fadeIn.js +43 -0
- package/dist/markdown/type.d.ts +46 -0
- package/dist/markdown/type.js +1 -0
- package/dist/markdown/utils.d.ts +22 -0
- package/dist/markdown/utils.js +125 -0
- package/dist/provider/CustomCardsProvider.d.ts +15 -0
- package/dist/provider/CustomCardsProvider.js +18 -0
- package/dist/provider/GlobalProvider.d.ts +5 -0
- package/dist/provider/GlobalProvider.js +11 -0
- package/dist/provider/index.d.ts +8 -0
- package/dist/provider/index.js +20 -0
- package/dist/provider/types.d.ts +8 -0
- package/dist/provider/types.js +1 -0
- package/dist/sender/SenderHeader.d.ts +19 -0
- package/dist/sender/SenderHeader.js +79 -0
- package/dist/sender/StopLoading.d.ts +5 -0
- package/dist/sender/StopLoading.js +20 -0
- package/dist/sender/components/ActionButton.d.ts +22 -0
- package/dist/sender/components/ActionButton.js +39 -0
- package/dist/sender/components/ClearButton.d.ts +4 -0
- package/dist/sender/components/ClearButton.js +13 -0
- package/dist/sender/components/LoadingButton.d.ts +4 -0
- package/dist/sender/components/LoadingButton.js +22 -0
- package/dist/sender/components/SendButton.d.ts +4 -0
- package/dist/sender/components/SendButton.js +14 -0
- package/dist/sender/components/SpeechButton/RecordingIcon.d.ts +5 -0
- package/dist/sender/components/SpeechButton/RecordingIcon.js +49 -0
- package/dist/sender/components/SpeechButton/index.d.ts +4 -0
- package/dist/sender/components/SpeechButton/index.js +30 -0
- package/dist/sender/index.d.ts +61 -0
- package/dist/sender/index.js +307 -0
- package/dist/sender/style/header.d.ts +4 -0
- package/dist/sender/style/header.js +46 -0
- package/dist/sender/style/index.d.ts +10 -0
- package/dist/sender/style/index.js +123 -0
- package/dist/sender/useSpeech.d.ts +6 -0
- package/dist/sender/useSpeech.js +114 -0
- package/dist/stream/index.d.ts +34 -0
- package/dist/stream/index.en-US.md.bk +50 -0
- package/dist/stream/index.js +197 -0
- package/dist/stream/index.zh-CN.md.bk +51 -0
- package/dist/theme/components.d.ts +10 -0
- package/dist/theme/components.js +1 -0
- package/dist/theme/cssinjs-utils.d.ts +14 -0
- package/dist/theme/cssinjs-utils.js +1 -0
- package/dist/theme/genStyleUtils.d.ts +28 -0
- package/dist/theme/genStyleUtils.js +49 -0
- package/dist/theme/useToken.d.ts +18 -0
- package/dist/theme/useToken.js +110 -0
- package/dist/version/index.d.ts +2 -0
- package/dist/version/index.js +2 -0
- package/dist/voice-chat/Recorder/index.d.ts +26 -0
- package/dist/voice-chat/Recorder/index.js +168 -0
- package/dist/voice-chat/VoiceChatProvider/context.d.ts +22 -0
- package/dist/voice-chat/VoiceChatProvider/context.js +3 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useChatState.d.ts +1 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useChatState.js +5 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useMessages.d.ts +8 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useMessages.js +31 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useRecorder.d.ts +5 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useRecorder.js +48 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useVoiceChat.d.ts +4 -0
- package/dist/voice-chat/VoiceChatProvider/hooks/useVoiceChat.js +10 -0
- package/dist/voice-chat/VoiceChatProvider/index.d.ts +9 -0
- package/dist/voice-chat/VoiceChatProvider/index.js +55 -0
- package/dist/voice-chat/VoiceChatService/index.d.ts +34 -0
- package/dist/voice-chat/VoiceChatService/index.js +209 -0
- package/dist/voice-chat/index.d.ts +2 -0
- package/dist/voice-chat/index.js +2 -0
- package/dist/voice-chat/types/index.d.ts +12 -0
- package/dist/voice-chat/types/index.js +4 -0
- package/dist/welcome/icon.d.ts +2 -0
- package/dist/welcome/icon.js +38 -0
- package/dist/welcome/index.d.ts +9 -0
- package/dist/welcome/index.js +57 -0
- package/package.json +117 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { CSSProperties, FC, ReactNode, Ref } from 'react';
|
|
2
|
+
import type { Options as ReactMarkdownOptions } from 'react-markdown';
|
|
3
|
+
import type { Components } from 'react-markdown/lib';
|
|
4
|
+
import type { Pluggable } from 'unified';
|
|
5
|
+
export interface MarkdownProps {
|
|
6
|
+
cursor?: boolean;
|
|
7
|
+
allowHtml?: boolean;
|
|
8
|
+
children: string;
|
|
9
|
+
citations?: {
|
|
10
|
+
title?: string;
|
|
11
|
+
url?: string;
|
|
12
|
+
content?: string;
|
|
13
|
+
}[];
|
|
14
|
+
citationsMap?: Record<string, {
|
|
15
|
+
title?: string;
|
|
16
|
+
url?: string;
|
|
17
|
+
content?: string;
|
|
18
|
+
}>;
|
|
19
|
+
className?: string;
|
|
20
|
+
componentProps?: {
|
|
21
|
+
a?: any;
|
|
22
|
+
highlight?: Partial<any>;
|
|
23
|
+
img?: Partial<any>;
|
|
24
|
+
mermaid?: Partial<any>;
|
|
25
|
+
pre?: Partial<any>;
|
|
26
|
+
video?: Partial<any>;
|
|
27
|
+
};
|
|
28
|
+
components?: Components & Record<string, FC>;
|
|
29
|
+
customRender?: (dom: ReactNode, context: {
|
|
30
|
+
text: string;
|
|
31
|
+
}) => ReactNode;
|
|
32
|
+
enableCustomFootnotes?: boolean;
|
|
33
|
+
enableImageGallery?: boolean;
|
|
34
|
+
enableLatex?: boolean;
|
|
35
|
+
enableMermaid?: boolean;
|
|
36
|
+
fullFeaturedCodeBlock?: boolean;
|
|
37
|
+
onDoubleClick?: () => void;
|
|
38
|
+
reactMarkdownProps?: Omit<Readonly<ReactMarkdownOptions>, 'components' | 'rehypePlugins' | 'remarkPlugins'>;
|
|
39
|
+
ref?: Ref<HTMLDivElement>;
|
|
40
|
+
rehypePlugins?: Pluggable[];
|
|
41
|
+
remarkPlugins?: Pluggable[];
|
|
42
|
+
remarkPluginsAhead?: Pluggable[];
|
|
43
|
+
showFootnotes?: boolean;
|
|
44
|
+
style?: CSSProperties;
|
|
45
|
+
variant?: 'default' | 'chat';
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Pluggable } from 'unified';
|
|
2
|
+
import { MarkdownProps } from './type';
|
|
3
|
+
export declare const contentCache: Map<string, string>;
|
|
4
|
+
export declare const addToCache: (key: string, value: string) => void;
|
|
5
|
+
export declare const createPlugins: (props: {
|
|
6
|
+
cursor?: boolean;
|
|
7
|
+
allowHtml?: boolean;
|
|
8
|
+
enableCustomFootnotes?: boolean;
|
|
9
|
+
enableLatex?: boolean;
|
|
10
|
+
isChatMode?: boolean;
|
|
11
|
+
rehypePlugins?: Pluggable | Pluggable[];
|
|
12
|
+
remarkPlugins?: Pluggable | Pluggable[];
|
|
13
|
+
remarkPluginsAhead?: Pluggable | Pluggable[];
|
|
14
|
+
}) => {
|
|
15
|
+
rehypePluginsList: Pluggable[];
|
|
16
|
+
remarkPluginsList: Pluggable[];
|
|
17
|
+
};
|
|
18
|
+
export declare function escapeBrackets(text: string): string;
|
|
19
|
+
export declare function escapeMhchem(text: string): string;
|
|
20
|
+
export declare function fixMarkdownBold(text: string): string;
|
|
21
|
+
export declare const transformCitations: (rawContent: string, citationsData: MarkdownProps['citationsMap']) => string;
|
|
22
|
+
export declare function Null(): any;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
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); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
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; }
|
|
7
|
+
import rehypeKatex from 'rehype-katex';
|
|
8
|
+
import rehypeRaw from 'rehype-raw';
|
|
9
|
+
import remarkBreaks from 'remark-breaks';
|
|
10
|
+
import remarkGfm from 'remark-gfm';
|
|
11
|
+
import remarkMath from 'remark-math';
|
|
12
|
+
import { rehypeFadeIn } from "./rehype/fadeIn";
|
|
13
|
+
import { rehypeFootnoteLinks, remarkCustomFootnotes } from "./plugins/footnote";
|
|
14
|
+
import { rehypeKatexDir } from "./plugins/katexDir";
|
|
15
|
+
// 使用普通 Map 代替 WeakMap,并限制缓存大小
|
|
16
|
+
var CACHE_SIZE = 50;
|
|
17
|
+
export var contentCache = new Map();
|
|
18
|
+
|
|
19
|
+
// 添加内容到缓存时,保持缓存大小不超过限制
|
|
20
|
+
export var addToCache = function addToCache(key, value) {
|
|
21
|
+
if (contentCache.size >= CACHE_SIZE) {
|
|
22
|
+
// 移除最早加入的缓存项
|
|
23
|
+
var firstKey = contentCache.keys().next().value;
|
|
24
|
+
if (firstKey) contentCache.delete(firstKey);
|
|
25
|
+
}
|
|
26
|
+
contentCache.set(key, value);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// 使用工厂函数处理插件,减少组件中的逻辑负担
|
|
30
|
+
export var createPlugins = function createPlugins(props) {
|
|
31
|
+
var cursor = props.cursor,
|
|
32
|
+
allowHtml = props.allowHtml,
|
|
33
|
+
enableLatex = props.enableLatex,
|
|
34
|
+
enableCustomFootnotes = props.enableCustomFootnotes,
|
|
35
|
+
isChatMode = props.isChatMode,
|
|
36
|
+
rehypePlugins = props.rehypePlugins,
|
|
37
|
+
remarkPlugins = props.remarkPlugins,
|
|
38
|
+
remarkPluginsAhead = props.remarkPluginsAhead;
|
|
39
|
+
|
|
40
|
+
// 预处理插件数组
|
|
41
|
+
var normalizedRehypePlugins = Array.isArray(rehypePlugins) ? rehypePlugins : rehypePlugins ? [rehypePlugins] : [];
|
|
42
|
+
var normalizedRemarkPlugins = Array.isArray(remarkPlugins) ? remarkPlugins : remarkPlugins ? [remarkPlugins] : [];
|
|
43
|
+
var normalizedRemarkPluginsAhead = Array.isArray(remarkPluginsAhead) ? remarkPluginsAhead : remarkPluginsAhead ? [remarkPluginsAhead] : [];
|
|
44
|
+
|
|
45
|
+
// 创建 rehype 插件列表
|
|
46
|
+
var rehypePluginsList = [allowHtml && rehypeRaw, enableLatex && rehypeKatex, enableLatex && rehypeKatexDir, enableCustomFootnotes && rehypeFootnoteLinks, cursor && rehypeFadeIn].concat(_toConsumableArray(normalizedRehypePlugins)).filter(Boolean);
|
|
47
|
+
|
|
48
|
+
// 创建 remark 插件列表
|
|
49
|
+
var remarkPluginsList = [].concat(_toConsumableArray(normalizedRemarkPluginsAhead), [[remarkGfm, {
|
|
50
|
+
singleTilde: false
|
|
51
|
+
}], enableCustomFootnotes && remarkCustomFootnotes, enableLatex && remarkMath, isChatMode && remarkBreaks], _toConsumableArray(normalizedRemarkPlugins)).filter(Boolean);
|
|
52
|
+
return {
|
|
53
|
+
rehypePluginsList: rehypePluginsList,
|
|
54
|
+
remarkPluginsList: remarkPluginsList
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export function escapeBrackets(text) {
|
|
58
|
+
var pattern = /(```[\S\s]*?```|`.*?`)|\\\[([\S\s]*?[^\\])\\]|\\\((.*?)\\\)/g;
|
|
59
|
+
return text.replaceAll(pattern, function (match, codeBlock, squareBracket, roundBracket) {
|
|
60
|
+
if (codeBlock) {
|
|
61
|
+
return codeBlock;
|
|
62
|
+
} else if (squareBracket) {
|
|
63
|
+
return "$$".concat(squareBracket, "$$");
|
|
64
|
+
} else if (roundBracket) {
|
|
65
|
+
return "$".concat(roundBracket, "$");
|
|
66
|
+
}
|
|
67
|
+
return match;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export function escapeMhchem(text) {
|
|
71
|
+
return text.replaceAll('$\\ce{', '$\\\\ce{').replaceAll('$\\pu{', '$\\\\pu{');
|
|
72
|
+
}
|
|
73
|
+
export function fixMarkdownBold(text) {
|
|
74
|
+
var count = 0;
|
|
75
|
+
var count2 = 0;
|
|
76
|
+
var result = '';
|
|
77
|
+
var inCodeBlock = false;
|
|
78
|
+
var inInlineCode = false;
|
|
79
|
+
for (var i = 0; i < text.length; i++) {
|
|
80
|
+
var char = text[i];
|
|
81
|
+
if (text.slice(i, i + 3) === '```') {
|
|
82
|
+
inCodeBlock = !inCodeBlock;
|
|
83
|
+
result += '```';
|
|
84
|
+
i += 2;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (char === '`') {
|
|
88
|
+
inInlineCode = !inInlineCode;
|
|
89
|
+
result += '`';
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (char === '*' && !inInlineCode && !inCodeBlock) {
|
|
93
|
+
count++;
|
|
94
|
+
if (count === 2) {
|
|
95
|
+
count2++;
|
|
96
|
+
}
|
|
97
|
+
if (count > 2) {
|
|
98
|
+
result += char;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (count === 2 && count2 % 2 === 0) {
|
|
102
|
+
var prevChar = i > 0 ? text[i - 2] : '';
|
|
103
|
+
var isPrevCharSymbol = /(?:[!-\/:-@\[-`\{-~\xA1-\xA9\xAB\xAC\xAE-\xB1\xB4\xB6-\xB8\xBB\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u037E\u0384\u0385\u0387\u03F6\u0482\u055A-\u055F\u0589\u058A\u058D-\u058F\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0606-\u060F\u061B\u061D-\u061F\u066A-\u066D\u06D4\u06DE\u06E9\u06FD\u06FE\u0700-\u070D\u07F6-\u07F9\u07FE\u07FF\u0830-\u083E\u085E\u0888\u0964\u0965\u0970\u09F2\u09F3\u09FA\u09FB\u09FD\u0A76\u0AF0\u0AF1\u0B70\u0BF3-\u0BFA\u0C77\u0C7F\u0C84\u0D4F\u0D79\u0DF4\u0E3F\u0E4F\u0E5A\u0E5B\u0F01-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F85\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE-\u0FDA\u104A-\u104F\u109E\u109F\u10FB\u1360-\u1368\u1390-\u1399\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DB\u1800-\u180A\u1940\u1944\u1945\u19DE-\u19FF\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B6A\u1B74-\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2010-\u2027\u2030-\u205E\u207A-\u207E\u208A-\u208E\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2775\u2794-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E5D\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3001-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u303F\u309B\u309C\u30A0\u30FB\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAA77-\uAA79\uAADE\uAADF\uAAF0\uAAF1\uAB5B\uAB6A\uAB6B\uABEB\uFB29\uFBB2-\uFBC2\uFD3E-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD00-\uDD02\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDC77\uDC78\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEC8\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3F]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFD5-\uDFF1\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3F\uDF44\uDF45]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F[\uDC9C\uDC9F]|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE8B]|\uD838[\uDD4F\uDEFF]|\uD83A[\uDD5E\uDD5F]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA])/.test(prevChar);
|
|
104
|
+
result += i + 1 < text.length && text[i + 1] !== ' ' && isPrevCharSymbol ? '* ' : '*';
|
|
105
|
+
} else {
|
|
106
|
+
result += '*';
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
result += char;
|
|
110
|
+
count = 0;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
export var transformCitations = function transformCitations(rawContent, citationsData) {
|
|
116
|
+
var citationsDataArray = Object.entries(citationsData);
|
|
117
|
+
if (citationsDataArray.length === 0) return rawContent;
|
|
118
|
+
var patternForCitationsData = new RegExp("\\[(".concat(Object.keys(citationsData).join('|'), ")\\]"), 'g');
|
|
119
|
+
return rawContent.replaceAll(patternForCitationsData, function (match, id) {
|
|
120
|
+
return "[#citation-".concat(id, "](citation-").concat(id, ")");
|
|
121
|
+
}).replaceAll('][', '] [');
|
|
122
|
+
};
|
|
123
|
+
export function Null() {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ProviderProps } from './types';
|
|
3
|
+
import { DefaultCards } from "..";
|
|
4
|
+
export declare const CustomCardsContext: React.Context<Record<string, any>>;
|
|
5
|
+
export declare const CustomCardsProvider: (props: Pick<ProviderProps, 'cardConfig' | 'children'>) => React.JSX.Element;
|
|
6
|
+
export declare const useCustomCardsContext: () => {
|
|
7
|
+
DeepThink: typeof DefaultCards.DeepThink;
|
|
8
|
+
Files: typeof DefaultCards.Files;
|
|
9
|
+
Images: typeof DefaultCards.Images;
|
|
10
|
+
Text: typeof DefaultCards.Text;
|
|
11
|
+
Footer: typeof DefaultCards.Footer;
|
|
12
|
+
FooterActions: typeof DefaultCards.FooterActions;
|
|
13
|
+
FooterCount: typeof DefaultCards.FooterCount;
|
|
14
|
+
Interrupted: typeof DefaultCards.Interrupted;
|
|
15
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import React, { createContext } from "react";
|
|
8
|
+
import { DefaultCards } from "./..";
|
|
9
|
+
export var CustomCardsContext = /*#__PURE__*/createContext(undefined);
|
|
10
|
+
export var CustomCardsProvider = function CustomCardsProvider(props) {
|
|
11
|
+
return /*#__PURE__*/React.createElement(CustomCardsContext.Provider, {
|
|
12
|
+
value: props.cardConfig
|
|
13
|
+
}, props.children);
|
|
14
|
+
};
|
|
15
|
+
export var useCustomCardsContext = function useCustomCardsContext() {
|
|
16
|
+
var cardConfig = React.useContext(CustomCardsContext);
|
|
17
|
+
return _objectSpread(_objectSpread({}, DefaultCards), cardConfig);
|
|
18
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ProviderProps } from './types';
|
|
3
|
+
export declare const GlobalContext: React.Context<Pick<ProviderProps, "markdown">>;
|
|
4
|
+
export declare const GlobalProvider: (props: Pick<ProviderProps, 'markdown' | 'children'>) => React.JSX.Element;
|
|
5
|
+
export declare const useGlobalContext: () => Pick<ProviderProps, "markdown">;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { createContext } from "react";
|
|
2
|
+
export var GlobalContext = /*#__PURE__*/createContext(undefined);
|
|
3
|
+
export var GlobalProvider = function GlobalProvider(props) {
|
|
4
|
+
return /*#__PURE__*/React.createElement(GlobalContext.Provider, {
|
|
5
|
+
value: props
|
|
6
|
+
}, props.children);
|
|
7
|
+
};
|
|
8
|
+
export var useGlobalContext = function useGlobalContext() {
|
|
9
|
+
var context = React.useContext(GlobalContext);
|
|
10
|
+
return context || {};
|
|
11
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CustomCardsProvider, CustomCardsContext, useCustomCardsContext } from './CustomCardsProvider';
|
|
3
|
+
import { GlobalProvider, GlobalContext, useGlobalContext } from './GlobalProvider';
|
|
4
|
+
import type { ProviderProps } from './types';
|
|
5
|
+
declare const SparkChatProvider: (props: ProviderProps) => React.JSX.Element;
|
|
6
|
+
export declare function useProviderContext(): import("antd/es/config-provider").ConfigConsumerProps;
|
|
7
|
+
export default SparkChatProvider;
|
|
8
|
+
export { useCustomCardsContext, CustomCardsProvider, useGlobalContext, CustomCardsContext, GlobalProvider, GlobalContext, ProviderProps };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ConfigProvider } from "antd";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { CustomCardsProvider, CustomCardsContext, useCustomCardsContext } from "./CustomCardsProvider";
|
|
4
|
+
import { GlobalProvider, GlobalContext, useGlobalContext } from "./GlobalProvider";
|
|
5
|
+
var SparkChatProvider = function SparkChatProvider(props) {
|
|
6
|
+
var children = props.children,
|
|
7
|
+
cardConfig = props.cardConfig,
|
|
8
|
+
markdown = props.markdown;
|
|
9
|
+
return /*#__PURE__*/React.createElement(GlobalProvider, {
|
|
10
|
+
markdown: markdown
|
|
11
|
+
}, /*#__PURE__*/React.createElement(CustomCardsProvider, {
|
|
12
|
+
cardConfig: cardConfig
|
|
13
|
+
}, children));
|
|
14
|
+
};
|
|
15
|
+
export function useProviderContext() {
|
|
16
|
+
var context = React.useContext(ConfigProvider.ConfigContext);
|
|
17
|
+
return context;
|
|
18
|
+
}
|
|
19
|
+
export default SparkChatProvider;
|
|
20
|
+
export { useCustomCardsContext, CustomCardsProvider, useGlobalContext, CustomCardsContext, GlobalProvider, GlobalContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface SendHeaderContextProps {
|
|
3
|
+
prefixCls: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const SendHeaderContext: React.Context<SendHeaderContextProps>;
|
|
6
|
+
export type SemanticType = 'header' | 'content';
|
|
7
|
+
export interface SenderHeaderProps {
|
|
8
|
+
forceRender?: boolean;
|
|
9
|
+
open?: boolean;
|
|
10
|
+
onOpenChange?: (open: boolean) => void;
|
|
11
|
+
title?: React.ReactNode;
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
classNames?: Partial<Record<SemanticType, string>>;
|
|
16
|
+
styles?: Partial<Record<SemanticType, React.CSSProperties>>;
|
|
17
|
+
closable?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export default function SenderHeader(props: SenderHeaderProps): React.JSX.Element;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { CloseOutlined } from '@ant-design/icons';
|
|
8
|
+
import { Button } from 'antd';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import CSSMotion from 'rc-motion';
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
export var SendHeaderContext = /*#__PURE__*/React.createContext({});
|
|
13
|
+
var collapseHeight = function collapseHeight() {
|
|
14
|
+
return {
|
|
15
|
+
height: 0
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
var expandedHeight = function expandedHeight(ele) {
|
|
19
|
+
return {
|
|
20
|
+
height: ele.scrollHeight
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default function SenderHeader(props) {
|
|
24
|
+
var title = props.title,
|
|
25
|
+
onOpenChange = props.onOpenChange,
|
|
26
|
+
open = props.open,
|
|
27
|
+
children = props.children,
|
|
28
|
+
className = props.className,
|
|
29
|
+
style = props.style,
|
|
30
|
+
_props$classNames = props.classNames,
|
|
31
|
+
classes = _props$classNames === void 0 ? {} : _props$classNames,
|
|
32
|
+
_props$styles = props.styles,
|
|
33
|
+
styles = _props$styles === void 0 ? {} : _props$styles,
|
|
34
|
+
closable = props.closable,
|
|
35
|
+
forceRender = props.forceRender;
|
|
36
|
+
var _React$useContext = React.useContext(SendHeaderContext),
|
|
37
|
+
prefixCls = _React$useContext.prefixCls;
|
|
38
|
+
var headerCls = "".concat(prefixCls, "-header");
|
|
39
|
+
return /*#__PURE__*/React.createElement(CSSMotion, {
|
|
40
|
+
motionEnter: true,
|
|
41
|
+
motionLeave: true,
|
|
42
|
+
motionName: "".concat(headerCls, "-motion"),
|
|
43
|
+
leavedClassName: "".concat(headerCls, "-motion-hidden"),
|
|
44
|
+
onEnterStart: collapseHeight,
|
|
45
|
+
onEnterActive: expandedHeight,
|
|
46
|
+
onLeaveStart: expandedHeight,
|
|
47
|
+
onLeaveActive: collapseHeight,
|
|
48
|
+
visible: open,
|
|
49
|
+
forceRender: forceRender
|
|
50
|
+
}, function (_ref) {
|
|
51
|
+
var motionClassName = _ref.className,
|
|
52
|
+
motionStyle = _ref.style;
|
|
53
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: classNames(headerCls, motionClassName, className),
|
|
55
|
+
style: _objectSpread(_objectSpread({}, motionStyle), style)
|
|
56
|
+
}, (closable !== false || title) && /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className:
|
|
58
|
+
// We follow antd naming standard here.
|
|
59
|
+
// So the header part is use `-header` suffix.
|
|
60
|
+
// Though its little bit weird for double `-header`.
|
|
61
|
+
classNames("".concat(headerCls, "-header"), classes.header),
|
|
62
|
+
style: _objectSpread({}, styles.header)
|
|
63
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: "".concat(headerCls, "-title")
|
|
65
|
+
}, title), closable !== false && /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: "".concat(headerCls, "-close")
|
|
67
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
68
|
+
type: "text",
|
|
69
|
+
icon: /*#__PURE__*/React.createElement(CloseOutlined, null),
|
|
70
|
+
size: "small",
|
|
71
|
+
onClick: function onClick() {
|
|
72
|
+
onOpenChange === null || onOpenChange === void 0 || onOpenChange(!open);
|
|
73
|
+
}
|
|
74
|
+
}))), children && /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
className: classNames("".concat(headerCls, "-content"), classes.content),
|
|
76
|
+
style: _objectSpread({}, styles.content)
|
|
77
|
+
}, children));
|
|
78
|
+
});
|
|
79
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
var StopLoadingIcon = /*#__PURE__*/memo(function (props) {
|
|
3
|
+
var className = props.className;
|
|
4
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
5
|
+
color: "currentColor",
|
|
6
|
+
viewBox: "0 0 1000 1000",
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
9
|
+
className: className
|
|
10
|
+
}, /*#__PURE__*/React.createElement("title", null, "Stop Loading"), /*#__PURE__*/React.createElement("rect", {
|
|
11
|
+
fill: "currentColor",
|
|
12
|
+
height: "250",
|
|
13
|
+
rx: "24",
|
|
14
|
+
ry: "24",
|
|
15
|
+
width: "250",
|
|
16
|
+
x: "375",
|
|
17
|
+
y: "375"
|
|
18
|
+
}));
|
|
19
|
+
});
|
|
20
|
+
export default StopLoadingIcon;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ButtonProps } from 'antd';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export interface ActionButtonContextProps {
|
|
4
|
+
prefixCls: string;
|
|
5
|
+
onSend?: VoidFunction;
|
|
6
|
+
onSendDisabled?: boolean;
|
|
7
|
+
onClear?: VoidFunction;
|
|
8
|
+
onClearDisabled?: boolean;
|
|
9
|
+
onCancel?: VoidFunction;
|
|
10
|
+
onCancelDisabled?: boolean;
|
|
11
|
+
onSpeech?: VoidFunction;
|
|
12
|
+
onSpeechDisabled?: boolean;
|
|
13
|
+
speechRecording?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const ActionButtonContext: React.Context<ActionButtonContextProps>;
|
|
17
|
+
export interface ActionButtonProps extends ButtonProps {
|
|
18
|
+
action: 'onSend' | 'onClear' | 'onCancel' | 'onSpeech';
|
|
19
|
+
}
|
|
20
|
+
export declare function ActionButton(props: ActionButtonProps, ref: React.Ref<HTMLButtonElement>): React.JSX.Element;
|
|
21
|
+
declare const _default: React.ForwardRefExoticComponent<ActionButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 = ["className", "action", "onClick"];
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _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; }
|
|
8
|
+
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; }
|
|
9
|
+
import { Button } from 'antd';
|
|
10
|
+
import classNames from 'classnames';
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
export var ActionButtonContext = /*#__PURE__*/React.createContext(null);
|
|
13
|
+
export function ActionButton(props, ref) {
|
|
14
|
+
var _ref;
|
|
15
|
+
var className = props.className,
|
|
16
|
+
action = props.action,
|
|
17
|
+
outClick = props.onClick,
|
|
18
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
19
|
+
var context = React.useContext(ActionButtonContext);
|
|
20
|
+
var prefixCls = context.prefixCls,
|
|
21
|
+
rootDisabled = context.disabled;
|
|
22
|
+
var _onClick = context[action];
|
|
23
|
+
var mergedDisabled = (_ref = rootDisabled !== null && rootDisabled !== void 0 ? rootDisabled : restProps.disabled) !== null && _ref !== void 0 ? _ref : context["".concat(action, "Disabled")];
|
|
24
|
+
return /*#__PURE__*/React.createElement(Button, _extends({}, restProps, {
|
|
25
|
+
ref: ref,
|
|
26
|
+
onClick: function onClick(e) {
|
|
27
|
+
if (!mergedDisabled) {
|
|
28
|
+
if (_onClick) {
|
|
29
|
+
_onClick();
|
|
30
|
+
}
|
|
31
|
+
if (outClick) {
|
|
32
|
+
outClick(e);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
className: classNames(prefixCls, className, _defineProperty({}, "".concat(prefixCls, "-disabled"), mergedDisabled))
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
export default /*#__PURE__*/React.forwardRef(ActionButton);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import { ClearOutlined } from '@ant-design/icons';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import ActionButton from "./ActionButton";
|
|
5
|
+
function ClearButton(props, ref) {
|
|
6
|
+
return /*#__PURE__*/React.createElement(ActionButton, _extends({
|
|
7
|
+
icon: /*#__PURE__*/React.createElement(ClearOutlined, null)
|
|
8
|
+
}, props, {
|
|
9
|
+
action: "onClear",
|
|
10
|
+
ref: ref
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
export default /*#__PURE__*/React.forwardRef(ClearButton);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import StopLoadingIcon from "../StopLoading";
|
|
5
|
+
import ActionButton, { ActionButtonContext } from "./ActionButton";
|
|
6
|
+
function LoadingButton(props, ref) {
|
|
7
|
+
var _React$useContext = React.useContext(ActionButtonContext),
|
|
8
|
+
prefixCls = _React$useContext.prefixCls;
|
|
9
|
+
var className = props.className;
|
|
10
|
+
return /*#__PURE__*/React.createElement(ActionButton, _extends({
|
|
11
|
+
icon: null,
|
|
12
|
+
type: "primary",
|
|
13
|
+
variant: "text"
|
|
14
|
+
}, props, {
|
|
15
|
+
className: classNames(className, "".concat(prefixCls, "-loading-button")),
|
|
16
|
+
action: "onCancel",
|
|
17
|
+
ref: ref
|
|
18
|
+
}), /*#__PURE__*/React.createElement(StopLoadingIcon, {
|
|
19
|
+
className: "".concat(prefixCls, "-loading-icon")
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
export default /*#__PURE__*/React.forwardRef(LoadingButton);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import { ArrowUpOutlined } from '@ant-design/icons';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import ActionButton from "./ActionButton";
|
|
5
|
+
function SendButton(props, ref) {
|
|
6
|
+
return /*#__PURE__*/React.createElement(ActionButton, _extends({
|
|
7
|
+
icon: /*#__PURE__*/React.createElement(ArrowUpOutlined, null),
|
|
8
|
+
type: "primary"
|
|
9
|
+
}, props, {
|
|
10
|
+
action: "onSend",
|
|
11
|
+
ref: ref
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
export default /*#__PURE__*/React.forwardRef(SendButton);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
var SIZE = 1000;
|
|
3
|
+
var COUNT = 4;
|
|
4
|
+
var RECT_WIDTH = 140;
|
|
5
|
+
var RECT_RADIUS = RECT_WIDTH / 2;
|
|
6
|
+
var RECT_HEIGHT_MIN = 250;
|
|
7
|
+
var RECT_HEIGHT_MAX = 500;
|
|
8
|
+
var DURATION = 0.8;
|
|
9
|
+
export default function RecordingIcon(_ref) {
|
|
10
|
+
var className = _ref.className;
|
|
11
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
12
|
+
color: "currentColor",
|
|
13
|
+
viewBox: "0 0 ".concat(SIZE, " ").concat(SIZE),
|
|
14
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
16
|
+
className: className
|
|
17
|
+
}, /*#__PURE__*/React.createElement("title", null, "Speech Recording"), Array.from({
|
|
18
|
+
length: COUNT
|
|
19
|
+
}).map(function (_, index) {
|
|
20
|
+
var dest = (SIZE - RECT_WIDTH * COUNT) / (COUNT - 1);
|
|
21
|
+
var x = index * (dest + RECT_WIDTH);
|
|
22
|
+
var yMin = SIZE / 2 - RECT_HEIGHT_MIN / 2;
|
|
23
|
+
var yMax = SIZE / 2 - RECT_HEIGHT_MAX / 2;
|
|
24
|
+
return /*#__PURE__*/React.createElement("rect", {
|
|
25
|
+
fill: "currentColor",
|
|
26
|
+
rx: RECT_RADIUS,
|
|
27
|
+
ry: RECT_RADIUS,
|
|
28
|
+
height: RECT_HEIGHT_MIN,
|
|
29
|
+
width: RECT_WIDTH,
|
|
30
|
+
x: x,
|
|
31
|
+
y: yMin,
|
|
32
|
+
key: index
|
|
33
|
+
}, /*#__PURE__*/React.createElement("animate", {
|
|
34
|
+
attributeName: "height",
|
|
35
|
+
values: "".concat(RECT_HEIGHT_MIN, "; ").concat(RECT_HEIGHT_MAX, "; ").concat(RECT_HEIGHT_MIN),
|
|
36
|
+
keyTimes: "0; 0.5; 1",
|
|
37
|
+
dur: "".concat(DURATION, "s"),
|
|
38
|
+
begin: "".concat(DURATION / COUNT * index, "s"),
|
|
39
|
+
repeatCount: "indefinite"
|
|
40
|
+
}), /*#__PURE__*/React.createElement("animate", {
|
|
41
|
+
attributeName: "y",
|
|
42
|
+
values: "".concat(yMin, "; ").concat(yMax, "; ").concat(yMin),
|
|
43
|
+
keyTimes: "0; 0.5; 1",
|
|
44
|
+
dur: "".concat(DURATION, "s"),
|
|
45
|
+
begin: "".concat(DURATION / COUNT * index, "s"),
|
|
46
|
+
repeatCount: "indefinite"
|
|
47
|
+
}));
|
|
48
|
+
}));
|
|
49
|
+
}
|