@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,176 @@
|
|
|
1
|
+
import type { MenuProps } from 'antd';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import GroupTitle, { GroupTitleContext } from './GroupTitle';
|
|
6
|
+
import ConversationsItem, { type ConversationsItemProps } from './Item';
|
|
7
|
+
|
|
8
|
+
import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
|
9
|
+
import { useProviderContext } from '@agentscope-ai/chat';
|
|
10
|
+
import useGroupable from './hooks/useGroupable';
|
|
11
|
+
import Style from './style';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
import pickAttrs from 'rc-util/lib/pickAttrs';
|
|
15
|
+
import type { Conversation, Groupable } from './interface';
|
|
16
|
+
|
|
17
|
+
export interface ConversationsProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
18
|
+
/**
|
|
19
|
+
* @description 会话列表的数据源数组,包含所有会话信息
|
|
20
|
+
* @descriptionEn Data source array for the conversation list containing all conversation information
|
|
21
|
+
*/
|
|
22
|
+
items?: Conversation[];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @description 当前激活的会话标识符,用于高亮显示选中项
|
|
26
|
+
* @descriptionEn Currently active conversation identifier for highlighting selected item
|
|
27
|
+
*/
|
|
28
|
+
activeKey?: Conversation['key'];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @description 组件初始化时的默认选中会话标识符
|
|
32
|
+
* @descriptionEn Default selected conversation identifier when component initializes
|
|
33
|
+
*/
|
|
34
|
+
defaultActiveKey?: Conversation['key'];
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @description 会话选择发生变化时的回调函数,接收新的会话标识符
|
|
38
|
+
* @descriptionEn Callback function when conversation selection changes, receives new conversation identifier
|
|
39
|
+
*/
|
|
40
|
+
onActiveChange?: (value: string) => void;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @description 会话操作菜单配置
|
|
44
|
+
* @descriptionEn Conversation operation menu configuration
|
|
45
|
+
*/
|
|
46
|
+
menu?: {
|
|
47
|
+
label?: string;
|
|
48
|
+
key?: string;
|
|
49
|
+
icon?: React.ReactNode;
|
|
50
|
+
danger?: boolean;
|
|
51
|
+
onClick?: (info: Conversation) => void;
|
|
52
|
+
onEdit?: (label: string, session: Conversation) => Promise<void>;
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
}[];
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @description 语义化样式对象,用于精确控制不同区域的样式
|
|
58
|
+
* @descriptionEn Semantic style object for precise control of different area styles
|
|
59
|
+
*/
|
|
60
|
+
styles?: Partial<Record<'item', React.CSSProperties>>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @description 语义化CSS类名,用于为不同区域添加自定义类名
|
|
64
|
+
* @descriptionEn Semantic CSS class names for adding custom classes to different areas
|
|
65
|
+
*/
|
|
66
|
+
classNames?: Partial<Record<'item', string>>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @description 自定义CSS类名前缀,用于样式隔离和主题定制
|
|
70
|
+
* @descriptionEn Custom CSS class name prefix for style isolation and theme customization
|
|
71
|
+
*/
|
|
72
|
+
prefixCls?: string;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @description 自定义根容器的CSS类名,用于覆盖默认样式
|
|
76
|
+
* @descriptionEn Custom CSS class name for the root container to override default styles
|
|
77
|
+
*/
|
|
78
|
+
rootClassName?: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const Conversations: React.FC<ConversationsProps & { groupable?: boolean | Groupable }> = (props) => {
|
|
82
|
+
const {
|
|
83
|
+
prefixCls: customizePrefixCls,
|
|
84
|
+
rootClassName,
|
|
85
|
+
items,
|
|
86
|
+
activeKey,
|
|
87
|
+
defaultActiveKey,
|
|
88
|
+
onActiveChange,
|
|
89
|
+
menu,
|
|
90
|
+
styles = {},
|
|
91
|
+
classNames = {},
|
|
92
|
+
groupable,
|
|
93
|
+
className,
|
|
94
|
+
style,
|
|
95
|
+
...restProps
|
|
96
|
+
} = props;
|
|
97
|
+
|
|
98
|
+
const domProps = pickAttrs(restProps, {
|
|
99
|
+
attr: true,
|
|
100
|
+
aria: true,
|
|
101
|
+
data: true,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const [mergedActiveKey, setMergedActiveKey] = useMergedState<ConversationsProps['activeKey']>(
|
|
105
|
+
defaultActiveKey,
|
|
106
|
+
{
|
|
107
|
+
value: activeKey,
|
|
108
|
+
},
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const [groupList, enableGroup] = useGroupable(groupable, items);
|
|
112
|
+
|
|
113
|
+
const { direction, getPrefixCls } = useProviderContext();
|
|
114
|
+
const prefixCls = getPrefixCls('conversations');
|
|
115
|
+
const mergedCls = classnames(
|
|
116
|
+
prefixCls,
|
|
117
|
+
className,
|
|
118
|
+
rootClassName,
|
|
119
|
+
{
|
|
120
|
+
[`${prefixCls}-rtl`]: direction === 'rtl',
|
|
121
|
+
},
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const onConversationItemClick: ConversationsItemProps['onClick'] = (info) => {
|
|
125
|
+
setMergedActiveKey(info.key);
|
|
126
|
+
|
|
127
|
+
if (onActiveChange) {
|
|
128
|
+
onActiveChange(info.key);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
return <>
|
|
133
|
+
<Style />
|
|
134
|
+
<ul
|
|
135
|
+
{...domProps}
|
|
136
|
+
style={style}
|
|
137
|
+
className={mergedCls}
|
|
138
|
+
>
|
|
139
|
+
{groupList.map((groupInfo, groupIndex) => {
|
|
140
|
+
const convItems = groupInfo.data.map((convInfo: Conversation, convIndex: number) => {
|
|
141
|
+
return (
|
|
142
|
+
<ConversationsItem
|
|
143
|
+
key={convInfo.key || `key-${convIndex}`}
|
|
144
|
+
info={convInfo}
|
|
145
|
+
prefixCls={prefixCls}
|
|
146
|
+
direction={direction}
|
|
147
|
+
className={classnames(classNames.item)}
|
|
148
|
+
style={styles.item}
|
|
149
|
+
menu={menu}
|
|
150
|
+
active={mergedActiveKey === convInfo.key}
|
|
151
|
+
onClick={onConversationItemClick}
|
|
152
|
+
/>
|
|
153
|
+
)
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
if (enableGroup) {
|
|
157
|
+
return (
|
|
158
|
+
<li key={groupInfo.name || `key-${groupIndex}`}>
|
|
159
|
+
<GroupTitleContext.Provider value={{ prefixCls }}>
|
|
160
|
+
{groupInfo.title?.(groupInfo.name!, { components: { GroupTitle } }) || (
|
|
161
|
+
<GroupTitle key={groupInfo.name}>{groupInfo.name}</GroupTitle>
|
|
162
|
+
)}
|
|
163
|
+
</GroupTitleContext.Provider>
|
|
164
|
+
<ul className={`${prefixCls}-list`}>{convItems}</ul>
|
|
165
|
+
</li>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return convItems;
|
|
170
|
+
})}
|
|
171
|
+
</ul></>
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
export type { Conversation };
|
|
176
|
+
export default Conversations;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 2
|
|
3
|
+
group:
|
|
4
|
+
title: 展现
|
|
5
|
+
order: 1
|
|
6
|
+
title: HistoryPanel
|
|
7
|
+
description: 对话历史面板
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<DemoTitle title="HistoryPanel" desc="对话历史面板" llmTxtName="Conversations"></DemoTitle>
|
|
11
|
+
|
|
12
|
+
<code src="./demo/basic.tsx" height="auto">示例</code>
|
|
13
|
+
|
|
14
|
+
<Install>import { HistoryPanel } from '@agentscope-ai/chat'</Install>
|
|
15
|
+
|
|
16
|
+
#### 历史面板示例
|
|
17
|
+
|
|
18
|
+
以下是此组件的示例和变体
|
|
19
|
+
|
|
20
|
+
<code src="./demo/timestamp.tsx" height="auto">展示时间戳</code>
|
|
21
|
+
<code src="./demo/timeline.tsx" height="auto">展示时间戳 & 时间线</code>
|
|
22
|
+
|
|
23
|
+
#### API
|
|
24
|
+
|
|
25
|
+
##### HistoryPanel
|
|
26
|
+
|
|
27
|
+
<ApiParser source="./index.tsx" id="ConversationsProps"></ApiParser>
|
|
28
|
+
|
|
29
|
+
##### Conversation
|
|
30
|
+
|
|
31
|
+
<ApiParser source="./interface.ts" id="Conversation"></ApiParser>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { AnyObject } from '../Util/type';
|
|
3
|
+
import type { GroupTitleProps } from './GroupTitle';
|
|
4
|
+
|
|
5
|
+
type GroupType = string;
|
|
6
|
+
|
|
7
|
+
export interface Conversation extends AnyObject {
|
|
8
|
+
/**
|
|
9
|
+
* @description 会话的唯一标识符,用于区分不同的聊天会话
|
|
10
|
+
* @descriptionEn Unique identifier for the conversation to distinguish different chat sessions
|
|
11
|
+
*/
|
|
12
|
+
key: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @description 会话的显示名称,支持文本或React元素
|
|
16
|
+
* @descriptionEn Display name for the conversation, supports text or React elements
|
|
17
|
+
*/
|
|
18
|
+
label?: React.ReactNode;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @description 会话创建或最后活动的时间戳,用于排序和显示
|
|
22
|
+
* @descriptionEn Timestamp of conversation creation or last activity for sorting and display
|
|
23
|
+
*/
|
|
24
|
+
timestamp?: number;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @description 会话的图标元素,用于视觉识别
|
|
29
|
+
* @descriptionEn Icon element for the conversation for visual identification
|
|
30
|
+
*/
|
|
31
|
+
icon?: React.ReactNode;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @description 是否禁用该会话,影响交互功能
|
|
35
|
+
* @descriptionEn Whether to disable this conversation, affects interaction functionality
|
|
36
|
+
*/
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @description 是否在时间线中显示该会话,用于分组显示
|
|
41
|
+
* @descriptionEn Whether to show this conversation in timeline for grouped display
|
|
42
|
+
*/
|
|
43
|
+
timeline?: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type GroupSorter = Parameters<GroupType[]['sort']>[0];
|
|
47
|
+
|
|
48
|
+
export type GroupTitleRenderComponents = {
|
|
49
|
+
components: {
|
|
50
|
+
GroupTitle: React.ComponentType<GroupTitleProps>;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type GroupTitleRender =
|
|
55
|
+
| ((group: GroupType, info: GroupTitleRenderComponents) => React.ReactNode)
|
|
56
|
+
| undefined;
|
|
57
|
+
|
|
58
|
+
export interface Groupable {
|
|
59
|
+
/**
|
|
60
|
+
* @description 会话分组的排序函数,用于自定义排序逻辑
|
|
61
|
+
* @descriptionEn Sorting function for conversation grouping for custom sorting logic
|
|
62
|
+
*/
|
|
63
|
+
sort?: GroupSorter;
|
|
64
|
+
/**
|
|
65
|
+
* @description 自定义分组标题的渲染函数,用于个性化显示
|
|
66
|
+
* @descriptionEn Custom rendering function for group titles for personalized display
|
|
67
|
+
*/
|
|
68
|
+
title?: GroupTitleRender;
|
|
69
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { createGlobalStyle } from 'antd-style';
|
|
2
|
+
|
|
3
|
+
export default createGlobalStyle`
|
|
4
|
+
.${(p) => p.theme.prefixCls}-conversations {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: 8px;
|
|
8
|
+
padding: 0;
|
|
9
|
+
overflow-y: hidden;
|
|
10
|
+
margin: 0;
|
|
11
|
+
|
|
12
|
+
&-rtl {
|
|
13
|
+
direction: rtl;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&-list {
|
|
17
|
+
display: flex;
|
|
18
|
+
gap: ${(p) => p.theme.paddingXXS}px;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
|
|
21
|
+
.${(p) => p.theme.prefixCls}-conversations-item {
|
|
22
|
+
padding-inline-start: ${(p) => p.theme.paddingXL}px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.${(p) => p.theme.prefixCls}-conversations-label {
|
|
26
|
+
color: ${(p) => p.theme.colorTextSecondary};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&-timeline {
|
|
31
|
+
position: relative;
|
|
32
|
+
z-index: 1;
|
|
33
|
+
width: 8px;
|
|
34
|
+
height: 8px;
|
|
35
|
+
border-radius: 8px;
|
|
36
|
+
background-color: ${(p) => p.theme.colorBgBase};
|
|
37
|
+
border: 1px solid ${(p) => p.theme.colorBorder};
|
|
38
|
+
margin-right: 8px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&-content {
|
|
42
|
+
height: 36px;
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
padding: 6px 2px 6px 16px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&-desc {
|
|
49
|
+
font-size: 12px;
|
|
50
|
+
padding: 0 16px 6px 16px;
|
|
51
|
+
color: ${(p) => p.theme.colorTextSecondary};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&-item {
|
|
55
|
+
position: relative;
|
|
56
|
+
border-radius: ${(p) => p.theme.borderRadiusLG}px;
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
transition: background-color 0.3s ease;
|
|
59
|
+
|
|
60
|
+
&-timeline {
|
|
61
|
+
&::before {
|
|
62
|
+
content: '';
|
|
63
|
+
position: absolute;
|
|
64
|
+
left: 19.5px;
|
|
65
|
+
top: 0;
|
|
66
|
+
bottom: -8px;
|
|
67
|
+
width: 1px;
|
|
68
|
+
background: ${(p) => p.theme.colorBorder};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&:hover {
|
|
73
|
+
background-color: ${(p) => p.theme.colorFillTertiary};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&-active {
|
|
77
|
+
background-color: ${(p) => p.theme.colorFillTertiary};
|
|
78
|
+
|
|
79
|
+
.${(p) => p.theme.prefixCls}-conversations-label,
|
|
80
|
+
.${(p) => p.theme.prefixCls}-conversations-menu-icon {
|
|
81
|
+
color: ${(p) => p.theme.colorText};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&-disabled {
|
|
86
|
+
cursor: not-allowed;
|
|
87
|
+
|
|
88
|
+
.${(p) => p.theme.prefixCls}-conversations-label {
|
|
89
|
+
color: ${(p) => p.theme.colorTextDisabled};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.${(p) => p.theme.prefixCls}-conversations-menu-icon {
|
|
93
|
+
opacity: 0;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&:hover,
|
|
98
|
+
&-active {
|
|
99
|
+
.${(p) => p.theme.prefixCls}-conversations-menu-icon {
|
|
100
|
+
opacity: 1;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&:focus-within {
|
|
105
|
+
background-color: ${(p) => p.theme.colorFillTertiary};
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&-label {
|
|
112
|
+
flex: 1;
|
|
113
|
+
color: ${(p) => p.theme.colorText};
|
|
114
|
+
text-overflow: ellipsis;
|
|
115
|
+
overflow: hidden;
|
|
116
|
+
white-space: nowrap;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&-label-edit {
|
|
120
|
+
font-size: 14px;
|
|
121
|
+
color: ${(p) => p.theme.colorText};
|
|
122
|
+
font-family: ${(p) => p.theme.fontFamily};
|
|
123
|
+
flex: 1;
|
|
124
|
+
border: none;
|
|
125
|
+
height: 22px;
|
|
126
|
+
line-height: 22px;
|
|
127
|
+
outline: none;
|
|
128
|
+
background-color: transparent;
|
|
129
|
+
padding: 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
&-menu-icon {
|
|
134
|
+
opacity: 0;
|
|
135
|
+
transition: all 0.3s;
|
|
136
|
+
font-size: ${(p) => p.theme.fontSizeXL}px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&-menu-popover {
|
|
140
|
+
display: flex;
|
|
141
|
+
flex-direction: column;
|
|
142
|
+
&-item {
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&-group-title {
|
|
147
|
+
display: flex;
|
|
148
|
+
align-items: center;
|
|
149
|
+
height: ${(p) => p.theme.controlHeightLG}px;
|
|
150
|
+
min-height: ${(p) => p.theme.controlHeightLG}px;
|
|
151
|
+
padding: 0 ${(p) => p.theme.paddingXS}px;
|
|
152
|
+
}
|
|
153
|
+
}`;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DeepThinking } from '@agentscope-ai/chat';
|
|
3
|
+
|
|
4
|
+
interface IProps {
|
|
5
|
+
data: {
|
|
6
|
+
block?: boolean;
|
|
7
|
+
title?: string;
|
|
8
|
+
subTitle?: string;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
content?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
defaultOpen?: boolean;
|
|
13
|
+
open?: boolean;
|
|
14
|
+
autoCloseOnFinish?: boolean;
|
|
15
|
+
maxHeight?: number;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default function (props: IProps) {
|
|
20
|
+
|
|
21
|
+
return <DeepThinking
|
|
22
|
+
defaultOpen={props.data.defaultOpen !== undefined ? props.data.defaultOpen : true}
|
|
23
|
+
title={props.data.title}
|
|
24
|
+
loading={props.data.loading}
|
|
25
|
+
content={props.data.content}
|
|
26
|
+
className={props.data.className}
|
|
27
|
+
open={props.data.open}
|
|
28
|
+
autoCloseOnFinish={props.data.autoCloseOnFinish}
|
|
29
|
+
maxHeight={props.data.maxHeight}
|
|
30
|
+
/>
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Space } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Attachments } from '@agentscope-ai/chat';
|
|
4
|
+
import { createGlobalStyle } from 'antd-style';
|
|
5
|
+
import { useProviderContext } from '@agentscope-ai/chat';
|
|
6
|
+
import { SparkDownloadLine } from '@agentscope-ai/icons';
|
|
7
|
+
|
|
8
|
+
const Style = createGlobalStyle`
|
|
9
|
+
.${p => p.theme.prefixCls}-bubble-files-file {
|
|
10
|
+
position: relative;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.${p => p.theme.prefixCls}-bubble-files-download {
|
|
14
|
+
position: absolute;
|
|
15
|
+
inset: 0;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
background: rgba(0,0,0,0.5);
|
|
20
|
+
z-index: 1;
|
|
21
|
+
opacity: 0;
|
|
22
|
+
font-size: 16px;
|
|
23
|
+
border-radius: ${p => p.theme.borderRadius}px;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
color: ${p => p.theme.colorWhite};
|
|
26
|
+
transition: opacity ${p => p.theme.motionDurationSlow}
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.${p => p.theme.prefixCls}-bubble-files-file:hover .${p => p.theme.prefixCls}-bubble-files-download {
|
|
31
|
+
opacity: 1;
|
|
32
|
+
}
|
|
33
|
+
`
|
|
34
|
+
export default function Files(props) {
|
|
35
|
+
|
|
36
|
+
const { getPrefixCls } = useProviderContext();
|
|
37
|
+
const prefixCls = getPrefixCls('bubble-files');
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
return <>
|
|
41
|
+
|
|
42
|
+
<Style />
|
|
43
|
+
<Space className={prefixCls}>
|
|
44
|
+
{props.data.map((file, index) => {
|
|
45
|
+
const fileInfo = {
|
|
46
|
+
name: file.name || file.filename,
|
|
47
|
+
size: file.size || file.bytes,
|
|
48
|
+
url: file.url,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return <div key={index} className={`${prefixCls}-file`}>
|
|
52
|
+
<Attachments.FileCard
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
item={fileInfo}
|
|
55
|
+
/>
|
|
56
|
+
|
|
57
|
+
{
|
|
58
|
+
fileInfo.url && <div className={`${prefixCls}-download`} onClick={() => {
|
|
59
|
+
window.open(fileInfo.url, '_blank');
|
|
60
|
+
}}>
|
|
61
|
+
<SparkDownloadLine />
|
|
62
|
+
</div>
|
|
63
|
+
}
|
|
64
|
+
</div>
|
|
65
|
+
})}
|
|
66
|
+
</Space>
|
|
67
|
+
</>
|
|
68
|
+
}
|
|
69
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
import Footer, { FooterActions, FooterCount } from "../../Bubble/Footer";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export default function (props: {
|
|
7
|
+
data: {
|
|
8
|
+
left?: React.ReactElement;
|
|
9
|
+
right?: React.ReactElement;
|
|
10
|
+
},
|
|
11
|
+
id: string;
|
|
12
|
+
}) {
|
|
13
|
+
return <Footer {...props.data} />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { FooterActions, FooterCount };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createGlobalStyle } from 'antd-style';
|
|
2
|
+
import { useProviderContext } from '@agentscope-ai/chat';
|
|
3
|
+
import { Space, Image as AntdImage, ConfigProvider } from 'antd';
|
|
4
|
+
import { Locale } from 'antd/es/locale';
|
|
5
|
+
|
|
6
|
+
const Style = createGlobalStyle`
|
|
7
|
+
.${p => p.theme.prefixCls}-bubble-image {
|
|
8
|
+
border-radius: 8px;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
|
|
11
|
+
.${p => p.theme.prefixCls}-image {
|
|
12
|
+
display: block;
|
|
13
|
+
}
|
|
14
|
+
.${p => p.theme.prefixCls}-image-img {
|
|
15
|
+
object-fit: cover;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.${p => p.theme.prefixCls}-image-mask-info {
|
|
19
|
+
span {
|
|
20
|
+
margin-inline-end: 0 !important;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`
|
|
25
|
+
function Image(image) {
|
|
26
|
+
const { getPrefixCls } = useProviderContext();
|
|
27
|
+
const prefixCls = getPrefixCls('bubble-image');
|
|
28
|
+
|
|
29
|
+
return <>
|
|
30
|
+
<Style />
|
|
31
|
+
<div className={`${prefixCls}`}>
|
|
32
|
+
<AntdImage
|
|
33
|
+
fallback="data:image/png;base64,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"
|
|
34
|
+
src={image.url} width={56} height={56} preview={{
|
|
35
|
+
transitionName: '',
|
|
36
|
+
}} />
|
|
37
|
+
</div></>
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
export default function Files(props) {
|
|
41
|
+
return <ConfigProvider
|
|
42
|
+
locale={{
|
|
43
|
+
Image: { preview: '' }
|
|
44
|
+
} as Locale}
|
|
45
|
+
>
|
|
46
|
+
|
|
47
|
+
<Space>
|
|
48
|
+
{props.data.map((image, index) =>
|
|
49
|
+
<Image key={index} url={image.url} />
|
|
50
|
+
)}
|
|
51
|
+
</Space>
|
|
52
|
+
</ConfigProvider>
|
|
53
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Interrupted from '../../Bubble/Interrupted';
|
|
2
|
+
|
|
3
|
+
interface IProps {
|
|
4
|
+
data: {
|
|
5
|
+
title?: string;
|
|
6
|
+
type?: 'error' | 'interrupted';
|
|
7
|
+
desc?: string;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function (props: IProps) {
|
|
12
|
+
return <Interrupted {...props.data} />;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Markdown } from "@agentscope-ai/chat";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function (props) {
|
|
6
|
+
const cursor = props.data.msgStatus === 'generating';
|
|
7
|
+
|
|
8
|
+
return <Markdown
|
|
9
|
+
cursor={cursor}
|
|
10
|
+
{...props.data}
|
|
11
|
+
typing={props.data.msgStatus === 'generating' ? props.data.typing : false}
|
|
12
|
+
/>
|
|
13
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as DeepThink, default as DeepThinking } from './DeepThinking';
|
|
2
|
+
export { default as Files } from './Files';
|
|
3
|
+
export { default as Images } from './Images';
|
|
4
|
+
export { default as Text } from './Text';
|
|
5
|
+
export { default as Footer, FooterActions, FooterCount } from './Footer';
|
|
6
|
+
export { default as Interrupted } from './Interrupted';
|