@patternfly/chatbot 6.5.0-prerelease.9 → 6.6.0-prerelease.1
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/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +9 -1
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +9 -2
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +38 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +29 -2
- package/dist/cjs/CodeModal/CodeModal.d.ts +2 -0
- package/dist/cjs/CodeModal/CodeModal.js +53 -12
- package/dist/cjs/DeepThinking/DeepThinking.d.ts +13 -0
- package/dist/cjs/DeepThinking/DeepThinking.js +31 -3
- package/dist/cjs/DeepThinking/DeepThinking.test.js +80 -0
- package/dist/cjs/MarkdownContent/MarkdownContent.d.ts +44 -0
- package/dist/cjs/MarkdownContent/MarkdownContent.js +181 -0
- package/dist/cjs/MarkdownContent/MarkdownContent.test.d.ts +1 -0
- package/dist/cjs/MarkdownContent/MarkdownContent.test.js +192 -0
- package/dist/cjs/MarkdownContent/index.d.ts +2 -0
- package/dist/cjs/MarkdownContent/index.js +23 -0
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.d.ts +3 -1
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +15 -4
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +1 -0
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.js +131 -0
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.d.ts +15 -1
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.js +5 -3
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.d.ts +1 -0
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.js +30 -0
- package/dist/cjs/Message/LinkMessage/LinkMessage.d.ts +5 -1
- package/dist/cjs/Message/LinkMessage/LinkMessage.js +4 -3
- package/dist/cjs/Message/ListMessage/OrderedListMessage.d.ts +9 -1
- package/dist/cjs/Message/ListMessage/OrderedListMessage.js +2 -1
- package/dist/cjs/Message/ListMessage/UnorderedListMessage.d.ts +7 -1
- package/dist/cjs/Message/ListMessage/UnorderedListMessage.js +2 -1
- package/dist/cjs/Message/Message.d.ts +20 -3
- package/dist/cjs/Message/Message.js +7 -160
- package/dist/cjs/Message/Message.test.js +129 -2
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.d.ts +14 -0
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.js +22 -0
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.d.ts +1 -0
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.js +25 -0
- package/dist/cjs/Message/MessageAndActions/index.d.ts +1 -0
- package/dist/cjs/Message/MessageAndActions/index.js +17 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.d.ts +13 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.js +22 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +1 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.js +25 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.d.ts +13 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.js +22 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +1 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.js +25 -0
- package/dist/cjs/Message/MessageAttachments/index.d.ts +2 -0
- package/dist/cjs/Message/MessageAttachments/index.js +18 -0
- package/dist/cjs/Message/MessageInput.d.ts +1 -1
- package/dist/cjs/Message/MessageInput.js +3 -1
- package/dist/cjs/Message/MessageLoading.d.ts +13 -4
- package/dist/cjs/Message/MessageLoading.js +19 -5
- package/dist/cjs/Message/MessageLoading.test.d.ts +1 -0
- package/dist/cjs/Message/MessageLoading.test.js +25 -0
- package/dist/cjs/Message/QuickResponse/QuickResponse.js +3 -2
- package/dist/cjs/Message/QuickResponse/QuickResponse.test.d.ts +1 -0
- package/dist/cjs/Message/QuickResponse/QuickResponse.test.js +109 -0
- package/dist/cjs/Message/QuickResponse/index.d.ts +1 -0
- package/dist/cjs/Message/QuickResponse/index.js +17 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTile.d.ts +1 -1
- package/dist/cjs/Message/QuickStarts/QuickStartTile.js +3 -2
- package/dist/cjs/Message/QuickStarts/index.d.ts +2 -0
- package/dist/cjs/Message/QuickStarts/index.js +18 -0
- package/dist/cjs/Message/TableMessage/TableMessage.d.ts +6 -1
- package/dist/cjs/Message/TableMessage/TableMessage.js +3 -2
- package/dist/cjs/Message/TextMessage/TextMessage.d.ts +8 -1
- package/dist/cjs/Message/TextMessage/TextMessage.js +3 -2
- package/dist/cjs/Message/UserFeedback/UserFeedback.d.ts +3 -1
- package/dist/cjs/Message/UserFeedback/UserFeedback.js +8 -6
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.d.ts +1 -1
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.js +3 -2
- package/dist/cjs/Message/UserFeedback/index.d.ts +2 -0
- package/dist/cjs/Message/UserFeedback/index.js +18 -0
- package/dist/cjs/Message/index.d.ts +8 -0
- package/dist/cjs/Message/index.js +8 -0
- package/dist/cjs/MessageBar/MessageBar.d.ts +10 -0
- package/dist/cjs/MessageBar/MessageBar.js +42 -10
- package/dist/cjs/MessageBar/MessageBar.test.js +20 -0
- package/dist/cjs/Onboarding/Onboarding.d.ts +36 -0
- package/dist/cjs/Onboarding/Onboarding.js +37 -0
- package/dist/cjs/Onboarding/Onboarding.test.d.ts +1 -0
- package/dist/cjs/Onboarding/Onboarding.test.js +80 -0
- package/dist/cjs/Onboarding/index.d.ts +2 -0
- package/dist/cjs/Onboarding/index.js +23 -0
- package/dist/cjs/ResponseActions/ResponseActions.d.ts +7 -0
- package/dist/cjs/ResponseActions/ResponseActions.js +28 -7
- package/dist/cjs/ResponseActions/ResponseActions.test.js +67 -12
- package/dist/cjs/ResponseActions/ResponseActionsGroups.d.ts +13 -0
- package/dist/cjs/ResponseActions/ResponseActionsGroups.js +22 -0
- package/dist/cjs/ResponseActions/ResponseActionsGroups.test.d.ts +1 -0
- package/dist/cjs/ResponseActions/ResponseActionsGroups.test.js +25 -0
- package/dist/cjs/ResponseActions/index.d.ts +1 -0
- package/dist/cjs/ResponseActions/index.js +1 -0
- package/dist/cjs/ToolCall/ToolCall.d.ts +11 -0
- package/dist/cjs/ToolCall/ToolCall.js +24 -3
- package/dist/cjs/ToolCall/ToolCall.test.js +57 -0
- package/dist/cjs/ToolResponse/ToolResponse.d.ts +17 -0
- package/dist/cjs/ToolResponse/ToolResponse.js +49 -3
- package/dist/cjs/ToolResponse/ToolResponse.test.js +100 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +7 -1
- package/dist/css/main.css +276 -30
- package/dist/css/main.css.map +1 -1
- package/dist/dynamic/MarkdownContent/package.json +1 -0
- package/dist/dynamic/Onboarding/package.json +1 -0
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +9 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +10 -3
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +38 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +30 -3
- package/dist/esm/CodeModal/CodeModal.d.ts +2 -0
- package/dist/esm/CodeModal/CodeModal.js +54 -13
- package/dist/esm/DeepThinking/DeepThinking.d.ts +13 -0
- package/dist/esm/DeepThinking/DeepThinking.js +28 -3
- package/dist/esm/DeepThinking/DeepThinking.test.js +80 -0
- package/dist/esm/MarkdownContent/MarkdownContent.d.ts +44 -0
- package/dist/esm/MarkdownContent/MarkdownContent.js +174 -0
- package/dist/esm/MarkdownContent/MarkdownContent.test.d.ts +1 -0
- package/dist/esm/MarkdownContent/MarkdownContent.test.js +187 -0
- package/dist/esm/MarkdownContent/index.d.ts +2 -0
- package/dist/esm/MarkdownContent/index.js +2 -0
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.d.ts +3 -1
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +15 -4
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +1 -0
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.js +126 -0
- package/dist/esm/Message/ErrorMessage/ErrorMessage.d.ts +15 -1
- package/dist/esm/Message/ErrorMessage/ErrorMessage.js +3 -3
- package/dist/esm/Message/ErrorMessage/ErrorMessage.test.d.ts +1 -0
- package/dist/esm/Message/ErrorMessage/ErrorMessage.test.js +25 -0
- package/dist/esm/Message/LinkMessage/LinkMessage.d.ts +5 -1
- package/dist/esm/Message/LinkMessage/LinkMessage.js +4 -3
- package/dist/esm/Message/ListMessage/OrderedListMessage.d.ts +9 -1
- package/dist/esm/Message/ListMessage/OrderedListMessage.js +2 -1
- package/dist/esm/Message/ListMessage/UnorderedListMessage.d.ts +7 -1
- package/dist/esm/Message/ListMessage/UnorderedListMessage.js +2 -1
- package/dist/esm/Message/Message.d.ts +20 -3
- package/dist/esm/Message/Message.js +8 -161
- package/dist/esm/Message/Message.test.js +129 -2
- package/dist/esm/Message/MessageAndActions/MessageAndActions.d.ts +14 -0
- package/dist/esm/Message/MessageAndActions/MessageAndActions.js +18 -0
- package/dist/esm/Message/MessageAndActions/MessageAndActions.test.d.ts +1 -0
- package/dist/esm/Message/MessageAndActions/MessageAndActions.test.js +20 -0
- package/dist/esm/Message/MessageAndActions/index.d.ts +1 -0
- package/dist/esm/Message/MessageAndActions/index.js +1 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.d.ts +13 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.js +18 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +1 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.js +20 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.d.ts +13 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.js +18 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +1 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.js +20 -0
- package/dist/esm/Message/MessageAttachments/index.d.ts +2 -0
- package/dist/esm/Message/MessageAttachments/index.js +2 -0
- package/dist/esm/Message/MessageInput.d.ts +1 -1
- package/dist/esm/Message/MessageInput.js +1 -1
- package/dist/esm/Message/MessageLoading.d.ts +13 -4
- package/dist/esm/Message/MessageLoading.js +16 -4
- package/dist/esm/Message/MessageLoading.test.d.ts +1 -0
- package/dist/esm/Message/MessageLoading.test.js +20 -0
- package/dist/esm/Message/QuickResponse/QuickResponse.js +3 -2
- package/dist/esm/Message/QuickResponse/QuickResponse.test.d.ts +1 -0
- package/dist/esm/Message/QuickResponse/QuickResponse.test.js +104 -0
- package/dist/esm/Message/QuickResponse/index.d.ts +1 -0
- package/dist/esm/Message/QuickResponse/index.js +1 -0
- package/dist/esm/Message/QuickStarts/QuickStartTile.d.ts +1 -1
- package/dist/esm/Message/QuickStarts/QuickStartTile.js +1 -1
- package/dist/esm/Message/QuickStarts/index.d.ts +2 -0
- package/dist/esm/Message/QuickStarts/index.js +2 -0
- package/dist/esm/Message/TableMessage/TableMessage.d.ts +6 -1
- package/dist/esm/Message/TableMessage/TableMessage.js +3 -2
- package/dist/esm/Message/TextMessage/TextMessage.d.ts +8 -1
- package/dist/esm/Message/TextMessage/TextMessage.js +3 -2
- package/dist/esm/Message/UserFeedback/UserFeedback.d.ts +3 -1
- package/dist/esm/Message/UserFeedback/UserFeedback.js +7 -7
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.d.ts +1 -1
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.js +1 -2
- package/dist/esm/Message/UserFeedback/index.d.ts +2 -0
- package/dist/esm/Message/UserFeedback/index.js +2 -0
- package/dist/esm/Message/index.d.ts +8 -0
- package/dist/esm/Message/index.js +8 -0
- package/dist/esm/MessageBar/MessageBar.d.ts +10 -0
- package/dist/esm/MessageBar/MessageBar.js +42 -10
- package/dist/esm/MessageBar/MessageBar.test.js +20 -0
- package/dist/esm/Onboarding/Onboarding.d.ts +36 -0
- package/dist/esm/Onboarding/Onboarding.js +30 -0
- package/dist/esm/Onboarding/Onboarding.test.d.ts +1 -0
- package/dist/esm/Onboarding/Onboarding.test.js +75 -0
- package/dist/esm/Onboarding/index.d.ts +2 -0
- package/dist/esm/Onboarding/index.js +2 -0
- package/dist/esm/ResponseActions/ResponseActions.d.ts +7 -0
- package/dist/esm/ResponseActions/ResponseActions.js +28 -7
- package/dist/esm/ResponseActions/ResponseActions.test.js +67 -12
- package/dist/esm/ResponseActions/ResponseActionsGroups.d.ts +13 -0
- package/dist/esm/ResponseActions/ResponseActionsGroups.js +18 -0
- package/dist/esm/ResponseActions/ResponseActionsGroups.test.d.ts +1 -0
- package/dist/esm/ResponseActions/ResponseActionsGroups.test.js +20 -0
- package/dist/esm/ResponseActions/index.d.ts +1 -0
- package/dist/esm/ResponseActions/index.js +1 -0
- package/dist/esm/ToolCall/ToolCall.d.ts +11 -0
- package/dist/esm/ToolCall/ToolCall.js +21 -3
- package/dist/esm/ToolCall/ToolCall.test.js +57 -0
- package/dist/esm/ToolResponse/ToolResponse.d.ts +17 -0
- package/dist/esm/ToolResponse/ToolResponse.js +46 -3
- package/dist/esm/ToolResponse/ToolResponse.test.js +100 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +4 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -3
- package/patternfly-docs/content/extensions/chatbot/chatbot.md +57 -0
- package/patternfly-docs/content/extensions/chatbot/design-guidelines.md +12 -12
- package/patternfly-docs/content/extensions/chatbot/examples/Analytics/Analytics.md +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Customizing Messages/Customizing Messages.md +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +1 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomStructure.tsx +102 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithDeepThinking.tsx +25 -11
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +14 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMarkdownDeepThinking.tsx +26 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMarkdownToolCall.tsx +29 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMarkdownToolResponse.tsx +200 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMultipleActionGroups.tsx +61 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithPersistedActions.tsx +22 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +11 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithToolCall.tsx +14 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithToolResponse.tsx +222 -105
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +123 -14
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +1 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSearchActions.tsx +198 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarCustomActions.tsx +190 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarIndicatorThinking.tsx +15 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/CompactOnboarding.tsx +141 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/Onboarding.tsx +151 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/RH-Hat-Image.svg +9 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +81 -30
- package/patternfly-docs/content/extensions/chatbot/examples/demos/AttachmentDemos.md +18 -18
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +33 -19
- package/patternfly-docs/patternfly-docs.config.js +1 -1
- package/patternfly-docs/patternfly-docs.source.js +1 -1
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +43 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +95 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +51 -15
- package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +56 -14
- package/src/ChatbotModal/ChatbotModal.scss +3 -0
- package/src/CodeModal/CodeModal.tsx +71 -26
- package/src/DeepThinking/DeepThinking.scss +1 -1
- package/src/DeepThinking/DeepThinking.test.tsx +109 -0
- package/src/DeepThinking/DeepThinking.tsx +54 -5
- package/src/MarkdownContent/MarkdownContent.test.tsx +207 -0
- package/src/MarkdownContent/MarkdownContent.tsx +269 -0
- package/src/MarkdownContent/index.ts +2 -0
- package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +13 -0
- package/src/Message/CodeBlockMessage/CodeBlockMessage.test.tsx +171 -0
- package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +17 -4
- package/src/Message/ErrorMessage/ErrorMessage.test.tsx +38 -0
- package/src/Message/ErrorMessage/ErrorMessage.tsx +17 -2
- package/src/Message/LinkMessage/LinkMessage.scss +5 -0
- package/src/Message/LinkMessage/LinkMessage.tsx +24 -2
- package/src/Message/ListMessage/ListMessage.scss +8 -0
- package/src/Message/ListMessage/OrderedListMessage.tsx +16 -2
- package/src/Message/ListMessage/UnorderedListMessage.tsx +12 -2
- package/src/Message/Message.scss +11 -7
- package/src/Message/Message.test.tsx +202 -2
- package/src/Message/Message.tsx +129 -241
- package/src/Message/MessageAndActions/MessageAndActions.test.tsx +23 -0
- package/src/Message/MessageAndActions/MessageAndActions.tsx +22 -0
- package/src/Message/MessageAndActions/index.ts +1 -0
- package/src/Message/MessageAttachments/MessageAttachmentItem.test.tsx +23 -0
- package/src/Message/MessageAttachments/MessageAttachmentItem.tsx +25 -0
- package/src/Message/MessageAttachments/MessageAttachmentsContainer.test.tsx +23 -0
- package/src/Message/MessageAttachments/MessageAttachmentsContainer.tsx +25 -0
- package/src/Message/MessageAttachments/index.ts +2 -0
- package/src/Message/MessageInput.tsx +1 -1
- package/src/Message/MessageLoading.test.tsx +23 -0
- package/src/Message/MessageLoading.tsx +17 -2
- package/src/Message/QuickResponse/QuickResponse.scss +3 -1
- package/src/Message/QuickResponse/QuickResponse.test.tsx +131 -0
- package/src/Message/QuickResponse/QuickResponse.tsx +3 -2
- package/src/Message/QuickResponse/index.ts +1 -0
- package/src/Message/QuickStarts/QuickStartTile.tsx +1 -1
- package/src/Message/QuickStarts/index.ts +2 -0
- package/src/Message/TableMessage/TableMessage.scss +13 -1
- package/src/Message/TableMessage/TableMessage.tsx +18 -2
- package/src/Message/TextMessage/TextMessage.scss +12 -0
- package/src/Message/TextMessage/TextMessage.tsx +29 -2
- package/src/Message/UserFeedback/UserFeedback.scss +28 -1
- package/src/Message/UserFeedback/UserFeedback.tsx +23 -13
- package/src/Message/UserFeedback/UserFeedbackComplete.tsx +1 -4
- package/src/Message/UserFeedback/index.ts +2 -0
- package/src/Message/index.ts +8 -0
- package/src/MessageBar/AttachButton.scss +0 -1
- package/src/MessageBar/MessageBar.scss +63 -7
- package/src/MessageBar/MessageBar.test.tsx +39 -0
- package/src/MessageBar/MessageBar.tsx +124 -48
- package/src/MessageBar/MicrophoneButton.scss +0 -1
- package/src/MessageBar/SendButton.scss +0 -1
- package/src/MessageBar/StopButton.scss +0 -1
- package/src/Onboarding/Onboarding.scss +101 -0
- package/src/Onboarding/Onboarding.test.tsx +148 -0
- package/src/Onboarding/Onboarding.tsx +126 -0
- package/src/Onboarding/index.ts +3 -0
- package/src/ResponseActions/ResponseActions.scss +12 -1
- package/src/ResponseActions/ResponseActions.test.tsx +111 -12
- package/src/ResponseActions/ResponseActions.tsx +44 -10
- package/src/ResponseActions/ResponseActionsGroups.test.tsx +23 -0
- package/src/ResponseActions/ResponseActionsGroups.tsx +28 -0
- package/src/ResponseActions/index.ts +1 -0
- package/src/ToolCall/ToolCall.scss +1 -1
- package/src/ToolCall/ToolCall.test.tsx +91 -0
- package/src/ToolCall/ToolCall.tsx +49 -4
- package/src/ToolResponse/ToolResponse.scss +13 -3
- package/src/ToolResponse/ToolResponse.test.tsx +119 -0
- package/src/ToolResponse/ToolResponse.tsx +82 -7
- package/src/index.ts +6 -0
- package/src/main.scss +2 -0
- package/tsconfig.json +1 -1
- package/patternfly-docs/content/extensions/chatbot/about-chatbot.md +0 -44
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
# Sidenav top-level section
|
|
3
3
|
# should be the same for all markdown files
|
|
4
|
-
section:
|
|
4
|
+
section: extensions
|
|
5
5
|
subsection: ChatBot
|
|
6
6
|
# Sidenav secondary level section
|
|
7
7
|
# should be the same for all markdown files
|
|
@@ -53,6 +53,7 @@ import FileDropZone from '@patternfly/chatbot/dist/dynamic/FileDropZone';
|
|
|
53
53
|
import { PreviewAttachment } from '@patternfly/chatbot/dist/dynamic/PreviewAttachment';
|
|
54
54
|
import ChatbotAlert from '@patternfly/chatbot/dist/dynamic/ChatbotAlert';
|
|
55
55
|
import TermsOfUse from '@patternfly/chatbot/dist/dynamic/TermsOfUse';
|
|
56
|
+
import Onboarding from '@patternfly/chatbot/dist/dynamic/Onboarding';
|
|
56
57
|
import {
|
|
57
58
|
ChatbotHeader,
|
|
58
59
|
ChatbotHeaderCloseButton,
|
|
@@ -69,11 +70,11 @@ import { MessageBar } from '@patternfly/chatbot/dist/dynamic/MessageBar';
|
|
|
69
70
|
import SourceDetailsMenuItem from '@patternfly/chatbot/dist/dynamic/SourceDetailsMenuItem';
|
|
70
71
|
import { ChatbotModal } from '@patternfly/chatbot/dist/dynamic/ChatbotModal';
|
|
71
72
|
import SettingsForm from '@patternfly/chatbot/dist/dynamic/Settings';
|
|
72
|
-
import { BellIcon, CalendarAltIcon, ClipboardIcon, CodeIcon, ThumbtackIcon, UploadIcon } from '@patternfly/react-icons';
|
|
73
|
+
import { BellIcon, CalendarAltIcon, ClipboardIcon, CodeIcon, PlusIcon, ThumbtackIcon, UploadIcon } from '@patternfly/react-icons';
|
|
73
74
|
import { useDropzone } from 'react-dropzone';
|
|
74
75
|
|
|
75
76
|
import ChatbotConversationHistoryNav from '@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav';
|
|
76
|
-
import { DropdownItem, DropdownList, Checkbox } from '@patternfly/react-core';
|
|
77
|
+
import { Button, Label, DropdownItem, DropdownList, Checkbox, MenuToggle, Select, SelectList, SelectOption } from '@patternfly/react-core';
|
|
77
78
|
|
|
78
79
|
import OutlinedWindowRestoreIcon from '@patternfly/react-icons/dist/esm/icons/outlined-window-restore-icon';
|
|
79
80
|
import ExpandIcon from '@patternfly/react-icons/dist/esm/icons/expand-icon';
|
|
@@ -85,7 +86,8 @@ import PFHorizontalLogoReverse from './PF-HorizontalLogo-Reverse.svg';
|
|
|
85
86
|
import userAvatar from '../Messages/user_avatar.svg';
|
|
86
87
|
import patternflyAvatar from '../Messages/patternfly_avatar.jpg';
|
|
87
88
|
import termsAndConditionsHeader from './PF-TermsAndConditionsHeader.svg';
|
|
88
|
-
import
|
|
89
|
+
import onboardingHeader from './RH-Hat-Image.svg';
|
|
90
|
+
import { CloseIcon, SearchIcon, OutlinedCommentsIcon, FilterIcon, SortAmountDownIcon } from '@patternfly/react-icons';
|
|
89
91
|
import { FunctionComponent, FormEvent, useState, useRef, MouseEvent, isValidElement, cloneElement, Children, ReactNode, Ref, MouseEvent as ReactMouseEvent, CSSProperties, useEffect} from 'react';
|
|
90
92
|
import FilePreview from '@patternfly/chatbot/dist/dynamic/FilePreview';
|
|
91
93
|
|
|
@@ -93,7 +95,7 @@ import FilePreview from '@patternfly/chatbot/dist/dynamic/FilePreview';
|
|
|
93
95
|
|
|
94
96
|
### Container
|
|
95
97
|
|
|
96
|
-
The PatternFly ChatBot is a separate window that overlays or is embedded within other UI content. This container can be shown and hidden via [the ChatBot toggle.](/
|
|
98
|
+
The PatternFly ChatBot is a separate window that overlays or is embedded within other UI content. This container can be shown and hidden via [the ChatBot toggle.](/extensions/chatbot/ui#toggle)
|
|
97
99
|
|
|
98
100
|
The `<Chatbot>` component is the container that encompasses the ChatBot experience. It adapts to various display modes (overlay/default, docked, fullscreen, and embedded) and supports both light and dark themes.
|
|
99
101
|
|
|
@@ -105,7 +107,7 @@ The "embedded" display mode is meant to be used within a [PatternFly page](/comp
|
|
|
105
107
|
|
|
106
108
|
### Content and message box
|
|
107
109
|
|
|
108
|
-
The `<ChatbotContent>` component is the container that is placed within the `<Chatbot>`, between the [`<ChatbotHeader>`](/
|
|
110
|
+
The `<ChatbotContent>` component is the container that is placed within the `<Chatbot>`, between the [`<ChatbotHeader>`](/extensions/chatbot/ui#header) and [`<ChatbotFooter>`.](/extensions/chatbot/ui#footer)
|
|
109
111
|
|
|
110
112
|
`<ChatbotContent>` usually contains a `<ChatbotMessageBox>` for displaying messages.
|
|
111
113
|
|
|
@@ -123,11 +125,11 @@ Your code structure should look like this:
|
|
|
123
125
|
</Chatbot>
|
|
124
126
|
```
|
|
125
127
|
|
|
126
|
-
**Note**: When messages update, it is important to announce new messages to users of assistive technology. To do this, make sure to set the `announcement` prop on `<MessageBox>` whenever you display a new message in `<MessageBox>`. You can view this in action in our [basic ChatBot](/
|
|
128
|
+
**Note**: When messages update, it is important to announce new messages to users of assistive technology. To do this, make sure to set the `announcement` prop on `<MessageBox>` whenever you display a new message in `<MessageBox>`. You can view this in action in our [basic ChatBot](/extensions/chatbot/overview/demo#basic-chatbot) and [embedded ChatBot](/extensions/chatbot/overview/demo#embedded-chatbot) demos.
|
|
127
129
|
|
|
128
130
|
### Welcome message
|
|
129
131
|
|
|
130
|
-
To introduce users to the ChatBot experience, display a welcome message before they input their first message. This brief message should follow our [conversation design guidelines](/
|
|
132
|
+
To introduce users to the ChatBot experience, display a welcome message before they input their first message. This brief message should follow our [conversation design guidelines](/ai/conversation-design) to welcome users to the ChatBot experience and encourage them to interact.
|
|
131
133
|
|
|
132
134
|
This message can be dismissed once a user sends their first message. To change the arrangement of the message within the message box, specify the `position` in the `<MessageBox>` component.
|
|
133
135
|
|
|
@@ -147,7 +149,7 @@ To provide users with a more specific direction, you can also include optional w
|
|
|
147
149
|
|
|
148
150
|
To provide page context, we recommend using a "Skip to chatbot" button. This allows you to skip past other content on the page, directly to the ChatBot content, using a [PatternFly skip to content component](/components/skip-to-content). To display this button, you must tab into the main window.
|
|
149
151
|
|
|
150
|
-
When using default or docked modes, we recommend putting focus on the toggle if the ChatBot is closed, and the ChatBot when it is open. For fullscreen and embedded, we recommend putting the focus on the first focusable item in the ChatBot, such as a menu toggle. This can be seen in our more fully-featured demos for the [default, embedded, and fullscreen ChatBot](/
|
|
152
|
+
When using default or docked modes, we recommend putting focus on the toggle if the ChatBot is closed, and the ChatBot when it is open. For fullscreen and embedded, we recommend putting the focus on the first focusable item in the ChatBot, such as a menu toggle. This can be seen in our more fully-featured demos for the [default, embedded, and fullscreen ChatBot](/extensions/chatbot/overview/demo#basic-chatbot) and the [embedded ChatBot](/extensions/chatbot/overview/demo#embedded-chatbot).
|
|
151
153
|
|
|
152
154
|
```js file="./SkipToContent.tsx" isFullscreen
|
|
153
155
|
|
|
@@ -226,7 +228,7 @@ There are a variety of options and customizations you can make to the header, to
|
|
|
226
228
|
In this example, select the respective checkbox to toggle these features:
|
|
227
229
|
|
|
228
230
|
- **Menu:** Users can select the menu toggle to open a menu of additional options or actions.
|
|
229
|
-
- **New chat button:** Used to start a new chat session. The header button can be used in addition to or in place of a new chat button within the [conversation history drawer](/
|
|
231
|
+
- **New chat button:** Used to start a new chat session. The header button can be used in addition to or in place of a new chat button within the [conversation history drawer](/extensions/chatbot/ui/#drawer-with-search-and-new-chat-button).
|
|
230
232
|
- **Left-aligned logo**
|
|
231
233
|
- **Centered logo**
|
|
232
234
|
- **Selector dropdown:** Users can choose from preselected options in a dropdown menu. For example, they can toggle between AI models.
|
|
@@ -283,12 +285,25 @@ To disable the send button in the following example, select the "Disable send bu
|
|
|
283
285
|
|
|
284
286
|
You can change the behavior of the attach button to open a menu, rather than the default file viewer for your operating system. This menu can display different actions related to attachments.
|
|
285
287
|
|
|
286
|
-
Attachments can also be added to the ChatBot via [drag and drop.](/
|
|
288
|
+
Attachments can also be added to the ChatBot via [drag and drop.](/extensions/chatbot/messages#attachment-dropzone)
|
|
287
289
|
|
|
288
290
|
```js file="./ChatbotMessageBarAttach.tsx"
|
|
289
291
|
|
|
290
292
|
```
|
|
291
293
|
|
|
294
|
+
### Message bar with custom attach menu and additional actions
|
|
295
|
+
|
|
296
|
+
You can move the attach button to the start of the message bar and customize it with a different icon. To include additional actions in the message bar you can also use the `additionalActions` prop.
|
|
297
|
+
|
|
298
|
+
This example shows two message bar variations:
|
|
299
|
+
|
|
300
|
+
1. A message bar with a custom attach menu where a `PlusIcon` is positioned at the start
|
|
301
|
+
2. The same custom attach menu with additional actions, including a model selector menu and a dismissable "Canvas" label
|
|
302
|
+
|
|
303
|
+
```js file="./ChatbotMessageBarCustomActions.tsx"
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
|
|
292
307
|
### Footer with message bar and footnote
|
|
293
308
|
|
|
294
309
|
A simple footer with a message bar and footnote would have this code structure:
|
|
@@ -314,6 +329,16 @@ To enable the stop button, set `hasStopButton` to `true` and pass in a `handleSt
|
|
|
314
329
|
|
|
315
330
|
```
|
|
316
331
|
|
|
332
|
+
### Message bar with AI indicator styles
|
|
333
|
+
|
|
334
|
+
To add a more pronounced AI indicator style to the message bar, pass `hasAiIndicator` to the `<MessageBar>` component. You can also enable a "thinking" animation by passing in `isThinking`.
|
|
335
|
+
|
|
336
|
+
This example shows a simplified method of handling the "thinking" animation: after a user sends a message, the `isThinking` property is set to `true` to trigger the animation, then returns to `false` after 10 seconds to halt the animation.
|
|
337
|
+
|
|
338
|
+
```ts file="./ChatbotMessageBarIndicatorThinking.tsx" isBeta
|
|
339
|
+
|
|
340
|
+
```
|
|
341
|
+
|
|
317
342
|
## Navigation
|
|
318
343
|
|
|
319
344
|
### Side nav in a drawer
|
|
@@ -342,7 +367,7 @@ The code structure will look like this:
|
|
|
342
367
|
</Chatbot>
|
|
343
368
|
```
|
|
344
369
|
|
|
345
|
-
The conversation history drawer looks different depending on the `displayMode` of the parent `<Chatbot>`. (As shown in the [main ChatBot demo](/
|
|
370
|
+
The conversation history drawer looks different depending on the `displayMode` of the parent `<Chatbot>`. (As shown in the [main ChatBot demo](/extensions/chatbot/overview/demo#basic-chatbot).):
|
|
346
371
|
|
|
347
372
|
- `Default` and `docked` display modes display the conversation history on top of the rest of the ChatBot content, with a PatternFly backdrop between the drawer panel and drawer content.
|
|
348
373
|
- `Fullscreen` and `embedded` display modes display the conversation history in line with the drawer content.
|
|
@@ -359,6 +384,16 @@ Both the search input field and "New chat" buttons are optional. The `reverseBut
|
|
|
359
384
|
|
|
360
385
|
```
|
|
361
386
|
|
|
387
|
+
### Drawer with search actions
|
|
388
|
+
|
|
389
|
+
You can customize the search experience within the conversation history drawer via the `searchActionStart` and `searchActionEnd` props, which provide additional search controls before and after the input field. These props are useful for adding filtering, sorting, or other search-related functionality.
|
|
390
|
+
|
|
391
|
+
You can also add a visual divider between the drawer head and the title by setting `hasDrawerHeadDivider` to `true`.
|
|
392
|
+
|
|
393
|
+
```ts file="./ChatbotHeaderDrawerWithSearchActions.tsx"
|
|
394
|
+
|
|
395
|
+
```
|
|
396
|
+
|
|
362
397
|
### Drawer with conversation actions
|
|
363
398
|
|
|
364
399
|
Actions can be added to conversations with `menuItems`. Optionally, you can also add a `className` to the menu via `menuClassName`, change the default aria-label and tooltip content via `label`, or add an `onSelect` callback for when a user selects an item.
|
|
@@ -414,24 +449,6 @@ The drawer can also be used to display a list of basic menu items.
|
|
|
414
449
|
|
|
415
450
|
```
|
|
416
451
|
|
|
417
|
-
### Terms of use
|
|
418
|
-
|
|
419
|
-
Based on the [PatternFly modal](/components/modal), this modal adapts to the ChatBot display mode and is meant to display terms and conditions for using a ChatBot in your project. The image in the header can be toggled on or off depending on whether the `image` and `altText` props are provided.
|
|
420
|
-
|
|
421
|
-
This example also includes an example of how to use [skip to content](/patternfly-ai/chatbot/ui#skip-to-content). When the terms of use modal is open, focus is placed on the terms of use container. When it is closed, focus is placed on the ChatBot. In a real example with a functioning ChatBot toggle, you would also want to place focus on the toggle when appropriate.
|
|
422
|
-
|
|
423
|
-
```js file="./TermsOfUse.tsx" isFullscreen
|
|
424
|
-
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
### Compact terms of use
|
|
428
|
-
|
|
429
|
-
To apply compact styling to the terms of use modal, pass `isCompact` to `<TermsOfUse>`. This will remove the header image and adjust the spacing of text, so that there is less white space in the modal.
|
|
430
|
-
|
|
431
|
-
```js file="./TermsOfUseCompact.tsx" isFullscreen
|
|
432
|
-
|
|
433
|
-
```
|
|
434
|
-
|
|
435
452
|
### Settings
|
|
436
453
|
|
|
437
454
|
To contain user preference controls and other ChatBot setting options, you can create a separate settings page that can accept any number of buttons, dropdown menus, toggles, labels, and so on. This settings page will render all components appropriately within all 4 display modes.
|
|
@@ -459,3 +476,37 @@ Based on the [PatternFly modal](/components/modal), this modal adapts to the Cha
|
|
|
459
476
|
```js file="./ChatbotModal.tsx" isFullscreen
|
|
460
477
|
|
|
461
478
|
```
|
|
479
|
+
|
|
480
|
+
### Onboarding
|
|
481
|
+
|
|
482
|
+
You can use the onboarding modal to introduce users to your ChatBot and provide necessary information. The title, image, and body text are customizable.
|
|
483
|
+
|
|
484
|
+
```js file="./Onboarding.tsx" isFullscreen
|
|
485
|
+
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
### Compact onboarding
|
|
489
|
+
|
|
490
|
+
To make the onboarding modal compact, with less spacing, pass `isCompact` to the `<Onboarding>` component.
|
|
491
|
+
|
|
492
|
+
```js file="./CompactOnboarding.tsx" isFullscreen
|
|
493
|
+
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
### Terms of use
|
|
497
|
+
|
|
498
|
+
Based on the [PatternFly modal](/components/modal), this modal adapts to the ChatBot display mode and is meant to display terms and conditions for using a ChatBot in your project. The image in the header can be toggled on or off depending on whether the `image` and `altText` props are provided.
|
|
499
|
+
|
|
500
|
+
This example also includes an example of how to use [skip to content](/extensions/chatbot/ui#skip-to-content). When the terms of use modal is open, focus is placed on the terms of use container. When it is closed, focus is placed on the ChatBot. In a real example with a functioning ChatBot toggle, you would also want to place focus on the toggle when appropriate.
|
|
501
|
+
|
|
502
|
+
```js file="./TermsOfUse.tsx" isFullscreen
|
|
503
|
+
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### Compact terms of use
|
|
507
|
+
|
|
508
|
+
To apply compact styling to the terms of use modal, pass `isCompact` to `<TermsOfUse>`. This will remove the header image and adjust the spacing of text, so that there is less white space in the modal.
|
|
509
|
+
|
|
510
|
+
```js file="./TermsOfUseCompact.tsx" isFullscreen
|
|
511
|
+
|
|
512
|
+
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
# Sidenav top-level section
|
|
3
3
|
# should be the same for all markdown files
|
|
4
|
-
section:
|
|
4
|
+
section: extensions
|
|
5
5
|
subsection: ChatBot
|
|
6
6
|
# Sidenav secondary level section
|
|
7
7
|
# should be the same for all markdown files
|
|
@@ -68,7 +68,7 @@ It is also important to announce when new content appears onscreen for accessibi
|
|
|
68
68
|
|
|
69
69
|
This demo shows auto-scrolling functionality, which automatically scrolls to the bottom of the active chat.
|
|
70
70
|
|
|
71
|
-
To enable auto-scroll behavior pass the `enableSmartScroll` prop to the [`<MessageBox>`](/
|
|
71
|
+
To enable auto-scroll behavior pass the `enableSmartScroll` prop to the [`<MessageBox>`](/extensions/chatbot/ui#message-box) component.
|
|
72
72
|
|
|
73
73
|
When enabled:
|
|
74
74
|
|
|
@@ -88,11 +88,11 @@ When using `ref`, the `<MessageBox>` component exposes the following methods:
|
|
|
88
88
|
|
|
89
89
|
This demo includes broader ChatBot features, including:
|
|
90
90
|
|
|
91
|
-
1. A [`<ChatbotToggle>`](/
|
|
92
|
-
2. A `<ChatbotContent>` and [`<MessageBox>`](/
|
|
91
|
+
1. A [`<ChatbotToggle>`](/extensions/chatbot/ui#toggle) that controls the [`<Chatbot>`](/extensions/chatbot/ui#container) container.
|
|
92
|
+
2. A `<ChatbotContent>` and [`<MessageBox>`](/extensions/chatbot/ui#content-and-message-box) with:
|
|
93
93
|
- A `<ChatbotWelcomePrompt>`
|
|
94
94
|
- An initial user message and initial bot message
|
|
95
|
-
3. A [`<ChatbotFooter>`](/
|
|
95
|
+
3. A [`<ChatbotFooter>`](/extensions/chatbot/ui#footer) with a [`<ChatbotFootnote>`](/extensions/chatbot/ui#footnote-with-popover) and a `<MessageBar>`
|
|
96
96
|
|
|
97
97
|
```js file="./ChatbotScrolling.tsx" isFullscreen
|
|
98
98
|
|
|
@@ -102,24 +102,24 @@ This demo includes broader ChatBot features, including:
|
|
|
102
102
|
|
|
103
103
|
This demo displays unique attachment features, including:
|
|
104
104
|
|
|
105
|
-
1. [`<ChatbotContent>` and `<MessageBox>`](/
|
|
106
|
-
- An initial [user `<Message>`](/
|
|
107
|
-
- The ability to preview or edit the attachment using the [`<PreviewAttachment>` and `<AttachmentEdit>` components.](/
|
|
105
|
+
1. [`<ChatbotContent>` and `<MessageBox>`](/extensions/chatbot/ui#content-and-message-box) components that contain:
|
|
106
|
+
- An initial [user `<Message>`](/extensions/chatbot/messages#user-messages) with an attachment.
|
|
107
|
+
- The ability to preview or edit the attachment using the [`<PreviewAttachment>` and `<AttachmentEdit>` components.](/extensions/chatbot/messages##file-attachments)
|
|
108
108
|
- A [PatternFly `<Alert>`](/components/alert), customized to be sticky within the ChatBot window, which provides success or error messages for attachments.
|
|
109
109
|
2. `<ChatbotContent>` and `<ChatbotFooter>`, wrapped in a `<FileDropZone>` component to support drag and drop attachments. The footer also:
|
|
110
|
-
- Displays attached files, using a [`<FileDetailsLabel>`](/
|
|
110
|
+
- Displays attached files, using a [`<FileDetailsLabel>`](/extensions/chatbot/messages#attachment-label) component.
|
|
111
111
|
- Demonstrates custom handling of file uploads, using the `handleAttach` in `<MessageBar>` and `handleFileDrop` in `<FileDropZone>`.
|
|
112
112
|
|
|
113
113
|
This demo includes broader ChatBot features, including:
|
|
114
114
|
|
|
115
|
-
1. A [`<ChatbotToggle>`](/
|
|
116
|
-
2. A [`<ChatbotHeader>`](/
|
|
115
|
+
1. A [`<ChatbotToggle>`](/extensions/chatbot/ui#toggle) that controls the [`<Chatbot>`](/extensions/chatbot/ui#container) container.
|
|
116
|
+
2. A [`<ChatbotHeader>`](/extensions/chatbot/ui#header) that updates based on the display mode, with sub-components (including a `<ChatbotHeaderTitle>`).
|
|
117
117
|
3. The ability to swap display modes via the `<ChatbotHeaderOptionsDropdown>`
|
|
118
|
-
4. A `<ChatbotContent>` and [`<MessageBox>`](/
|
|
118
|
+
4. A `<ChatbotContent>` and [`<MessageBox>`](/extensions/chatbot/uir#content-and-message-box) with:
|
|
119
119
|
- A `<ChatbotWelcomePrompt>`
|
|
120
120
|
- The ability to preview or edit the attachment.
|
|
121
121
|
- An initial bot message
|
|
122
|
-
5. A [`<ChatbotFooter>`](/
|
|
122
|
+
5. A [`<ChatbotFooter>`](/extensions/chatbot/ui#footer) with a [`<ChatbotFootnote>`](/extensions/chatbot/ui#footnote-with-popover) and a `<MessageBar>`
|
|
123
123
|
|
|
124
124
|
```js file="./ChatbotAttachment.tsx" isFullscreen
|
|
125
125
|
|
|
@@ -129,21 +129,21 @@ This demo includes broader ChatBot features, including:
|
|
|
129
129
|
|
|
130
130
|
This demo displays unique attachment features, including:
|
|
131
131
|
|
|
132
|
-
1. [`<ChatbotContent>` and `<MessageBox>`](/
|
|
132
|
+
1. [`<ChatbotContent>` and `<MessageBox>`](/extensions/chatbot/ui#content-and-message-box) components that contain:
|
|
133
133
|
- A PatternFly [`<Alert>`](/components/alert) to provide success or error messages for attachments.
|
|
134
134
|
2. `<ChatbotContent>` and `<ChatbotFooter>`, wrapped in a `<FileDropZone>` component to support drag and drop attachments. The footer also:
|
|
135
135
|
|
|
136
|
-
- Displays attached files, using a [`<FileDetailsLabel>`](/
|
|
136
|
+
- Displays attached files, using a [`<FileDetailsLabel>`](/extensions/chatbot/ui#attachment-label) component.
|
|
137
137
|
- Demonstrates custom handling of file uploads, using the `handleAttach` in `<MessageBar>` and `handleFileDrop` in `<FileDropZone>`.
|
|
138
138
|
- Demonstrates how to define the `attachMenuProps` in the `<MessageBar>` to create a menu that allows users to select the source of an item they're attaching.
|
|
139
139
|
|
|
140
140
|
This demo includes broader ChatBot features, including:
|
|
141
141
|
|
|
142
|
-
1. A [`<ChatbotToggle>`](/
|
|
143
|
-
2. A `<ChatbotContent>` and [`<MessageBox>`](/
|
|
142
|
+
1. A [`<ChatbotToggle>`](/extensions/chatbot/ui#toggle) that controls the [`<Chatbot>`](/extensions/chatbot/ui#container) container.
|
|
143
|
+
2. A `<ChatbotContent>` and [`<MessageBox>`](/extensions/chatbot/ui#content-and-message-box) with:
|
|
144
144
|
- A `<ChatbotWelcomePrompt>`
|
|
145
145
|
- An initial user message and initial bot message
|
|
146
|
-
3. A [`<ChatbotFooter>`](/
|
|
146
|
+
3. A [`<ChatbotFooter>`](/extensions/chatbot/ui#footer) with a [`<ChatbotFootnote>`](/extensions/chatbot/ui#footnote-with-popover) and a `<MessageBar>`
|
|
147
147
|
|
|
148
148
|
```js file="./ChatbotAttachmentMenu.tsx" isFullscreen
|
|
149
149
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
# Sidenav top-level section
|
|
3
3
|
# should be the same for all markdown files
|
|
4
|
-
section:
|
|
4
|
+
section: extensions
|
|
5
5
|
subsection: ChatBot
|
|
6
6
|
# Sidenav secondary level section
|
|
7
7
|
# should be the same for all markdown files
|
|
@@ -52,6 +52,20 @@ import ExpandIcon from '@patternfly/react-icons/dist/esm/icons/expand-icon';
|
|
|
52
52
|
import OpenDrawerRightIcon from '@patternfly/react-icons/dist/esm/icons/open-drawer-right-icon';
|
|
53
53
|
import OutlinedWindowRestoreIcon from '@patternfly/react-icons/dist/esm/icons/outlined-window-restore-icon';
|
|
54
54
|
import { BarsIcon } from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
55
|
+
import { CopyIcon } from '@patternfly/react-icons/dist/esm/icons/copy-icon';
|
|
56
|
+
import { WrenchIcon } from '@patternfly/react-icons/dist/esm/icons/wrench-icon';
|
|
57
|
+
import {
|
|
58
|
+
Button,
|
|
59
|
+
DescriptionList,
|
|
60
|
+
DescriptionListDescription,
|
|
61
|
+
DescriptionListGroup,
|
|
62
|
+
DescriptionListTerm,
|
|
63
|
+
ExpandableSection,
|
|
64
|
+
ExpandableSectionVariant,
|
|
65
|
+
Flex,
|
|
66
|
+
FlexItem,
|
|
67
|
+
Label
|
|
68
|
+
} from '@patternfly/react-core';
|
|
55
69
|
import PFHorizontalLogoColor from '../UI/PF-HorizontalLogo-Color.svg';
|
|
56
70
|
import PFHorizontalLogoReverse from '../UI/PF-HorizontalLogo-Reverse.svg';
|
|
57
71
|
import PFIconLogoColor from '../UI/PF-IconLogo-Color.svg';
|
|
@@ -59,31 +73,31 @@ import PFIconLogoReverse from '../UI/PF-IconLogo-Reverse.svg';
|
|
|
59
73
|
import userAvatar from '../Messages/user_avatar.svg';
|
|
60
74
|
import patternflyAvatar from '../Messages/patternfly_avatar.jpg';
|
|
61
75
|
import { getTrackingProviders } from "@patternfly/chatbot/dist/dynamic/tracking";
|
|
62
|
-
import { useEffect,useCallback, useRef, useState, FunctionComponent, MouseEvent } from 'react';
|
|
76
|
+
import { useEffect,useCallback, useRef, useState, FunctionComponent, MouseEvent, MouseEvent as ReactMouseEvent } from 'react';
|
|
63
77
|
import saveAs from 'file-saver';
|
|
64
78
|
|
|
65
79
|
### Basic ChatBot
|
|
66
80
|
|
|
67
81
|
This demo displays a basic ChatBot, which includes:
|
|
68
82
|
|
|
69
|
-
1. The [`<ChatbotToggle>`](/
|
|
70
|
-
2. A [`<ChatbotHeader>`](/
|
|
83
|
+
1. The [`<ChatbotToggle>`](/extensions/chatbot/ui#toggle) that controls the [`<Chatbot>` container.](/extensions/chatbot/ui#container)
|
|
84
|
+
2. A [`<ChatbotHeader>`](/extensions/chatbot/ui#header) with all built sub-components laid out, including a `<ChatbotHeaderTitle>` that changes its presentation depending on the display mode.
|
|
71
85
|
3. The ability to swap display modes via `<ChatbotHeaderOptionsDropdown>`
|
|
72
|
-
4. [`<ChatbotContent>` and `<MessageBox>`](/
|
|
86
|
+
4. [`<ChatbotContent>` and `<MessageBox>`](/extensions/chatbot/ui#content-and-message-box) with:
|
|
73
87
|
|
|
74
88
|
- A `<ChatbotWelcomePrompt>`
|
|
75
|
-
- An initial [user `<Message>`](/
|
|
89
|
+
- An initial [user `<Message>`](/extensions/chatbot/messages#user-messages) and an initial bot message with [message actions.](/extensions/chatbot/messages#message-actions)
|
|
76
90
|
- Logic for enabling auto-scrolling to the most recent message whenever a new message is sent or received using a `scrollToBottomRef`
|
|
77
91
|
|
|
78
|
-
5. A [`<ChatbotFooter>`](/
|
|
92
|
+
5. A [`<ChatbotFooter>`](/extensions/chatbot/ui#footer) with a [`<ChatbotFootNote>`](/extensions/chatbot/ui#footnote-with-popover) and a `<MessageBar>` that contains the abilities of:
|
|
79
93
|
|
|
80
|
-
- [Speech to text.](/
|
|
94
|
+
- [Speech to text.](/extensions/chatbot/ui#message-bar-with-speech-recognition-and-file-attachment)
|
|
81
95
|
- Sending a message to the ChatBot.
|
|
82
96
|
- Receiving a response from a backend AI tool with a loading message state.
|
|
83
97
|
|
|
84
|
-
6. A [`<ChatbotConversationHistoryNav>`](/
|
|
98
|
+
6. A [`<ChatbotConversationHistoryNav>`](/extensions/chatbot/ui#navigation) toggled open and closed by the `<ChatbotHeaderMenu`> in the `<ChatbotHeader>`.
|
|
85
99
|
|
|
86
|
-
7. A "Skip to chatbot" button that allows you to skip to the chatbot content via the [PatternFly skip to content component](/
|
|
100
|
+
7. A "Skip to chatbot" button that allows you to skip to the chatbot content via the [PatternFly skip to content component](/extensions/chatbot/ui#skip-to-content). To display this button you must tab into the main window.
|
|
87
101
|
|
|
88
102
|
```js file="./Chatbot.tsx" isFullscreen
|
|
89
103
|
|
|
@@ -102,17 +116,17 @@ This demo displays a basic compact ChatBot
|
|
|
102
116
|
This demo displays an embedded ChatBot. Embedded ChatBots are meant to be placed within a page in your product. This demo includes:
|
|
103
117
|
|
|
104
118
|
1. A [PatternFly page](/components/page) with a sidebar, "Skip to chatbot" button, and masthead. To display the "Skip to chatbot" button you must tab into the main window.
|
|
105
|
-
2. A [`<Chatbot>`](/
|
|
106
|
-
3. A [`<ChatbotHeader>`](/
|
|
107
|
-
4. [`<ChatbotContent>` and `<MessageBox>`](/
|
|
119
|
+
2. A [`<Chatbot>`](/extensions/chatbot/ui#container) container.
|
|
120
|
+
3. A [`<ChatbotHeader>`](/extensions/chatbot/ui#header) with all built sub-components laid out, including a `<ChatbotHeaderTitle>`
|
|
121
|
+
4. [`<ChatbotContent>` and `<MessageBox>`](/extensions/chatbot/ui#content-and-message-box) with:
|
|
108
122
|
- A `<ChatbotWelcomePrompt>`
|
|
109
|
-
- An initial [user `<Message>`](/
|
|
123
|
+
- An initial [user `<Message>`](/extensions/chatbot/messages#user-messages) and an initial bot message with [message actions.](/extensions/chatbot/messages/#message-actions)
|
|
110
124
|
- Logic for enabling auto-scrolling to the most recent message whenever a new message is sent or received using a `scrollToBottomRef`
|
|
111
|
-
5. A [`<ChatbotFooter>`](/
|
|
112
|
-
- [Speech to text.](/
|
|
125
|
+
5. A [`<ChatbotFooter>`](/extensions/chatbot/ui#footer) with a [`<ChatbotFootNote>`](/extensions/chatbot/ui#footnote-with-popover) and a `<MessageBar>` that contains the abilities of:
|
|
126
|
+
- [Speech to text.](/extensions/chatbot/ui#message-bar-with-speech-recognition-and-file-attachment)
|
|
113
127
|
- Sending a message to the ChatBot.
|
|
114
128
|
- Receiving a response from a backend AI tool with a loading message state.
|
|
115
|
-
6. A [`<ChatbotConversationHistoryNav>`](/
|
|
129
|
+
6. A [`<ChatbotConversationHistoryNav>`](/extensions/chatbot/ui#navigation) that can be toggled by the `<ChatbotHeaderMenu`> in the `<ChatbotHeader>`.
|
|
116
130
|
|
|
117
131
|
```js file="./EmbeddedChatbot.tsx" isFullscreen
|
|
118
132
|
|
|
@@ -133,7 +147,7 @@ This demo displays a ChatBot in a static, inline drawer. This demo includes:
|
|
|
133
147
|
|
|
134
148
|
### Primary color background
|
|
135
149
|
|
|
136
|
-
This demo displays an embedded ChatBot with a [primary background color](/design-foundations/colors#background-colors). This example includes the same features as the [Embedded ChatBot demo](/
|
|
150
|
+
This demo displays an embedded ChatBot with a [primary background color](/design-foundations/colors#background-colors). This example includes the same features as the [Embedded ChatBot demo](/extensions/chatbot/overview/demo/#embedded-chatbot)—the only differences are that the background color is adjusted via the `isPrimary` prop and some of the sample Messages have changed. You can use the same logic to adjust the background color in any ChatBot layout.
|
|
137
151
|
|
|
138
152
|
```js file="./WhiteEmbeddedChatbot.tsx" isFullscreen
|
|
139
153
|
|
|
@@ -143,7 +157,7 @@ This demo displays an embedded ChatBot with a [primary background color](/design
|
|
|
143
157
|
|
|
144
158
|
This demo showcases how the ChatBot can be rendered in different display modes to suit various application layouts. It demonstrates how to dynamically change the page structure in response to the user's selection. This demo includes:
|
|
145
159
|
|
|
146
|
-
1. The ability to switch between overlay, drawer, and fullscreen modes using the [`<ChatbotHeaderOptionsDropdown>`](/
|
|
160
|
+
1. The ability to switch between overlay, drawer, and fullscreen modes using the [`<ChatbotHeaderOptionsDropdown>`](/extensions/chatbot/ui#header-options) in the header.
|
|
147
161
|
2. A conditional page layout that renders the ChatBot for each display mode option:
|
|
148
162
|
- **Overlay:** As a floating window on top of the page content.
|
|
149
163
|
- **Drawer:** Inside an inline PatternFly `<Drawer>` as a side panel.
|
|
@@ -8,7 +8,7 @@ module.exports = (sourceMD, sourceProps) => {
|
|
|
8
8
|
|
|
9
9
|
// Parse md files
|
|
10
10
|
const contentBase = path.join(__dirname, './content');
|
|
11
|
-
sourceMD(path.join(contentBase, 'extensions/**/*.md'), '
|
|
11
|
+
sourceMD(path.join(contentBase, 'extensions/**/*.md'), 'Extensions');
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
If you want to parse content from node_modules instead of providing a relative/absolute path,
|
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
border-radius: var(--pf-t--global--border--radius--medium);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
.pf-chatbot__heading-divider {
|
|
11
|
+
padding-inline-start: var(--pf-t--global--spacer--lg);
|
|
12
|
+
padding-inline-end: var(--pf-t--global--spacer--lg);
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
// Drawer title
|
|
11
16
|
// ----------------------------------------------------------------------------
|
|
12
17
|
.pf-chatbot__heading-container {
|
|
@@ -28,11 +33,26 @@
|
|
|
28
33
|
justify-content: flex-start;
|
|
29
34
|
gap: var(--pf-t--global--spacer--gap--text-to-element--default);
|
|
30
35
|
}
|
|
36
|
+
|
|
37
|
+
// Drawer search and actions
|
|
38
|
+
.pf-chatbot__history-search-actions {
|
|
39
|
+
.pf-v6-c-button.pf-m-control {
|
|
40
|
+
--pf-v6-c-button--m-control--PaddingInlineStart: var(--pf-t--global--spacer--control--horizontal--compact);
|
|
41
|
+
--pf-v6-c-button--m-control--PaddingInlineEnd: var(--pf-t--global--spacer--control--horizontal--compact);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.pf-chatbot__input {
|
|
46
|
+
width: 100%;
|
|
47
|
+
}
|
|
48
|
+
|
|
31
49
|
// Drawer menu
|
|
32
50
|
// ----------------------------------------------------------------------------
|
|
33
51
|
.pf-v6-c-menu {
|
|
34
52
|
--pf-v6-c-menu--PaddingBlockStart: 0;
|
|
35
53
|
--pf-v6-c-menu--BackgroundColor: var(--pf-t--global--background--color--floating--default);
|
|
54
|
+
// override high contrast style
|
|
55
|
+
--pf-v6-c-menu--BorderWidth: 0;
|
|
36
56
|
overflow: initial;
|
|
37
57
|
position: relative;
|
|
38
58
|
}
|
|
@@ -56,6 +76,8 @@
|
|
|
56
76
|
.pf-chatbot__menu-item {
|
|
57
77
|
--pf-v6-c-menu__item--PaddingInlineStart: var(--pf-t--global--spacer--sm);
|
|
58
78
|
--pf-v6-c-menu__item--PaddingInlineEnd: var(--pf-t--global--spacer--sm);
|
|
79
|
+
// override high contrast style
|
|
80
|
+
--pf-v6-c-menu__list-item--BorderWidth: 0;
|
|
59
81
|
padding-block-start: var(--pf-t--global--spacer--xs);
|
|
60
82
|
padding-block-end: var(--pf-t--global--spacer--xs);
|
|
61
83
|
color: var(--pf-t--global--text--color--regular);
|
|
@@ -63,6 +85,17 @@
|
|
|
63
85
|
font-weight: var(--pf-t--global--font--weight--body--default);
|
|
64
86
|
border-radius: var(--pf-t--global--border--radius--small);
|
|
65
87
|
}
|
|
88
|
+
|
|
89
|
+
li.pf-chatbot__menu-item:hover::after {
|
|
90
|
+
position: absolute;
|
|
91
|
+
inset: 0;
|
|
92
|
+
pointer-events: none;
|
|
93
|
+
content: '';
|
|
94
|
+
border: var(--pf-t--global--border--width--action--plain--hover) solid
|
|
95
|
+
var(--pf-t--global--border--color--high-contrast);
|
|
96
|
+
border-radius: inherit;
|
|
97
|
+
}
|
|
98
|
+
|
|
66
99
|
// allows focus state to have border radius
|
|
67
100
|
.pf-v6-c-menu__list-item.pf-chatbot__menu-item {
|
|
68
101
|
overflow: hidden;
|
|
@@ -76,6 +109,16 @@
|
|
|
76
109
|
background-color: var(--pf-t--global--background--color--action--plain--clicked);
|
|
77
110
|
}
|
|
78
111
|
|
|
112
|
+
li.pf-chatbot__menu-item--active::after {
|
|
113
|
+
position: absolute;
|
|
114
|
+
inset: 0;
|
|
115
|
+
pointer-events: none;
|
|
116
|
+
content: '';
|
|
117
|
+
border: var(--pf-t--global--border--width--action--plain--clicked) solid
|
|
118
|
+
var(--pf-t--global--border--color--high-contrast);
|
|
119
|
+
border-radius: inherit;
|
|
120
|
+
}
|
|
121
|
+
|
|
79
122
|
button.pf-chatbot__menu-item--active {
|
|
80
123
|
background-color: initial;
|
|
81
124
|
}
|
|
@@ -592,6 +592,101 @@ describe('ChatbotConversationHistoryNav', () => {
|
|
|
592
592
|
expect(screen.getByRole('dialog', { name: /Chat history I am a sample search/i })).toBeInTheDocument();
|
|
593
593
|
});
|
|
594
594
|
|
|
595
|
+
it('Does not render search actions by default', () => {
|
|
596
|
+
const handleSearch = jest.fn();
|
|
597
|
+
const groupedConversations: { [key: string]: Conversation[] } = {
|
|
598
|
+
Today: [...initialConversations, { id: '2', text: 'Chatbot extension' }]
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
render(
|
|
602
|
+
<ChatbotConversationHistoryNav
|
|
603
|
+
onDrawerToggle={onDrawerToggle}
|
|
604
|
+
isDrawerOpen={true}
|
|
605
|
+
displayMode={ChatbotDisplayMode.fullscreen}
|
|
606
|
+
setIsDrawerOpen={jest.fn()}
|
|
607
|
+
reverseButtonOrder={false}
|
|
608
|
+
conversations={groupedConversations}
|
|
609
|
+
handleTextInputChange={handleSearch}
|
|
610
|
+
/>
|
|
611
|
+
);
|
|
612
|
+
|
|
613
|
+
const searchInput = screen.getByPlaceholderText(/Search/i);
|
|
614
|
+
|
|
615
|
+
expect(searchInput.parentElement?.previousElementSibling).toBeNull();
|
|
616
|
+
expect(searchInput.parentElement?.nextElementSibling).toBeNull();
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
it('Renders with action at start when searchActionStart is passed', () => {
|
|
620
|
+
const handleSearch = jest.fn();
|
|
621
|
+
const groupedConversations: { [key: string]: Conversation[] } = {
|
|
622
|
+
Today: [...initialConversations, { id: '2', text: 'Chatbot extension' }]
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
render(
|
|
626
|
+
<ChatbotConversationHistoryNav
|
|
627
|
+
onDrawerToggle={onDrawerToggle}
|
|
628
|
+
isDrawerOpen={true}
|
|
629
|
+
displayMode={ChatbotDisplayMode.fullscreen}
|
|
630
|
+
setIsDrawerOpen={jest.fn()}
|
|
631
|
+
reverseButtonOrder={false}
|
|
632
|
+
conversations={groupedConversations}
|
|
633
|
+
handleTextInputChange={handleSearch}
|
|
634
|
+
searchActionStart={<div>Search action start test</div>}
|
|
635
|
+
/>
|
|
636
|
+
);
|
|
637
|
+
|
|
638
|
+
expect(screen.getByText('Search action start test')).toBeVisible();
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
it('Renders with action at end when searchActionEnd is passed', () => {
|
|
642
|
+
const handleSearch = jest.fn();
|
|
643
|
+
const groupedConversations: { [key: string]: Conversation[] } = {
|
|
644
|
+
Today: [...initialConversations, { id: '2', text: 'Chatbot extension' }]
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
render(
|
|
648
|
+
<ChatbotConversationHistoryNav
|
|
649
|
+
onDrawerToggle={onDrawerToggle}
|
|
650
|
+
isDrawerOpen={true}
|
|
651
|
+
displayMode={ChatbotDisplayMode.fullscreen}
|
|
652
|
+
setIsDrawerOpen={jest.fn()}
|
|
653
|
+
reverseButtonOrder={false}
|
|
654
|
+
handleTextInputChange={handleSearch}
|
|
655
|
+
conversations={groupedConversations}
|
|
656
|
+
searchActionEnd={<div>Search action end test</div>}
|
|
657
|
+
/>
|
|
658
|
+
);
|
|
659
|
+
|
|
660
|
+
expect(screen.getByText('Search action end test')).toBeVisible();
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
it('Overrides default search input and actions when searchToolbar is passed', () => {
|
|
664
|
+
const handleSearch = jest.fn();
|
|
665
|
+
const groupedConversations: { [key: string]: Conversation[] } = {
|
|
666
|
+
Today: [...initialConversations, { id: '2', text: 'Chatbot extension' }]
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
render(
|
|
670
|
+
<ChatbotConversationHistoryNav
|
|
671
|
+
onDrawerToggle={onDrawerToggle}
|
|
672
|
+
isDrawerOpen={true}
|
|
673
|
+
displayMode={ChatbotDisplayMode.fullscreen}
|
|
674
|
+
setIsDrawerOpen={jest.fn()}
|
|
675
|
+
reverseButtonOrder={false}
|
|
676
|
+
conversations={groupedConversations}
|
|
677
|
+
handleTextInputChange={handleSearch}
|
|
678
|
+
searchActionStart={<div>Search action start test</div>}
|
|
679
|
+
searchActionEnd={<div>Search action end test</div>}
|
|
680
|
+
searchToolbar={<div>Custom toolbar</div>}
|
|
681
|
+
/>
|
|
682
|
+
);
|
|
683
|
+
|
|
684
|
+
expect(screen.queryByPlaceholderText(/Search/i)).not.toBeInTheDocument();
|
|
685
|
+
expect(screen.queryByText('Search action start test')).not.toBeInTheDocument();
|
|
686
|
+
expect(screen.queryByText('Search action end test')).not.toBeInTheDocument();
|
|
687
|
+
expect(screen.getByText('Custom toolbar')).toBeInTheDocument();
|
|
688
|
+
});
|
|
689
|
+
|
|
595
690
|
it('overrides nav title heading level when navTitleProps.headingLevel is passed', () => {
|
|
596
691
|
render(
|
|
597
692
|
<ChatbotConversationHistoryNav
|