@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,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
7
|
+
<link rel="shortcut icon" href="https://g.alicdn.com/liveme-console/agentscope-portal/0.0.3/assets/agentscope%20logo-af290c80.svg">
|
|
8
|
+
<link rel="stylesheet" href="/umi.css">
|
|
9
|
+
<script src="/preload_helper.js" crossorigin="anonymous"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
<script src="/umi.js" crossorigin="anonymous"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
7
|
+
<link rel="shortcut icon" href="https://g.alicdn.com/liveme-console/agentscope-portal/0.0.3/assets/agentscope%20logo-af290c80.svg">
|
|
8
|
+
<link rel="stylesheet" href="/umi.css">
|
|
9
|
+
<script src="/preload_helper.js" crossorigin="anonymous"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
<script src="/umi.js" crossorigin="anonymous"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
7
|
+
<link rel="shortcut icon" href="https://g.alicdn.com/liveme-console/agentscope-portal/0.0.3/assets/agentscope%20logo-af290c80.svg">
|
|
8
|
+
<link rel="stylesheet" href="/umi.css">
|
|
9
|
+
<script src="/preload_helper.js" crossorigin="anonymous"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
<script src="/umi.js" crossorigin="anonymous"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
7
|
+
<link rel="shortcut icon" href="https://g.alicdn.com/liveme-console/agentscope-portal/0.0.3/assets/agentscope%20logo-af290c80.svg">
|
|
8
|
+
<link rel="stylesheet" href="/umi.css">
|
|
9
|
+
<script src="/preload_helper.js" crossorigin="anonymous"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
<script src="/umi.js" crossorigin="anonymous"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
7
|
+
<link rel="shortcut icon" href="https://g.alicdn.com/liveme-console/agentscope-portal/0.0.3/assets/agentscope%20logo-af290c80.svg">
|
|
8
|
+
<link rel="stylesheet" href="/umi.css">
|
|
9
|
+
<script src="/preload_helper.js" crossorigin="anonymous"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
<script src="/umi.js" crossorigin="anonymous"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
7
|
+
<link rel="shortcut icon" href="https://g.alicdn.com/liveme-console/agentscope-portal/0.0.3/assets/agentscope%20logo-af290c80.svg">
|
|
8
|
+
<link rel="stylesheet" href="/umi.css">
|
|
9
|
+
<script src="/preload_helper.js" crossorigin="anonymous"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
<script src="/umi.js" crossorigin="anonymous"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
7
|
+
<link rel="shortcut icon" href="https://g.alicdn.com/liveme-console/agentscope-portal/0.0.3/assets/agentscope%20logo-af290c80.svg">
|
|
8
|
+
<link rel="stylesheet" href="/umi.css">
|
|
9
|
+
<script src="/preload_helper.js" crossorigin="anonymous"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
<script src="/umi.js" crossorigin="anonymous"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
7
|
+
<link rel="shortcut icon" href="https://g.alicdn.com/liveme-console/agentscope-portal/0.0.3/assets/agentscope%20logo-af290c80.svg">
|
|
8
|
+
<link rel="stylesheet" href="/umi.css">
|
|
9
|
+
<script src="/preload_helper.js" crossorigin="anonymous"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
<script src="/umi.js" crossorigin="anonymous"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import './index.less';
|
|
2
|
+
export { ConfigProvider } from 'antd';
|
|
3
|
+
export { default as version } from './version';
|
|
4
|
+
export { default as Attachments } from './attachments';
|
|
5
|
+
export type { AttachmentsProps } from './attachments';
|
|
6
|
+
export { default as ChatInput, default as Sender } from './sender';
|
|
7
|
+
export type { SenderProps as ChatInputProps, SenderProps } from './sender';
|
|
8
|
+
export { default as Bubble } from './bubble';
|
|
9
|
+
export type { BubbleProps } from './bubble';
|
|
10
|
+
export { default as Conversations } from './conversations';
|
|
11
|
+
export type { ConversationsProps } from './conversations';
|
|
12
|
+
export * from './voice-chat';
|
|
13
|
+
export { useCustomCardsContext, useGlobalContext, CustomCardsContext, CustomCardsProvider, default as SparkChatProvider, useProviderContext, } from './provider';
|
|
14
|
+
export { default as Stream } from './stream';
|
|
15
|
+
export type { StreamOptions as StreamOptions } from './stream';
|
|
16
|
+
export { createCard } from './bubble/Cards';
|
|
17
|
+
export { default as ChatAnywhere, uuid, useChatAnywhere } from './chat-anywhere';
|
|
18
|
+
export type { ChatAnywhereRef, TMessage, TSession } from './chat-anywhere';
|
|
19
|
+
export * as DefaultCards from './default-cards';
|
|
20
|
+
export { Accordion, Accordion as Process } from './accordion';
|
|
21
|
+
export type { AccordionProps } from './accordion';
|
|
22
|
+
export { default as DeepThink } from './accordion/DeepThink';
|
|
23
|
+
export { default as Disclaimer } from './disclaimer';
|
|
24
|
+
export { default as Markdown, type MarkdownProps } from './markdown';
|
|
25
|
+
export { default as useTypedEffect } from './markdown/hooks/useTypedEffect';
|
|
26
|
+
export { default as Welcome } from './welcome';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import "./index.less";
|
|
2
|
+
export { ConfigProvider } from 'antd';
|
|
3
|
+
export { default as version } from "./version";
|
|
4
|
+
export { default as Attachments } from "./attachments";
|
|
5
|
+
export { default as ChatInput, default as Sender } from "./sender";
|
|
6
|
+
export { default as Bubble } from "./bubble";
|
|
7
|
+
export { default as Conversations } from "./conversations";
|
|
8
|
+
export * from "./voice-chat";
|
|
9
|
+
export { useCustomCardsContext, useGlobalContext, CustomCardsContext, CustomCardsProvider, default as SparkChatProvider, useProviderContext } from "./provider";
|
|
10
|
+
export { default as Stream } from "./stream";
|
|
11
|
+
export { createCard } from "./bubble/Cards";
|
|
12
|
+
export { default as ChatAnywhere, uuid, useChatAnywhere } from "./chat-anywhere";
|
|
13
|
+
import * as _DefaultCards from "./default-cards";
|
|
14
|
+
export { _DefaultCards as DefaultCards };
|
|
15
|
+
export { Accordion, Accordion as Process } from "./accordion";
|
|
16
|
+
export { default as DeepThink } from "./accordion/DeepThink";
|
|
17
|
+
export { default as Disclaimer } from "./disclaimer";
|
|
18
|
+
export { default as Markdown } from "./markdown";
|
|
19
|
+
export { default as useTypedEffect } from "./markdown/hooks/useTypedEffect";
|
|
20
|
+
export { default as Welcome } from "./welcome";
|
package/dist/index.less
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@ant-prefix: ant;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FC, ReactElement } from 'react';
|
|
2
|
+
interface CitationDetailProps {
|
|
3
|
+
url?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
content?: string;
|
|
6
|
+
render?: ({ id, citationDetail }: {
|
|
7
|
+
id: string;
|
|
8
|
+
citationDetail: CitationDetailProps;
|
|
9
|
+
}) => ReactElement;
|
|
10
|
+
}
|
|
11
|
+
interface CitationProps {
|
|
12
|
+
citationDetail?: CitationDetailProps;
|
|
13
|
+
id: string;
|
|
14
|
+
}
|
|
15
|
+
declare const Citation: FC<CitationProps>;
|
|
16
|
+
export default Citation;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { createStyles } from 'antd-style';
|
|
5
|
+
import { Popover } from 'antd';
|
|
6
|
+
var useStyles = createStyles(function (_ref) {
|
|
7
|
+
var css = _ref.css,
|
|
8
|
+
token = _ref.token;
|
|
9
|
+
return {
|
|
10
|
+
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n "]))),
|
|
11
|
+
content: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 16px;\n padding: 0 4px !important;\n height: 16px;\n margin-inline: 2px;\n font-size: 10px;\n color: ", " !important;\n text-align: center;\n vertical-align: top;\n background: ", " !important;\n border-radius: 4px;\n transition: all 100ms ", ";\n "])), token.colorTextSecondary, token.colorFillSecondary, token.motionEaseOut),
|
|
12
|
+
hover: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n cursor: pointer;\n\n :hover {\n color: ", " !important;\n background: ", " !important;\n }\n "])), token.colorWhite, token.colorPrimary),
|
|
13
|
+
supContainer: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n vertical-align: super;\n "])))
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
function DefaultRender(_ref2) {
|
|
17
|
+
var id = _ref2.id,
|
|
18
|
+
citationDetail = _ref2.citationDetail;
|
|
19
|
+
var _useStyles = useStyles(),
|
|
20
|
+
styles = _useStyles.styles,
|
|
21
|
+
cx = _useStyles.cx;
|
|
22
|
+
var isTooltip = citationDetail.content || citationDetail.title;
|
|
23
|
+
var url = citationDetail === null || citationDetail === void 0 ? void 0 : citationDetail.url;
|
|
24
|
+
var node = /*#__PURE__*/React.createElement("sup", {
|
|
25
|
+
className: cx(styles.container, styles.supContainer)
|
|
26
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
27
|
+
className: cx(styles.content, styles.hover),
|
|
28
|
+
rel: "noreferrer",
|
|
29
|
+
href: citationDetail.url,
|
|
30
|
+
target: '_blank'
|
|
31
|
+
}, id));
|
|
32
|
+
if (isTooltip) {
|
|
33
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
34
|
+
title: citationDetail.title,
|
|
35
|
+
content: url ? /*#__PURE__*/React.createElement("a", {
|
|
36
|
+
href: url,
|
|
37
|
+
rel: "noreferrer",
|
|
38
|
+
target: '_blank'
|
|
39
|
+
}, url) : citationDetail.content
|
|
40
|
+
}, node);
|
|
41
|
+
}
|
|
42
|
+
return node;
|
|
43
|
+
}
|
|
44
|
+
var Citation = function Citation(props) {
|
|
45
|
+
var citationDetail = props.citationDetail,
|
|
46
|
+
id = props.id;
|
|
47
|
+
var _citationDetail$rende = citationDetail.render,
|
|
48
|
+
render = _citationDetail$rende === void 0 ? DefaultRender : _citationDetail$rende;
|
|
49
|
+
var Render = render;
|
|
50
|
+
return /*#__PURE__*/React.createElement(Render, {
|
|
51
|
+
id: id,
|
|
52
|
+
citationDetail: citationDetail
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
export default Citation;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
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."); }
|
|
5
|
+
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); }
|
|
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
|
+
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; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
import React, { useState } from 'react';
|
|
10
|
+
import { CodeBlock as Code, CodeBlockLangExtensionsMap } from '@spark-ai/design';
|
|
11
|
+
import { createStyles } from 'antd-style';
|
|
12
|
+
import { CheckOutlined, CopyOutlined } from '@ant-design/icons';
|
|
13
|
+
import { useProviderContext } from "./..";
|
|
14
|
+
import { theme as AntdTheme } from 'antd';
|
|
15
|
+
var supportedLanguages = Object.keys(CodeBlockLangExtensionsMap);
|
|
16
|
+
var countLines = function countLines(str) {
|
|
17
|
+
var regex = /\n/g;
|
|
18
|
+
var matches = str.match(regex);
|
|
19
|
+
return matches ? matches.length : 1;
|
|
20
|
+
};
|
|
21
|
+
var useCode = function useCode(raw) {
|
|
22
|
+
if (!raw) return {};
|
|
23
|
+
var _raw$props = raw.props,
|
|
24
|
+
children = _raw$props.children,
|
|
25
|
+
className = _raw$props.className;
|
|
26
|
+
if (!children) return {};
|
|
27
|
+
var content = Array.isArray(children) ? children[0] : children;
|
|
28
|
+
var lang = (className === null || className === void 0 ? void 0 : className.replace('language-', '')) || 'txt';
|
|
29
|
+
var isSingleLine = countLines(content) <= 1 && content.length <= 32;
|
|
30
|
+
return {
|
|
31
|
+
content: content,
|
|
32
|
+
isSingleLine: isSingleLine,
|
|
33
|
+
lang: lang
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
var CodeBlock = function CodeBlock(_ref) {
|
|
37
|
+
var children = _ref.children;
|
|
38
|
+
var code = useCode(children);
|
|
39
|
+
var _useStyles = useStyles(),
|
|
40
|
+
styles = _useStyles.styles,
|
|
41
|
+
cx = _useStyles.cx;
|
|
42
|
+
var _useProviderContext = useProviderContext(),
|
|
43
|
+
getPrefixCls = _useProviderContext.getPrefixCls,
|
|
44
|
+
theme = _useProviderContext.theme;
|
|
45
|
+
var isDarkMode = theme.algorithm === AntdTheme.darkAlgorithm;
|
|
46
|
+
var _useState = useState(false),
|
|
47
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48
|
+
copied = _useState2[0],
|
|
49
|
+
setCopied = _useState2[1];
|
|
50
|
+
var _code$content = code.content,
|
|
51
|
+
content = _code$content === void 0 ? '' : _code$content,
|
|
52
|
+
_code$lang = code.lang,
|
|
53
|
+
lang = _code$lang === void 0 ? '' : _code$lang;
|
|
54
|
+
if (!code.content) return null;
|
|
55
|
+
if (supportedLanguages.indexOf(lang) === -1) return /*#__PURE__*/React.createElement("pre", null, /*#__PURE__*/React.createElement("code", null, content));
|
|
56
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: styles.container
|
|
58
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: styles.header
|
|
60
|
+
}, /*#__PURE__*/React.createElement("div", null, lang), copied ? /*#__PURE__*/React.createElement(CheckOutlined, {
|
|
61
|
+
className: styles.copied
|
|
62
|
+
}) : /*#__PURE__*/React.createElement(CopyOutlined, {
|
|
63
|
+
className: styles.icon,
|
|
64
|
+
onClick: function onClick() {
|
|
65
|
+
navigator.clipboard.writeText(content);
|
|
66
|
+
setCopied(true);
|
|
67
|
+
setTimeout(function () {
|
|
68
|
+
setCopied(false);
|
|
69
|
+
}, 1000);
|
|
70
|
+
}
|
|
71
|
+
})), /*#__PURE__*/React.createElement(Code, {
|
|
72
|
+
value: content,
|
|
73
|
+
language: lang,
|
|
74
|
+
theme: isDarkMode ? 'dark' : 'light',
|
|
75
|
+
readOnly: true
|
|
76
|
+
}));
|
|
77
|
+
};
|
|
78
|
+
var useStyles = createStyles(function (_ref2) {
|
|
79
|
+
var css = _ref2.css,
|
|
80
|
+
token = _ref2.token;
|
|
81
|
+
return {
|
|
82
|
+
copied: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", "\n "])), token.colorSuccess),
|
|
83
|
+
container: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n border-radius: 6px;\n overflow: hidden;\n font-size: 0.8571428571428571em;\n "])), token.colorBorderSecondary),
|
|
84
|
+
header: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n background: ", ";\n height: 28px;\n line-height: 28px;\n border-radius: 4px 4px 0 0;\n align-items: center;\n user-select: none;\n position: relative;\n padding: 0 12px;\n "])), token.colorFillSecondary),
|
|
85
|
+
icon: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n fontsize: 14px;\n cursor: pointer;\n "])))
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
export default CodeBlock;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
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 _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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
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); }
|
|
8
|
+
import React, { useState } from "react";
|
|
9
|
+
import { Image as ImageViewer } from '@spark-ai/design';
|
|
10
|
+
import { Modal } from 'antd';
|
|
11
|
+
import { CloseOutlined, PlayCircleOutlined } from "@ant-design/icons";
|
|
12
|
+
import { useProviderContext } from "../provider";
|
|
13
|
+
export default function (props) {
|
|
14
|
+
var src = props.src;
|
|
15
|
+
var url = new URL(src);
|
|
16
|
+
var pathname = url.pathname;
|
|
17
|
+
var isVideo = pathname.endsWith(".mp4");
|
|
18
|
+
if (isVideo) {
|
|
19
|
+
return /*#__PURE__*/React.createElement(Video, _extends({
|
|
20
|
+
src: props.src
|
|
21
|
+
}, props));
|
|
22
|
+
}
|
|
23
|
+
return /*#__PURE__*/React.createElement(Image, _extends({
|
|
24
|
+
src: props.src
|
|
25
|
+
}, props));
|
|
26
|
+
}
|
|
27
|
+
function Image(props) {
|
|
28
|
+
var _useProviderContext = useProviderContext(),
|
|
29
|
+
getPrefixCls = _useProviderContext.getPrefixCls;
|
|
30
|
+
var prefixCls = getPrefixCls('markdown-image');
|
|
31
|
+
return /*#__PURE__*/React.createElement(ImageViewer, _extends({
|
|
32
|
+
src: props.src
|
|
33
|
+
}, props, {
|
|
34
|
+
className: prefixCls
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
function Video(props) {
|
|
38
|
+
var src = props.src;
|
|
39
|
+
var _useState = useState(false),
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
open = _useState2[0],
|
|
42
|
+
setOpen = _useState2[1];
|
|
43
|
+
var _useProviderContext2 = useProviderContext(),
|
|
44
|
+
getPrefixCls = _useProviderContext2.getPrefixCls;
|
|
45
|
+
var prefixCls = getPrefixCls('markdown-video');
|
|
46
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
onClick: function onClick() {
|
|
48
|
+
return setOpen(true);
|
|
49
|
+
},
|
|
50
|
+
className: prefixCls
|
|
51
|
+
}, /*#__PURE__*/React.createElement(PlayCircleOutlined, {
|
|
52
|
+
className: "".concat(prefixCls, "-play")
|
|
53
|
+
})), /*#__PURE__*/React.createElement(Modal, {
|
|
54
|
+
closeIcon: /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(CloseOutlined, null)),
|
|
55
|
+
centered: true,
|
|
56
|
+
transitionName: "",
|
|
57
|
+
footer: null,
|
|
58
|
+
width: 500,
|
|
59
|
+
title: "",
|
|
60
|
+
styles: {
|
|
61
|
+
content: {
|
|
62
|
+
padding: 0
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
open: open,
|
|
66
|
+
destroyOnHidden: true,
|
|
67
|
+
onCancel: function onCancel() {
|
|
68
|
+
return setOpen(false);
|
|
69
|
+
}
|
|
70
|
+
}, /*#__PURE__*/React.createElement("video", {
|
|
71
|
+
controls: true,
|
|
72
|
+
autoPlay: true,
|
|
73
|
+
style: {
|
|
74
|
+
display: 'block',
|
|
75
|
+
width: '100%'
|
|
76
|
+
}
|
|
77
|
+
}, /*#__PURE__*/React.createElement("source", {
|
|
78
|
+
src: src,
|
|
79
|
+
type: "video/mp4"
|
|
80
|
+
}))));
|
|
81
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var _excluded = ["href", "target", "citationsData"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import Citation from "./Citation";
|
|
7
|
+
var Link = function Link(_ref) {
|
|
8
|
+
var _href$startsWith;
|
|
9
|
+
var href = _ref.href,
|
|
10
|
+
target = _ref.target,
|
|
11
|
+
citationsData = _ref.citationsData,
|
|
12
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
+
var match = href === null || href === void 0 || (_href$startsWith = href.startsWith) === null || _href$startsWith === void 0 ? void 0 : _href$startsWith.call(href, 'citation-');
|
|
14
|
+
if (match) {
|
|
15
|
+
var key = href === null || href === void 0 ? void 0 : href.replace('citation-', '');
|
|
16
|
+
var detail = citationsData === null || citationsData === void 0 ? void 0 : citationsData[key];
|
|
17
|
+
return /*#__PURE__*/React.createElement(Citation, {
|
|
18
|
+
citationDetail: detail,
|
|
19
|
+
id: key
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
var isNewWindow = href === null || href === void 0 ? void 0 : href.startsWith('http');
|
|
23
|
+
return /*#__PURE__*/React.createElement("a", _extends({
|
|
24
|
+
href: href,
|
|
25
|
+
target: target || isNewWindow ? '_blank' : undefined
|
|
26
|
+
}, rest));
|
|
27
|
+
};
|
|
28
|
+
export default Link;
|
|
@@ -0,0 +1,121 @@
|
|
|
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 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
|
+
import React, { useCallback } from 'react';
|
|
9
|
+
import { memo, useMemo } from 'react';
|
|
10
|
+
import ReactMarkdown from 'react-markdown';
|
|
11
|
+
import { addToCache, contentCache, createPlugins, escapeBrackets, escapeMhchem, fixMarkdownBold, transformCitations, Null } from "./utils";
|
|
12
|
+
import Link from "./Link";
|
|
13
|
+
import CodeBlock from "./CodeBlock";
|
|
14
|
+
import ImageOrVideo from "./ImageOrVideo";
|
|
15
|
+
var emptyArray = [];
|
|
16
|
+
var emptyMap = {};
|
|
17
|
+
var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
_ref$enableLatex = _ref.enableLatex,
|
|
20
|
+
enableLatex = _ref$enableLatex === void 0 ? true : _ref$enableLatex,
|
|
21
|
+
_ref$enableCustomFoot = _ref.enableCustomFootnotes,
|
|
22
|
+
enableCustomFootnotes = _ref$enableCustomFoot === void 0 ? true : _ref$enableCustomFoot,
|
|
23
|
+
componentProps = _ref.componentProps,
|
|
24
|
+
_ref$allowHtml = _ref.allowHtml,
|
|
25
|
+
allowHtml = _ref$allowHtml === void 0 ? false : _ref$allowHtml,
|
|
26
|
+
reactMarkdownProps = _ref.reactMarkdownProps,
|
|
27
|
+
rehypePlugins = _ref.rehypePlugins,
|
|
28
|
+
remarkPlugins = _ref.remarkPlugins,
|
|
29
|
+
remarkPluginsAhead = _ref.remarkPluginsAhead,
|
|
30
|
+
_ref$components = _ref.components,
|
|
31
|
+
components = _ref$components === void 0 ? {} : _ref$components,
|
|
32
|
+
cursor = _ref.cursor,
|
|
33
|
+
_ref$citations = _ref.citations,
|
|
34
|
+
citations = _ref$citations === void 0 ? emptyArray : _ref$citations,
|
|
35
|
+
_ref$citationsMap = _ref.citationsMap,
|
|
36
|
+
citationsMap = _ref$citationsMap === void 0 ? emptyMap : _ref$citationsMap;
|
|
37
|
+
var citationsData = useMemo(function () {
|
|
38
|
+
var map = _objectSpread({}, citationsMap);
|
|
39
|
+
citations.forEach(function (item, index) {
|
|
40
|
+
var key = index + 1;
|
|
41
|
+
map[key] = item;
|
|
42
|
+
});
|
|
43
|
+
return map;
|
|
44
|
+
}, [citations, citationsMap]);
|
|
45
|
+
|
|
46
|
+
// 计算缓存键
|
|
47
|
+
var cacheKey = useMemo(function () {
|
|
48
|
+
return "".concat(children, "-").concat(enableLatex, "-").concat(enableCustomFootnotes, "-").concat(Object.keys(citationsData).length);
|
|
49
|
+
}, [children, enableLatex, enableCustomFootnotes, citationsData]);
|
|
50
|
+
|
|
51
|
+
// 处理内容并利用缓存避免重复计算
|
|
52
|
+
var escapedContent = useMemo(function () {
|
|
53
|
+
// 尝试从缓存获取
|
|
54
|
+
if (contentCache.has(cacheKey)) {
|
|
55
|
+
return contentCache.get(cacheKey);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 处理新内容
|
|
59
|
+
var processedContent;
|
|
60
|
+
if (enableLatex) {
|
|
61
|
+
var baseContent = fixMarkdownBold(escapeMhchem(escapeBrackets(children)));
|
|
62
|
+
processedContent = enableCustomFootnotes ? transformCitations(baseContent, citationsData) : baseContent;
|
|
63
|
+
} else {
|
|
64
|
+
processedContent = fixMarkdownBold(children);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 缓存处理结果
|
|
68
|
+
addToCache(cacheKey, processedContent);
|
|
69
|
+
return processedContent;
|
|
70
|
+
}, [cacheKey, children, enableLatex, enableCustomFootnotes, citationsData]);
|
|
71
|
+
|
|
72
|
+
// 创建插件
|
|
73
|
+
var _useMemo = useMemo(function () {
|
|
74
|
+
return createPlugins({
|
|
75
|
+
cursor: cursor,
|
|
76
|
+
allowHtml: allowHtml,
|
|
77
|
+
enableLatex: enableLatex,
|
|
78
|
+
enableCustomFootnotes: enableCustomFootnotes,
|
|
79
|
+
rehypePlugins: rehypePlugins,
|
|
80
|
+
remarkPlugins: remarkPlugins,
|
|
81
|
+
remarkPluginsAhead: remarkPluginsAhead
|
|
82
|
+
});
|
|
83
|
+
}, [cursor, allowHtml, enableLatex, enableCustomFootnotes, rehypePlugins, remarkPlugins, remarkPluginsAhead]),
|
|
84
|
+
rehypePluginsList = _useMemo.rehypePluginsList,
|
|
85
|
+
remarkPluginsList = _useMemo.remarkPluginsList;
|
|
86
|
+
var renderLink = useCallback(function (props) {
|
|
87
|
+
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
88
|
+
citationsData: citationsData
|
|
89
|
+
}, props, componentProps === null || componentProps === void 0 ? void 0 : componentProps.a));
|
|
90
|
+
}, [citationsData, componentProps === null || componentProps === void 0 ? void 0 : componentProps.a]);
|
|
91
|
+
var renderImage = useCallback(function (props) {
|
|
92
|
+
return /*#__PURE__*/React.createElement(ImageOrVideo, _extends({
|
|
93
|
+
src: props.src
|
|
94
|
+
}, props));
|
|
95
|
+
}, [componentProps === null || componentProps === void 0 ? void 0 : componentProps.img]);
|
|
96
|
+
var renderCodeBlock = useCallback(function (props) {
|
|
97
|
+
return /*#__PURE__*/React.createElement(CodeBlock, _extends({}, props, componentProps === null || componentProps === void 0 ? void 0 : componentProps.pre));
|
|
98
|
+
}, [componentProps === null || componentProps === void 0 ? void 0 : componentProps.pre]);
|
|
99
|
+
|
|
100
|
+
// 创建组件映射
|
|
101
|
+
var memoComponents = useMemo(function () {
|
|
102
|
+
return _objectSpread({
|
|
103
|
+
a: renderLink,
|
|
104
|
+
style: Null,
|
|
105
|
+
script: Null,
|
|
106
|
+
img: renderImage,
|
|
107
|
+
pre: renderCodeBlock
|
|
108
|
+
}, components);
|
|
109
|
+
}, [components]);
|
|
110
|
+
|
|
111
|
+
// 渲染默认内容
|
|
112
|
+
var defaultDOM = useMemo(function () {
|
|
113
|
+
return /*#__PURE__*/React.createElement(ReactMarkdown, _extends({}, reactMarkdownProps, {
|
|
114
|
+
components: memoComponents,
|
|
115
|
+
rehypePlugins: rehypePluginsList,
|
|
116
|
+
remarkPlugins: remarkPluginsList
|
|
117
|
+
}), escapedContent);
|
|
118
|
+
}, [escapedContent, memoComponents, rehypePluginsList, remarkPluginsList]);
|
|
119
|
+
return defaultDOM;
|
|
120
|
+
});
|
|
121
|
+
export default Markdown;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import "./index.less";
|
|
3
|
+
export default function () {
|
|
4
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
5
|
+
className: "markdown-cursor-dot"
|
|
6
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
7
|
+
style: {
|
|
8
|
+
opacity: 0,
|
|
9
|
+
marginLeft: '-.75em'
|
|
10
|
+
}
|
|
11
|
+
}, "_"), /*#__PURE__*/React.createElement("span", {
|
|
12
|
+
className: "markdown-cursor-dot-dot1"
|
|
13
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
14
|
+
className: "markdown-cursor-dot-dot2"
|
|
15
|
+
}));
|
|
16
|
+
}
|