@baishuyun/chat-sdk 0.0.17 → 0.1.0
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/.turbo/turbo-build.log +76 -16
- package/CHANGELOG.md +27 -0
- package/dist/chat-sdk.js +37511 -45236
- package/dist/chat-sdk.js.map +1 -1
- package/dist/chat-sdk.umd.cjs +221 -296
- package/dist/chat-sdk.umd.cjs.map +1 -1
- package/dist/chat.d.ts +5 -0
- package/dist/chat.d.ts.map +1 -0
- package/dist/components/biz-comp/FakeBotMsg.d.ts +8 -0
- package/dist/components/biz-comp/FakeBotMsg.d.ts.map +1 -0
- package/dist/components/biz-comp/FieldChecker.d.ts +19 -0
- package/dist/components/biz-comp/FieldChecker.d.ts.map +1 -0
- package/dist/components/biz-comp/FieldCheckerListMsg.d.ts +19 -0
- package/dist/components/biz-comp/FieldCheckerListMsg.d.ts.map +1 -0
- package/dist/components/biz-comp/FieldValueChecker.d.ts +16 -0
- package/dist/components/biz-comp/FieldValueChecker.d.ts.map +1 -0
- package/dist/components/biz-comp/SubformFieldsValueChecker.d.ts +22 -0
- package/dist/components/biz-comp/SubformFieldsValueChecker.d.ts.map +1 -0
- package/dist/components/biz-comp/chat-client.d.ts +13 -0
- package/dist/components/biz-comp/chat-client.d.ts.map +1 -0
- package/dist/components/biz-comp/chat-frame.d.ts +6 -0
- package/dist/components/biz-comp/chat-frame.d.ts.map +1 -0
- package/dist/components/biz-comp/conversation.d.ts +10 -0
- package/dist/components/biz-comp/conversation.d.ts.map +1 -0
- package/dist/components/biz-comp/dash-widget-icon.d.ts +7 -0
- package/dist/components/biz-comp/dash-widget-icon.d.ts.map +1 -0
- package/dist/components/biz-comp/dock-btn.d.ts +2 -0
- package/dist/components/biz-comp/dock-btn.d.ts.map +1 -0
- package/dist/components/biz-comp/error-boundary.d.ts +15 -0
- package/dist/components/biz-comp/error-boundary.d.ts.map +1 -0
- package/dist/components/biz-comp/error-msg.d.ts +4 -0
- package/dist/components/biz-comp/error-msg.d.ts.map +1 -0
- package/dist/components/biz-comp/field-icon.d.ts +5 -0
- package/dist/components/biz-comp/field-icon.d.ts.map +1 -0
- package/dist/components/biz-comp/highlight-msg.d.ts +4 -0
- package/dist/components/biz-comp/highlight-msg.d.ts.map +1 -0
- package/dist/components/biz-comp/markdown-part.d.ts +7 -0
- package/dist/components/biz-comp/markdown-part.d.ts.map +1 -0
- package/dist/components/biz-comp/markdown.d.ts +5 -0
- package/dist/components/biz-comp/markdown.d.ts.map +1 -0
- package/dist/components/biz-comp/message-content.d.ts +6 -0
- package/dist/components/biz-comp/message-content.d.ts.map +1 -0
- package/dist/components/biz-comp/messages.d.ts +3 -0
- package/dist/components/biz-comp/messages.d.ts.map +1 -0
- package/dist/components/biz-comp/multi-modal-input/attachment-btn.d.ts +9 -0
- package/dist/components/biz-comp/multi-modal-input/attachment-btn.d.ts.map +1 -0
- package/dist/components/biz-comp/multi-modal-input/clear-btn.d.ts +8 -0
- package/dist/components/biz-comp/multi-modal-input/clear-btn.d.ts.map +1 -0
- package/dist/components/biz-comp/multi-modal-input/index.d.ts +21 -0
- package/dist/components/biz-comp/multi-modal-input/index.d.ts.map +1 -0
- package/dist/components/biz-comp/multi-modal-input/preview-attachment.d.ts +12 -0
- package/dist/components/biz-comp/multi-modal-input/preview-attachment.d.ts.map +1 -0
- package/dist/components/biz-comp/multi-modal-input/prompt-input.d.ts +36 -0
- package/dist/components/biz-comp/multi-modal-input/prompt-input.d.ts.map +1 -0
- package/dist/components/biz-comp/opening-lines.d.ts +3 -0
- package/dist/components/biz-comp/opening-lines.d.ts.map +1 -0
- package/dist/components/biz-comp/preview-message-wrapper.d.ts +12 -0
- package/dist/components/biz-comp/preview-message-wrapper.d.ts.map +1 -0
- package/dist/components/biz-comp/preview-message.d.ts +13 -0
- package/dist/components/biz-comp/preview-message.d.ts.map +1 -0
- package/dist/components/biz-comp/response.d.ts +6 -0
- package/dist/components/biz-comp/response.d.ts.map +1 -0
- package/dist/components/biz-comp/suggestions.d.ts +8 -0
- package/dist/components/biz-comp/suggestions.d.ts.map +1 -0
- package/dist/components/bs-ui/abs-fullscreen-gradient-bg.d.ts +10 -0
- package/dist/components/bs-ui/abs-fullscreen-gradient-bg.d.ts.map +1 -0
- package/dist/components/bs-ui/attachment-part-group.d.ts +16 -0
- package/dist/components/bs-ui/attachment-part-group.d.ts.map +1 -0
- package/dist/components/bs-ui/attachment-part.d.ts +19 -0
- package/dist/components/bs-ui/attachment-part.d.ts.map +1 -0
- package/dist/components/bs-ui/attachments-previewer.d.ts +18 -0
- package/dist/components/bs-ui/attachments-previewer.d.ts.map +1 -0
- package/dist/components/bs-ui/base-button.d.ts +8 -0
- package/dist/components/bs-ui/base-button.d.ts.map +1 -0
- package/dist/components/bs-ui/border-animation.d.ts +23 -0
- package/dist/components/bs-ui/border-animation.d.ts.map +1 -0
- package/dist/components/bs-ui/border-color-animation.d.ts +11 -0
- package/dist/components/bs-ui/border-color-animation.d.ts.map +1 -0
- package/dist/components/bs-ui/bot-avatar-name.d.ts +6 -0
- package/dist/components/bs-ui/bot-avatar-name.d.ts.map +1 -0
- package/dist/components/bs-ui/bot-icon.d.ts +5 -0
- package/dist/components/bs-ui/bot-icon.d.ts.map +1 -0
- package/dist/components/bs-ui/bs-icons.d.ts +65 -0
- package/dist/components/bs-ui/bs-icons.d.ts.map +1 -0
- package/dist/components/bs-ui/card-field.d.ts +11 -0
- package/dist/components/bs-ui/card-field.d.ts.map +1 -0
- package/dist/components/bs-ui/card.d.ts +11 -0
- package/dist/components/bs-ui/card.d.ts.map +1 -0
- package/dist/components/bs-ui/chat-area-header.d.ts +13 -0
- package/dist/components/bs-ui/chat-area-header.d.ts.map +1 -0
- package/dist/components/bs-ui/circle-checker.d.ts +10 -0
- package/dist/components/bs-ui/circle-checker.d.ts.map +1 -0
- package/dist/components/bs-ui/collapsible-txt-msg.d.ts +11 -0
- package/dist/components/bs-ui/collapsible-txt-msg.d.ts.map +1 -0
- package/dist/components/bs-ui/confirm-dialog.d.ts +26 -0
- package/dist/components/bs-ui/confirm-dialog.d.ts.map +1 -0
- package/dist/components/bs-ui/fields-design-info-table.d.ts +7 -0
- package/dist/components/bs-ui/fields-design-info-table.d.ts.map +1 -0
- package/dist/components/bs-ui/fields-generating-indicator.d.ts +6 -0
- package/dist/components/bs-ui/fields-generating-indicator.d.ts.map +1 -0
- package/dist/components/bs-ui/fields-portal.d.ts +8 -0
- package/dist/components/bs-ui/fields-portal.d.ts.map +1 -0
- package/dist/components/bs-ui/fields-previewer.d.ts +18 -0
- package/dist/components/bs-ui/fields-previewer.d.ts.map +1 -0
- package/dist/components/bs-ui/font-icon.d.ts +6 -0
- package/dist/components/bs-ui/font-icon.d.ts.map +1 -0
- package/dist/components/bs-ui/form-info-editor.d.ts +37 -0
- package/dist/components/bs-ui/form-info-editor.d.ts.map +1 -0
- package/dist/components/bs-ui/formula-tag.d.ts +8 -0
- package/dist/components/bs-ui/formula-tag.d.ts.map +1 -0
- package/dist/components/bs-ui/generate-animation.d.ts +5 -0
- package/dist/components/bs-ui/generate-animation.d.ts.map +1 -0
- package/dist/components/bs-ui/icon-btn.d.ts +9 -0
- package/dist/components/bs-ui/icon-btn.d.ts.map +1 -0
- package/dist/components/bs-ui/img-part.d.ts +10 -0
- package/dist/components/bs-ui/img-part.d.ts.map +1 -0
- package/dist/components/bs-ui/line-checker.d.ts +19 -0
- package/dist/components/bs-ui/line-checker.d.ts.map +1 -0
- package/dist/components/bs-ui/linear-gradient-border-btn.d.ts +10 -0
- package/dist/components/bs-ui/linear-gradient-border-btn.d.ts.map +1 -0
- package/dist/components/bs-ui/linear-gradient-color-bg-animation.d.ts +8 -0
- package/dist/components/bs-ui/linear-gradient-color-bg-animation.d.ts.map +1 -0
- package/dist/components/bs-ui/number-part.d.ts +9 -0
- package/dist/components/bs-ui/number-part.d.ts.map +1 -0
- package/dist/components/bs-ui/option-item.d.ts +9 -0
- package/dist/components/bs-ui/option-item.d.ts.map +1 -0
- package/dist/components/bs-ui/previewer-header.d.ts +20 -0
- package/dist/components/bs-ui/previewer-header.d.ts.map +1 -0
- package/dist/components/bs-ui/primary-confirm-btn.d.ts +10 -0
- package/dist/components/bs-ui/primary-confirm-btn.d.ts.map +1 -0
- package/dist/components/bs-ui/primary-entry-btn.d.ts +9 -0
- package/dist/components/bs-ui/primary-entry-btn.d.ts.map +1 -0
- package/dist/components/bs-ui/scroll-to-bottom-btn.d.ts +6 -0
- package/dist/components/bs-ui/scroll-to-bottom-btn.d.ts.map +1 -0
- package/dist/components/bs-ui/split-line.d.ts +5 -0
- package/dist/components/bs-ui/split-line.d.ts.map +1 -0
- package/dist/components/bs-ui/square-checker.d.ts +15 -0
- package/dist/components/bs-ui/square-checker.d.ts.map +1 -0
- package/dist/components/bs-ui/tab-radio-group.d.ts +19 -0
- package/dist/components/bs-ui/tab-radio-group.d.ts.map +1 -0
- package/dist/components/bs-ui/tooltip.d.ts +6 -0
- package/dist/components/bs-ui/tooltip.d.ts.map +1 -0
- package/dist/components/bs-ui/user-txt-msg-bubble.d.ts +6 -0
- package/dist/components/bs-ui/user-txt-msg-bubble.d.ts.map +1 -0
- package/dist/components/bs-ui/warning-msg.d.ts +6 -0
- package/dist/components/bs-ui/warning-msg.d.ts.map +1 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/button.d.ts +12 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/dialog.d.ts +24 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/icons.d.ts +176 -0
- package/dist/components/ui/icons.d.ts.map +1 -0
- package/dist/components/ui/input-group.d.ts +17 -0
- package/dist/components/ui/input-group.d.ts.map +1 -0
- package/dist/components/ui/input.d.ts +4 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/one-time-click-btn.d.ts +4 -0
- package/dist/components/ui/one-time-click-btn.d.ts.map +1 -0
- package/dist/components/ui/select.d.ts +14 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/spinner.d.ts +3 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/textarea.d.ts +4 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/tooltip.d.ts +13 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/web-comp/fields-previewer-web-component.d.ts +60 -0
- package/dist/components/web-comp/fields-previewer-web-component.d.ts.map +1 -0
- package/dist/const/index.d.ts +5 -0
- package/dist/const/index.d.ts.map +1 -0
- package/dist/const/ui.d.ts +7 -0
- package/dist/const/ui.d.ts.map +1 -0
- package/dist/hooks/use-chat-preference.d.ts +3 -0
- package/dist/hooks/use-chat-preference.d.ts.map +1 -0
- package/dist/hooks/use-draggable.d.ts +24 -0
- package/dist/hooks/use-draggable.d.ts.map +1 -0
- package/dist/hooks/use-evt-bus.d.ts +2 -0
- package/dist/hooks/use-evt-bus.d.ts.map +1 -0
- package/dist/hooks/use-evt.d.ts +3 -0
- package/dist/hooks/use-evt.d.ts.map +1 -0
- package/dist/hooks/use-frame-mode.d.ts +20 -0
- package/dist/hooks/use-frame-mode.d.ts.map +1 -0
- package/dist/hooks/use-merged-chat.d.ts +7 -0
- package/dist/hooks/use-merged-chat.d.ts.map +1 -0
- package/dist/hooks/use-msg-status-broadcast.d.ts +3 -0
- package/dist/hooks/use-msg-status-broadcast.d.ts.map +1 -0
- package/dist/hooks/use-plugin-component.d.ts +5 -0
- package/dist/hooks/use-plugin-component.d.ts.map +1 -0
- package/dist/hooks/use-plugin-ctx.d.ts +3 -0
- package/dist/hooks/use-plugin-ctx.d.ts.map +1 -0
- package/dist/hooks/use-plugin-custom-components.d.ts +5 -0
- package/dist/hooks/use-plugin-custom-components.d.ts.map +1 -0
- package/dist/hooks/use-plugin-life-cycle-chain-runner.d.ts +5 -0
- package/dist/hooks/use-plugin-life-cycle-chain-runner.d.ts.map +1 -0
- package/dist/hooks/use-plugin-list.d.ts +2 -0
- package/dist/hooks/use-plugin-list.d.ts.map +1 -0
- package/dist/hooks/use-plugin.d.ts +2 -0
- package/dist/hooks/use-plugin.d.ts.map +1 -0
- package/dist/hooks/use-scroll-to-bottom.d.ts +9 -0
- package/dist/hooks/use-scroll-to-bottom.d.ts.map +1 -0
- package/dist/hooks/use-shadow.d.ts +25 -0
- package/dist/hooks/use-shadow.d.ts.map +1 -0
- package/dist/hooks/use-toast.d.ts +3 -0
- package/dist/hooks/use-toast.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/clone.d.ts +32 -0
- package/dist/lib/clone.d.ts.map +1 -0
- package/dist/lib/event-emitter.d.ts +39 -0
- package/dist/lib/event-emitter.d.ts.map +1 -0
- package/dist/lib/parse-design-doc.d.ts +16 -0
- package/dist/lib/parse-design-doc.d.ts.map +1 -0
- package/dist/lib/readonly.d.ts +14 -0
- package/dist/lib/readonly.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +55 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/plugins/form-builder-base-plugin/const.d.ts +3 -0
- package/dist/plugins/form-builder-base-plugin/const.d.ts.map +1 -0
- package/dist/plugins/form-builder-base-plugin/index.d.ts +7 -0
- package/dist/plugins/form-builder-base-plugin/index.d.ts.map +1 -0
- package/dist/plugins/form-builder-base-plugin/types.d.ts +12 -0
- package/dist/plugins/form-builder-base-plugin/types.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/components/create-form-confirm.d.ts +7 -0
- package/dist/plugins/form-builder-plugin/components/create-form-confirm.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/components/design-doc-part.d.ts +4 -0
- package/dist/plugins/form-builder-plugin/components/design-doc-part.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/components/design-info.d.ts +6 -0
- package/dist/plugins/form-builder-plugin/components/design-info.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/components/entry-btn.d.ts +3 -0
- package/dist/plugins/form-builder-plugin/components/entry-btn.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/components/fields-part.d.ts +4 -0
- package/dist/plugins/form-builder-plugin/components/fields-part.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/components/follow-up.d.ts +3 -0
- package/dist/plugins/form-builder-plugin/components/follow-up.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/components/msg-part.d.ts +3 -0
- package/dist/plugins/form-builder-plugin/components/msg-part.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/components/opening-lines.d.ts +3 -0
- package/dist/plugins/form-builder-plugin/components/opening-lines.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/components/suggestion-part.d.ts +5 -0
- package/dist/plugins/form-builder-plugin/components/suggestion-part.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/const/index.d.ts +12 -0
- package/dist/plugins/form-builder-plugin/const/index.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/hooks/index.d.ts +4 -0
- package/dist/plugins/form-builder-plugin/hooks/index.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/hooks/use-fields-confirmed.d.ts +2 -0
- package/dist/plugins/form-builder-plugin/hooks/use-fields-confirmed.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/index.d.ts +30 -0
- package/dist/plugins/form-builder-plugin/index.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/types.d.ts +28 -0
- package/dist/plugins/form-builder-plugin/types.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/utils/get-render-strategy.d.ts +3 -0
- package/dist/plugins/form-builder-plugin/utils/get-render-strategy.d.ts.map +1 -0
- package/dist/plugins/form-builder-plugin/utils/index.d.ts +57 -0
- package/dist/plugins/form-builder-plugin/utils/index.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/batch-filling-data-manager.d.ts +26 -0
- package/dist/plugins/form-filling-plugin/batch-filling-data-manager.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/components/FormFillingOpeningLines.d.ts +3 -0
- package/dist/plugins/form-filling-plugin/components/FormFillingOpeningLines.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/components/avatar.d.ts +5 -0
- package/dist/plugins/form-filling-plugin/components/avatar.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/components/batch-fill-part.d.ts +4 -0
- package/dist/plugins/form-filling-plugin/components/batch-fill-part.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/components/batch-generator-action.d.ts +14 -0
- package/dist/plugins/form-filling-plugin/components/batch-generator-action.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/components/entry-btn.d.ts +3 -0
- package/dist/plugins/form-filling-plugin/components/entry-btn.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/components/first-batch-generating-animation.d.ts +2 -0
- package/dist/plugins/form-filling-plugin/components/first-batch-generating-animation.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/components/generated-data-counter.d.ts +5 -0
- package/dist/plugins/form-filling-plugin/components/generated-data-counter.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/components/mode-select.d.ts +2 -0
- package/dist/plugins/form-filling-plugin/components/mode-select.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/components/msg-part.d.ts +3 -0
- package/dist/plugins/form-filling-plugin/components/msg-part.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/components/non-first-batch-generating-animation.d.ts +2 -0
- package/dist/plugins/form-filling-plugin/components/non-first-batch-generating-animation.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/components/single-fill-part.d.ts +4 -0
- package/dist/plugins/form-filling-plugin/components/single-fill-part.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/const.d.ts +615 -0
- package/dist/plugins/form-filling-plugin/const.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/hooks/use-conversation-id-in-ctx.d.ts +3 -0
- package/dist/plugins/form-filling-plugin/hooks/use-conversation-id-in-ctx.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/hooks/use-fields-data.d.ts +4 -0
- package/dist/plugins/form-filling-plugin/hooks/use-fields-data.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/index.d.ts +22 -0
- package/dist/plugins/form-filling-plugin/index.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/types.d.ts +22 -0
- package/dist/plugins/form-filling-plugin/types.d.ts.map +1 -0
- package/dist/plugins/form-filling-plugin/utils.d.ts +6 -0
- package/dist/plugins/form-filling-plugin/utils.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/components/avatar.d.ts +5 -0
- package/dist/plugins/report-query-plugin/components/avatar.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/components/query-entry-btn.d.ts +3 -0
- package/dist/plugins/report-query-plugin/components/query-entry-btn.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/components/query-msg-part.d.ts +3 -0
- package/dist/plugins/report-query-plugin/components/query-msg-part.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/components/query-opening-lines.d.ts +2 -0
- package/dist/plugins/report-query-plugin/components/query-opening-lines.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/components/result-cards/CreatedSourceMsg.d.ts +7 -0
- package/dist/plugins/report-query-plugin/components/result-cards/CreatedSourceMsg.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/components/result-cards/DataTableCard.d.ts +5 -0
- package/dist/plugins/report-query-plugin/components/result-cards/DataTableCard.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/components/result-cards/DataTableFields.d.ts +18 -0
- package/dist/plugins/report-query-plugin/components/result-cards/DataTableFields.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/components/result-cards/FilterCondition.d.ts +4 -0
- package/dist/plugins/report-query-plugin/components/result-cards/FilterCondition.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/components/result-cards/FormulaField.d.ts +8 -0
- package/dist/plugins/report-query-plugin/components/result-cards/FormulaField.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/const.d.ts +5 -0
- package/dist/plugins/report-query-plugin/const.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/index.d.ts +19 -0
- package/dist/plugins/report-query-plugin/index.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/types.d.ts +18 -0
- package/dist/plugins/report-query-plugin/types.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/utils/build-dash-component.d.ts +17 -0
- package/dist/plugins/report-query-plugin/utils/build-dash-component.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/utils/create-default-dash-styles.d.ts +30 -0
- package/dist/plugins/report-query-plugin/utils/create-default-dash-styles.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/utils/create-default-widget-attr-list.d.ts +60 -0
- package/dist/plugins/report-query-plugin/utils/create-default-widget-attr-list.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/utils/field-enhance.d.ts +31 -0
- package/dist/plugins/report-query-plugin/utils/field-enhance.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/utils/get-field-group.d.ts +208 -0
- package/dist/plugins/report-query-plugin/utils/get-field-group.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/utils/get-field-icon.d.ts +4 -0
- package/dist/plugins/report-query-plugin/utils/get-field-icon.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/utils/get-group-rule.d.ts +4 -0
- package/dist/plugins/report-query-plugin/utils/get-group-rule.d.ts.map +1 -0
- package/dist/plugins/report-query-plugin/utils/index.d.ts +5 -0
- package/dist/plugins/report-query-plugin/utils/index.d.ts.map +1 -0
- package/dist/sdk.impl.d.ts +42 -0
- package/dist/sdk.impl.d.ts.map +1 -0
- package/dist/store/context.d.ts +12 -0
- package/dist/store/context.d.ts.map +1 -0
- package/dist/store/index.d.ts +14 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/stories/AbsFullscreenGradientBg.stories.d.ts +17 -0
- package/dist/stories/AbsFullscreenGradientBg.stories.d.ts.map +1 -0
- package/dist/stories/AttachmentPart.stories.d.ts +23 -0
- package/dist/stories/AttachmentPart.stories.d.ts.map +1 -0
- package/dist/stories/AttachmentPartGroup.stories.d.ts +21 -0
- package/dist/stories/AttachmentPartGroup.stories.d.ts.map +1 -0
- package/dist/stories/AttachmentsPreviewer.stories.d.ts +20 -0
- package/dist/stories/AttachmentsPreviewer.stories.d.ts.map +1 -0
- package/dist/stories/BaseButton.stories.d.ts +18 -0
- package/dist/stories/BaseButton.stories.d.ts.map +1 -0
- package/dist/stories/BorderAnimation.stories.d.ts +21 -0
- package/dist/stories/BorderAnimation.stories.d.ts.map +1 -0
- package/dist/stories/BorderColorAnimation.stories.d.ts +26 -0
- package/dist/stories/BorderColorAnimation.stories.d.ts.map +1 -0
- package/dist/stories/BotAvatarAndName.stories.d.ts +18 -0
- package/dist/stories/BotAvatarAndName.stories.d.ts.map +1 -0
- package/dist/stories/BotIcon.stories.d.ts +17 -0
- package/dist/stories/BotIcon.stories.d.ts.map +1 -0
- package/dist/stories/BsTooltip.stories.d.ts +7 -0
- package/dist/stories/BsTooltip.stories.d.ts.map +1 -0
- package/dist/stories/Card.stories.d.ts +14 -0
- package/dist/stories/Card.stories.d.ts.map +1 -0
- package/dist/stories/CardField.stories.d.ts +13 -0
- package/dist/stories/CardField.stories.d.ts.map +1 -0
- package/dist/stories/ChatAreaHeader.stories.d.ts +14 -0
- package/dist/stories/ChatAreaHeader.stories.d.ts.map +1 -0
- package/dist/stories/CircleChecker.stories.d.ts +21 -0
- package/dist/stories/CircleChecker.stories.d.ts.map +1 -0
- package/dist/stories/CollapsibleTextMsg.stories.d.ts +16 -0
- package/dist/stories/CollapsibleTextMsg.stories.d.ts.map +1 -0
- package/dist/stories/ConfirmDialog.stories.d.ts +61 -0
- package/dist/stories/ConfirmDialog.stories.d.ts.map +1 -0
- package/dist/stories/DashWidgetIcon.stories.d.ts +13 -0
- package/dist/stories/DashWidgetIcon.stories.d.ts.map +1 -0
- package/dist/stories/FormInfoEditor.stories.d.ts +15 -0
- package/dist/stories/FormInfoEditor.stories.d.ts.map +1 -0
- package/dist/stories/FormulaField.stories.d.ts +24 -0
- package/dist/stories/FormulaField.stories.d.ts.map +1 -0
- package/dist/stories/FormulaTag.stories.d.ts +37 -0
- package/dist/stories/FormulaTag.stories.d.ts.map +1 -0
- package/dist/stories/GenerateAnimation.stories.d.ts +17 -0
- package/dist/stories/GenerateAnimation.stories.d.ts.map +1 -0
- package/dist/stories/IconBtn.stories.d.ts +15 -0
- package/dist/stories/IconBtn.stories.d.ts.map +1 -0
- package/dist/stories/IconLib.d.ts +12 -0
- package/dist/stories/IconLib.d.ts.map +1 -0
- package/dist/stories/Icons.stories.d.ts +24 -0
- package/dist/stories/Icons.stories.d.ts.map +1 -0
- package/dist/stories/ImgMsgPart.stories.d.ts +20 -0
- package/dist/stories/ImgMsgPart.stories.d.ts.map +1 -0
- package/dist/stories/LineChecker.stories.d.ts +23 -0
- package/dist/stories/LineChecker.stories.d.ts.map +1 -0
- package/dist/stories/LinearGradientBorderBtn.stories.d.ts +22 -0
- package/dist/stories/LinearGradientBorderBtn.stories.d.ts.map +1 -0
- package/dist/stories/LinearGradientColorBgAnimation.stories.d.ts +23 -0
- package/dist/stories/LinearGradientColorBgAnimation.stories.d.ts.map +1 -0
- package/dist/stories/NumbersMsgPart.stories.d.ts +19 -0
- package/dist/stories/NumbersMsgPart.stories.d.ts.map +1 -0
- package/dist/stories/OptionItem.stories.d.ts +20 -0
- package/dist/stories/OptionItem.stories.d.ts.map +1 -0
- package/dist/stories/PreviewerHeader.stories.d.ts +12 -0
- package/dist/stories/PreviewerHeader.stories.d.ts.map +1 -0
- package/dist/stories/PrimaryConfirmBtn.stories.d.ts +19 -0
- package/dist/stories/PrimaryConfirmBtn.stories.d.ts.map +1 -0
- package/dist/stories/PrimaryEntryBtn.stories.d.ts +26 -0
- package/dist/stories/PrimaryEntryBtn.stories.d.ts.map +1 -0
- package/dist/stories/ScrollToBottom.stories.d.ts +15 -0
- package/dist/stories/ScrollToBottom.stories.d.ts.map +1 -0
- package/dist/stories/SplitLine.stories.d.ts +9 -0
- package/dist/stories/SplitLine.stories.d.ts.map +1 -0
- package/dist/stories/SquareChecker.stories.d.ts +26 -0
- package/dist/stories/SquareChecker.stories.d.ts.map +1 -0
- package/dist/stories/TabRadioGroup.stories.d.ts +18 -0
- package/dist/stories/TabRadioGroup.stories.d.ts.map +1 -0
- package/dist/stories/UserTextMsgBubble.stories.d.ts +14 -0
- package/dist/stories/UserTextMsgBubble.stories.d.ts.map +1 -0
- package/dist/stories/WarningMessage.stories.d.ts +16 -0
- package/dist/stories/WarningMessage.stories.d.ts.map +1 -0
- package/dist/stories/fields-design-info-table.stories.d.ts +14 -0
- package/dist/stories/fields-design-info-table.stories.d.ts.map +1 -0
- package/dist/stories/fields-generating.stories.d.ts +20 -0
- package/dist/stories/fields-generating.stories.d.ts.map +1 -0
- package/dist/stories/fields-previewer.stories.d.ts +19 -0
- package/dist/stories/fields-previewer.stories.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/chat.tsx +63 -2
- package/src/components/biz-comp/FakeBotMsg.tsx +4 -1
- package/src/components/biz-comp/chat-client.tsx +2 -2
- package/src/components/biz-comp/markdown-part.tsx +17 -4
- package/src/components/biz-comp/multi-modal-input/index.tsx +28 -9
- package/src/components/biz-comp/preview-message-wrapper.tsx +3 -1
- package/src/components/biz-comp/preview-message.tsx +40 -3
- package/src/components/bs-ui/attachment-part-group.tsx +5 -2
- package/src/components/bs-ui/attachment-part.tsx +14 -9
- package/src/components/bs-ui/attachments-previewer.tsx +2 -2
- package/src/components/bs-ui/base-button.tsx +14 -4
- package/src/components/bs-ui/border-animation.tsx +107 -0
- package/src/components/bs-ui/bs-icons.tsx +6 -0
- package/src/components/bs-ui/confirm-dialog.tsx +17 -11
- package/src/components/bs-ui/fields-previewer.tsx +16 -8
- package/src/components/bs-ui/img-part.tsx +4 -2
- package/src/components/bs-ui/previewer-header.tsx +26 -7
- package/src/components/bs-ui/primary-entry-btn.tsx +2 -1
- package/src/index.tsx +0 -1
- package/src/lib/utils.ts +94 -2
- package/src/plugins/form-builder-plugin/components/create-form-confirm.tsx +0 -2
- package/src/plugins/form-builder-plugin/components/design-doc-part.tsx +19 -0
- package/src/plugins/form-builder-plugin/components/fields-part.tsx +78 -0
- package/src/plugins/form-builder-plugin/components/msg-part.tsx +20 -165
- package/src/plugins/form-builder-plugin/components/suggestion-part.tsx +62 -0
- package/src/plugins/form-builder-plugin/hooks/index.tsx +50 -0
- package/src/plugins/form-builder-plugin/index.ts +39 -30
- package/src/plugins/form-builder-plugin/types.ts +19 -2
- package/src/plugins/form-builder-plugin/utils/get-render-strategy.ts +27 -0
- package/src/plugins/form-builder-plugin/utils/index.ts +44 -37
- package/src/plugins/form-filling-plugin/components/FormFillingOpeningLines.tsx +4 -0
- package/src/plugins/form-filling-plugin/components/batch-fill-part.tsx +17 -0
- package/src/plugins/form-filling-plugin/components/batch-generator-action.tsx +6 -1
- package/src/plugins/form-filling-plugin/components/entry-btn.tsx +1 -1
- package/src/plugins/form-filling-plugin/components/first-batch-generating-animation.tsx +6 -16
- package/src/plugins/form-filling-plugin/components/msg-part.tsx +39 -122
- package/src/plugins/form-filling-plugin/components/non-first-batch-generating-animation.tsx +9 -19
- package/src/plugins/form-filling-plugin/components/single-fill-part.tsx +42 -0
- package/src/plugins/form-filling-plugin/hooks/use-conversation-id-in-ctx.ts +13 -0
- package/src/plugins/form-filling-plugin/hooks/use-fields-data.ts +110 -0
- package/src/plugins/form-filling-plugin/index.ts +49 -43
- package/src/plugins/form-filling-plugin/types.ts +19 -1
- package/src/plugins/report-query-plugin/components/query-msg-part.tsx +13 -4
- package/src/plugins/report-query-plugin/index.ts +20 -11
- package/src/sdk.impl.tsx +54 -7
- package/src/store/index.ts +8 -1
- package/src/stories/BorderAnimation.stories.tsx +116 -0
- package/src/stories/PreviewerHeader.stories.tsx +24 -0
- package/src/style.css +25 -0
- package/src/plugins/form-builder-plugin/hooks/index.ts +0 -0
- package/src/plugins/general-model-form-builder-plugin/components/confirmer.tsx +0 -90
- package/src/plugins/general-model-form-builder-plugin/components/ghost-evt-dispatcher.tsx +0 -69
- package/src/plugins/general-model-form-builder-plugin/components/msg-part.tsx +0 -147
- package/src/plugins/general-model-form-builder-plugin/components/new-confirmer.tsx +0 -191
- package/src/plugins/general-model-form-builder-plugin/const.ts +0 -3
- package/src/plugins/general-model-form-builder-plugin/index.ts +0 -20
- package/src/plugins/general-model-form-builder-plugin/types.ts +0 -1
package/src/sdk.impl.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { ChatStore, createStore, setupStoreSubscriptions } from '@/store';
|
|
|
3
3
|
import { ChatClient } from '@/components/biz-comp/chat-client';
|
|
4
4
|
import './style.css';
|
|
5
5
|
import {
|
|
6
|
+
ChatMessage,
|
|
6
7
|
DeepReadonly,
|
|
7
8
|
IChatSDK,
|
|
8
9
|
IChatSDKOption,
|
|
@@ -10,18 +11,25 @@ import {
|
|
|
10
11
|
type PluginRegistryEntry,
|
|
11
12
|
} from '@baishuyun/types';
|
|
12
13
|
import { EvtBus } from './lib/event-emitter';
|
|
14
|
+
import type { UseChatHelpers } from '@ai-sdk/react';
|
|
15
|
+
import { ChatRequestOptions, JSONValue } from 'ai';
|
|
13
16
|
|
|
14
17
|
export class ChatSDK implements IChatSDK {
|
|
15
18
|
static instances: ChatSDK[] = [];
|
|
16
19
|
|
|
17
20
|
private root: ReturnType<typeof createRoot> | undefined;
|
|
18
21
|
private readonly Store: ChatStore;
|
|
22
|
+
private chatComponentReadyResolve!: () => void;
|
|
23
|
+
private chatComponentReadyPromise: Promise<void>;
|
|
19
24
|
|
|
20
25
|
public options: IChatSDKOption;
|
|
21
26
|
|
|
22
27
|
public eventBus = new EvtBus() as IEvtBus;
|
|
23
28
|
|
|
24
29
|
constructor(options: IChatSDKOption) {
|
|
30
|
+
this.chatComponentReadyPromise = new Promise((resolve) => {
|
|
31
|
+
this.chatComponentReadyResolve = resolve;
|
|
32
|
+
});
|
|
25
33
|
this.options = options;
|
|
26
34
|
|
|
27
35
|
const renderEl = document.createElement('div');
|
|
@@ -92,10 +100,56 @@ export class ChatSDK implements IChatSDK {
|
|
|
92
100
|
return undefined;
|
|
93
101
|
}
|
|
94
102
|
|
|
103
|
+
markChatComponentReady() {
|
|
104
|
+
this.chatComponentReadyResolve();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
whenChatComponentReady(): Promise<void> {
|
|
108
|
+
return this.chatComponentReadyPromise;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
_sendMessage?: UseChatHelpers<ChatMessage>['sendMessage'];
|
|
112
|
+
_appendFakeBotMessage?: (text: string) => void;
|
|
113
|
+
|
|
114
|
+
public appendBotMessage = async (text: string) => {
|
|
115
|
+
await this.whenChatComponentReady();
|
|
116
|
+
this._appendFakeBotMessage?.(text);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
public sendMessage = async (text: string, customVariable: JSONValue, options: ChatRequestOptions) => {
|
|
120
|
+
await this.whenChatComponentReady();
|
|
121
|
+
|
|
122
|
+
// if is streaming, return;
|
|
123
|
+
this._sendMessage?.(
|
|
124
|
+
{ text }, // First arg: message data
|
|
125
|
+
{ // Second arg: options
|
|
126
|
+
...options,
|
|
127
|
+
body: {
|
|
128
|
+
...(options?.body || {}),
|
|
129
|
+
userVar: customVariable,
|
|
130
|
+
},
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
95
135
|
public clearChatHistory() {
|
|
96
136
|
this.Store.getState().clearMessages();
|
|
97
137
|
}
|
|
98
138
|
|
|
139
|
+
public getLastBotMsg(textOnly?: boolean): ChatMessage | string | undefined {
|
|
140
|
+
const lastBotMessage = this.Store.getState().lastBotMessage;
|
|
141
|
+
if (!lastBotMessage) return undefined;
|
|
142
|
+
|
|
143
|
+
if (textOnly) {
|
|
144
|
+
return lastBotMessage.parts
|
|
145
|
+
.filter((part) => part.type === 'text')
|
|
146
|
+
.map((part) => (part as any).text)
|
|
147
|
+
.join('');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return lastBotMessage;
|
|
151
|
+
}
|
|
152
|
+
|
|
99
153
|
public getFullStyle() {
|
|
100
154
|
return this.options.style;
|
|
101
155
|
}
|
|
@@ -121,13 +175,6 @@ export class ChatSDK implements IChatSDK {
|
|
|
121
175
|
};
|
|
122
176
|
}
|
|
123
177
|
|
|
124
|
-
public setUserId(userId: string) {
|
|
125
|
-
this.options.chatApiHeaders = {
|
|
126
|
-
...this.options.chatApiHeaders,
|
|
127
|
-
'X-User-Id': userId,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
178
|
public getChatStatus() {
|
|
132
179
|
return this.Store.getState().chatStatus;
|
|
133
180
|
}
|
package/src/store/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
ChatStatus,
|
|
7
7
|
IChatSDKOption,
|
|
8
8
|
IEvtBus,
|
|
9
|
+
ChatMessage,
|
|
9
10
|
} from '@baishuyun/types';
|
|
10
11
|
import { ChatSDK } from '..';
|
|
11
12
|
import { create } from 'zustand';
|
|
@@ -24,6 +25,8 @@ export const createStore = (sdkInst: ChatSDK) => {
|
|
|
24
25
|
|
|
25
26
|
msgClearTimestamp: Date.now(),
|
|
26
27
|
globalFakeLoadingMessage: '',
|
|
28
|
+
lastBotMessage: undefined,
|
|
29
|
+
botInfo: sdkInst.options?.botInfo,
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
return create<ChatContextType>()(
|
|
@@ -104,6 +107,11 @@ export const createStore = (sdkInst: ChatSDK) => {
|
|
|
104
107
|
newButtons.set(id, { ...existing, visible });
|
|
105
108
|
return { chatEntryButtons: newButtons };
|
|
106
109
|
}),
|
|
110
|
+
|
|
111
|
+
setLastBotMessage: (message?: ChatMessage | undefined) =>
|
|
112
|
+
set(() => ({
|
|
113
|
+
lastBotMessage: message,
|
|
114
|
+
})),
|
|
107
115
|
}))
|
|
108
116
|
);
|
|
109
117
|
};
|
|
@@ -118,7 +126,6 @@ export const setupStoreSubscriptions = (store: ChatStore, option: IChatSDKOption
|
|
|
118
126
|
option.onChatStatusChange?.(status);
|
|
119
127
|
// @deprecated, will be removed in future versions
|
|
120
128
|
eventBus.emit('chat-area-visibility-change', { visible, status });
|
|
121
|
-
console.log('chat status changed:', status);
|
|
122
129
|
}
|
|
123
130
|
);
|
|
124
131
|
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import { BorderAnimation } from '@/components/bs-ui/border-animation';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Animation/BorderAnimation',
|
|
7
|
+
component: BorderAnimation,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
},
|
|
12
|
+
args: {},
|
|
13
|
+
} satisfies Meta<typeof BorderAnimation>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
children: (
|
|
21
|
+
<div className="flex items-center gap-[6px] bg-white px-[10px] py-[4px] rounded-[4px]">
|
|
22
|
+
<span className="text-[#999] text-[14px]">
|
|
23
|
+
数据生成中,可点击下方按钮暂停
|
|
24
|
+
</span>
|
|
25
|
+
</div>
|
|
26
|
+
),
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const WithCustomContent: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
children: (
|
|
33
|
+
<div className="bg-white px-4 py-3 rounded-[4px]">
|
|
34
|
+
<h3 className="text-[16px] font-medium text-[#333]">标题内容</h3>
|
|
35
|
+
<p className="text-[14px] text-[#666] mt-1">
|
|
36
|
+
这是一段描述文字,展示边框动画效果。
|
|
37
|
+
</p>
|
|
38
|
+
</div>
|
|
39
|
+
),
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const LargerRadius: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
borderRadius: 12,
|
|
46
|
+
children: (
|
|
47
|
+
<div className="bg-white px-4 py-3 rounded-[12px]">
|
|
48
|
+
<p className="text-[14px] text-[#666]">圆角 12px 的边框动画</p>
|
|
49
|
+
</div>
|
|
50
|
+
),
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const SlowAnimation: Story = {
|
|
55
|
+
args: {
|
|
56
|
+
duration: 5,
|
|
57
|
+
children: (
|
|
58
|
+
<div className="bg-white px-4 py-3 rounded-[4px]">
|
|
59
|
+
<p className="text-[14px] text-[#666]">慢速动画(5秒一圈)</p>
|
|
60
|
+
</div>
|
|
61
|
+
),
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const FastAnimation: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
duration: 1,
|
|
68
|
+
children: (
|
|
69
|
+
<div className="bg-white px-4 py-3 rounded-[4px]">
|
|
70
|
+
<p className="text-[14px] text-[#666]">快速动画(1秒一圈)</p>
|
|
71
|
+
</div>
|
|
72
|
+
),
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const CustomGradient: Story = {
|
|
77
|
+
args: {
|
|
78
|
+
gradient:
|
|
79
|
+
'linear-gradient(180deg, #FF84B4 0%, #FF0265 50%, #FFB1FA 100%)',
|
|
80
|
+
children: (
|
|
81
|
+
<div className="bg-white px-4 py-3 rounded-[4px]">
|
|
82
|
+
<p className="text-[14px] text-[#666]">自定义渐变色(粉色系)</p>
|
|
83
|
+
</div>
|
|
84
|
+
),
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const CustomClassName: Story = {
|
|
89
|
+
args: {
|
|
90
|
+
className: 'w-[300px]',
|
|
91
|
+
children: (
|
|
92
|
+
<div className="bg-white px-4 py-3 rounded-[4px]">
|
|
93
|
+
<p className="text-[14px] text-[#666]">自定义宽度 300px</p>
|
|
94
|
+
</div>
|
|
95
|
+
),
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const FullWidth: Story = {
|
|
100
|
+
decorators: [
|
|
101
|
+
(Story) => (
|
|
102
|
+
<div style={{ width: '500px' }}>
|
|
103
|
+
<Story />
|
|
104
|
+
</div>
|
|
105
|
+
),
|
|
106
|
+
],
|
|
107
|
+
args: {
|
|
108
|
+
children: (
|
|
109
|
+
<div className="bg-white px-4 py-3 rounded-[4px]">
|
|
110
|
+
<p className="text-[14px] text-[#666]">
|
|
111
|
+
宽度 100%,自动填满父容器
|
|
112
|
+
</p>
|
|
113
|
+
</div>
|
|
114
|
+
),
|
|
115
|
+
},
|
|
116
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { PreviewerHeader } from '@/components/bs-ui/previewer-header';
|
|
3
|
+
import { TooltipProvider } from '@radix-ui/react-tooltip';
|
|
3
4
|
|
|
4
5
|
const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
5
6
|
|
|
@@ -10,6 +11,13 @@ const meta: Meta<typeof PreviewerHeader> = {
|
|
|
10
11
|
parameters: {
|
|
11
12
|
layout: 'centered',
|
|
12
13
|
},
|
|
14
|
+
decorators: [
|
|
15
|
+
(Story) => (
|
|
16
|
+
<TooltipProvider delayDuration={100}>
|
|
17
|
+
<Story />
|
|
18
|
+
</TooltipProvider>
|
|
19
|
+
),
|
|
20
|
+
],
|
|
13
21
|
};
|
|
14
22
|
export default meta;
|
|
15
23
|
type Story = StoryObj<typeof meta>;
|
|
@@ -65,3 +73,19 @@ export const LoadingOnSave: Story = {
|
|
|
65
73
|
style: { width: 700 },
|
|
66
74
|
},
|
|
67
75
|
};
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
export const ShowClear: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
title: '编辑表单',
|
|
81
|
+
onClear: () => {
|
|
82
|
+
alert('清除点击');
|
|
83
|
+
},
|
|
84
|
+
onSave: async () => {
|
|
85
|
+
await delay(2000);
|
|
86
|
+
alert('保存完成');
|
|
87
|
+
},
|
|
88
|
+
onCancel: () => alert('取消点击'),
|
|
89
|
+
style: { width: 700 },
|
|
90
|
+
},
|
|
91
|
+
};
|
package/src/style.css
CHANGED
|
@@ -163,6 +163,31 @@
|
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
@utility rounded-inherit {
|
|
167
|
+
border-radius: inherit;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@layer components {
|
|
171
|
+
.gradient-border {
|
|
172
|
+
@apply relative;
|
|
173
|
+
}
|
|
174
|
+
.gradient-border::before {
|
|
175
|
+
content: '';
|
|
176
|
+
@apply absolute inset-0 rounded-inherit p-[1px] pointer-events-none;
|
|
177
|
+
background: linear-gradient(
|
|
178
|
+
90deg,
|
|
179
|
+
rgb(132, 180, 255) 0%,
|
|
180
|
+
rgb(2, 101, 255) 50%,
|
|
181
|
+
rgb(177, 250, 255) 100%
|
|
182
|
+
);
|
|
183
|
+
-webkit-mask:
|
|
184
|
+
linear-gradient(#fff 0 0) content-box,
|
|
185
|
+
linear-gradient(#fff 0 0);
|
|
186
|
+
-webkit-mask-composite: xor;
|
|
187
|
+
mask-composite: exclude;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
166
191
|
.prose {
|
|
167
192
|
--tw-prose-body: #121111;
|
|
168
193
|
}
|
|
File without changes
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { MessageContent } from '../../../components/biz-comp/message-content';
|
|
2
|
-
import { Button } from '@/components/ui/button';
|
|
3
|
-
import { ConfirmTools } from '@baishuyun/agents';
|
|
4
|
-
import type { ConfirmTypes } from '@baishuyun/types';
|
|
5
|
-
import { ChatRequestOptions, ToolUIPart } from 'ai';
|
|
6
|
-
import { Suggestions } from '../../../components/biz-comp/suggestions';
|
|
7
|
-
|
|
8
|
-
export const Confirmer = ({
|
|
9
|
-
input,
|
|
10
|
-
type,
|
|
11
|
-
onConfirm,
|
|
12
|
-
onCancel,
|
|
13
|
-
}: {
|
|
14
|
-
type: ConfirmTypes;
|
|
15
|
-
onConfirm: (opt?: ChatRequestOptions, msg?: string) => void;
|
|
16
|
-
onCancel?: (opt?: ChatRequestOptions) => void;
|
|
17
|
-
} & Pick<ToolUIPart<ConfirmTools>, 'input'>) => {
|
|
18
|
-
// 建表、保存字段
|
|
19
|
-
if (type === 'tool-confirmToCreateForm' || type === 'tool-confirmToSaveCheckedFields') {
|
|
20
|
-
return (
|
|
21
|
-
<MessageContent className="gap-0 py-0" compact>
|
|
22
|
-
<Button
|
|
23
|
-
onClick={() => {
|
|
24
|
-
onConfirm({
|
|
25
|
-
body: {
|
|
26
|
-
stage: type === 'tool-confirmToCreateForm' ? 'build' : 'continue',
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
}}
|
|
30
|
-
>
|
|
31
|
-
确认
|
|
32
|
-
</Button>
|
|
33
|
-
</MessageContent>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// 是否继续创建关联表
|
|
38
|
-
if (type === 'tool-confirmToCreateRelatedForm' && input.forms.length > 0) {
|
|
39
|
-
return (
|
|
40
|
-
<MessageContent className="gap-0 py-0" compact>
|
|
41
|
-
<Button
|
|
42
|
-
onClick={() => {
|
|
43
|
-
onConfirm({
|
|
44
|
-
body: { stage: 'continue ' },
|
|
45
|
-
});
|
|
46
|
-
}}
|
|
47
|
-
>
|
|
48
|
-
确认
|
|
49
|
-
</Button>
|
|
50
|
-
<Button
|
|
51
|
-
onClick={() => {
|
|
52
|
-
onCancel && onCancel();
|
|
53
|
-
}}
|
|
54
|
-
>
|
|
55
|
-
跳过
|
|
56
|
-
</Button>
|
|
57
|
-
</MessageContent>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// 继续为关联表创建字段
|
|
62
|
-
if (type === 'tool-confirmToCreateFieldsForRelatedForm') {
|
|
63
|
-
return (
|
|
64
|
-
<MessageContent className="gap-0 py-0" compact>
|
|
65
|
-
{
|
|
66
|
-
<Suggestions
|
|
67
|
-
items={input.forms}
|
|
68
|
-
onSelect={(name) => {
|
|
69
|
-
onConfirm(
|
|
70
|
-
{
|
|
71
|
-
body: { stage: 'design' },
|
|
72
|
-
},
|
|
73
|
-
name
|
|
74
|
-
);
|
|
75
|
-
}}
|
|
76
|
-
/>
|
|
77
|
-
}
|
|
78
|
-
<Button
|
|
79
|
-
onClick={() => {
|
|
80
|
-
onCancel && onCancel();
|
|
81
|
-
}}
|
|
82
|
-
>
|
|
83
|
-
取消
|
|
84
|
-
</Button>
|
|
85
|
-
</MessageContent>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return null;
|
|
90
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { ConfirmTypes } from '@baishuyun/types';
|
|
2
|
-
import { memo, useEffect } from 'react';
|
|
3
|
-
import { FakeBotMessage } from '../../../components/biz-comp/FakeBotMsg';
|
|
4
|
-
import { usePlugin } from '@/hooks/use-plugin';
|
|
5
|
-
import { PLUGIN_NAME, DEFAULT_EVT } from '../const';
|
|
6
|
-
import { ModelFormBuilderPlugin } from '..';
|
|
7
|
-
|
|
8
|
-
const eventFactory: Record<
|
|
9
|
-
ConfirmTypes,
|
|
10
|
-
(plugin: ModelFormBuilderPlugin) => (output: string, input: any) => CustomEvent
|
|
11
|
-
> = {
|
|
12
|
-
'tool-confirmToCreateForm': (plugin) => (_: string, input: any) => {
|
|
13
|
-
return plugin.publicMethods!.dispatchCreateFormEvent(input.formName);
|
|
14
|
-
},
|
|
15
|
-
'tool-confirmToSaveCheckedFields': (plugin) => (_: string) => {
|
|
16
|
-
return plugin.publicMethods!.dispatchSaveFieldsEvent();
|
|
17
|
-
},
|
|
18
|
-
'tool-confirmToCreateFieldsForRelatedForm': (_) => (_: string) => {
|
|
19
|
-
// return plugin.publicMethods!.dispatchCreateFieldsForRelatedFormEvent();
|
|
20
|
-
// new CustomEvent("form-builder-RelatedFormFieldsConfirmed"),
|
|
21
|
-
return DEFAULT_EVT;
|
|
22
|
-
},
|
|
23
|
-
'tool-confirmToCreateRelatedForm': (_) => (_: string) => {
|
|
24
|
-
return DEFAULT_EVT;
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const BaseDispatcher = ({
|
|
29
|
-
output,
|
|
30
|
-
input,
|
|
31
|
-
type,
|
|
32
|
-
}: {
|
|
33
|
-
output: string;
|
|
34
|
-
input: any;
|
|
35
|
-
type: ConfirmTypes;
|
|
36
|
-
}) => {
|
|
37
|
-
const plugin = usePlugin(PLUGIN_NAME);
|
|
38
|
-
if (!plugin) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
const eventCreator = eventFactory[type];
|
|
44
|
-
if (eventCreator) {
|
|
45
|
-
const event = eventCreator(plugin as ModelFormBuilderPlugin)(output, input);
|
|
46
|
-
dispatchEvent(event);
|
|
47
|
-
}
|
|
48
|
-
}, []);
|
|
49
|
-
return <FakeBotMessage headless>{output}</FakeBotMessage>;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* 确认事件分发
|
|
54
|
-
*/
|
|
55
|
-
export const GhostEvtDispatcher = memo(BaseDispatcher, (prevProps, nextProps) => {
|
|
56
|
-
if (prevProps.output !== nextProps.output) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (prevProps.type !== nextProps.type) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (prevProps.input !== nextProps.input) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return true;
|
|
69
|
-
});
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { Confirmer } from '@/plugins/general-model-form-builder-plugin/components/confirmer';
|
|
2
|
-
import { FieldChecker } from '@/components/biz-comp/FieldChecker';
|
|
3
|
-
import { GhostEvtDispatcher } from '@/plugins/general-model-form-builder-plugin/components/ghost-evt-dispatcher';
|
|
4
|
-
import { MemoizedMarkdown } from '@/components/biz-comp/markdown';
|
|
5
|
-
import { MessageContent } from '@/components/biz-comp/message-content';
|
|
6
|
-
import { NewConfirmer } from '@/plugins/general-model-form-builder-plugin/components/new-confirmer';
|
|
7
|
-
import { cn, sanitizeText } from '@/lib/utils';
|
|
8
|
-
import {
|
|
9
|
-
APPROVAL,
|
|
10
|
-
ConfirmTools,
|
|
11
|
-
ContinueTools,
|
|
12
|
-
DesignConfirmPayload,
|
|
13
|
-
FormBuildTools,
|
|
14
|
-
SaveCheckedFieldsPayload,
|
|
15
|
-
ToolsCanBeExecutedDirectly,
|
|
16
|
-
ToolsRequiringConfirmation,
|
|
17
|
-
} from '@baishuyun/agents';
|
|
18
|
-
import { ConfirmDataPart, ConfirmTypes, MsgPartCompProps } from '@baishuyun/types';
|
|
19
|
-
import {
|
|
20
|
-
ChatRequestOptions,
|
|
21
|
-
DataUIPart,
|
|
22
|
-
getToolName,
|
|
23
|
-
InferUITools,
|
|
24
|
-
isToolUIPart,
|
|
25
|
-
TextUIPart,
|
|
26
|
-
ToolUIPart,
|
|
27
|
-
} from 'ai';
|
|
28
|
-
import { useCallback } from 'react';
|
|
29
|
-
|
|
30
|
-
export const ModelMessagePart = (props: MsgPartCompProps) => {
|
|
31
|
-
const { part: p, id, index, sendMessage, role, addToolOutput } = props;
|
|
32
|
-
|
|
33
|
-
const part = p as
|
|
34
|
-
| ToolUIPart<ConfirmTools | FormBuildTools | InferUITools<ContinueTools>>
|
|
35
|
-
| TextUIPart
|
|
36
|
-
| DataUIPart<ConfirmDataPart<DesignConfirmPayload | SaveCheckedFieldsPayload>>;
|
|
37
|
-
|
|
38
|
-
const key = `message-${id}-part-${index}-${part.type}`;
|
|
39
|
-
|
|
40
|
-
// markdown text
|
|
41
|
-
if (part.type === 'text' && part.text) {
|
|
42
|
-
return (
|
|
43
|
-
<div key={key}>
|
|
44
|
-
<MessageContent
|
|
45
|
-
className={cn({
|
|
46
|
-
'w-fit wrap-break-words rounded-2 px-3 py-2 text-right text-white': role === 'user',
|
|
47
|
-
'bg-transparent px-0 py-0 text-left': role === 'assistant',
|
|
48
|
-
})}
|
|
49
|
-
data-testid="message-content"
|
|
50
|
-
style={role === 'user' ? { backgroundColor: '#006cff' } : undefined}
|
|
51
|
-
>
|
|
52
|
-
<MemoizedMarkdown id={id} content={sanitizeText(part.text)} />
|
|
53
|
-
</MessageContent>
|
|
54
|
-
</div>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (part.type === 'data-confirm') {
|
|
59
|
-
const data = part.data;
|
|
60
|
-
return (
|
|
61
|
-
<NewConfirmer
|
|
62
|
-
key={key}
|
|
63
|
-
input={data.payload}
|
|
64
|
-
sendMessage={sendMessage}
|
|
65
|
-
onCancel={() => {}}
|
|
66
|
-
type={data.type as ConfirmTypes}
|
|
67
|
-
/>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
if (isToolUIPart<FormBuildTools>(part)) {
|
|
71
|
-
// 工具返回
|
|
72
|
-
const toolName = getToolName(part);
|
|
73
|
-
// 自定义确认提示
|
|
74
|
-
if (toolName === 'promptToCreateRelatedForm' && part.state === 'output-available') {
|
|
75
|
-
return (
|
|
76
|
-
<div key={key}>
|
|
77
|
-
<MessageContent className="gap-0 py-0" compact>
|
|
78
|
-
<MemoizedMarkdown
|
|
79
|
-
id={id}
|
|
80
|
-
content={sanitizeText(part.output ? '是否继续创建关联表?' : '表单创建已完成。')}
|
|
81
|
-
/>
|
|
82
|
-
</MessageContent>
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// 字段构建工具
|
|
88
|
-
if (part.state === 'output-available' && ToolsCanBeExecutedDirectly.has(toolName)) {
|
|
89
|
-
return (
|
|
90
|
-
<div key={key}>
|
|
91
|
-
<MessageContent className="gap-0 py-0" compact>
|
|
92
|
-
{part?.output && <FieldChecker field={part.output} />}
|
|
93
|
-
</MessageContent>
|
|
94
|
-
</div>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// 确认工具
|
|
99
|
-
if (ToolsRequiringConfirmation.includes(toolName) && part.state === 'input-available') {
|
|
100
|
-
const handleConfirm = useCallback(
|
|
101
|
-
(opt?: ChatRequestOptions) => {
|
|
102
|
-
addToolOutput({
|
|
103
|
-
toolCallId: part.toolCallId,
|
|
104
|
-
tool: toolName,
|
|
105
|
-
output: APPROVAL.YES,
|
|
106
|
-
});
|
|
107
|
-
sendMessage(undefined, opt);
|
|
108
|
-
},
|
|
109
|
-
[part.toolCallId, toolName]
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
const handleCancle = useCallback(() => {
|
|
113
|
-
addToolOutput({
|
|
114
|
-
toolCallId: part.toolCallId,
|
|
115
|
-
tool: toolName,
|
|
116
|
-
output: APPROVAL.NO,
|
|
117
|
-
});
|
|
118
|
-
sendMessage();
|
|
119
|
-
}, [part.toolCallId, toolName]);
|
|
120
|
-
|
|
121
|
-
return (
|
|
122
|
-
<Confirmer
|
|
123
|
-
key={key}
|
|
124
|
-
input={part.input}
|
|
125
|
-
onConfirm={handleConfirm}
|
|
126
|
-
onCancel={handleCancle}
|
|
127
|
-
type={part.type as ConfirmTypes}
|
|
128
|
-
/>
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// 确认事件分发
|
|
133
|
-
if (ToolsRequiringConfirmation.includes(toolName) && part.state === 'output-available') {
|
|
134
|
-
const p = part as ToolUIPart<ConfirmTools>;
|
|
135
|
-
return (
|
|
136
|
-
<GhostEvtDispatcher
|
|
137
|
-
input={p.input}
|
|
138
|
-
output={p.output}
|
|
139
|
-
type={p.type as ConfirmTypes}
|
|
140
|
-
key={part.toolCallId}
|
|
141
|
-
/>
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return null;
|
|
147
|
-
};
|