@agentscope-ai/chat 1.1.20 → 1.1.22
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/bin/client.js +1 -1
- package/components/AGUI/components/HelpModal/icons.tsx +68 -0
- package/components/AGUI/components/HelpModal/index.tsx +1 -0
- package/components/AGUI/components/HelpModal/modal.tsx +101 -0
- package/components/AGUI/components/chat/Button.tsx +18 -0
- package/components/AGUI/components/chat/Chat.tsx +780 -0
- package/components/AGUI/components/chat/ChatContext.tsx +248 -0
- package/components/AGUI/components/chat/CodeBlock.tsx +406 -0
- package/components/AGUI/components/chat/Header.tsx +22 -0
- package/components/AGUI/components/chat/Icons.tsx +237 -0
- package/components/AGUI/components/chat/ImageUploadQueue.tsx +77 -0
- package/components/AGUI/components/chat/Input.tsx +24 -0
- package/components/AGUI/components/chat/Markdown.tsx +134 -0
- package/components/AGUI/components/chat/Messages.tsx +259 -0
- package/components/AGUI/components/chat/Modal.tsx +133 -0
- package/components/AGUI/components/chat/Popup.tsx +57 -0
- package/components/AGUI/components/chat/PoweredByTag.tsx +29 -0
- package/components/AGUI/components/chat/Sidebar.tsx +74 -0
- package/components/AGUI/components/chat/Suggestion.tsx +132 -0
- package/components/AGUI/components/chat/Suggestions.tsx +20 -0
- package/components/AGUI/components/chat/Textarea.tsx +61 -0
- package/components/AGUI/components/chat/Window.tsx +152 -0
- package/components/AGUI/components/chat/index.tsx +11 -0
- package/components/AGUI/components/chat/messages/AssistantMessage.tsx +69 -0
- package/components/AGUI/components/chat/messages/RenderActionExecutionMessage.tsx +129 -0
- package/components/AGUI/components/chat/messages/RenderAgentStateMessage.tsx +116 -0
- package/components/AGUI/components/chat/messages/RenderImageMessage.tsx +64 -0
- package/components/AGUI/components/chat/messages/RenderResultMessage.tsx +26 -0
- package/components/AGUI/components/chat/messages/RenderTextMessage.tsx +51 -0
- package/components/AGUI/components/chat/messages/UserMessage.tsx +10 -0
- package/components/AGUI/components/chat/props.ts +186 -0
- package/components/AGUI/components/index.ts +1 -0
- package/components/AGUI/context/index.ts +1 -0
- package/components/AGUI/hooks/index.ts +1 -0
- package/components/AGUI/hooks/use-copilot-chat-suggestions.tsx +122 -0
- package/components/AGUI/hooks/use-copy-to-clipboard.tsx +29 -0
- package/components/AGUI/hooks/use-dark-mode.ts +10 -0
- package/components/AGUI/hooks/use-push-to-talk.tsx +166 -0
- package/components/AGUI/index.tsx +4 -0
- package/components/AGUI/lib/utils.test.ts +7 -0
- package/components/AGUI/lib/utils.ts +27 -0
- package/components/AGUI/styles.css +0 -0
- package/components/AGUI/types/css.ts +0 -0
- package/components/AGUI/types/index.ts +1 -0
- package/components/AGUI/types/suggestions.ts +6 -0
- package/components/Accordion/Accordion.tsx +203 -0
- package/components/Accordion/BodyContent.tsx +28 -0
- package/components/Accordion/DeepThinking.tsx +91 -0
- package/components/Accordion/SoftLightTitle.tsx +13 -0
- package/components/Accordion/demo/search.tsx +39 -0
- package/components/Accordion/demo/steps.tsx +135 -0
- package/components/Accordion/demo/thinking.tsx +62 -0
- package/components/Accordion/index.en-US.md +34 -0
- package/components/Accordion/index.tsx +3 -0
- package/components/Accordion/index.zh-CN.md +34 -0
- package/components/Accordion/style.ts +208 -0
- package/components/AgentScopeRuntimeWebUI/demo/index.tsx +4 -0
- package/components/AgentScopeRuntimeWebUI/index.tsx +3 -0
- package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Request/Builder.tsx +82 -0
- package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Request/Card.tsx +52 -0
- package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Actions.tsx +39 -0
- package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Builder.tsx +205 -0
- package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Card.tsx +44 -0
- package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Error.tsx +7 -0
- package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Message.tsx +23 -0
- package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Reasoning.tsx +16 -0
- package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Tool.tsx +19 -0
- package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/index.tsx +0 -0
- package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/types.tsx +100 -0
- package/components/AgentScopeRuntimeWebUI/lib/Chat/Input/index.tsx +77 -0
- package/components/AgentScopeRuntimeWebUI/lib/Chat/Input/useAttachments.tsx +53 -0
- package/components/AgentScopeRuntimeWebUI/lib/Chat/MessageList/index.tsx +30 -0
- package/components/AgentScopeRuntimeWebUI/lib/Chat/Welcome/index.tsx +66 -0
- package/components/AgentScopeRuntimeWebUI/lib/Chat/Welcome/styles.ts +51 -0
- package/components/AgentScopeRuntimeWebUI/lib/Chat/hooks/index.tsx +5 -0
- package/components/AgentScopeRuntimeWebUI/lib/Chat/hooks/useChatController.tsx +130 -0
- package/components/AgentScopeRuntimeWebUI/lib/Chat/hooks/useChatMessageHandler.tsx +87 -0
- package/components/AgentScopeRuntimeWebUI/lib/Chat/hooks/useChatRequest.tsx +114 -0
- package/components/AgentScopeRuntimeWebUI/lib/Chat/hooks/useChatSessionHandler.tsx +50 -0
- package/components/AgentScopeRuntimeWebUI/lib/Chat/index.tsx +18 -0
- package/components/AgentScopeRuntimeWebUI/lib/Chat/styles.tsx +59 -0
- package/components/AgentScopeRuntimeWebUI/lib/ChatAnywhere/ComposedProvider.tsx +27 -0
- package/components/AgentScopeRuntimeWebUI/lib/ChatAnywhere/index.tsx +29 -0
- package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereControl.tsx +0 -0
- package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereInputContext.tsx +27 -0
- package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereLayoutContext.tsx +27 -0
- package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereMessagesContext.tsx +82 -0
- package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereOptionsContext.tsx +76 -0
- package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereSessionsContext.tsx +111 -0
- package/components/AgentScopeRuntimeWebUI/lib/Context/useChatAnywhereEventEmitter.tsx +30 -0
- package/components/AgentScopeRuntimeWebUI/lib/Header/index.tsx +45 -0
- package/components/AgentScopeRuntimeWebUI/lib/Header/styles.ts +23 -0
- package/components/AgentScopeRuntimeWebUI/lib/Layout/index.tsx +45 -0
- package/components/AgentScopeRuntimeWebUI/lib/Layout/styles.tsx +104 -0
- package/components/AgentScopeRuntimeWebUI/lib/Sessions/index.tsx +114 -0
- package/components/AgentScopeRuntimeWebUI/lib/Sessions/styles.tsx +0 -0
- package/components/AgentScopeRuntimeWebUI/lib/demo/OptionsPanel/FormItem.tsx +37 -0
- package/components/AgentScopeRuntimeWebUI/lib/demo/OptionsPanel/OptionsEditor.tsx +163 -0
- package/components/AgentScopeRuntimeWebUI/lib/demo/OptionsPanel/defaultConfig.ts +43 -0
- package/components/AgentScopeRuntimeWebUI/lib/demo/OptionsPanel/index.tsx +27 -0
- package/components/AgentScopeRuntimeWebUI/lib/demo/index.tsx +57 -0
- package/components/AgentScopeRuntimeWebUI/lib/demo/sessionApi/index.ts +51 -0
- package/components/AgentScopeRuntimeWebUI/lib/types/IChatAnywhere.ts +358 -0
- package/components/AgentScopeRuntimeWebUI/lib/types/IMessages.tsx +52 -0
- package/components/AgentScopeRuntimeWebUI/lib/types/ISessions.tsx +29 -0
- package/components/AgentScopeRuntimeWebUI/lib/types/index.tsx +3 -0
- package/components/AgentScopeRuntimeWebUI/starter/OptionsPanel/FormItem.tsx +37 -0
- package/components/AgentScopeRuntimeWebUI/starter/OptionsPanel/OptionsEditor.tsx +163 -0
- package/components/AgentScopeRuntimeWebUI/starter/OptionsPanel/defaultConfig.ts +43 -0
- package/components/AgentScopeRuntimeWebUI/starter/OptionsPanel/index.tsx +27 -0
- package/components/AgentScopeRuntimeWebUI/starter/index.tsx +57 -0
- package/components/AgentScopeRuntimeWebUI/starter/sessionApi/index.ts +51 -0
- package/components/Attachments/DropArea.tsx +97 -0
- package/components/Attachments/FileList/AudioIcon.tsx +20 -0
- package/components/Attachments/FileList/FileListCard.tsx +270 -0
- package/components/Attachments/FileList/Progress.tsx +30 -0
- package/components/Attachments/FileList/VideoIcon.tsx +20 -0
- package/components/Attachments/FileList/index.tsx +201 -0
- package/components/Attachments/PlaceholderUploader.tsx +124 -0
- package/components/Attachments/SilentUploader.tsx +39 -0
- package/components/Attachments/context.tsx +11 -0
- package/components/Attachments/demo/basic.tsx +71 -0
- package/components/Attachments/index.en-US.md.bk +10 -0
- package/components/Attachments/index.tsx +274 -0
- package/components/Attachments/index.zh-CN.md.bk +10 -0
- package/components/Attachments/style/fileCard.ts +163 -0
- package/components/Attachments/style/index.ts +232 -0
- package/components/Attachments/util.ts +56 -0
- package/components/Bubble/Avatar.tsx +39 -0
- package/components/Bubble/Bubble.tsx +131 -0
- package/components/Bubble/BubbleList.tsx +105 -0
- package/components/Bubble/Cards.tsx +61 -0
- package/components/Bubble/Footer.tsx +55 -0
- package/components/Bubble/Interrupted.tsx +82 -0
- package/components/Bubble/ScrollToBottom.tsx +42 -0
- package/components/Bubble/Spin.tsx +13 -0
- package/components/Bubble/demo/assistantWithCode.tsx +60 -0
- package/components/Bubble/demo/assistantWithErrorStatus.tsx +102 -0
- package/components/Bubble/demo/assistantWithImage.tsx +46 -0
- package/components/Bubble/demo/assistantWithProcess.tsx +103 -0
- package/components/Bubble/demo/assistantWithSearch.tsx +69 -0
- package/components/Bubble/demo/assistantWithThinking.tsx +54 -0
- package/components/Bubble/demo/basic.tsx +55 -0
- package/components/Bubble/demo/userWithFile.tsx +27 -0
- package/components/Bubble/demo/userWithImage.tsx +26 -0
- package/components/Bubble/hooks/useDisplayData.ts +0 -0
- package/components/Bubble/hooks/useListData.ts +0 -0
- package/components/Bubble/index.en-US.md +33 -0
- package/components/Bubble/index.tsx +21 -0
- package/components/Bubble/index.zh-CN.md +33 -0
- package/components/Bubble/interface.ts +71 -0
- package/components/Bubble/loading.tsx +15 -0
- package/components/Bubble/style/avatar.ts +43 -0
- package/components/Bubble/style/footer.ts +45 -0
- package/components/Bubble/style/index.ts +192 -0
- package/components/Bubble/style/list.ts +51 -0
- package/components/ChatAnywhere/Chat/Ref.tsx +20 -0
- package/components/ChatAnywhere/Chat/index.tsx +56 -0
- package/components/ChatAnywhere/Chat/style.ts +59 -0
- package/components/ChatAnywhere/Header/index.tsx +37 -0
- package/components/ChatAnywhere/Header/style.ts +27 -0
- package/components/ChatAnywhere/Input/index.tsx +158 -0
- package/components/ChatAnywhere/Input/style.ts +14 -0
- package/components/ChatAnywhere/Layout/index.tsx +70 -0
- package/components/ChatAnywhere/Layout/style.ts +51 -0
- package/components/ChatAnywhere/SessionList/index.tsx +122 -0
- package/components/ChatAnywhere/SessionList/style.ts +53 -0
- package/components/ChatAnywhere/hooks/ChatAnywhereProvider.tsx +219 -0
- package/components/ChatAnywhere/hooks/types.ts +333 -0
- package/components/ChatAnywhere/hooks/useInput.tsx +22 -0
- package/components/ChatAnywhere/hooks/useMessages.tsx +63 -0
- package/components/ChatAnywhere/hooks/useSessionList.tsx +123 -0
- package/components/ChatAnywhere/index.tsx +49 -0
- package/components/Conversations/GroupTitle.tsx +28 -0
- package/components/Conversations/Item.tsx +189 -0
- package/components/Conversations/demo/basic.tsx +107 -0
- package/components/Conversations/demo/timeline.tsx +111 -0
- package/components/Conversations/demo/timestamp.tsx +110 -0
- package/components/Conversations/hooks/useGroupable.ts +81 -0
- package/components/Conversations/index.en-US.md +32 -0
- package/components/Conversations/index.tsx +176 -0
- package/components/Conversations/index.zh-CN.md +31 -0
- package/components/Conversations/interface.ts +69 -0
- package/components/Conversations/style.ts +153 -0
- package/components/DefaultCards/DeepThinking/index.tsx +33 -0
- package/components/DefaultCards/Files/index.tsx +69 -0
- package/components/DefaultCards/Footer/index.tsx +16 -0
- package/components/DefaultCards/Images/index.tsx +53 -0
- package/components/DefaultCards/Interrupted/index.tsx +13 -0
- package/components/DefaultCards/Text/index.tsx +13 -0
- package/components/DefaultCards/index.tsx +6 -0
- package/components/DeviceAction/actionMap.tsx +100 -0
- package/components/DeviceAction/demo/index.tsx +132 -0
- package/components/DeviceAction/index.en-US.md +19 -0
- package/components/DeviceAction/index.tsx +75 -0
- package/components/DeviceAction/index.zh-CN.md +19 -0
- package/components/Disclaimer/demo/index.tsx +4 -0
- package/components/Disclaimer/demo/withLink.tsx +4 -0
- package/components/Disclaimer/index.en-US.md +23 -0
- package/components/Disclaimer/index.tsx +42 -0
- package/components/Disclaimer/index.zh-CN.md +24 -0
- package/components/Disclaimer/style.ts +17 -0
- package/components/ImageGenerator/demo/basic.tsx +23 -0
- package/components/ImageGenerator/demo/custom.tsx +56 -0
- package/components/ImageGenerator/demo/size.tsx +15 -0
- package/components/ImageGenerator/index.en-US.md +23 -0
- package/components/ImageGenerator/index.tsx +124 -0
- package/components/ImageGenerator/index.zh-CN.md +23 -0
- package/components/ImageGenerator/style.ts +99 -0
- package/components/Markdown/Markdown/AnimationNode.tsx +89 -0
- package/components/Markdown/Markdown/Markdown.tsx +61 -0
- package/components/Markdown/Markdown/core/Parser.ts +52 -0
- package/components/Markdown/Markdown/core/Renderer.ts +121 -0
- package/components/Markdown/Markdown/core/index.ts +4 -0
- package/components/Markdown/Markdown/defaultComponents/CodeBlock.tsx +113 -0
- package/components/Markdown/Markdown/defaultComponents/DisabledImage.tsx +3 -0
- package/components/Markdown/Markdown/defaultComponents/Media.tsx +71 -0
- package/components/Markdown/Markdown/hooks/index.ts +4 -0
- package/components/Markdown/Markdown/hooks/useAnimation.tsx +27 -0
- package/components/Markdown/Markdown/hooks/useCitationsData.tsx +36 -0
- package/components/Markdown/Markdown/hooks/useStreaming.ts +503 -0
- package/components/Markdown/Markdown/hooks/useTyping.ts +22 -0
- package/components/Markdown/Markdown/index.tsx +198 -0
- package/components/Markdown/Markdown/interface.ts +217 -0
- package/components/Markdown/Markdown/style.ts +152 -0
- package/components/Markdown/demo/basic.tsx +107 -0
- package/components/Markdown/demo/citations.tsx +47 -0
- package/components/Markdown/demo/cursor.tsx +9 -0
- package/components/Markdown/demo/latex.tsx +77 -0
- package/components/Markdown/demo/typing.tsx +82 -0
- package/components/Markdown/index.en-US.md +27 -0
- package/components/Markdown/index.ts +1 -0
- package/components/Markdown/index.zh-CN.md +28 -0
- package/components/Markdown/plugins/citations/CitationComponent.tsx +72 -0
- package/components/Markdown/plugins/citations/index.tsx +37 -0
- package/components/Markdown/plugins/cursor/Dot.tsx +106 -0
- package/components/Markdown/plugins/cursor/Underline.tsx +38 -0
- package/components/Markdown/plugins/cursor/index.tsx +59 -0
- package/components/Markdown/plugins/latex/index.ts +109 -0
- package/components/Markdown/plugins/type.ts +71 -0
- package/components/Mermaid/demo/basic.tsx +12 -0
- package/components/Mermaid/demo/class.tsx +31 -0
- package/components/Mermaid/demo/flowchart.tsx +13 -0
- package/components/Mermaid/demo/sequence.tsx +18 -0
- package/components/Mermaid/demo/state.tsx +16 -0
- package/components/Mermaid/demo/timeline.tsx +15 -0
- package/components/Mermaid/index.en-US.md +27 -0
- package/components/Mermaid/index.tsx +118 -0
- package/components/Mermaid/index.zh-CN.md +27 -0
- package/components/OperateCard/OperateCard.tsx +93 -0
- package/components/OperateCard/demo/index.tsx +35 -0
- package/components/OperateCard/demo/rag.tsx +19 -0
- package/components/OperateCard/demo/thinking.tsx +17 -0
- package/components/OperateCard/demo/todo.tsx +28 -0
- package/components/OperateCard/demo/toolCall.tsx +14 -0
- package/components/OperateCard/demo/webSearch.tsx +12 -0
- package/components/OperateCard/index.en-US.md +51 -0
- package/components/OperateCard/index.tsx +1 -0
- package/components/OperateCard/index.zh-CN.md +51 -0
- package/components/OperateCard/preset/Rag.tsx +90 -0
- package/components/OperateCard/preset/Thinking.tsx +45 -0
- package/components/OperateCard/preset/TodoList.tsx +73 -0
- package/components/OperateCard/preset/ToolCall.tsx +67 -0
- package/components/OperateCard/preset/WebSearch.tsx +65 -0
- package/components/OperateCard/preset/index.tsx +5 -0
- package/components/OperateCard/style.ts +268 -0
- package/components/Provider/CustomCardsProvider.tsx +17 -0
- package/components/Provider/GlobalProvider.tsx +17 -0
- package/components/Provider/index.tsx +33 -0
- package/components/Provider/types.ts +23 -0
- package/components/ResponsesAPI/index.tsx +0 -0
- package/components/Sender/ModeSelect/index.tsx +160 -0
- package/components/Sender/ModeSelect/styles.ts +0 -0
- package/components/Sender/SenderHeader.tsx +164 -0
- package/components/Sender/StopLoading.tsx +48 -0
- package/components/Sender/components/ActionButton.tsx +106 -0
- package/components/Sender/components/ClearButton.tsx +10 -0
- package/components/Sender/components/LoadingButton.tsx +26 -0
- package/components/Sender/components/SendButton.tsx +22 -0
- package/components/Sender/components/SpeechButton/RecordingIcon.tsx +68 -0
- package/components/Sender/components/SpeechButton/index.tsx +30 -0
- package/components/Sender/demo/asr.tsx +7 -0
- package/components/Sender/demo/basic.tsx +7 -0
- package/components/Sender/demo/loading.tsx +5 -0
- package/components/Sender/demo/moreMode.tsx +45 -0
- package/components/Sender/demo/morePrefixAction.tsx +40 -0
- package/components/Sender/demo/withFile.tsx +54 -0
- package/components/Sender/demo/withImage.tsx +52 -0
- package/components/Sender/index.en-US.md +29 -0
- package/components/Sender/index.tsx +491 -0
- package/components/Sender/index.zh-CN.md +30 -0
- package/components/Sender/style/index.ts +150 -0
- package/components/Sender/useSpeech.ts +133 -0
- package/components/StatusCard/demo/index.tsx +32 -0
- package/components/StatusCard/index.en-US.md +30 -0
- package/components/StatusCard/index.tsx +162 -0
- package/components/StatusCard/index.zh-CN.md +27 -0
- package/components/StatusCard/style.ts +119 -0
- package/components/Stream/index.ts +203 -0
- package/components/Util/hooks/use-proxy-imperative-handle.ts +25 -0
- package/components/Util/sleep.ts +3 -0
- package/components/Util/type.ts +1 -0
- package/components/Util/warning.ts +118 -0
- package/components/Version/index.ts +3 -0
- package/components/Voice/Recorder.tsx +3 -0
- package/components/Voice/demo/index.tsx +0 -0
- package/components/Voice/index.en-US.md +8 -0
- package/components/Voice/index.tsx +0 -0
- package/components/Voice/index.zh-CN.md +9 -0
- package/components/Welcome/demo/EyeFollower.tsx +161 -0
- package/components/Welcome/demo/demo0.tsx +14 -0
- package/components/Welcome/demo/demo1.tsx +16 -0
- package/components/Welcome/demo/demo2.tsx +30 -0
- package/components/Welcome/demo/demo3.tsx +16 -0
- package/components/Welcome/index.en-US.md +28 -0
- package/components/Welcome/index.tsx +72 -0
- package/components/Welcome/index.zh-CN.md +28 -0
- package/components/index.ts +88 -0
- package/components/overview.en-US.md +10 -0
- package/components/overview.zh-CN.md +10 -0
- package/lib/AgentScopeRuntimeWebUI/index.d.ts +1 -0
- package/lib/AgentScopeRuntimeWebUI/index.js +1 -0
- package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/FormItem.d.ts +9 -0
- package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/FormItem.js +33 -0
- package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/OptionsEditor.d.ts +7 -0
- package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/OptionsEditor.js +188 -0
- package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/defaultConfig.d.ts +29 -0
- package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/defaultConfig.js +35 -0
- package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/index.d.ts +6 -0
- package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/index.js +49 -0
- package/lib/AgentScopeRuntimeWebUI/starter/index.d.ts +1 -0
- package/lib/AgentScopeRuntimeWebUI/starter/index.js +70 -0
- package/lib/AgentScopeRuntimeWebUI/starter/sessionApi/index.d.ts +14 -0
- package/lib/AgentScopeRuntimeWebUI/starter/sessionApi/index.js +143 -0
- package/package.json +3 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface LoadingProps {
|
|
4
|
+
prefixCls?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const Loading: React.FC<Readonly<LoadingProps>> = ({ prefixCls }) => (
|
|
8
|
+
<span className={`${prefixCls}-dot`}>
|
|
9
|
+
<i className={`${prefixCls}-dot-item`} key={`item-${1}`} />
|
|
10
|
+
<i className={`${prefixCls}-dot-item`} key={`item-${2}`} />
|
|
11
|
+
<i className={`${prefixCls}-dot-item`} key={`item-${3}`} />
|
|
12
|
+
</span>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export default Loading;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createGlobalStyle } from 'antd-style';
|
|
2
|
+
|
|
3
|
+
export default createGlobalStyle`
|
|
4
|
+
.${(p) => p.theme.prefixCls}-bubble-avatar {
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
align-self: flex-start;
|
|
8
|
+
|
|
9
|
+
&-loading .${(p) => p.theme.prefixCls}-avatar::after {
|
|
10
|
+
content: '';
|
|
11
|
+
position: absolute;
|
|
12
|
+
left: 0;
|
|
13
|
+
right: 0;
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 200%;
|
|
16
|
+
background-image: url('data:image/png;base64,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');
|
|
17
|
+
background-size: cover;
|
|
18
|
+
background-position: center;
|
|
19
|
+
background-repeat: no-repeat;
|
|
20
|
+
transform: rotate(-45deg);
|
|
21
|
+
filter: blur(2px);
|
|
22
|
+
animation: light_sweeping 1.5s infinite linear;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@keyframes light_sweeping {
|
|
27
|
+
0% {
|
|
28
|
+
transform: translate(-40%, -80%);
|
|
29
|
+
opacity: 0.2;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
45% {
|
|
33
|
+
transform: translate(20%, 20%);
|
|
34
|
+
opacity: 0.8;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
100% {
|
|
38
|
+
transform: translate(40%, 80%);
|
|
39
|
+
opacity: 0.2;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
`;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createGlobalStyle } from 'antd-style';
|
|
2
|
+
|
|
3
|
+
const Style = createGlobalStyle`
|
|
4
|
+
.${(p) => p.theme.prefixCls}-bubble-footer {
|
|
5
|
+
width: 100%;
|
|
6
|
+
margin-top: 8px;
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
align-items: center;
|
|
10
|
+
font-size: 12px;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.${(p) => p.theme.prefixCls}-bubble-footer-actions {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 8px;
|
|
18
|
+
|
|
19
|
+
&-item {
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
color: ${(p) => p.theme.colorText}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.${(p) => p.theme.prefixCls}-bubble-footer-count {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
|
|
29
|
+
&-item {
|
|
30
|
+
color: ${(p) => p.theme.colorTextTertiary};
|
|
31
|
+
line-height: 1;
|
|
32
|
+
padding-right: 13px;
|
|
33
|
+
margin-left: 13px;
|
|
34
|
+
border-right: 1px solid ${(p) => p.theme.colorBorder};
|
|
35
|
+
white-space: nowrap;
|
|
36
|
+
|
|
37
|
+
&:last-of-type {
|
|
38
|
+
padding-right: 0;
|
|
39
|
+
border-right: 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
export default Style;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { createGlobalStyle } from 'antd-style';
|
|
2
|
+
|
|
3
|
+
export default createGlobalStyle`
|
|
4
|
+
.${(p) => p.theme.prefixCls}-bubble {
|
|
5
|
+
display: flex;
|
|
6
|
+
|
|
7
|
+
&-end,
|
|
8
|
+
&-user {
|
|
9
|
+
justify-content: flex-end;
|
|
10
|
+
|
|
11
|
+
.${(p) => p.theme.prefixCls}-bubble-content-wrapper {
|
|
12
|
+
align-items: flex-end;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&-content-wrapper {
|
|
17
|
+
width: 100%;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
align-items: flex-start;
|
|
21
|
+
gap: 8px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&-content-wrapper-card {
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&-content {
|
|
28
|
+
position: relative;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
min-width: 0;
|
|
31
|
+
max-width: 100%;
|
|
32
|
+
color: ${(p) => p.theme.colorText};
|
|
33
|
+
font-size: ${(p) => p.theme.fontSize}px;
|
|
34
|
+
line-height: ${(p) => p.theme.lineHeight};
|
|
35
|
+
word-break: break-word;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.${(p) => p.theme.prefixCls}-bubble {
|
|
40
|
+
&-content {
|
|
41
|
+
&-filled {
|
|
42
|
+
padding: 12px 16px;
|
|
43
|
+
border-radius: ${(p) => p.theme.borderRadiusLG}px;
|
|
44
|
+
background-color: ${(p) => p.theme.colorPrimaryBg};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
.${(p) => p.theme.prefixCls}-bubble-loading {
|
|
52
|
+
position: relative;
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
gap: 4px;
|
|
56
|
+
filter: invert(1) brightness(100%) saturate(0%);
|
|
57
|
+
|
|
58
|
+
&-text {
|
|
59
|
+
opacity: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&-dot1 {
|
|
63
|
+
width: 4px;
|
|
64
|
+
height: 4px;
|
|
65
|
+
border-radius: 999px;
|
|
66
|
+
background: linear-gradient(
|
|
67
|
+
${(p) => p.theme.colorText},
|
|
68
|
+
${(p) => p.theme.colorText}
|
|
69
|
+
),
|
|
70
|
+
linear-gradient(
|
|
71
|
+
${(p) => p.theme.colorBgBase},
|
|
72
|
+
${(p) => p.theme.colorBgBase}
|
|
73
|
+
);
|
|
74
|
+
background-blend-mode: multiply;
|
|
75
|
+
animation: dot_01 2.5s infinite ease;
|
|
76
|
+
}
|
|
77
|
+
&-dot2 {
|
|
78
|
+
width: 4px;
|
|
79
|
+
height: 4px;
|
|
80
|
+
border-radius: 999px;
|
|
81
|
+
background: linear-gradient(
|
|
82
|
+
${(p) => p.theme.colorTextTertiary},
|
|
83
|
+
${(p) => p.theme.colorTextTertiary}
|
|
84
|
+
),
|
|
85
|
+
linear-gradient(
|
|
86
|
+
${(p) => p.theme.colorBgBase},
|
|
87
|
+
${(p) => p.theme.colorBgBase}
|
|
88
|
+
);
|
|
89
|
+
background-blend-mode: multiply;
|
|
90
|
+
animation: dot_02 2.5s infinite ease;
|
|
91
|
+
}
|
|
92
|
+
&-dot3 {
|
|
93
|
+
width: 4px;
|
|
94
|
+
height: 4px;
|
|
95
|
+
border-radius: 999px;
|
|
96
|
+
background: linear-gradient(
|
|
97
|
+
${(p) => p.theme.colorTextSecondary},
|
|
98
|
+
${(p) => p.theme.colorTextSecondary}
|
|
99
|
+
),
|
|
100
|
+
linear-gradient(
|
|
101
|
+
${(p) => p.theme.colorBgBase},
|
|
102
|
+
${(p) => p.theme.colorBgBase}
|
|
103
|
+
);
|
|
104
|
+
background-blend-mode: multiply;
|
|
105
|
+
animation: dot_03 2.5s infinite ease;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@keyframes dot_01 {
|
|
110
|
+
0% {
|
|
111
|
+
transform: translateX(0px) scale(1);
|
|
112
|
+
z-index: 3;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
30.3% {
|
|
116
|
+
transform: translateX(15px) scale(1);
|
|
117
|
+
z-index: 3;
|
|
118
|
+
}
|
|
119
|
+
33.3% {
|
|
120
|
+
transform: translateX(15px) scale(1);
|
|
121
|
+
z-index: 1;
|
|
122
|
+
}
|
|
123
|
+
63.6% {
|
|
124
|
+
transform: translateX(7.5px) scale(0.75);
|
|
125
|
+
z-index: 1;
|
|
126
|
+
}
|
|
127
|
+
66.6% {
|
|
128
|
+
transform: translateX(7.5px) scale(0.75);
|
|
129
|
+
z-index: 2;
|
|
130
|
+
}
|
|
131
|
+
97% {
|
|
132
|
+
transform: translateX(0px) scale(1);
|
|
133
|
+
z-index: 2;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@keyframes dot_02 {
|
|
138
|
+
0% {
|
|
139
|
+
transform: translateX(0px) scale(1);
|
|
140
|
+
z-index: 2;
|
|
141
|
+
}
|
|
142
|
+
23.3% {
|
|
143
|
+
transform: translateX(-7.5px) scale(1.33333);
|
|
144
|
+
z-index: 2;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
30.3% {
|
|
148
|
+
transform: translateX(-7.5px) scale(1.33333);
|
|
149
|
+
z-index: 3;
|
|
150
|
+
}
|
|
151
|
+
56.6% {
|
|
152
|
+
transform: translateX(7.5px) scale(1.33333);
|
|
153
|
+
z-index: 3;
|
|
154
|
+
}
|
|
155
|
+
63.6% {
|
|
156
|
+
transform: translateX(7.5px) scale(1.33333);
|
|
157
|
+
z-index: 1;
|
|
158
|
+
}
|
|
159
|
+
97% {
|
|
160
|
+
transform: translateX(0px) scale(1);
|
|
161
|
+
z-index: 1;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@keyframes dot_03 {
|
|
166
|
+
0% {
|
|
167
|
+
transform: translateX(0px) scale(1);
|
|
168
|
+
z-index: 1;
|
|
169
|
+
}
|
|
170
|
+
23.3% {
|
|
171
|
+
transform: translateX(-7.5px) scale(0.75);
|
|
172
|
+
z-index: 1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
30.3% {
|
|
176
|
+
transform: translateX(-7.5px) scale(0.75);
|
|
177
|
+
z-index: 2;
|
|
178
|
+
}
|
|
179
|
+
56.6% {
|
|
180
|
+
transform: translateX(-15px) scale(1);
|
|
181
|
+
z-index: 2;
|
|
182
|
+
}
|
|
183
|
+
63.6% {
|
|
184
|
+
transform: translateX(-15px) scale(1);
|
|
185
|
+
z-index: 3;
|
|
186
|
+
}
|
|
187
|
+
97% {
|
|
188
|
+
transform: translateX(0px) scale(1);
|
|
189
|
+
z-index: 3;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
`;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createGlobalStyle } from 'antd-style';
|
|
2
|
+
|
|
3
|
+
export default createGlobalStyle`
|
|
4
|
+
.${(p) => p.theme.prefixCls}-bubble-list-wrapper {
|
|
5
|
+
position: relative;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.${(p) => p.theme.prefixCls}-bubble-list {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: 24px;
|
|
13
|
+
padding: 16px 16px 0 16px;
|
|
14
|
+
|
|
15
|
+
&::after {
|
|
16
|
+
display: block;
|
|
17
|
+
content: ' ';
|
|
18
|
+
height: 16px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.${(p) => p.theme.prefixCls}-bubble-list-scroll-to-bottom {
|
|
23
|
+
position: absolute;
|
|
24
|
+
left: 0;
|
|
25
|
+
right: 0;
|
|
26
|
+
bottom: 10px;
|
|
27
|
+
display: flex;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
transition: all 0.2s;
|
|
30
|
+
z-index: 10;
|
|
31
|
+
|
|
32
|
+
&-hide {
|
|
33
|
+
opacity: 0;
|
|
34
|
+
transform: translateY(100%);
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&-show {
|
|
39
|
+
opacity: 1;
|
|
40
|
+
transform: translateY(0%);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
button {
|
|
44
|
+
&:hover {
|
|
45
|
+
border-color: ${(p) => p.theme.colorPrimaryBorder} !important;
|
|
46
|
+
background-color: ${(p) => p.theme.colorPrimaryBg} !important;
|
|
47
|
+
color: ${(p) => p.theme.colorPrimary} !important;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useMessages } from '../hooks/useMessages';
|
|
3
|
+
import { useInput } from '../hooks/useInput';
|
|
4
|
+
import { useSessionList } from '../hooks/useSessionList';
|
|
5
|
+
|
|
6
|
+
export default React.forwardRef(function Ref(_, ref) {
|
|
7
|
+
|
|
8
|
+
const messageContext = useMessages();
|
|
9
|
+
const inputContext = useInput();
|
|
10
|
+
const sessionContext = useSessionList();
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
React.useImperativeHandle(ref, () => ({
|
|
14
|
+
...messageContext,
|
|
15
|
+
...inputContext,
|
|
16
|
+
...sessionContext,
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
return null;
|
|
20
|
+
})
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { forwardRef, useState } from 'react';
|
|
2
|
+
import Bubble from '../../Bubble';
|
|
3
|
+
import Input from '../Input';
|
|
4
|
+
import { useProviderContext } from '@agentscope-ai/chat';
|
|
5
|
+
import cls from 'classnames';
|
|
6
|
+
import { useTimeout } from 'ahooks';
|
|
7
|
+
import { Disclaimer } from '@agentscope-ai/chat';
|
|
8
|
+
import { useChatAnywhere } from '../hooks/ChatAnywhereProvider';
|
|
9
|
+
import Style from './style';
|
|
10
|
+
|
|
11
|
+
export default forwardRef(function (_, ref) {
|
|
12
|
+
const messages = useChatAnywhere(v => v.messages);
|
|
13
|
+
const { getPrefixCls } = useProviderContext();
|
|
14
|
+
const prefixCls = getPrefixCls('chat-anywhere');
|
|
15
|
+
const uiConfig = useChatAnywhere(v => v.uiConfig);
|
|
16
|
+
const [ready, setReady] = useState(false);
|
|
17
|
+
|
|
18
|
+
useTimeout(() => {
|
|
19
|
+
setReady(true);
|
|
20
|
+
}, 300);
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
const chatClassName = cls(
|
|
24
|
+
`${prefixCls}-chat`,
|
|
25
|
+
{
|
|
26
|
+
[`${prefixCls}-chat-hide`]: !ready,
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const emptyMessage = !messages?.length;
|
|
31
|
+
|
|
32
|
+
return <>
|
|
33
|
+
<Style />
|
|
34
|
+
<div className={chatClassName}>
|
|
35
|
+
<Bubble.List
|
|
36
|
+
style={{ height: 0, flex: emptyMessage ? 0 : 1 }}
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
ref={ref.chatRef}
|
|
39
|
+
items={messages}
|
|
40
|
+
/>
|
|
41
|
+
{
|
|
42
|
+
emptyMessage ? <div className={`${chatClassName}-welcome`}>{uiConfig?.welcome}</div> : null
|
|
43
|
+
}
|
|
44
|
+
<div
|
|
45
|
+
className={`${chatClassName}-sender`}
|
|
46
|
+
style={uiConfig?.disclaimer ? { marginBottom: 16 } : {}}
|
|
47
|
+
>
|
|
48
|
+
{/* @ts-ignore */}
|
|
49
|
+
<Input ref={ref.inputRef}/>
|
|
50
|
+
</div>
|
|
51
|
+
{
|
|
52
|
+
uiConfig?.disclaimer && <Disclaimer style={{ position: 'absolute', bottom: 0, width: '100%' }} desc={uiConfig?.disclaimer} />
|
|
53
|
+
}
|
|
54
|
+
</div>
|
|
55
|
+
</>
|
|
56
|
+
})
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createGlobalStyle } from 'antd-style';
|
|
2
|
+
|
|
3
|
+
export default createGlobalStyle`
|
|
4
|
+
.${(p) => p.theme.prefixCls}-chat-anywhere-chat {
|
|
5
|
+
position: relative;
|
|
6
|
+
height: 100%;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
transition: all 0.3s;
|
|
10
|
+
opacity: 1;
|
|
11
|
+
|
|
12
|
+
.${(p) => p.theme.prefixCls}-bubble-list {
|
|
13
|
+
position: relative;
|
|
14
|
+
margin: 0 auto;
|
|
15
|
+
max-width: 850px;
|
|
16
|
+
min-width: 300px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.${(p) => p.theme.prefixCls}-chat-anywhere-sender-wrapper {
|
|
20
|
+
max-width: 850px;
|
|
21
|
+
min-width: 300px;
|
|
22
|
+
padding: 0 16px 16px 16px;
|
|
23
|
+
margin: 0 auto;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&-hide {
|
|
27
|
+
opacity: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&-welcome {
|
|
31
|
+
max-width: 850px;
|
|
32
|
+
min-width: 300px;
|
|
33
|
+
width: -webkit-fill-available;
|
|
34
|
+
padding: 16px;
|
|
35
|
+
margin: 0 auto;
|
|
36
|
+
height: 100%;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: safe center;
|
|
39
|
+
justify-content: safe center;
|
|
40
|
+
overflow: auto;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@media screen and (max-width: 768px) {
|
|
48
|
+
button {
|
|
49
|
+
cursor: default !important;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.${(p) => p.theme.prefixCls}-conversations .${(p) => p.theme.prefixCls}-conversations-item {
|
|
53
|
+
cursor: default !important;
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
`;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useContext, useState } from "react";
|
|
2
|
+
import { useProviderContext } from "@agentscope-ai/chat";
|
|
3
|
+
import { isMobileHook } from "../Layout";
|
|
4
|
+
import { useChatAnywhere } from "../hooks/ChatAnywhereProvider";
|
|
5
|
+
import { useSessionList } from "../hooks/useSessionList";
|
|
6
|
+
import Style from './style';
|
|
7
|
+
import { IconButton } from "@agentscope-ai/design";
|
|
8
|
+
import { SparkOperateLeftLine, SparkOperateRightLine } from "@agentscope-ai/icons";
|
|
9
|
+
|
|
10
|
+
export default function () {
|
|
11
|
+
const { getPrefixCls } = useProviderContext();
|
|
12
|
+
const prefixCls = getPrefixCls('chat-anywhere-header');
|
|
13
|
+
const uiConfig = useChatAnywhere(v => v.uiConfig)
|
|
14
|
+
const {
|
|
15
|
+
sessionListShow,
|
|
16
|
+
setSessionListShow
|
|
17
|
+
} = useSessionList();
|
|
18
|
+
const isMobile = isMobileHook();
|
|
19
|
+
|
|
20
|
+
return <>
|
|
21
|
+
<Style />
|
|
22
|
+
<div className={prefixCls}>
|
|
23
|
+
{
|
|
24
|
+
isMobile && <IconButton
|
|
25
|
+
style={{ marginLeft: 12 }}
|
|
26
|
+
bordered={false}
|
|
27
|
+
onClick={() => setSessionListShow(!sessionListShow)}
|
|
28
|
+
icon={
|
|
29
|
+
sessionListShow ? <SparkOperateLeftLine /> : <SparkOperateRightLine />
|
|
30
|
+
}>
|
|
31
|
+
</IconButton>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
{uiConfig.header}
|
|
35
|
+
</div>
|
|
36
|
+
</>
|
|
37
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createGlobalStyle } from 'antd-style';
|
|
2
|
+
|
|
3
|
+
export default createGlobalStyle`
|
|
4
|
+
.${(p) => p.theme.prefixCls}-chat-anywhere-header {
|
|
5
|
+
height: 64px;
|
|
6
|
+
position: absolute;
|
|
7
|
+
left: 0;
|
|
8
|
+
right: 0;
|
|
9
|
+
top: 0;
|
|
10
|
+
backdrop-filter: blur(100px);
|
|
11
|
+
z-index: 1;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.${(p) => p.theme.prefixCls}-chat-anywhere-header
|
|
17
|
+
~ .${(p) => p.theme.prefixCls}-chat-anywhere-chat
|
|
18
|
+
.${(p) => p.theme.prefixCls}-bubble-list {
|
|
19
|
+
&::before {
|
|
20
|
+
content: ' ';
|
|
21
|
+
display: block;
|
|
22
|
+
height: 24px;
|
|
23
|
+
flex: 0 0 24px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
`;
|