@swisper.ai/web-chat-ui 0.0.2
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/LICENSE +202 -0
- package/README.md +251 -0
- package/dist/components/canvas-shell/canvas-shell.d.ts +64 -0
- package/dist/components/canvas-shell/canvas-shell.d.ts.map +1 -0
- package/dist/components/canvas-shell/canvas-shell.stories.d.ts +26 -0
- package/dist/components/canvas-shell/canvas-shell.stories.d.ts.map +1 -0
- package/dist/components/canvas-shell/index.d.ts +2 -0
- package/dist/components/canvas-shell/index.d.ts.map +1 -0
- package/dist/components/card-item-picker/card-item-picker-context.d.ts +21 -0
- package/dist/components/card-item-picker/card-item-picker-context.d.ts.map +1 -0
- package/dist/components/card-item-picker/card-item-picker-list.d.ts +24 -0
- package/dist/components/card-item-picker/card-item-picker-list.d.ts.map +1 -0
- package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts +28 -0
- package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts.map +1 -0
- package/dist/components/card-item-picker/card-item-picker-row.d.ts +12 -0
- package/dist/components/card-item-picker/card-item-picker-row.d.ts.map +1 -0
- package/dist/components/card-item-picker/card-item-picker.stories.d.ts +19 -0
- package/dist/components/card-item-picker/card-item-picker.stories.d.ts.map +1 -0
- package/dist/components/card-item-picker/index.d.ts +9 -0
- package/dist/components/card-item-picker/index.d.ts.map +1 -0
- package/dist/components/chat-card/chat-card.d.ts +4 -0
- package/dist/components/chat-card/chat-card.d.ts.map +1 -0
- package/dist/components/chat-card/chat-card.stories.d.ts +11 -0
- package/dist/components/chat-card/chat-card.stories.d.ts.map +1 -0
- package/dist/components/chat-card/components/chat-card-body.d.ts +22 -0
- package/dist/components/chat-card/components/chat-card-body.d.ts.map +1 -0
- package/dist/components/chat-card/components/chat-card-footer.d.ts +20 -0
- package/dist/components/chat-card/components/chat-card-footer.d.ts.map +1 -0
- package/dist/components/chat-card/components/chat-card-form.d.ts +28 -0
- package/dist/components/chat-card/components/chat-card-form.d.ts.map +1 -0
- package/dist/components/chat-card/components/chat-card-header.d.ts +36 -0
- package/dist/components/chat-card/components/chat-card-header.d.ts.map +1 -0
- package/dist/components/chat-card/components/index.d.ts +5 -0
- package/dist/components/chat-card/components/index.d.ts.map +1 -0
- package/dist/components/chat-card/context.d.ts +13 -0
- package/dist/components/chat-card/context.d.ts.map +1 -0
- package/dist/components/chat-card/contexts.d.ts +16 -0
- package/dist/components/chat-card/contexts.d.ts.map +1 -0
- package/dist/components/chat-card/hooks.d.ts +13 -0
- package/dist/components/chat-card/hooks.d.ts.map +1 -0
- package/dist/components/chat-card/index.d.ts +6 -0
- package/dist/components/chat-card/index.d.ts.map +1 -0
- package/dist/components/chat-card/types.d.ts +21 -0
- package/dist/components/chat-card/types.d.ts.map +1 -0
- package/dist/components/chat-card-container/chat-card-container.d.ts +43 -0
- package/dist/components/chat-card-container/chat-card-container.d.ts.map +1 -0
- package/dist/components/chat-card-container/chat-card-container.stories.d.ts +17 -0
- package/dist/components/chat-card-container/chat-card-container.stories.d.ts.map +1 -0
- package/dist/components/chat-card-container/index.d.ts +3 -0
- package/dist/components/chat-card-container/index.d.ts.map +1 -0
- package/dist/components/chat-container/chat-container.d.ts +51 -0
- package/dist/components/chat-container/chat-container.d.ts.map +1 -0
- package/dist/components/chat-container/chat-container.stories.d.ts +21 -0
- package/dist/components/chat-container/chat-container.stories.d.ts.map +1 -0
- package/dist/components/chat-container/index.d.ts +3 -0
- package/dist/components/chat-container/index.d.ts.map +1 -0
- package/dist/components/chat-input/chat-input.d.ts +35 -0
- package/dist/components/chat-input/chat-input.d.ts.map +1 -0
- package/dist/components/chat-input/chat-input.stories.d.ts +14 -0
- package/dist/components/chat-input/chat-input.stories.d.ts.map +1 -0
- package/dist/components/chat-input/index.d.ts +3 -0
- package/dist/components/chat-input/index.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/auto-focus-plugin.d.ts +8 -0
- package/dist/components/chat-input/plugins/auto-focus-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/controlled-value-plugin.d.ts +6 -0
- package/dist/components/chat-input/plugins/controlled-value-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/disabled-plugin.d.ts +7 -0
- package/dist/components/chat-input/plugins/disabled-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/focus-plugin.d.ts +6 -0
- package/dist/components/chat-input/plugins/focus-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/has-value-plugin.d.ts +6 -0
- package/dist/components/chat-input/plugins/has-value-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/hooks.d.ts +2 -0
- package/dist/components/chat-input/plugins/hooks.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/index.d.ts +8 -0
- package/dist/components/chat-input/plugins/index.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/markdown-plain-paste-plugin.d.ts +2 -0
- package/dist/components/chat-input/plugins/markdown-plain-paste-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/utils.d.ts +4 -0
- package/dist/components/chat-input/plugins/utils.d.ts.map +1 -0
- package/dist/components/chat-input/plugins/value-plugin.d.ts +6 -0
- package/dist/components/chat-input/plugins/value-plugin.d.ts.map +1 -0
- package/dist/components/chat-input/transformers.d.ts +3 -0
- package/dist/components/chat-input/transformers.d.ts.map +1 -0
- package/dist/components/chat-list/chat-list-item.d.ts +8 -0
- package/dist/components/chat-list/chat-list-item.d.ts.map +1 -0
- package/dist/components/chat-list/chat-list-items.d.ts +11 -0
- package/dist/components/chat-list/chat-list-items.d.ts.map +1 -0
- package/dist/components/chat-list/chat-list.d.ts +63 -0
- package/dist/components/chat-list/chat-list.d.ts.map +1 -0
- package/dist/components/chat-list/chat-list.stories.d.ts +13 -0
- package/dist/components/chat-list/chat-list.stories.d.ts.map +1 -0
- package/dist/components/chat-list/index.d.ts +4 -0
- package/dist/components/chat-list/index.d.ts.map +1 -0
- package/dist/components/chat-message/chat-message.d.ts +17 -0
- package/dist/components/chat-message/chat-message.d.ts.map +1 -0
- package/dist/components/chat-message/chat-message.stories.d.ts +11 -0
- package/dist/components/chat-message/chat-message.stories.d.ts.map +1 -0
- package/dist/components/chat-message/index.d.ts +2 -0
- package/dist/components/chat-message/index.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts +9 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts +30 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts +11 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/index.d.ts +4 -0
- package/dist/components/chat-message-attachment-card/index.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/utils.d.ts +5 -0
- package/dist/components/chat-message-attachment-card/utils.d.ts.map +1 -0
- package/dist/components/chat-message-history/chat-message-history.d.ts +48 -0
- package/dist/components/chat-message-history/chat-message-history.d.ts.map +1 -0
- package/dist/components/chat-message-history/chat-message-history.stories.d.ts +7 -0
- package/dist/components/chat-message-history/chat-message-history.stories.d.ts.map +1 -0
- package/dist/components/chat-message-history/index.d.ts +2 -0
- package/dist/components/chat-message-history/index.d.ts.map +1 -0
- package/dist/components/chat-message-response/chat-message-response.d.ts +7 -0
- package/dist/components/chat-message-response/chat-message-response.d.ts.map +1 -0
- package/dist/components/chat-message-response/chat-message-response.stories.d.ts +7 -0
- package/dist/components/chat-message-response/chat-message-response.stories.d.ts.map +1 -0
- package/dist/components/chat-message-response/index.d.ts +2 -0
- package/dist/components/chat-message-response/index.d.ts.map +1 -0
- package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts +25 -0
- package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts.map +1 -0
- package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts +7 -0
- package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts.map +1 -0
- package/dist/components/chat-message-toolbar/index.d.ts +2 -0
- package/dist/components/chat-message-toolbar/index.d.ts.map +1 -0
- package/dist/components/chat-messages/chat-messages.d.ts +24 -0
- package/dist/components/chat-messages/chat-messages.d.ts.map +1 -0
- package/dist/components/chat-messages/chat-messages.stories.d.ts +8 -0
- package/dist/components/chat-messages/chat-messages.stories.d.ts.map +1 -0
- package/dist/components/chat-messages/index.d.ts +2 -0
- package/dist/components/chat-messages/index.d.ts.map +1 -0
- package/dist/components/chat-notification-card/chat-notification-card.d.ts +114 -0
- package/dist/components/chat-notification-card/chat-notification-card.d.ts.map +1 -0
- package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts +10 -0
- package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts.map +1 -0
- package/dist/components/chat-notification-card/index.d.ts +4 -0
- package/dist/components/chat-notification-card/index.d.ts.map +1 -0
- package/dist/components/chat-notification-card/types.d.ts +2 -0
- package/dist/components/chat-notification-card/types.d.ts.map +1 -0
- package/dist/components/chat-notification-card/utils.d.ts +3 -0
- package/dist/components/chat-notification-card/utils.d.ts.map +1 -0
- package/dist/components/chat-notification-popup/chat-notification-popup.d.ts +12 -0
- package/dist/components/chat-notification-popup/chat-notification-popup.d.ts.map +1 -0
- package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts +8 -0
- package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts.map +1 -0
- package/dist/components/chat-notification-popup/index.d.ts +2 -0
- package/dist/components/chat-notification-popup/index.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-context.d.ts +17 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-context.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-focus-plugin.d.ts +2 -0
- package/dist/components/chat-prompt-box/chat-prompt-box-focus-plugin.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/chat-prompt-box.d.ts +27 -0
- package/dist/components/chat-prompt-box/chat-prompt-box.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts +9 -0
- package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts.map +1 -0
- package/dist/components/chat-prompt-box/index.d.ts +3 -0
- package/dist/components/chat-prompt-box/index.d.ts.map +1 -0
- package/dist/components/chat-reply/chat-reply.d.ts +23 -0
- package/dist/components/chat-reply/chat-reply.d.ts.map +1 -0
- package/dist/components/chat-reply/chat-reply.stories.d.ts +7 -0
- package/dist/components/chat-reply/chat-reply.stories.d.ts.map +1 -0
- package/dist/components/chat-reply/index.d.ts +2 -0
- package/dist/components/chat-reply/index.d.ts.map +1 -0
- package/dist/components/chat-suggestion/chat-suggestion.d.ts +37 -0
- package/dist/components/chat-suggestion/chat-suggestion.d.ts.map +1 -0
- package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts +9 -0
- package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts.map +1 -0
- package/dist/components/chat-suggestion/index.d.ts +2 -0
- package/dist/components/chat-suggestion/index.d.ts.map +1 -0
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts +47 -0
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts.map +1 -0
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts +10 -0
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts.map +1 -0
- package/dist/components/chat-thinking-process/index.d.ts +2 -0
- package/dist/components/chat-thinking-process/index.d.ts.map +1 -0
- package/dist/components/chat-thread/chat-thread.d.ts +78 -0
- package/dist/components/chat-thread/chat-thread.d.ts.map +1 -0
- package/dist/components/chat-thread/chat-thread.stories.d.ts +14 -0
- package/dist/components/chat-thread/chat-thread.stories.d.ts.map +1 -0
- package/dist/components/chat-thread/index.d.ts +2 -0
- package/dist/components/chat-thread/index.d.ts.map +1 -0
- package/dist/components/deprecated-empty-state.d.ts +22 -0
- package/dist/components/deprecated-empty-state.d.ts.map +1 -0
- package/dist/components/index.d.ts +27 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/markdown-viewer/hooks.d.ts +9 -0
- package/dist/components/markdown-viewer/hooks.d.ts.map +1 -0
- package/dist/components/markdown-viewer/index.d.ts +3 -0
- package/dist/components/markdown-viewer/index.d.ts.map +1 -0
- package/dist/components/markdown-viewer/markdown-viewer.d.ts +10 -0
- package/dist/components/markdown-viewer/markdown-viewer.d.ts.map +1 -0
- package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts +9 -0
- package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts.map +1 -0
- package/dist/components/markdown-viewer/types.d.ts +9 -0
- package/dist/components/markdown-viewer/types.d.ts.map +1 -0
- package/dist/components/markdown-viewer/utils.d.ts +3 -0
- package/dist/components/markdown-viewer/utils.d.ts.map +1 -0
- package/dist/components/new-chat-trigger/index.d.ts +2 -0
- package/dist/components/new-chat-trigger/index.d.ts.map +1 -0
- package/dist/components/new-chat-trigger/new-chat-trigger.d.ts +8 -0
- package/dist/components/new-chat-trigger/new-chat-trigger.d.ts.map +1 -0
- package/dist/components/rich-text-area/constants/index.d.ts +3 -0
- package/dist/components/rich-text-area/constants/index.d.ts.map +1 -0
- package/dist/components/rich-text-area/hooks.d.ts +3 -0
- package/dist/components/rich-text-area/hooks.d.ts.map +1 -0
- package/dist/components/rich-text-area/html-config.d.ts +4 -0
- package/dist/components/rich-text-area/html-config.d.ts.map +1 -0
- package/dist/components/rich-text-area/index.d.ts +7 -0
- package/dist/components/rich-text-area/index.d.ts.map +1 -0
- package/dist/components/rich-text-area/nodes/div-block-node.d.ts +18 -0
- package/dist/components/rich-text-area/nodes/div-block-node.d.ts.map +1 -0
- package/dist/components/rich-text-area/nodes/image-node.d.ts +24 -0
- package/dist/components/rich-text-area/nodes/image-node.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/blur-plugin.d.ts +6 -0
- package/dist/components/rich-text-area/plugins/blur-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/controlled-plugin.d.ts +7 -0
- package/dist/components/rich-text-area/plugins/controlled-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/controlled-value-plugin.d.ts +7 -0
- package/dist/components/rich-text-area/plugins/controlled-value-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/disabled-plugin.d.ts +6 -0
- package/dist/components/rich-text-area/plugins/disabled-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/file-attachment-plugin.d.ts +10 -0
- package/dist/components/rich-text-area/plugins/file-attachment-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/focus-plugin.d.ts +6 -0
- package/dist/components/rich-text-area/plugins/focus-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/html-paste-plugin.d.ts +19 -0
- package/dist/components/rich-text-area/plugins/html-paste-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/image-drop-plugin.d.ts +12 -0
- package/dist/components/rich-text-area/plugins/image-drop-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/index.d.ts +11 -0
- package/dist/components/rich-text-area/plugins/index.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/markdown-plain-paste-plugin.d.ts +2 -0
- package/dist/components/rich-text-area/plugins/markdown-plain-paste-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/plugins/value-plugin.d.ts +7 -0
- package/dist/components/rich-text-area/plugins/value-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-area/rich-text-area.d.ts +20 -0
- package/dist/components/rich-text-area/rich-text-area.d.ts.map +1 -0
- package/dist/components/rich-text-area/rich-text-area.stories.d.ts +7 -0
- package/dist/components/rich-text-area/rich-text-area.stories.d.ts.map +1 -0
- package/dist/components/rich-text-area/styled.d.ts +3 -0
- package/dist/components/rich-text-area/styled.d.ts.map +1 -0
- package/dist/components/rich-text-area/transformers.d.ts +16 -0
- package/dist/components/rich-text-area/transformers.d.ts.map +1 -0
- package/dist/components/rich-text-area/types.d.ts +8 -0
- package/dist/components/rich-text-area/types.d.ts.map +1 -0
- package/dist/components/rich-text-area/utils/index.d.ts +6 -0
- package/dist/components/rich-text-area/utils/index.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/alignment-select.d.ts +5 -0
- package/dist/components/rich-text-field/components/alignment-select.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/attachment-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/attachment-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/bold-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/bold-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/clean-format-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/clean-format-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts +11 -0
- package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/image-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/image-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/index.d.ts +14 -0
- package/dist/components/rich-text-field/components/index.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/italic-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/italic-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/link-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/link-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/size-select.d.ts +5 -0
- package/dist/components/rich-text-field/components/size-select.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/text-color-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/text-color-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/toolbar-button.d.ts +6 -0
- package/dist/components/rich-text-field/components/toolbar-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/toolbar-select.d.ts +5 -0
- package/dist/components/rich-text-field/components/toolbar-select.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/typography-select.d.ts +5 -0
- package/dist/components/rich-text-field/components/typography-select.d.ts.map +1 -0
- package/dist/components/rich-text-field/components/underline-button.d.ts +3 -0
- package/dist/components/rich-text-field/components/underline-button.d.ts.map +1 -0
- package/dist/components/rich-text-field/constants.d.ts +57 -0
- package/dist/components/rich-text-field/constants.d.ts.map +1 -0
- package/dist/components/rich-text-field/context.d.ts +26 -0
- package/dist/components/rich-text-field/context.d.ts.map +1 -0
- package/dist/components/rich-text-field/index.d.ts +3 -0
- package/dist/components/rich-text-field/index.d.ts.map +1 -0
- package/dist/components/rich-text-field/rich-text-field.d.ts +17 -0
- package/dist/components/rich-text-field/rich-text-field.d.ts.map +1 -0
- package/dist/components/rich-text-field/rich-text-field.stories.d.ts +10 -0
- package/dist/components/rich-text-field/rich-text-field.stories.d.ts.map +1 -0
- package/dist/components/rich-text-field/utils.d.ts +1759 -0
- package/dist/components/rich-text-field/utils.d.ts.map +1 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.d.ts.map +1 -0
- package/dist/components/spinner/spinner.d.ts +9 -0
- package/dist/components/spinner/spinner.d.ts.map +1 -0
- package/dist/components/spinner/spinner.stories.d.ts +8 -0
- package/dist/components/spinner/spinner.stories.d.ts.map +1 -0
- package/dist/contexts/chat-context/chat-context.d.ts +20 -0
- package/dist/contexts/chat-context/chat-context.d.ts.map +1 -0
- package/dist/contexts/chat-context/index.d.ts +2 -0
- package/dist/contexts/chat-context/index.d.ts.map +1 -0
- package/dist/contexts/chat-context/utils.d.ts +3 -0
- package/dist/contexts/chat-context/utils.d.ts.map +1 -0
- package/dist/contexts/chat-conversation-context/chat-conversation-context.d.ts +20 -0
- package/dist/contexts/chat-conversation-context/chat-conversation-context.d.ts.map +1 -0
- package/dist/contexts/chat-conversation-context/index.d.ts +2 -0
- package/dist/contexts/chat-conversation-context/index.d.ts.map +1 -0
- package/dist/contexts/index.d.ts +3 -0
- package/dist/contexts/index.d.ts.map +1 -0
- package/dist/docs/agent.stories.d.ts +41 -0
- package/dist/docs/agent.stories.d.ts.map +1 -0
- package/dist/docs/chat-panel.d.ts +33 -0
- package/dist/docs/chat-panel.d.ts.map +1 -0
- package/dist/docs/chatbot-panel.d.ts +20 -0
- package/dist/docs/chatbot-panel.d.ts.map +1 -0
- package/dist/docs/chatbot.stories.d.ts +11 -0
- package/dist/docs/chatbot.stories.d.ts.map +1 -0
- package/dist/domain/actions/constants.d.ts +2 -0
- package/dist/domain/actions/constants.d.ts.map +1 -0
- package/dist/domain/actions/hooks/index.d.ts +3 -0
- package/dist/domain/actions/hooks/index.d.ts.map +1 -0
- package/dist/domain/actions/index.d.ts +5 -0
- package/dist/domain/actions/index.d.ts.map +1 -0
- package/dist/domain/actions/types.d.ts +7 -0
- package/dist/domain/actions/types.d.ts.map +1 -0
- package/dist/domain/actions/utils/index.d.ts +11 -0
- package/dist/domain/actions/utils/index.d.ts.map +1 -0
- package/dist/domain/index.d.ts +2 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/use-chat-prompt-placeholder.d.ts +6 -0
- package/dist/hooks/use-chat-prompt-placeholder.d.ts.map +1 -0
- package/dist/hooks/use-chat-stream-message.d.ts +42 -0
- package/dist/hooks/use-chat-stream-message.d.ts.map +1 -0
- package/dist/hooks/use-current-chat-id.d.ts +2 -0
- package/dist/hooks/use-current-chat-id.d.ts.map +1 -0
- package/dist/hooks/use-is-current-chat-new.d.ts +2 -0
- package/dist/hooks/use-is-current-chat-new.d.ts.map +1 -0
- package/dist/hooks/use-loaded-chat-ids.d.ts +9 -0
- package/dist/hooks/use-loaded-chat-ids.d.ts.map +1 -0
- package/dist/hooks/use-on-chat-changed.d.ts +9 -0
- package/dist/hooks/use-on-chat-changed.d.ts.map +1 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +4404 -0
- package/dist/index.es.js.map +1 -0
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts +95 -0
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts.map +1 -0
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts +24 -0
- package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts.map +1 -0
- package/dist/layouts/chat-card-list-layout/index.d.ts +3 -0
- package/dist/layouts/chat-card-list-layout/index.d.ts.map +1 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.d.ts +84 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.d.ts.map +1 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.sizing.d.ts +45 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.sizing.d.ts.map +1 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts +37 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts.map +1 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.variants.d.ts +81 -0
- package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.variants.d.ts.map +1 -0
- package/dist/layouts/chat-card-three-column-layout/index.d.ts +5 -0
- package/dist/layouts/chat-card-three-column-layout/index.d.ts.map +1 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts +31 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts.map +1 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.sizing.d.ts +12 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.sizing.d.ts.map +1 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts +19 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts.map +1 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.variants.d.ts +35 -0
- package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.variants.d.ts.map +1 -0
- package/dist/layouts/chat-card-two-column-layout/index.d.ts +4 -0
- package/dist/layouts/chat-card-two-column-layout/index.d.ts.map +1 -0
- package/dist/layouts/index.d.ts +4 -0
- package/dist/layouts/index.d.ts.map +1 -0
- package/dist/types.d.ts +22 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/use-streaming-markdown.d.ts +18 -0
- package/dist/utils/use-streaming-markdown.d.ts.map +1 -0
- package/package.json +155 -0
- package/src/__tests__/setup.ts +5 -0
- package/src/components/canvas-shell/canvas-shell.json +126 -0
- package/src/components/canvas-shell/canvas-shell.stories.tsx +194 -0
- package/src/components/canvas-shell/canvas-shell.test.tsx +205 -0
- package/src/components/canvas-shell/canvas-shell.tsx +250 -0
- package/src/components/canvas-shell/index.ts +19 -0
- package/src/components/card-item-picker/__tests__/card-item-picker.spec.tsx +279 -0
- package/src/components/card-item-picker/card-item-picker-context.tsx +44 -0
- package/src/components/card-item-picker/card-item-picker-list.tsx +95 -0
- package/src/components/card-item-picker/card-item-picker-row-parts.tsx +96 -0
- package/src/components/card-item-picker/card-item-picker-row.tsx +109 -0
- package/src/components/card-item-picker/card-item-picker.json +147 -0
- package/src/components/card-item-picker/card-item-picker.stories.tsx +158 -0
- package/src/components/card-item-picker/index.ts +24 -0
- package/src/components/chat-card/__tests__/chat-card.spec.tsx +118 -0
- package/src/components/chat-card/chat-card.json +162 -0
- package/src/components/chat-card/chat-card.stories.tsx +349 -0
- package/src/components/chat-card/chat-card.tsx +106 -0
- package/src/components/chat-card/components/chat-card-body.tsx +115 -0
- package/src/components/chat-card/components/chat-card-footer.tsx +95 -0
- package/src/components/chat-card/components/chat-card-form.tsx +120 -0
- package/src/components/chat-card/components/chat-card-header.tsx +240 -0
- package/src/components/chat-card/components/index.ts +4 -0
- package/src/components/chat-card/context.tsx +34 -0
- package/src/components/chat-card/contexts.tsx +42 -0
- package/src/components/chat-card/hooks.ts +51 -0
- package/src/components/chat-card/index.ts +5 -0
- package/src/components/chat-card/types.ts +23 -0
- package/src/components/chat-card-container/chat-card-container.json +84 -0
- package/src/components/chat-card-container/chat-card-container.stories.tsx +149 -0
- package/src/components/chat-card-container/chat-card-container.tsx +75 -0
- package/src/components/chat-card-container/index.ts +2 -0
- package/src/components/chat-container/chat-container.json +93 -0
- package/src/components/chat-container/chat-container.stories.tsx +179 -0
- package/src/components/chat-container/chat-container.tsx +231 -0
- package/src/components/chat-container/index.ts +2 -0
- package/src/components/chat-input/chat-input.json +106 -0
- package/src/components/chat-input/chat-input.stories.tsx +291 -0
- package/src/components/chat-input/chat-input.tsx +220 -0
- package/src/components/chat-input/index.ts +2 -0
- package/src/components/chat-input/plugins/auto-focus-plugin.tsx +43 -0
- package/src/components/chat-input/plugins/controlled-value-plugin.tsx +47 -0
- package/src/components/chat-input/plugins/disabled-plugin.tsx +18 -0
- package/src/components/chat-input/plugins/focus-plugin.tsx +44 -0
- package/src/components/chat-input/plugins/has-value-plugin.tsx +51 -0
- package/src/components/chat-input/plugins/hooks.ts +7 -0
- package/src/components/chat-input/plugins/index.ts +7 -0
- package/src/components/chat-input/plugins/markdown-plain-paste-plugin.tsx +63 -0
- package/src/components/chat-input/plugins/utils.ts +48 -0
- package/src/components/chat-input/plugins/value-plugin.tsx +35 -0
- package/src/components/chat-input/transformers.ts +4 -0
- package/src/components/chat-list/chat-list-item.tsx +33 -0
- package/src/components/chat-list/chat-list-items.tsx +144 -0
- package/src/components/chat-list/chat-list.json +117 -0
- package/src/components/chat-list/chat-list.stories.tsx +332 -0
- package/src/components/chat-list/chat-list.tsx +278 -0
- package/src/components/chat-list/index.ts +18 -0
- package/src/components/chat-message/chat-message.json +105 -0
- package/src/components/chat-message/chat-message.stories.tsx +95 -0
- package/src/components/chat-message/chat-message.tsx +66 -0
- package/src/components/chat-message/index.ts +1 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card-icon.tsx +74 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.json +110 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.stories.tsx +131 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.tsx +142 -0
- package/src/components/chat-message-attachment-card/index.ts +12 -0
- package/src/components/chat-message-attachment-card/utils.ts +41 -0
- package/src/components/chat-message-history/chat-message-history.json +99 -0
- package/src/components/chat-message-history/chat-message-history.stories.tsx +136 -0
- package/src/components/chat-message-history/chat-message-history.tsx +277 -0
- package/src/components/chat-message-history/index.ts +13 -0
- package/src/components/chat-message-response/chat-message-response.json +68 -0
- package/src/components/chat-message-response/chat-message-response.stories.tsx +63 -0
- package/src/components/chat-message-response/chat-message-response.tsx +24 -0
- package/src/components/chat-message-response/index.ts +1 -0
- package/src/components/chat-message-toolbar/chat-message-toolbar.json +100 -0
- package/src/components/chat-message-toolbar/chat-message-toolbar.stories.tsx +62 -0
- package/src/components/chat-message-toolbar/chat-message-toolbar.tsx +97 -0
- package/src/components/chat-message-toolbar/index.ts +6 -0
- package/src/components/chat-messages/chat-messages.json +95 -0
- package/src/components/chat-messages/chat-messages.stories.tsx +284 -0
- package/src/components/chat-messages/chat-messages.tsx +264 -0
- package/src/components/chat-messages/index.ts +10 -0
- package/src/components/chat-notification-card/chat-notification-card.json +135 -0
- package/src/components/chat-notification-card/chat-notification-card.stories.tsx +290 -0
- package/src/components/chat-notification-card/chat-notification-card.tsx +684 -0
- package/src/components/chat-notification-card/index.ts +3 -0
- package/src/components/chat-notification-card/types.ts +1 -0
- package/src/components/chat-notification-card/utils.ts +34 -0
- package/src/components/chat-notification-popup/chat-notification-popup.json +97 -0
- package/src/components/chat-notification-popup/chat-notification-popup.stories.tsx +80 -0
- package/src/components/chat-notification-popup/chat-notification-popup.tsx +36 -0
- package/src/components/chat-notification-popup/index.ts +1 -0
- package/src/components/chat-prompt-box/chat-prompt-box-context.tsx +62 -0
- package/src/components/chat-prompt-box/chat-prompt-box-focus-plugin.tsx +22 -0
- package/src/components/chat-prompt-box/chat-prompt-box.json +106 -0
- package/src/components/chat-prompt-box/chat-prompt-box.stories.tsx +117 -0
- package/src/components/chat-prompt-box/chat-prompt-box.tsx +296 -0
- package/src/components/chat-prompt-box/index.ts +16 -0
- package/src/components/chat-reply/chat-reply.json +79 -0
- package/src/components/chat-reply/chat-reply.stories.tsx +72 -0
- package/src/components/chat-reply/chat-reply.tsx +103 -0
- package/src/components/chat-reply/index.ts +1 -0
- package/src/components/chat-suggestion/chat-suggestion.json +108 -0
- package/src/components/chat-suggestion/chat-suggestion.stories.tsx +147 -0
- package/src/components/chat-suggestion/chat-suggestion.tsx +184 -0
- package/src/components/chat-suggestion/index.ts +8 -0
- package/src/components/chat-thinking-process/chat-thinking-process.json +110 -0
- package/src/components/chat-thinking-process/chat-thinking-process.stories.tsx +202 -0
- package/src/components/chat-thinking-process/chat-thinking-process.tsx +268 -0
- package/src/components/chat-thinking-process/index.ts +9 -0
- package/src/components/chat-thread/__tests__/chat-thread.spec.tsx +385 -0
- package/src/components/chat-thread/chat-thread.json +120 -0
- package/src/components/chat-thread/chat-thread.stories.tsx +218 -0
- package/src/components/chat-thread/chat-thread.tsx +549 -0
- package/src/components/chat-thread/index.ts +18 -0
- package/src/components/deprecated-empty-state.ts +39 -0
- package/src/components/index.ts +26 -0
- package/src/components/markdown-viewer/hooks.ts +59 -0
- package/src/components/markdown-viewer/index.ts +2 -0
- package/src/components/markdown-viewer/markdown-viewer.json +84 -0
- package/src/components/markdown-viewer/markdown-viewer.stories.tsx +110 -0
- package/src/components/markdown-viewer/markdown-viewer.tsx +95 -0
- package/src/components/markdown-viewer/types.ts +10 -0
- package/src/components/markdown-viewer/utils.ts +5 -0
- package/src/components/new-chat-trigger/index.ts +1 -0
- package/src/components/new-chat-trigger/new-chat-trigger.tsx +29 -0
- package/src/components/rich-text-area/constants/index.ts +10 -0
- package/src/components/rich-text-area/hooks.ts +24 -0
- package/src/components/rich-text-area/html-config.ts +195 -0
- package/src/components/rich-text-area/index.ts +6 -0
- package/src/components/rich-text-area/nodes/div-block-node.tsx +145 -0
- package/src/components/rich-text-area/nodes/image-node.tsx +100 -0
- package/src/components/rich-text-area/plugins/blur-plugin.tsx +36 -0
- package/src/components/rich-text-area/plugins/controlled-plugin.tsx +23 -0
- package/src/components/rich-text-area/plugins/controlled-value-plugin.tsx +101 -0
- package/src/components/rich-text-area/plugins/disabled-plugin.tsx +17 -0
- package/src/components/rich-text-area/plugins/file-attachment-plugin.tsx +57 -0
- package/src/components/rich-text-area/plugins/focus-plugin.tsx +44 -0
- package/src/components/rich-text-area/plugins/html-paste-plugin.tsx +104 -0
- package/src/components/rich-text-area/plugins/image-drop-plugin.tsx +56 -0
- package/src/components/rich-text-area/plugins/index.ts +10 -0
- package/src/components/rich-text-area/plugins/markdown-plain-paste-plugin.tsx +63 -0
- package/src/components/rich-text-area/plugins/value-plugin.tsx +46 -0
- package/src/components/rich-text-area/rich-text-area.json +102 -0
- package/src/components/rich-text-area/rich-text-area.stories.tsx +140 -0
- package/src/components/rich-text-area/rich-text-area.tsx +156 -0
- package/src/components/rich-text-area/styled.tsx +20 -0
- package/src/components/rich-text-area/transformers.ts +175 -0
- package/src/components/rich-text-area/types.ts +8 -0
- package/src/components/rich-text-area/utils/index.ts +77 -0
- package/src/components/rich-text-field/components/alignment-select.tsx +103 -0
- package/src/components/rich-text-field/components/attachment-button.tsx +25 -0
- package/src/components/rich-text-field/components/bold-button.tsx +21 -0
- package/src/components/rich-text-field/components/clean-format-button.tsx +44 -0
- package/src/components/rich-text-field/components/formatting-toolbar-plugin.tsx +69 -0
- package/src/components/rich-text-field/components/image-button.tsx +11 -0
- package/src/components/rich-text-field/components/index.ts +14 -0
- package/src/components/rich-text-field/components/italic-button.tsx +21 -0
- package/src/components/rich-text-field/components/link-button.tsx +11 -0
- package/src/components/rich-text-field/components/size-select.tsx +27 -0
- package/src/components/rich-text-field/components/text-color-button.tsx +41 -0
- package/src/components/rich-text-field/components/toolbar-button.tsx +27 -0
- package/src/components/rich-text-field/components/toolbar-select.tsx +19 -0
- package/src/components/rich-text-field/components/typography-select.tsx +27 -0
- package/src/components/rich-text-field/components/underline-button.tsx +21 -0
- package/src/components/rich-text-field/constants.ts +33 -0
- package/src/components/rich-text-field/context.tsx +251 -0
- package/src/components/rich-text-field/index.tsx +6 -0
- package/src/components/rich-text-field/rich-text-field.json +118 -0
- package/src/components/rich-text-field/rich-text-field.stories.tsx +218 -0
- package/src/components/rich-text-field/rich-text-field.tsx +93 -0
- package/src/components/rich-text-field/utils.ts +532 -0
- package/src/components/spinner/index.ts +1 -0
- package/src/components/spinner/spinner.json +73 -0
- package/src/components/spinner/spinner.stories.tsx +41 -0
- package/src/components/spinner/spinner.tsx +32 -0
- package/src/contexts/chat-context/chat-context.tsx +97 -0
- package/src/contexts/chat-context/index.ts +1 -0
- package/src/contexts/chat-context/utils.ts +7 -0
- package/src/contexts/chat-conversation-context/chat-conversation-context.tsx +608 -0
- package/src/contexts/chat-conversation-context/index.ts +1 -0
- package/src/contexts/index.ts +2 -0
- package/src/docs/agent.stories.tsx +567 -0
- package/src/docs/chat-panel.tsx +174 -0
- package/src/docs/chatbot-panel.tsx +381 -0
- package/src/docs/chatbot.mdx +144 -0
- package/src/docs/chatbot.stories.tsx +63 -0
- package/src/domain/actions/constants.ts +1 -0
- package/src/domain/actions/hooks/index.ts +22 -0
- package/src/domain/actions/index.ts +4 -0
- package/src/domain/actions/types.ts +6 -0
- package/src/domain/actions/utils/index.ts +112 -0
- package/src/domain/index.ts +1 -0
- package/src/hooks/index.tsx +10 -0
- package/src/hooks/use-chat-prompt-placeholder.ts +7 -0
- package/src/hooks/use-chat-stream-message.ts +189 -0
- package/src/hooks/use-current-chat-id.ts +6 -0
- package/src/hooks/use-is-current-chat-new.ts +6 -0
- package/src/hooks/use-loaded-chat-ids.ts +32 -0
- package/src/hooks/use-on-chat-changed.ts +33 -0
- package/src/index.css +1 -0
- package/src/index.ts +6 -0
- package/src/layouts/chat-card-list-layout/__tests__/chat-card-list-layout.spec.tsx +204 -0
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.json +116 -0
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.stories.tsx +190 -0
- package/src/layouts/chat-card-list-layout/chat-card-list-layout.tsx +250 -0
- package/src/layouts/chat-card-list-layout/index.ts +11 -0
- package/src/layouts/chat-card-three-column-layout/__tests__/chat-card-three-column-layout.sizing.test.ts +73 -0
- package/src/layouts/chat-card-three-column-layout/__tests__/chat-card-three-column-layout.spec.tsx +282 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.json +131 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.sizing.ts +78 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.tsx +273 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.tsx +291 -0
- package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.variants.ts +135 -0
- package/src/layouts/chat-card-three-column-layout/index.ts +24 -0
- package/src/layouts/chat-card-two-column-layout/__tests__/chat-card-two-column-layout.spec.tsx +109 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.json +97 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.sizing.ts +21 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.tsx +138 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.tsx +132 -0
- package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.variants.ts +65 -0
- package/src/layouts/chat-card-two-column-layout/index.ts +17 -0
- package/src/layouts/index.ts +3 -0
- package/src/types.ts +29 -0
- package/src/utils/use-streaming-markdown.ts +113 -0
- package/tailwind.css +7 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { fn } from 'storybook/test';
|
|
3
|
+
|
|
4
|
+
import { EnterIcon, CloseIcon, PersonIcon } from '@swisper.ai/icons';
|
|
5
|
+
import { IconButton } from '@swisper.ai/ui';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
ChatSuggestion,
|
|
9
|
+
ChatSuggestionActions,
|
|
10
|
+
ChatSuggestionLabel,
|
|
11
|
+
ChatSuggestionLabelIcon,
|
|
12
|
+
ChatSuggestions,
|
|
13
|
+
} from './chat-suggestion';
|
|
14
|
+
|
|
15
|
+
const meta: Meta<typeof ChatSuggestion> = {
|
|
16
|
+
title: 'Chatbot/ChatSuggestion',
|
|
17
|
+
component: ChatSuggestion,
|
|
18
|
+
tags: ['autodocs'],
|
|
19
|
+
decorators: [
|
|
20
|
+
(Story) => (
|
|
21
|
+
<div className="max-w-[420px]">
|
|
22
|
+
<Story />
|
|
23
|
+
</div>
|
|
24
|
+
),
|
|
25
|
+
],
|
|
26
|
+
argTypes: {
|
|
27
|
+
index: {
|
|
28
|
+
control: 'number',
|
|
29
|
+
description:
|
|
30
|
+
'Zero-based position in the list. `ChatSuggestions` sets it automatically; `ChatSuggestionLabelIcon` shows `index + 1` when it has no icon.',
|
|
31
|
+
table: { defaultValue: { summary: '0' } },
|
|
32
|
+
},
|
|
33
|
+
children: {
|
|
34
|
+
control: false,
|
|
35
|
+
description:
|
|
36
|
+
'A `ChatSuggestionLabelIcon`, a `ChatSuggestionLabel` and optional `ChatSuggestionActions` shown on hover.',
|
|
37
|
+
},
|
|
38
|
+
className: {
|
|
39
|
+
control: 'text',
|
|
40
|
+
description: 'Extra classes merged onto the root.',
|
|
41
|
+
},
|
|
42
|
+
onClick: {
|
|
43
|
+
action: 'clicked',
|
|
44
|
+
description: 'Called when the suggestion is clicked, usually to send it as the next message.',
|
|
45
|
+
},
|
|
46
|
+
onHover: {
|
|
47
|
+
description:
|
|
48
|
+
'Called when the pointer enters the suggestion, e.g. to preview or highlight it.',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
args: {
|
|
52
|
+
index: 0,
|
|
53
|
+
children: (
|
|
54
|
+
<>
|
|
55
|
+
<ChatSuggestionLabelIcon />
|
|
56
|
+
<ChatSuggestionLabel>Yes</ChatSuggestionLabel>
|
|
57
|
+
<ChatSuggestionActions>
|
|
58
|
+
<EnterIcon />
|
|
59
|
+
</ChatSuggestionActions>
|
|
60
|
+
</>
|
|
61
|
+
),
|
|
62
|
+
onClick: fn(),
|
|
63
|
+
onHover: fn(),
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default meta;
|
|
68
|
+
type Story = StoryObj<typeof ChatSuggestion>;
|
|
69
|
+
|
|
70
|
+
export const Default: Story = {
|
|
71
|
+
render: () => (
|
|
72
|
+
<ChatSuggestion index={0} onClick={() => alert('suggestion clicked')}>
|
|
73
|
+
<ChatSuggestionLabelIcon />
|
|
74
|
+
<ChatSuggestionLabel>{'Suggestion 1'}</ChatSuggestionLabel>
|
|
75
|
+
<ChatSuggestionActions>
|
|
76
|
+
<EnterIcon />
|
|
77
|
+
</ChatSuggestionActions>
|
|
78
|
+
</ChatSuggestion>
|
|
79
|
+
),
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const List: StoryObj<typeof ChatSuggestions> = {
|
|
83
|
+
render: () => (
|
|
84
|
+
<ChatSuggestions>
|
|
85
|
+
<ChatSuggestion>
|
|
86
|
+
<ChatSuggestionLabelIcon />
|
|
87
|
+
<ChatSuggestionLabel>Yes</ChatSuggestionLabel>
|
|
88
|
+
<ChatSuggestionActions>
|
|
89
|
+
<EnterIcon />
|
|
90
|
+
</ChatSuggestionActions>
|
|
91
|
+
</ChatSuggestion>
|
|
92
|
+
<ChatSuggestion>
|
|
93
|
+
<ChatSuggestionLabelIcon />
|
|
94
|
+
<ChatSuggestionLabel>No</ChatSuggestionLabel>
|
|
95
|
+
<ChatSuggestionActions>
|
|
96
|
+
<EnterIcon />
|
|
97
|
+
</ChatSuggestionActions>
|
|
98
|
+
</ChatSuggestion>
|
|
99
|
+
<ChatSuggestion>
|
|
100
|
+
<ChatSuggestionLabelIcon />
|
|
101
|
+
<ChatSuggestionLabel>Maybe later</ChatSuggestionLabel>
|
|
102
|
+
<ChatSuggestionActions>
|
|
103
|
+
<EnterIcon />
|
|
104
|
+
</ChatSuggestionActions>
|
|
105
|
+
</ChatSuggestion>
|
|
106
|
+
<ChatSuggestion>
|
|
107
|
+
<ChatSuggestionLabelIcon />
|
|
108
|
+
<ChatSuggestionLabel isMultiline={false}>
|
|
109
|
+
Inline. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor
|
|
110
|
+
incididunt ut labore et dolore magna aliqua.
|
|
111
|
+
</ChatSuggestionLabel>
|
|
112
|
+
<ChatSuggestionActions>
|
|
113
|
+
<EnterIcon />
|
|
114
|
+
</ChatSuggestionActions>
|
|
115
|
+
</ChatSuggestion>
|
|
116
|
+
<ChatSuggestion>
|
|
117
|
+
<ChatSuggestionLabelIcon>
|
|
118
|
+
<PersonIcon />
|
|
119
|
+
</ChatSuggestionLabelIcon>
|
|
120
|
+
<ChatSuggestionLabel isMultiline>
|
|
121
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt
|
|
122
|
+
ut labore et dolore magna aliqua.Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
123
|
+
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
124
|
+
</ChatSuggestionLabel>
|
|
125
|
+
<ChatSuggestionActions>
|
|
126
|
+
<EnterIcon />
|
|
127
|
+
</ChatSuggestionActions>
|
|
128
|
+
</ChatSuggestion>
|
|
129
|
+
</ChatSuggestions>
|
|
130
|
+
),
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const WithActions: StoryObj<typeof ChatSuggestion> = {
|
|
134
|
+
render: () => (
|
|
135
|
+
<ChatSuggestion index={0}>
|
|
136
|
+
<ChatSuggestionLabelIcon />
|
|
137
|
+
<ChatSuggestionLabel>
|
|
138
|
+
If only 1 line. One November weekend, after a particularly brutal
|
|
139
|
+
</ChatSuggestionLabel>
|
|
140
|
+
<ChatSuggestionActions>
|
|
141
|
+
<IconButton size="xs" variant="primary">
|
|
142
|
+
<CloseIcon />
|
|
143
|
+
</IconButton>
|
|
144
|
+
</ChatSuggestionActions>
|
|
145
|
+
</ChatSuggestion>
|
|
146
|
+
),
|
|
147
|
+
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Children,
|
|
3
|
+
cloneElement,
|
|
4
|
+
createContext,
|
|
5
|
+
isValidElement,
|
|
6
|
+
useContext,
|
|
7
|
+
useMemo,
|
|
8
|
+
type ReactElement,
|
|
9
|
+
type ReactNode,
|
|
10
|
+
} from 'react';
|
|
11
|
+
|
|
12
|
+
import { Typography } from '@swisper.ai/ui';
|
|
13
|
+
import { cn } from '@swisper.ai/web-core';
|
|
14
|
+
|
|
15
|
+
interface ChatSuggestionContextValue {
|
|
16
|
+
index?: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const ChatSuggestionContext = createContext<ChatSuggestionContextValue>(null!);
|
|
20
|
+
|
|
21
|
+
export function useChatSuggestionContext() {
|
|
22
|
+
const context = useContext(ChatSuggestionContext);
|
|
23
|
+
|
|
24
|
+
if (!context) {
|
|
25
|
+
throw new Error('"useChatSuggestionContext" must be used within a ChatSuggestion');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return context;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ChatSuggestionsProps {
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
className?: string;
|
|
34
|
+
onMouseLeave?: () => void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function ChatSuggestions({ children, className, onMouseLeave }: ChatSuggestionsProps) {
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
role="list"
|
|
41
|
+
data-testid="chat-suggestions"
|
|
42
|
+
className={cn('list-none flex flex-col flex-wrap align-start items-stretch gap-0', className)}
|
|
43
|
+
onMouseLeave={onMouseLeave}
|
|
44
|
+
>
|
|
45
|
+
{Children.map(children, (child, index) => {
|
|
46
|
+
if (!isValidElement(child)) {
|
|
47
|
+
return child;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return cloneElement(child as ReactElement<ChatSuggestionProps>, { index });
|
|
51
|
+
})}
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface ChatSuggestionProps {
|
|
57
|
+
index?: number;
|
|
58
|
+
children: ReactNode;
|
|
59
|
+
className?: string;
|
|
60
|
+
onHover?: () => void;
|
|
61
|
+
onClick?: () => void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function ChatSuggestion({
|
|
65
|
+
index,
|
|
66
|
+
children,
|
|
67
|
+
className,
|
|
68
|
+
onHover,
|
|
69
|
+
onClick,
|
|
70
|
+
}: ChatSuggestionProps) {
|
|
71
|
+
const contextValue = useMemo(() => ({ index }), [index]);
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<ChatSuggestionContext.Provider value={contextValue}>
|
|
75
|
+
<div
|
|
76
|
+
role="listitem"
|
|
77
|
+
onClick={onClick}
|
|
78
|
+
onMouseEnter={onHover}
|
|
79
|
+
className={cn(
|
|
80
|
+
'cursor-pointer',
|
|
81
|
+
'inline-flex flex-row max-w-full',
|
|
82
|
+
'items-start',
|
|
83
|
+
'p-4 gap-0 rounded-[12px]',
|
|
84
|
+
'group/suggestion',
|
|
85
|
+
'text-typography-text-secondary',
|
|
86
|
+
'hover:bg-layout-accent-low-background-hover-default',
|
|
87
|
+
'focus-visible:bg-layout-accent-low-background-hover-default',
|
|
88
|
+
className,
|
|
89
|
+
)}
|
|
90
|
+
>
|
|
91
|
+
{children}
|
|
92
|
+
</div>
|
|
93
|
+
</ChatSuggestionContext.Provider>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface ChatSuggestionLabelIconProps {
|
|
98
|
+
children?: ReactNode;
|
|
99
|
+
className?: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function ChatSuggestionLabelIcon({ children, className }: ChatSuggestionLabelIconProps) {
|
|
103
|
+
const { index = 0 } = useChatSuggestionContext();
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<span
|
|
107
|
+
aria-hidden="true"
|
|
108
|
+
className={cn(
|
|
109
|
+
'inline-flex flex-row justify-center items-center shrink-0 size-auto text-inherit',
|
|
110
|
+
className,
|
|
111
|
+
)}
|
|
112
|
+
>
|
|
113
|
+
<span
|
|
114
|
+
aria-hidden="true"
|
|
115
|
+
className={cn(
|
|
116
|
+
'size-[32px]',
|
|
117
|
+
'inline-flex items-center justify-center',
|
|
118
|
+
'px-8 py-[7px]',
|
|
119
|
+
'[&_svg]:size-[18px]!',
|
|
120
|
+
)}
|
|
121
|
+
>
|
|
122
|
+
{children || (
|
|
123
|
+
<Typography variant="caption-md" fontWeight="normal" className="text-inherit">
|
|
124
|
+
{index + 1}
|
|
125
|
+
</Typography>
|
|
126
|
+
)}
|
|
127
|
+
</span>
|
|
128
|
+
</span>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface ChatSuggestionLabelProps {
|
|
133
|
+
children: ReactNode;
|
|
134
|
+
className?: string;
|
|
135
|
+
isMultiline?: boolean;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function ChatSuggestionLabel({
|
|
139
|
+
children,
|
|
140
|
+
className,
|
|
141
|
+
isMultiline = true,
|
|
142
|
+
}: ChatSuggestionLabelProps) {
|
|
143
|
+
return (
|
|
144
|
+
<Typography
|
|
145
|
+
variant="body-small-low"
|
|
146
|
+
data-multiline={isMultiline}
|
|
147
|
+
className={cn(
|
|
148
|
+
'gap-0 px-4 my-[7px]',
|
|
149
|
+
'h-full flex-1 items-center justify-center text-left text-inherit',
|
|
150
|
+
'data-[multiline=false]:truncate',
|
|
151
|
+
'data-[multiline=true]:line-clamp-3',
|
|
152
|
+
className,
|
|
153
|
+
)}
|
|
154
|
+
>
|
|
155
|
+
{children}
|
|
156
|
+
</Typography>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface ChatSuggestionActionsProps {
|
|
161
|
+
children: ReactNode;
|
|
162
|
+
className?: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function ChatSuggestionActions({ children, className }: ChatSuggestionActionsProps) {
|
|
166
|
+
return (
|
|
167
|
+
<div
|
|
168
|
+
role="group"
|
|
169
|
+
className={cn(
|
|
170
|
+
'shrink-0 flex items-center justify-center gap-8',
|
|
171
|
+
'self-start',
|
|
172
|
+
'min-w-[32px] h-[32px]',
|
|
173
|
+
'*:text-secondary-main',
|
|
174
|
+
'[&>svg]:size-[18px]!',
|
|
175
|
+
'opacity-0',
|
|
176
|
+
'group-hover/suggestion:opacity-100',
|
|
177
|
+
'group-focus-visible/suggestion:opacity-100',
|
|
178
|
+
className,
|
|
179
|
+
)}
|
|
180
|
+
>
|
|
181
|
+
{children}
|
|
182
|
+
</div>
|
|
183
|
+
);
|
|
184
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../../int-eslint-config/schemas/component.schema.json",
|
|
3
|
+
"component": "chat-thinking-process",
|
|
4
|
+
"purpose": "Collapsible disclosure of the assistant's reasoning or tool-use steps above its answer: a trigger (icon, label, chevron) and a timeline of steps, with a shimmering label and a preview of the latest step while the model is still thinking. Parts: ChatThinkingProcessTrigger, ChatThinkingProcessTriggerIcon, ChatThinkingProcessTriggerLabel, ChatThinkingProcessTriggerArrow, ChatThinkingProcessContent, ChatThinkingProcessContentItem.",
|
|
5
|
+
"useWhen": [
|
|
6
|
+
"An assistant answer is preceded by reasoning, searches or tool calls the user may want to inspect",
|
|
7
|
+
"Showing live progress while the model thinks, before the first answer text arrives",
|
|
8
|
+
"Keeping the steps available but out of the way once the answer is shown"
|
|
9
|
+
],
|
|
10
|
+
"avoidWhen": [
|
|
11
|
+
"A plain wait with no steps to show — use web-chat-ui/spinner",
|
|
12
|
+
"Collapsible content that is not the assistant's process (settings, FAQs, details) — use ui/collapsible",
|
|
13
|
+
"The answer itself — render it with web-chat-ui/markdown-viewer in the message content"
|
|
14
|
+
],
|
|
15
|
+
"uxPrinciples": [
|
|
16
|
+
"The answer is the point: the process stays collapsed by default and only previews its latest step while it is live.",
|
|
17
|
+
"The label reports state: what is happening while streaming, what was done afterwards ('Used 3 tools')."
|
|
18
|
+
],
|
|
19
|
+
"accessibility": {
|
|
20
|
+
"required": [
|
|
21
|
+
"ChatThinkingProcessTriggerLabel must contain text: it is the trigger button's accessible name",
|
|
22
|
+
"Change the label text when thinking ends ('Thinking…' → 'Used 3 tools'); the shimmer alone does not tell assistive tech the state changed",
|
|
23
|
+
"Keep each step's text self-contained; the timeline dots and connectors are hidden from assistive tech"
|
|
24
|
+
],
|
|
25
|
+
"keyboard": [
|
|
26
|
+
"Tab focuses the trigger button",
|
|
27
|
+
"Enter or Space toggles the steps open and closed"
|
|
28
|
+
],
|
|
29
|
+
"aria": [
|
|
30
|
+
"The trigger is a Radix Collapsible trigger: a <button> with aria-expanded and aria-controls pointing at the steps",
|
|
31
|
+
"ChatThinkingProcessTriggerArrow and the timeline markers are aria-hidden",
|
|
32
|
+
"No live region: new steps and the streaming preview are not announced"
|
|
33
|
+
],
|
|
34
|
+
"focus": [
|
|
35
|
+
"One tab stop, the trigger; focus stays on it when it toggles",
|
|
36
|
+
"Steps are text only and not focusable unless their content is"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"behaviour": {
|
|
40
|
+
"states": [
|
|
41
|
+
"collapsed",
|
|
42
|
+
"expanded",
|
|
43
|
+
"streaming (collapsed, previewing the latest step)",
|
|
44
|
+
"streaming (expanded)"
|
|
45
|
+
],
|
|
46
|
+
"rules": [
|
|
47
|
+
"Uncontrolled by default and collapsed on first render (defaultOpen=false, unlike ui/collapsible); pass open with onOpenChange to control it",
|
|
48
|
+
"isStreaming=true marks the model as still thinking: the trigger label shimmers and, while collapsed, the content previews the last step",
|
|
49
|
+
"The preview shows the last child of ChatThinkingProcessContent, faded, and cross-fades each time a new step is added; it is hidden when expanded or not streaming. hasLastMessagePreview=false turns it off",
|
|
50
|
+
"Expanded, every child of ChatThinkingProcessContent becomes a timeline row with a dot, joined to the next row by a line; the last row has no connector",
|
|
51
|
+
"ChatThinkingProcessTriggerArrow rotates 180° when expanded",
|
|
52
|
+
"itemsClassName styles the expanded list of steps; className on ChatThinkingProcessContent styles its outer wrapper",
|
|
53
|
+
"A step's content can be any node, including streamed text that grows as it arrives"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"composition": {
|
|
57
|
+
"allowedParents": ["web-chat-ui/ChatMessage"],
|
|
58
|
+
"allowedChildren": [
|
|
59
|
+
"web-chat-ui/ChatThinkingProcessTrigger",
|
|
60
|
+
"web-chat-ui/ChatThinkingProcessTriggerIcon",
|
|
61
|
+
"web-chat-ui/ChatThinkingProcessTriggerLabel",
|
|
62
|
+
"web-chat-ui/ChatThinkingProcessTriggerArrow",
|
|
63
|
+
"web-chat-ui/ChatThinkingProcessContent",
|
|
64
|
+
"web-chat-ui/ChatThinkingProcessContentItem",
|
|
65
|
+
"icon (in ChatThinkingProcessTriggerIcon)",
|
|
66
|
+
"text label",
|
|
67
|
+
"step text"
|
|
68
|
+
],
|
|
69
|
+
"avoidCombinations": [
|
|
70
|
+
"Children of ChatThinkingProcessContent other than ChatThinkingProcessContentItem — each child becomes a timeline row and the preview uses the last one",
|
|
71
|
+
"Placing it after the answer content — it belongs above web-chat-ui/ChatMessageContent in the assistant's message",
|
|
72
|
+
"Interactive controls inside steps — the steps are a read-only log"
|
|
73
|
+
],
|
|
74
|
+
"contexts": ["assistant message in a chat thread"]
|
|
75
|
+
},
|
|
76
|
+
"content": {
|
|
77
|
+
"labelRules": [
|
|
78
|
+
"While streaming: a present-progressive phrase with an ellipsis ('Thinking…')",
|
|
79
|
+
"When done: a summary of what was done ('Used 3 tools')"
|
|
80
|
+
],
|
|
81
|
+
"helperTextRules": [
|
|
82
|
+
"Steps: short present-progressive phrases ('Searching knowledge base…', 'Analyzing context…'), one action per step"
|
|
83
|
+
],
|
|
84
|
+
"errorRules": []
|
|
85
|
+
},
|
|
86
|
+
"aiDecisionRules": [
|
|
87
|
+
{
|
|
88
|
+
"condition": "The model is still thinking and no answer text has arrived",
|
|
89
|
+
"decision": "Set isStreaming on ChatThinkingProcess and keep it collapsed",
|
|
90
|
+
"reason": "The shimmer and the latest-step preview show progress without expanding the full log"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"condition": "Thinking has finished",
|
|
94
|
+
"decision": "Set isStreaming={false} and change the label to a summary of the steps",
|
|
95
|
+
"reason": "The preview hides when not streaming, and the label is the only state cue screen readers get"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"condition": "The latest-step preview would repeat content shown elsewhere",
|
|
99
|
+
"decision": "Pass hasLastMessagePreview={false} to ChatThinkingProcessContent",
|
|
100
|
+
"reason": "It switches off the collapsed preview while keeping the expandable list"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"relatedComponents": [
|
|
104
|
+
"ui/collapsible",
|
|
105
|
+
"web-chat-ui/chat-message",
|
|
106
|
+
"web-chat-ui/markdown-viewer",
|
|
107
|
+
"web-chat-ui/spinner",
|
|
108
|
+
"ui/timeline"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { fn } from 'storybook/test';
|
|
3
|
+
|
|
4
|
+
import { BrainIcon } from '@swisper.ai/icons';
|
|
5
|
+
|
|
6
|
+
import { useStreamingMarkdown } from '../../utils/use-streaming-markdown';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
ChatThinkingProcess,
|
|
10
|
+
ChatThinkingProcessContent,
|
|
11
|
+
ChatThinkingProcessContentItem,
|
|
12
|
+
ChatThinkingProcessTrigger,
|
|
13
|
+
ChatThinkingProcessTriggerArrow,
|
|
14
|
+
ChatThinkingProcessTriggerIcon,
|
|
15
|
+
ChatThinkingProcessTriggerLabel,
|
|
16
|
+
} from './chat-thinking-process';
|
|
17
|
+
|
|
18
|
+
const meta: Meta<typeof ChatThinkingProcess> = {
|
|
19
|
+
title: 'Chatbot/ChatThinkingProcess',
|
|
20
|
+
component: ChatThinkingProcess,
|
|
21
|
+
parameters: { layout: 'padded' },
|
|
22
|
+
tags: ['autodocs'],
|
|
23
|
+
decorators: [
|
|
24
|
+
(Story) => (
|
|
25
|
+
<div className="w-[700px]">
|
|
26
|
+
<Story />
|
|
27
|
+
</div>
|
|
28
|
+
),
|
|
29
|
+
],
|
|
30
|
+
argTypes: {
|
|
31
|
+
isStreaming: {
|
|
32
|
+
control: 'boolean',
|
|
33
|
+
description:
|
|
34
|
+
'Set while the model is still thinking: shimmers the trigger label and, when collapsed, previews the latest step.',
|
|
35
|
+
table: { defaultValue: { summary: 'false' } },
|
|
36
|
+
},
|
|
37
|
+
defaultOpen: {
|
|
38
|
+
control: 'boolean',
|
|
39
|
+
description: 'Initial expanded state when uncontrolled.',
|
|
40
|
+
table: { defaultValue: { summary: 'false' } },
|
|
41
|
+
},
|
|
42
|
+
open: {
|
|
43
|
+
control: 'boolean',
|
|
44
|
+
description:
|
|
45
|
+
'Controlled expanded state. Pair it with `onOpenChange`; leave it unset to let the trigger toggle it.',
|
|
46
|
+
},
|
|
47
|
+
onOpenChange: {
|
|
48
|
+
description: 'Called with the next expanded state when the trigger is clicked.',
|
|
49
|
+
},
|
|
50
|
+
children: {
|
|
51
|
+
control: false,
|
|
52
|
+
description:
|
|
53
|
+
'A `ChatThinkingProcessTrigger` (icon, label, arrow) followed by a `ChatThinkingProcessContent` with the steps.',
|
|
54
|
+
},
|
|
55
|
+
className: {
|
|
56
|
+
control: 'text',
|
|
57
|
+
description: 'Extra classes merged onto the root.',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
args: {
|
|
61
|
+
isStreaming: false,
|
|
62
|
+
defaultOpen: false,
|
|
63
|
+
onOpenChange: fn(),
|
|
64
|
+
children: (
|
|
65
|
+
<>
|
|
66
|
+
<ChatThinkingProcessTrigger>
|
|
67
|
+
<ChatThinkingProcessTriggerIcon>
|
|
68
|
+
<BrainIcon />
|
|
69
|
+
</ChatThinkingProcessTriggerIcon>
|
|
70
|
+
<ChatThinkingProcessTriggerLabel>Thinking...</ChatThinkingProcessTriggerLabel>
|
|
71
|
+
<ChatThinkingProcessTriggerArrow />
|
|
72
|
+
</ChatThinkingProcessTrigger>
|
|
73
|
+
<ChatThinkingProcessContent>
|
|
74
|
+
<ChatThinkingProcessContentItem>
|
|
75
|
+
Searching knowledge base...
|
|
76
|
+
</ChatThinkingProcessContentItem>
|
|
77
|
+
<ChatThinkingProcessContentItem>Analyzing context...</ChatThinkingProcessContentItem>
|
|
78
|
+
</ChatThinkingProcessContent>
|
|
79
|
+
</>
|
|
80
|
+
),
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export default meta;
|
|
85
|
+
type Story = StoryObj<typeof ChatThinkingProcess>;
|
|
86
|
+
|
|
87
|
+
export const Default: Story = {
|
|
88
|
+
render: () => (
|
|
89
|
+
<ChatThinkingProcess>
|
|
90
|
+
<ChatThinkingProcessTrigger>
|
|
91
|
+
<ChatThinkingProcessTriggerIcon>
|
|
92
|
+
<BrainIcon />
|
|
93
|
+
</ChatThinkingProcessTriggerIcon>
|
|
94
|
+
<ChatThinkingProcessTriggerLabel>Thinking...</ChatThinkingProcessTriggerLabel>
|
|
95
|
+
<ChatThinkingProcessTriggerArrow />
|
|
96
|
+
</ChatThinkingProcessTrigger>
|
|
97
|
+
|
|
98
|
+
<ChatThinkingProcessContent>
|
|
99
|
+
<ChatThinkingProcessContentItem>Searching knowledge base...</ChatThinkingProcessContentItem>
|
|
100
|
+
<ChatThinkingProcessContentItem>Analyzing context...</ChatThinkingProcessContentItem>
|
|
101
|
+
</ChatThinkingProcessContent>
|
|
102
|
+
</ChatThinkingProcess>
|
|
103
|
+
),
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const WithoutPreview: Story = {
|
|
107
|
+
render: () => (
|
|
108
|
+
<ChatThinkingProcess defaultOpen>
|
|
109
|
+
<ChatThinkingProcessTrigger>
|
|
110
|
+
<ChatThinkingProcessTriggerIcon>
|
|
111
|
+
<BrainIcon />
|
|
112
|
+
</ChatThinkingProcessTriggerIcon>
|
|
113
|
+
<ChatThinkingProcessTriggerLabel>Thinking...</ChatThinkingProcessTriggerLabel>
|
|
114
|
+
<ChatThinkingProcessTriggerArrow />
|
|
115
|
+
</ChatThinkingProcessTrigger>
|
|
116
|
+
|
|
117
|
+
<ChatThinkingProcessContent hasLastMessagePreview={false}>
|
|
118
|
+
<ChatThinkingProcessContentItem>Searching knowledge base...</ChatThinkingProcessContentItem>
|
|
119
|
+
<ChatThinkingProcessContentItem>Analyzing context...</ChatThinkingProcessContentItem>
|
|
120
|
+
</ChatThinkingProcessContent>
|
|
121
|
+
</ChatThinkingProcess>
|
|
122
|
+
),
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const Streaming: Story = {
|
|
126
|
+
render: () => (
|
|
127
|
+
<ChatThinkingProcess isStreaming>
|
|
128
|
+
<ChatThinkingProcessTrigger>
|
|
129
|
+
<ChatThinkingProcessTriggerIcon>
|
|
130
|
+
<BrainIcon />
|
|
131
|
+
</ChatThinkingProcessTriggerIcon>
|
|
132
|
+
<ChatThinkingProcessTriggerLabel>Thinking...</ChatThinkingProcessTriggerLabel>
|
|
133
|
+
<ChatThinkingProcessTriggerArrow />
|
|
134
|
+
</ChatThinkingProcessTrigger>
|
|
135
|
+
|
|
136
|
+
<ChatThinkingProcessContent>
|
|
137
|
+
<ChatThinkingProcessContentItem>Searching knowledge base...</ChatThinkingProcessContentItem>
|
|
138
|
+
<ChatThinkingProcessContentItem>Analyzing context...</ChatThinkingProcessContentItem>
|
|
139
|
+
</ChatThinkingProcessContent>
|
|
140
|
+
</ChatThinkingProcess>
|
|
141
|
+
),
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const STREAMING_PROCESSING_EXAMPLE = `Processing your request to retrieve your email list...
|
|
145
|
+
|
|
146
|
+
Understanding intent
|
|
147
|
+
- Parsed: "show me my emails" → list inbox messages for the connected account
|
|
148
|
+
- Scope: Inbox only (excluding Sent, Drafts, Junk unless user asks otherwise)
|
|
149
|
+
- Time window: last 7 days, newest first
|
|
150
|
+
|
|
151
|
+
Checking access
|
|
152
|
+
- Account: alex.morgan@acme.com (Microsoft 365)
|
|
153
|
+
- OAuth token present and not expired
|
|
154
|
+
- Required scope Mail.Read confirmed
|
|
155
|
+
|
|
156
|
+
Connecting to mailbox
|
|
157
|
+
- Endpoint: https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messages
|
|
158
|
+
- Building OData query:
|
|
159
|
+
- $filter: receivedDateTime ge 2026-05-21T00:00:00Z
|
|
160
|
+
- $orderby: receivedDateTime desc
|
|
161
|
+
- $top: 50
|
|
162
|
+
- $select: id,subject,from,receivedDateTime,isRead,hasAttachments,bodyPreview
|
|
163
|
+
|
|
164
|
+
Fetching messages (page 1 of 1)
|
|
165
|
+
- Request sent… waiting for response
|
|
166
|
+
- HTTP 200 — 47 messages returned in 312ms
|
|
167
|
+
|
|
168
|
+
Normalizing results
|
|
169
|
+
- Mapping sender display names and email addresses
|
|
170
|
+
- Trimming body previews to 120 characters
|
|
171
|
+
- Flagging 12 unread, 8 with attachments
|
|
172
|
+
|
|
173
|
+
Ranking for display
|
|
174
|
+
- Prioritizing unread and messages from known contacts
|
|
175
|
+
- Deprioritizing newsletters and automated notifications (noreply@, no-reply@)
|
|
176
|
+
|
|
177
|
+
Preparing summary
|
|
178
|
+
- Grouping: 12 unread · 35 read · 8 with attachments
|
|
179
|
+
- Top threads: "Q2 budget review", "Design sign-off", "Invoice #4821"
|
|
180
|
+
- Ready to present the email list to the user`;
|
|
181
|
+
|
|
182
|
+
export const StreamingWithContent: Story = {
|
|
183
|
+
render: () => {
|
|
184
|
+
const { markdown, isStreaming } = useStreamingMarkdown(STREAMING_PROCESSING_EXAMPLE, 30);
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
<ChatThinkingProcess isStreaming={isStreaming}>
|
|
188
|
+
<ChatThinkingProcessTrigger>
|
|
189
|
+
<ChatThinkingProcessTriggerIcon>
|
|
190
|
+
<BrainIcon />
|
|
191
|
+
</ChatThinkingProcessTriggerIcon>
|
|
192
|
+
<ChatThinkingProcessTriggerLabel>Thinking...</ChatThinkingProcessTriggerLabel>
|
|
193
|
+
<ChatThinkingProcessTriggerArrow />
|
|
194
|
+
</ChatThinkingProcessTrigger>
|
|
195
|
+
<ChatThinkingProcessContent>
|
|
196
|
+
<ChatThinkingProcessContentItem>Connecting to mailbox...</ChatThinkingProcessContentItem>
|
|
197
|
+
<ChatThinkingProcessContentItem>{markdown}</ChatThinkingProcessContentItem>
|
|
198
|
+
</ChatThinkingProcessContent>
|
|
199
|
+
</ChatThinkingProcess>
|
|
200
|
+
);
|
|
201
|
+
},
|
|
202
|
+
};
|