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