@uipath/apollo-react 7.3.2 → 7.5.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/README.md +1 -1
- package/dist/canvas/components/Guardrails/centralized-guardrail-utils.cjs +3 -2
- package/dist/canvas/components/Guardrails/centralized-guardrail-utils.d.ts +7 -2
- package/dist/canvas/components/Guardrails/centralized-guardrail-utils.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/centralized-guardrail-utils.js +3 -2
- package/dist/canvas/components/Guardrails/centralized-types.d.ts +1 -0
- package/dist/canvas/components/Guardrails/centralized-types.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/index.d.ts +1 -1
- package/dist/canvas/components/Guardrails/index.d.ts.map +1 -1
- package/dist/canvas/locales/de.cjs +1 -1
- package/dist/canvas/locales/de.d.ts.map +1 -1
- package/dist/canvas/locales/de.js +1 -1
- package/dist/canvas/locales/es-MX.cjs +1 -1
- package/dist/canvas/locales/es-MX.d.ts.map +1 -1
- package/dist/canvas/locales/es-MX.js +1 -1
- package/dist/canvas/locales/es.cjs +1 -1
- package/dist/canvas/locales/es.d.ts.map +1 -1
- package/dist/canvas/locales/es.js +1 -1
- package/dist/canvas/locales/fr.cjs +1 -1
- package/dist/canvas/locales/fr.d.ts.map +1 -1
- package/dist/canvas/locales/fr.js +1 -1
- package/dist/canvas/locales/ja.cjs +1 -1
- package/dist/canvas/locales/ja.d.ts.map +1 -1
- package/dist/canvas/locales/ja.js +1 -1
- package/dist/canvas/locales/ko.cjs +1 -1
- package/dist/canvas/locales/ko.d.ts.map +1 -1
- package/dist/canvas/locales/ko.js +1 -1
- package/dist/canvas/locales/pt-BR.cjs +1 -1
- package/dist/canvas/locales/pt-BR.d.ts.map +1 -1
- package/dist/canvas/locales/pt-BR.js +1 -1
- package/dist/canvas/locales/pt.cjs +1 -1
- package/dist/canvas/locales/pt.d.ts.map +1 -1
- package/dist/canvas/locales/pt.js +1 -1
- package/dist/canvas/locales/ro.cjs +1 -1
- package/dist/canvas/locales/ro.d.ts.map +1 -1
- package/dist/canvas/locales/ro.js +1 -1
- package/dist/canvas/locales/tr.cjs +1 -1
- package/dist/canvas/locales/tr.d.ts.map +1 -1
- package/dist/canvas/locales/tr.js +1 -1
- package/dist/canvas/locales/zh-CN.cjs +1 -1
- package/dist/canvas/locales/zh-CN.d.ts.map +1 -1
- package/dist/canvas/locales/zh-CN.js +1 -1
- package/dist/canvas/locales/zh-TW.cjs +1 -1
- package/dist/canvas/locales/zh-TW.d.ts.map +1 -1
- package/dist/canvas/locales/zh-TW.js +1 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/chat/assets/autopilot-logo.cjs +61 -0
- package/dist/chat/assets/autopilot-logo.d.ts +3 -0
- package/dist/chat/assets/autopilot-logo.d.ts.map +1 -0
- package/dist/chat/assets/autopilot-logo.js +27 -0
- package/dist/chat/headless/history/history-groups.cjs +87 -0
- package/dist/chat/headless/history/history-groups.d.ts +22 -0
- package/dist/chat/headless/history/history-groups.d.ts.map +1 -0
- package/dist/chat/headless/history/history-groups.js +47 -0
- package/dist/chat/headless/hooks/use-attachment-intake.cjs +163 -0
- package/dist/chat/headless/hooks/use-attachment-intake.d.ts +13 -0
- package/dist/chat/headless/hooks/use-attachment-intake.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-attachment-intake.js +113 -0
- package/dist/chat/headless/hooks/use-attachment-limits.cjs +77 -0
- package/dist/chat/headless/hooks/use-attachment-limits.d.ts +3 -0
- package/dist/chat/headless/hooks/use-attachment-limits.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-attachment-limits.js +33 -0
- package/dist/chat/headless/hooks/use-chat-header-actions.cjs +146 -0
- package/dist/chat/headless/hooks/use-chat-header-actions.d.ts +32 -0
- package/dist/chat/headless/hooks/use-chat-header-actions.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-chat-header-actions.js +99 -0
- package/dist/chat/headless/hooks/use-chat-history.cjs +280 -0
- package/dist/chat/headless/hooks/use-chat-history.d.ts +24 -0
- package/dist/chat/headless/hooks/use-chat-history.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-chat-history.js +226 -0
- package/dist/chat/headless/hooks/use-chat-labels.cjs +52 -0
- package/dist/chat/headless/hooks/use-chat-labels.d.ts +7 -0
- package/dist/chat/headless/hooks/use-chat-labels.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-chat-labels.js +18 -0
- package/dist/chat/headless/hooks/use-chat-messages.cjs +110 -0
- package/dist/chat/headless/hooks/use-chat-messages.d.ts +6 -0
- package/dist/chat/headless/hooks/use-chat-messages.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-chat-messages.js +66 -0
- package/dist/chat/headless/hooks/use-chat-scroll-adapter.cjs +112 -0
- package/dist/chat/headless/hooks/use-chat-scroll-adapter.d.ts +13 -0
- package/dist/chat/headless/hooks/use-chat-scroll-adapter.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-chat-scroll-adapter.js +68 -0
- package/dist/chat/headless/hooks/use-citations.cjs +99 -0
- package/dist/chat/headless/hooks/use-citations.d.ts +7 -0
- package/dist/chat/headless/hooks/use-citations.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-citations.js +52 -0
- package/dist/chat/headless/hooks/use-composer-send.cjs +79 -0
- package/dist/chat/headless/hooks/use-composer-send.d.ts +8 -0
- package/dist/chat/headless/hooks/use-composer-send.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-composer-send.js +35 -0
- package/dist/chat/headless/hooks/use-history-item.cjs +152 -0
- package/dist/chat/headless/hooks/use-history-item.d.ts +14 -0
- package/dist/chat/headless/hooks/use-history-item.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-history-item.js +108 -0
- package/dist/chat/headless/hooks/use-injected-message-renderer.cjs +61 -0
- package/dist/chat/headless/hooks/use-injected-message-renderer.d.ts +4 -0
- package/dist/chat/headless/hooks/use-injected-message-renderer.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-injected-message-renderer.js +17 -0
- package/dist/chat/headless/hooks/use-loading-messages.cjs +68 -0
- package/dist/chat/headless/hooks/use-loading-messages.d.ts +7 -0
- package/dist/chat/headless/hooks/use-loading-messages.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-loading-messages.js +18 -0
- package/dist/chat/headless/hooks/use-message-actions.cjs +175 -0
- package/dist/chat/headless/hooks/use-message-actions.d.ts +11 -0
- package/dist/chat/headless/hooks/use-message-actions.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-message-actions.js +116 -0
- package/dist/chat/headless/hooks/use-message-inset.cjs +67 -0
- package/dist/chat/headless/hooks/use-message-inset.d.ts +2 -0
- package/dist/chat/headless/hooks/use-message-inset.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-message-inset.js +23 -0
- package/dist/chat/headless/hooks/use-settings-renderer.cjs +65 -0
- package/dist/chat/headless/hooks/use-settings-renderer.d.ts +2 -0
- package/dist/chat/headless/hooks/use-settings-renderer.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-settings-renderer.js +21 -0
- package/dist/chat/headless/hooks/use-settled-replies.cjs +88 -0
- package/dist/chat/headless/hooks/use-settled-replies.d.ts +3 -0
- package/dist/chat/headless/hooks/use-settled-replies.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-settled-replies.js +44 -0
- package/dist/chat/headless/hooks/use-streamed-message-content.cjs +158 -0
- package/dist/chat/headless/hooks/use-streamed-message-content.d.ts +6 -0
- package/dist/chat/headless/hooks/use-streamed-message-content.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-streamed-message-content.js +114 -0
- package/dist/chat/headless/hooks/use-suggestions.cjs +72 -0
- package/dist/chat/headless/hooks/use-suggestions.d.ts +8 -0
- package/dist/chat/headless/hooks/use-suggestions.d.ts.map +1 -0
- package/dist/chat/headless/hooks/use-suggestions.js +25 -0
- package/dist/chat/headless/layout/chat-layout.cjs +48 -0
- package/dist/chat/headless/layout/chat-layout.d.ts +18 -0
- package/dist/chat/headless/layout/chat-layout.d.ts.map +1 -0
- package/dist/chat/headless/layout/chat-layout.js +14 -0
- package/dist/chat/headless/markdown/citation-highlight.cjs +85 -0
- package/dist/chat/headless/markdown/citation-highlight.d.ts +2 -0
- package/dist/chat/headless/markdown/citation-highlight.d.ts.map +1 -0
- package/dist/chat/headless/markdown/citation-highlight.js +51 -0
- package/dist/chat/headless/markdown/citations.cjs +69 -0
- package/dist/chat/headless/markdown/citations.d.ts +13 -0
- package/dist/chat/headless/markdown/citations.d.ts.map +1 -0
- package/dist/chat/headless/markdown/citations.js +29 -0
- package/dist/chat/headless/markdown/html-preview.cjs +41 -0
- package/dist/chat/headless/markdown/html-preview.d.ts +4 -0
- package/dist/chat/headless/markdown/html-preview.d.ts.map +1 -0
- package/dist/chat/headless/markdown/html-preview.js +7 -0
- package/dist/chat/headless/markdown/incomplete-tokens.cjs +58 -0
- package/dist/chat/headless/markdown/incomplete-tokens.d.ts +6 -0
- package/dist/chat/headless/markdown/incomplete-tokens.d.ts.map +1 -0
- package/dist/chat/headless/markdown/incomplete-tokens.js +21 -0
- package/dist/chat/headless/messages/message-groups.cjs +59 -0
- package/dist/chat/headless/messages/message-groups.d.ts +25 -0
- package/dist/chat/headless/messages/message-groups.d.ts.map +1 -0
- package/dist/chat/headless/messages/message-groups.js +19 -0
- package/dist/chat/headless/providers/attachments-provider.cjs +4 -4
- package/dist/chat/headless/providers/attachments-provider.d.ts.map +1 -1
- package/dist/chat/headless/providers/attachments-provider.js +4 -4
- package/dist/chat/headless/providers/chat-scroll-provider.cjs +37 -29
- package/dist/chat/headless/providers/chat-scroll-provider.d.ts.map +1 -1
- package/dist/chat/headless/providers/chat-scroll-provider.js +37 -29
- package/dist/chat/headless/providers/chat-state-provider.cjs +41 -4
- package/dist/chat/headless/providers/chat-state-provider.d.ts +11 -1
- package/dist/chat/headless/providers/chat-state-provider.d.ts.map +1 -1
- package/dist/chat/headless/providers/chat-state-provider.js +39 -5
- package/dist/chat/headless/providers/loading-provider.cjs +41 -3
- package/dist/chat/headless/providers/loading-provider.d.ts +5 -0
- package/dist/chat/headless/providers/loading-provider.d.ts.map +1 -1
- package/dist/chat/headless/providers/loading-provider.js +35 -3
- package/dist/chat/headless/providers/picker-provider.cjs +2 -1
- package/dist/chat/headless/providers/picker-provider.d.ts.map +1 -1
- package/dist/chat/headless/providers/picker-provider.js +2 -1
- package/dist/chat/headless/providers/theme-provider.cjs +1 -1
- package/dist/chat/headless/providers/theme-provider.js +1 -1
- package/dist/chat/headless/renderer-registry.cjs +10 -2
- package/dist/chat/headless/renderer-registry.d.ts +5 -0
- package/dist/chat/headless/renderer-registry.d.ts.map +1 -1
- package/dist/chat/headless/renderer-registry.js +6 -1
- package/dist/{material/components/ap-tool-call/utils/traceIconUtils.cjs → chat/headless/tool-call/span-icon.cjs} +5 -13
- package/dist/chat/headless/tool-call/span-icon.d.ts +3 -0
- package/dist/chat/headless/tool-call/span-icon.d.ts.map +1 -0
- package/dist/{material/components/ap-tool-call/utils/traceIconUtils.js → chat/headless/tool-call/span-icon.js} +4 -12
- package/dist/{material/components/ap-tool-call/assets/spanIcons.d.ts → chat/headless/tool-call/span-icons.d.ts} +1 -1
- package/dist/chat/headless/tool-call/span-icons.d.ts.map +1 -0
- package/dist/chat/headless/tool-call/tool-call-model.cjs +133 -0
- package/dist/chat/headless/tool-call/tool-call-model.d.ts +44 -0
- package/dist/chat/headless/tool-call/tool-call-model.d.ts.map +1 -0
- package/dist/chat/headless/tool-call/tool-call-model.js +78 -0
- package/dist/chat/headless/tree/chat-tree.cjs +64 -0
- package/dist/chat/headless/tree/chat-tree.d.ts +26 -0
- package/dist/chat/headless/tree/chat-tree.d.ts.map +1 -0
- package/dist/chat/headless/tree/chat-tree.js +27 -0
- package/dist/chat/headless/utils/file-type.cjs +48 -0
- package/dist/chat/headless/utils/file-type.d.ts +3 -0
- package/dist/chat/headless/utils/file-type.d.ts.map +1 -0
- package/dist/chat/headless/utils/file-type.js +14 -0
- package/dist/chat/headless/utils/openable-url.cjs +46 -0
- package/dist/chat/headless/utils/openable-url.d.ts +2 -0
- package/dist/chat/headless/utils/openable-url.d.ts.map +1 -0
- package/dist/chat/headless/utils/openable-url.js +12 -0
- package/dist/chat/headless/utils/publish-chat-event.cjs +38 -0
- package/dist/chat/headless/utils/publish-chat-event.d.ts +3 -0
- package/dist/chat/headless/utils/publish-chat-event.d.ts.map +1 -0
- package/dist/chat/headless/utils/publish-chat-event.js +4 -0
- package/dist/chat/index.cjs +13 -19
- package/dist/chat/index.d.ts.map +1 -1
- package/dist/chat/index.js +1 -4
- package/dist/chat/locales/en.cjs +1 -1
- package/dist/chat/locales/en.d.ts.map +1 -1
- package/dist/chat/locales/en.js +1 -1
- package/dist/chat/root/ApChat.cjs +8 -0
- package/dist/chat/root/ApChat.d.ts.map +1 -1
- package/dist/chat/root/ApChat.js +8 -0
- package/dist/chat/root/ChatRoot.cjs +14 -2
- package/dist/chat/root/ChatRoot.d.ts +2 -1
- package/dist/chat/root/ChatRoot.d.ts.map +1 -1
- package/dist/chat/root/ChatRoot.js +14 -2
- package/dist/chat/service/ChatModel.d.ts +1 -1
- package/dist/chat/service/ChatModel.d.ts.map +1 -1
- package/dist/chat/service/ChatService.cjs +14 -3
- package/dist/chat/service/ChatService.d.ts +2 -0
- package/dist/chat/service/ChatService.d.ts.map +1 -1
- package/dist/chat/service/ChatService.js +14 -3
- package/dist/chat/stories/chat-playground.d.ts +39 -0
- package/dist/chat/stories/chat-playground.d.ts.map +1 -0
- package/dist/chat/stories/chat-story-confirm.d.ts +2 -0
- package/dist/chat/stories/chat-story-confirm.d.ts.map +1 -0
- package/dist/chat/stories/chat-story-fixtures.d.ts +334 -0
- package/dist/chat/stories/chat-story-fixtures.d.ts.map +1 -0
- package/dist/chat/stories/chat-story-frame.d.ts +11 -0
- package/dist/chat/stories/chat-story-frame.d.ts.map +1 -0
- package/dist/chat/stories/chat-story-scenarios.d.ts +133 -0
- package/dist/chat/stories/chat-story-scenarios.d.ts.map +1 -0
- package/dist/chat/stories/chat-story-settings.d.ts +2 -0
- package/dist/chat/stories/chat-story-settings.d.ts.map +1 -0
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/chat/wind/WindChatRenderer.cjs +145 -0
- package/dist/chat/wind/WindChatRenderer.d.ts +3 -0
- package/dist/chat/wind/WindChatRenderer.d.ts.map +1 -0
- package/dist/chat/wind/WindChatRenderer.js +98 -0
- package/dist/chat/wind/common/dialog-container.cjs +51 -0
- package/dist/chat/wind/common/dialog-container.d.ts +4 -0
- package/dist/chat/wind/common/dialog-container.d.ts.map +1 -0
- package/dist/chat/wind/common/dialog-container.js +4 -0
- package/dist/chat/wind/common/lucide-icon.cjs +64 -0
- package/dist/chat/wind/common/lucide-icon.d.ts +5 -0
- package/dist/chat/wind/common/lucide-icon.d.ts.map +1 -0
- package/dist/chat/wind/common/lucide-icon.js +27 -0
- package/dist/chat/wind/common/panel-popover.cjs +138 -0
- package/dist/chat/wind/common/panel-popover.d.ts +16 -0
- package/dist/chat/wind/common/panel-popover.d.ts.map +1 -0
- package/dist/chat/wind/common/panel-popover.js +94 -0
- package/dist/chat/wind/common/service-icon-fallback.cjs +54 -0
- package/dist/chat/wind/common/service-icon-fallback.d.ts +5 -0
- package/dist/chat/wind/common/service-icon-fallback.d.ts.map +1 -0
- package/dist/chat/wind/common/service-icon-fallback.js +17 -0
- package/dist/chat/wind/common/service-icon.cjs +58 -0
- package/dist/chat/wind/common/service-icon.d.ts +4 -0
- package/dist/chat/wind/common/service-icon.d.ts.map +1 -0
- package/dist/chat/wind/common/service-icon.js +14 -0
- package/dist/chat/wind/composer/chat-composer.cjs +215 -0
- package/dist/chat/wind/composer/chat-composer.d.ts +2 -0
- package/dist/chat/wind/composer/chat-composer.d.ts.map +1 -0
- package/dist/chat/wind/composer/chat-composer.js +171 -0
- package/dist/chat/wind/composer/chat-dropzone.cjs +92 -0
- package/dist/chat/wind/composer/chat-dropzone.d.ts +6 -0
- package/dist/chat/wind/composer/chat-dropzone.d.ts.map +1 -0
- package/dist/chat/wind/composer/chat-dropzone.js +58 -0
- package/dist/chat/wind/composer/composer-strings.cjs +77 -0
- package/dist/chat/wind/composer/composer-strings.d.ts +3 -0
- package/dist/chat/wind/composer/composer-strings.d.ts.map +1 -0
- package/dist/chat/wind/composer/composer-strings.js +33 -0
- package/dist/chat/wind/first-run/first-run.cjs +94 -0
- package/dist/chat/wind/first-run/first-run.d.ts +10 -0
- package/dist/chat/wind/first-run/first-run.d.ts.map +1 -0
- package/dist/chat/wind/first-run/first-run.js +57 -0
- package/dist/chat/wind/first-run/suggestion-list.cjs +60 -0
- package/dist/chat/wind/first-run/suggestion-list.d.ts +7 -0
- package/dist/chat/wind/first-run/suggestion-list.d.ts.map +1 -0
- package/dist/chat/wind/first-run/suggestion-list.js +26 -0
- package/dist/chat/wind/header/chat-header.cjs +128 -0
- package/dist/chat/wind/header/chat-header.d.ts +6 -0
- package/dist/chat/wind/header/chat-header.d.ts.map +1 -0
- package/dist/chat/wind/header/chat-header.js +94 -0
- package/dist/chat/wind/header/custom-actions-menu.cjs +123 -0
- package/dist/chat/wind/header/custom-actions-menu.d.ts +6 -0
- package/dist/chat/wind/header/custom-actions-menu.d.ts.map +1 -0
- package/dist/chat/wind/header/custom-actions-menu.js +89 -0
- package/dist/chat/wind/header/header-action-button.cjs +74 -0
- package/dist/chat/wind/header/header-action-button.d.ts +7 -0
- package/dist/chat/wind/header/header-action-button.d.ts.map +1 -0
- package/dist/chat/wind/header/header-action-button.js +30 -0
- package/dist/chat/wind/history/chat-history.cjs +82 -0
- package/dist/chat/wind/history/chat-history.d.ts +6 -0
- package/dist/chat/wind/history/chat-history.d.ts.map +1 -0
- package/dist/chat/wind/history/chat-history.js +38 -0
- package/dist/chat/wind/history/history-item.cjs +147 -0
- package/dist/chat/wind/history/history-item.d.ts +5 -0
- package/dist/chat/wind/history/history-item.d.ts.map +1 -0
- package/dist/chat/wind/history/history-item.js +103 -0
- package/dist/chat/wind/history/history-panel.cjs +138 -0
- package/dist/chat/wind/history/history-panel.d.ts +7 -0
- package/dist/chat/wind/history/history-panel.d.ts.map +1 -0
- package/dist/chat/wind/history/history-panel.js +94 -0
- package/dist/chat/wind/hooks/use-open-transition.cjs +72 -0
- package/dist/chat/wind/hooks/use-open-transition.d.ts +6 -0
- package/dist/chat/wind/hooks/use-open-transition.d.ts.map +1 -0
- package/dist/chat/wind/hooks/use-open-transition.js +28 -0
- package/dist/chat/wind/hooks/use-prefers-reduced-motion.cjs +59 -0
- package/dist/chat/wind/hooks/use-prefers-reduced-motion.d.ts +2 -0
- package/dist/chat/wind/hooks/use-prefers-reduced-motion.d.ts.map +1 -0
- package/dist/chat/wind/hooks/use-prefers-reduced-motion.js +15 -0
- package/dist/chat/wind/layout/embedded-layout.cjs +109 -0
- package/dist/chat/wind/layout/embedded-layout.d.ts +5 -0
- package/dist/chat/wind/layout/embedded-layout.d.ts.map +1 -0
- package/dist/chat/wind/layout/embedded-layout.js +65 -0
- package/dist/chat/wind/layout/full-screen-layout.cjs +112 -0
- package/dist/chat/wind/layout/full-screen-layout.d.ts +5 -0
- package/dist/chat/wind/layout/full-screen-layout.d.ts.map +1 -0
- package/dist/chat/wind/layout/full-screen-layout.js +68 -0
- package/dist/chat/wind/layout/placeholder-region.cjs +46 -0
- package/dist/chat/wind/layout/placeholder-region.d.ts +8 -0
- package/dist/chat/wind/layout/placeholder-region.d.ts.map +1 -0
- package/dist/chat/wind/layout/placeholder-region.js +12 -0
- package/dist/chat/wind/{WindChatPlaceholder.cjs → layout/regions.cjs} +8 -6
- package/dist/chat/wind/layout/regions.d.ts +2 -0
- package/dist/chat/wind/layout/regions.d.ts.map +1 -0
- package/dist/chat/wind/layout/regions.js +10 -0
- package/dist/chat/wind/layout/side-by-side-placeholder.cjs +48 -0
- package/dist/chat/wind/layout/side-by-side-placeholder.d.ts +2 -0
- package/dist/chat/wind/layout/side-by-side-placeholder.d.ts.map +1 -0
- package/dist/chat/wind/layout/side-by-side-placeholder.js +14 -0
- package/dist/chat/wind/messages/chat-message.cjs +111 -0
- package/dist/chat/wind/messages/chat-message.d.ts +13 -0
- package/dist/chat/wind/messages/chat-message.d.ts.map +1 -0
- package/dist/chat/wind/messages/chat-message.js +67 -0
- package/dist/chat/wind/messages/injected-message.cjs +57 -0
- package/dist/chat/wind/messages/injected-message.d.ts +5 -0
- package/dist/chat/wind/messages/injected-message.d.ts.map +1 -0
- package/dist/chat/wind/messages/injected-message.js +13 -0
- package/dist/chat/wind/messages/message-action-bar.cjs +110 -0
- package/dist/chat/wind/messages/message-action-bar.d.ts +7 -0
- package/dist/chat/wind/messages/message-action-bar.d.ts.map +1 -0
- package/dist/chat/wind/messages/message-action-bar.js +76 -0
- package/dist/chat/wind/messages/message-attachments.cjs +94 -0
- package/dist/chat/wind/messages/message-attachments.d.ts +13 -0
- package/dist/chat/wind/messages/message-attachments.d.ts.map +1 -0
- package/dist/chat/wind/messages/message-attachments.js +48 -0
- package/dist/chat/wind/messages/message-list.cjs +246 -0
- package/dist/chat/wind/messages/message-list.d.ts +5 -0
- package/dist/chat/wind/messages/message-list.d.ts.map +1 -0
- package/dist/chat/wind/messages/message-list.js +202 -0
- package/dist/chat/wind/messages/message-sources.cjs +77 -0
- package/dist/chat/wind/messages/message-sources.d.ts +5 -0
- package/dist/chat/wind/messages/message-sources.d.ts.map +1 -0
- package/dist/chat/wind/messages/message-sources.js +43 -0
- package/dist/chat/wind/messages/thinking-row.cjs +48 -0
- package/dist/chat/wind/messages/thinking-row.d.ts +2 -0
- package/dist/chat/wind/messages/thinking-row.d.ts.map +1 -0
- package/dist/chat/wind/messages/thinking-row.js +14 -0
- package/dist/chat/wind/renderers/citation-highlights.cjs +77 -0
- package/dist/chat/wind/renderers/citation-highlights.d.ts +8 -0
- package/dist/chat/wind/renderers/citation-highlights.d.ts.map +1 -0
- package/dist/chat/wind/renderers/citation-highlights.js +30 -0
- package/dist/chat/wind/renderers/code-block-actions.cjs +176 -0
- package/dist/chat/wind/renderers/code-block-actions.d.ts +9 -0
- package/dist/chat/wind/renderers/code-block-actions.d.ts.map +1 -0
- package/dist/chat/wind/renderers/code-block-actions.js +132 -0
- package/dist/chat/wind/renderers/disclosure-tree.cjs +136 -0
- package/dist/chat/wind/renderers/disclosure-tree.d.ts +22 -0
- package/dist/chat/wind/renderers/disclosure-tree.d.ts.map +1 -0
- package/dist/chat/wind/renderers/disclosure-tree.js +92 -0
- package/dist/chat/wind/renderers/index.cjs +53 -0
- package/dist/chat/wind/renderers/index.d.ts +3 -0
- package/dist/chat/wind/renderers/index.d.ts.map +1 -0
- package/dist/chat/wind/renderers/index.js +19 -0
- package/dist/chat/wind/renderers/markdown-citation.cjs +102 -0
- package/dist/chat/wind/renderers/markdown-citation.d.ts +3 -0
- package/dist/chat/wind/renderers/markdown-citation.d.ts.map +1 -0
- package/dist/chat/wind/renderers/markdown-citation.js +58 -0
- package/dist/chat/wind/renderers/markdown-renderer.cjs +127 -0
- package/dist/chat/wind/renderers/markdown-renderer.d.ts +10 -0
- package/dist/chat/wind/renderers/markdown-renderer.d.ts.map +1 -0
- package/dist/chat/wind/renderers/markdown-renderer.js +80 -0
- package/dist/chat/wind/renderers/markdown-resource-chip.cjs +53 -0
- package/dist/chat/wind/renderers/markdown-resource-chip.d.ts +3 -0
- package/dist/chat/wind/renderers/markdown-resource-chip.d.ts.map +1 -0
- package/dist/chat/wind/renderers/markdown-resource-chip.js +19 -0
- package/dist/chat/wind/renderers/tool-call-renderer.cjs +232 -0
- package/dist/chat/wind/renderers/tool-call-renderer.d.ts +8 -0
- package/dist/chat/wind/renderers/tool-call-renderer.d.ts.map +1 -0
- package/dist/chat/wind/renderers/tool-call-renderer.js +188 -0
- package/dist/chat/wind/renderers/tool-call-strings.cjs +161 -0
- package/dist/chat/wind/renderers/tool-call-strings.d.ts +12 -0
- package/dist/chat/wind/renderers/tool-call-strings.d.ts.map +1 -0
- package/dist/chat/wind/renderers/tool-call-strings.js +117 -0
- package/dist/chat/wind/renderers/tree-renderer.cjs +103 -0
- package/dist/chat/wind/renderers/tree-renderer.d.ts +8 -0
- package/dist/chat/wind/renderers/tree-renderer.d.ts.map +1 -0
- package/dist/chat/wind/renderers/tree-renderer.js +59 -0
- package/dist/chat/wind/settings/chat-settings.cjs +155 -0
- package/dist/chat/wind/settings/chat-settings.d.ts +11 -0
- package/dist/chat/wind/settings/chat-settings.d.ts.map +1 -0
- package/dist/chat/wind/settings/chat-settings.js +108 -0
- package/dist/core/tokens/css/theme-variables.css +1 -1
- package/dist/core/tokens/css/variables.css +1 -1
- package/dist/core/tokens/less/_variables.less +1 -1
- package/dist/core/tokens/scss/_css-variables.scss +1 -1
- package/dist/core/tokens/scss/_variables.scss +1 -1
- package/dist/material/components/ap-chat/MaterialChatRenderer.cjs +22 -11
- package/dist/material/components/ap-chat/MaterialChatRenderer.d.ts +8 -0
- package/dist/material/components/ap-chat/MaterialChatRenderer.d.ts.map +1 -1
- package/dist/material/components/ap-chat/MaterialChatRenderer.js +21 -13
- package/dist/material/components/ap-chat/ap-chat-material.cjs +70 -0
- package/dist/material/components/ap-chat/ap-chat-material.d.ts +13 -0
- package/dist/material/components/ap-chat/ap-chat-material.d.ts.map +1 -0
- package/dist/material/components/ap-chat/ap-chat-material.js +26 -0
- package/dist/material/components/ap-chat/ap-chat.cjs +5 -32
- package/dist/material/components/ap-chat/ap-chat.d.ts +1 -11
- package/dist/material/components/ap-chat/ap-chat.d.ts.map +1 -1
- package/dist/material/components/ap-chat/ap-chat.js +5 -22
- package/dist/material/components/ap-chat/components/dropzone/dropzone.cjs +23 -82
- package/dist/material/components/ap-chat/components/dropzone/dropzone.d.ts +2 -0
- package/dist/material/components/ap-chat/components/dropzone/dropzone.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/dropzone/dropzone.js +20 -82
- package/dist/material/components/ap-chat/components/header/header-actions.cjs +23 -91
- package/dist/material/components/ap-chat/components/header/header-actions.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/header/header-actions.js +23 -91
- package/dist/material/components/ap-chat/components/header/header.cjs +6 -7
- package/dist/material/components/ap-chat/components/header/header.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/header/header.js +6 -6
- package/dist/material/components/ap-chat/components/history/chat-history-group.d.ts +2 -2
- package/dist/material/components/ap-chat/components/history/chat-history-group.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/history/chat-history-item.cjs +15 -104
- package/dist/material/components/ap-chat/components/history/chat-history-item.d.ts +1 -1
- package/dist/material/components/ap-chat/components/history/chat-history-item.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/history/chat-history-item.js +13 -102
- package/dist/material/components/ap-chat/components/history/chat-history.cjs +5 -170
- package/dist/material/components/ap-chat/components/history/chat-history.d.ts +0 -5
- package/dist/material/components/ap-chat/components/history/chat-history.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/history/chat-history.js +7 -171
- package/dist/material/components/ap-chat/components/input/chat-input-actions.cjs +15 -98
- package/dist/material/components/ap-chat/components/input/chat-input-actions.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/input/chat-input-actions.js +15 -98
- package/dist/material/components/ap-chat/components/input/chat-input-footer.cjs +3 -7
- package/dist/material/components/ap-chat/components/input/chat-input-footer.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/input/chat-input-footer.js +3 -7
- package/dist/material/components/ap-chat/components/input/chat-input.cjs +11 -23
- package/dist/material/components/ap-chat/components/input/chat-input.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/input/chat-input.js +11 -23
- package/dist/material/components/ap-chat/components/input/tiptap/tiptap-editor.cjs +1 -1
- package/dist/material/components/ap-chat/components/input/tiptap/tiptap-editor.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/input/tiptap/tiptap-editor.js +1 -1
- package/dist/material/components/ap-chat/components/message/actions/chat-actions-list.cjs +2 -23
- package/dist/material/components/ap-chat/components/message/actions/chat-actions-list.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/message/actions/chat-actions-list.js +2 -23
- package/dist/material/components/ap-chat/components/message/actions/chat-actions.cjs +3 -84
- package/dist/material/components/ap-chat/components/message/actions/chat-actions.d.ts +1 -1
- package/dist/material/components/ap-chat/components/message/actions/chat-actions.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/message/actions/chat-actions.js +4 -85
- package/dist/material/components/ap-chat/components/message/chat-message-content.cjs +4 -39
- package/dist/material/components/ap-chat/components/message/chat-message-content.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/message/chat-message-content.js +5 -40
- package/dist/material/components/ap-chat/components/message/chat-message.cjs +7 -90
- package/dist/material/components/ap-chat/components/message/chat-message.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/message/chat-message.js +9 -92
- package/dist/material/components/ap-chat/components/message/chat-scroll-container.cjs +4 -2
- package/dist/material/components/ap-chat/components/message/chat-scroll-container.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/message/chat-scroll-container.js +4 -2
- package/dist/material/components/ap-chat/components/message/first-run-experience/chat-fre.cjs +2 -2
- package/dist/material/components/ap-chat/components/message/first-run-experience/chat-fre.js +2 -2
- package/dist/material/components/ap-chat/components/message/loader/chat-loading-text.cjs +25 -46
- package/dist/material/components/ap-chat/components/message/loader/chat-loading-text.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/message/loader/chat-loading-text.js +24 -45
- package/dist/material/components/ap-chat/components/message/markdown/citation.cjs +26 -84
- package/dist/material/components/ap-chat/components/message/markdown/citation.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/message/markdown/citation.js +24 -82
- package/dist/material/components/ap-chat/components/message/markdown/code.cjs +2 -1
- package/dist/material/components/ap-chat/components/message/markdown/code.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/message/markdown/code.js +2 -1
- package/dist/material/components/ap-chat/components/message/markdown/markdown.cjs +2 -117
- package/dist/material/components/ap-chat/components/message/markdown/markdown.d.ts +1 -1
- package/dist/material/components/ap-chat/components/message/markdown/markdown.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/message/markdown/markdown.js +3 -118
- package/dist/material/components/ap-chat/components/message/sources/chat-sources.cjs +8 -55
- package/dist/material/components/ap-chat/components/message/sources/chat-sources.d.ts +2 -3
- package/dist/material/components/ap-chat/components/message/sources/chat-sources.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/message/sources/chat-sources.js +5 -52
- package/dist/material/components/ap-chat/components/message/suggestions/chat-suggestions.cjs +7 -14
- package/dist/material/components/ap-chat/components/message/suggestions/chat-suggestions.d.ts +1 -1
- package/dist/material/components/ap-chat/components/message/suggestions/chat-suggestions.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/message/suggestions/chat-suggestions.js +4 -11
- package/dist/material/components/ap-chat/components/message/tree/tree-renderer.cjs +6 -34
- package/dist/material/components/ap-chat/components/message/tree/tree-renderer.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/message/tree/tree-renderer.js +6 -34
- package/dist/material/components/ap-chat/components/settings/chat-settings-header.cjs +1 -1
- package/dist/material/components/ap-chat/components/settings/chat-settings-header.js +1 -1
- package/dist/material/components/ap-chat/components/settings/chat-settings.cjs +6 -20
- package/dist/material/components/ap-chat/components/settings/chat-settings.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/settings/chat-settings.js +7 -21
- package/dist/material/components/ap-chat/utils/file-to-icon.cjs +11 -28
- package/dist/material/components/ap-chat/utils/file-to-icon.d.ts.map +1 -1
- package/dist/material/components/ap-chat/utils/file-to-icon.js +11 -28
- package/dist/material/components/ap-tool-call/ApToolCall.cjs +40 -96
- package/dist/material/components/ap-tool-call/ApToolCall.d.ts.map +1 -1
- package/dist/material/components/ap-tool-call/ApToolCall.js +39 -95
- package/dist/material/components/ap-tool-call/components/ToolCallSection.cjs +3 -2
- package/dist/material/components/ap-tool-call/components/ToolCallSection.d.ts.map +1 -1
- package/dist/material/components/ap-tool-call/components/ToolCallSection.js +3 -2
- package/dist/material/stories/chat-story-support.d.ts +1 -2
- package/dist/material/stories/chat-story-support.d.ts.map +1 -1
- package/package.json +10 -6
- package/dist/chat/wind/WindChatPlaceholder.d.ts +0 -2
- package/dist/chat/wind/WindChatPlaceholder.d.ts.map +0 -1
- package/dist/chat/wind/WindChatPlaceholder.js +0 -8
- package/dist/material/components/ap-chat/assets/autopilot-logo.cjs +0 -61
- package/dist/material/components/ap-chat/assets/autopilot-logo.js +0 -27
- package/dist/material/components/ap-tool-call/assets/spanIcons.d.ts.map +0 -1
- package/dist/material/components/ap-tool-call/utils/traceIconUtils.d.ts +0 -3
- package/dist/material/components/ap-tool-call/utils/traceIconUtils.d.ts.map +0 -1
- package/dist/material/stories/chat-story-support.cjs +0 -2563
- package/dist/material/stories/chat-story-support.js +0 -2507
- package/dist/material/stories/storybook-helpers.cjs +0 -166
- package/dist/material/stories/storybook-helpers.js +0 -109
- /package/dist/{material/components/ap-tool-call/assets/spanIcons.cjs → chat/headless/tool-call/span-icons.cjs} +0 -0
- /package/dist/{material/components/ap-tool-call/assets/spanIcons.js → chat/headless/tool-call/span-icons.js} +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
AutopilotLogo: ()=>AutopilotLogo
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
function AutopilotLogo(props) {
|
|
31
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("svg", {
|
|
32
|
+
width: "20",
|
|
33
|
+
height: "20",
|
|
34
|
+
viewBox: "0 0 20 20",
|
|
35
|
+
fill: "none",
|
|
36
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
37
|
+
"aria-hidden": "true",
|
|
38
|
+
...props,
|
|
39
|
+
children: [
|
|
40
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
41
|
+
d: "M10.9305 0.74464C11.2979 -0.248213 12.7021 -0.248213 13.0695 0.744639L14.2001 3.79992L17.2554 4.93047C18.2482 5.29786 18.2482 6.70214 17.2554 7.06953L14.2001 8.20008L13.0695 11.2554C12.7021 12.2482 11.2979 12.2482 10.9305 11.2554L9.79992 8.20008L6.74464 7.06953C5.75179 6.70214 5.75179 5.29786 6.74464 4.93047L9.79992 3.79992L10.9305 0.74464Z",
|
|
42
|
+
fill: "var(--color-primary)"
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
45
|
+
d: "M3.28698 9.49643C3.53191 8.83452 4.46809 8.83452 4.71302 9.49643L5.46672 11.5333L7.50357 12.287C8.16547 12.5319 8.16547 13.4681 7.50357 13.713L5.46672 14.4667L4.71302 16.5036C4.46809 17.1655 3.53191 17.1655 3.28698 16.5036L2.53328 14.4667L0.496426 13.713C-0.165475 13.4681 -0.165476 12.5319 0.496426 12.287L2.53328 11.5333L3.28698 9.49643Z",
|
|
46
|
+
fill: "var(--color-icon-default)"
|
|
47
|
+
}),
|
|
48
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
49
|
+
d: "M15.4652 13.3723C15.6489 12.8759 16.3511 12.8759 16.5348 13.3723L17.1 14.9L18.6277 15.4652C19.1241 15.6489 19.1241 16.3511 18.6277 16.5348L17.1 17.1L16.5348 18.6277C16.3511 19.1241 15.6489 19.1241 15.4652 18.6277L14.9 17.1L13.3723 16.5348C12.8759 16.3511 12.8759 15.6489 13.3723 15.4652L14.9 14.9L15.4652 13.3723Z",
|
|
50
|
+
fill: "var(--color-icon-default)"
|
|
51
|
+
})
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
exports.AutopilotLogo = __webpack_exports__.AutopilotLogo;
|
|
56
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
57
|
+
"AutopilotLogo"
|
|
58
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
59
|
+
Object.defineProperty(exports, '__esModule', {
|
|
60
|
+
value: true
|
|
61
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autopilot-logo.d.ts","sourceRoot":"","sources":["../../../src/chat/assets/autopilot-logo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,2CAyBjE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
function AutopilotLogo(props) {
|
|
3
|
+
return /*#__PURE__*/ jsxs("svg", {
|
|
4
|
+
width: "20",
|
|
5
|
+
height: "20",
|
|
6
|
+
viewBox: "0 0 20 20",
|
|
7
|
+
fill: "none",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
"aria-hidden": "true",
|
|
10
|
+
...props,
|
|
11
|
+
children: [
|
|
12
|
+
/*#__PURE__*/ jsx("path", {
|
|
13
|
+
d: "M10.9305 0.74464C11.2979 -0.248213 12.7021 -0.248213 13.0695 0.744639L14.2001 3.79992L17.2554 4.93047C18.2482 5.29786 18.2482 6.70214 17.2554 7.06953L14.2001 8.20008L13.0695 11.2554C12.7021 12.2482 11.2979 12.2482 10.9305 11.2554L9.79992 8.20008L6.74464 7.06953C5.75179 6.70214 5.75179 5.29786 6.74464 4.93047L9.79992 3.79992L10.9305 0.74464Z",
|
|
14
|
+
fill: "var(--color-primary)"
|
|
15
|
+
}),
|
|
16
|
+
/*#__PURE__*/ jsx("path", {
|
|
17
|
+
d: "M3.28698 9.49643C3.53191 8.83452 4.46809 8.83452 4.71302 9.49643L5.46672 11.5333L7.50357 12.287C8.16547 12.5319 8.16547 13.4681 7.50357 13.713L5.46672 14.4667L4.71302 16.5036C4.46809 17.1655 3.53191 17.1655 3.28698 16.5036L2.53328 14.4667L0.496426 13.713C-0.165475 13.4681 -0.165476 12.5319 0.496426 12.287L2.53328 11.5333L3.28698 9.49643Z",
|
|
18
|
+
fill: "var(--color-icon-default)"
|
|
19
|
+
}),
|
|
20
|
+
/*#__PURE__*/ jsx("path", {
|
|
21
|
+
d: "M15.4652 13.3723C15.6489 12.8759 16.3511 12.8759 16.5348 13.3723L17.1 14.9L18.6277 15.4652C19.1241 15.6489 19.1241 16.3511 18.6277 16.5348L17.1 17.1L16.5348 18.6277C16.3511 19.1241 15.6489 19.1241 15.4652 18.6277L14.9 17.1L13.3723 16.5348C12.8759 16.3511 12.8759 15.6489 13.3723 15.4652L14.9 14.9L15.4652 13.3723Z",
|
|
22
|
+
fill: "var(--color-icon-default)"
|
|
23
|
+
})
|
|
24
|
+
]
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export { AutopilotLogo };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
getHistoryBucket: ()=>getHistoryBucket,
|
|
28
|
+
groupHistory: ()=>groupHistory,
|
|
29
|
+
filterHistory: ()=>filterHistory
|
|
30
|
+
});
|
|
31
|
+
const external_date_fns_namespaceObject = require("date-fns");
|
|
32
|
+
function getHistoryBucket(timestamp, now) {
|
|
33
|
+
const date = new Date(timestamp);
|
|
34
|
+
const daysAgo = (0, external_date_fns_namespaceObject.differenceInDays)(now, date);
|
|
35
|
+
if ((0, external_date_fns_namespaceObject.isSameDay)(date, now)) return {
|
|
36
|
+
kind: 'today'
|
|
37
|
+
};
|
|
38
|
+
if ((0, external_date_fns_namespaceObject.isSameDay)(date, (0, external_date_fns_namespaceObject.subDays)(now, 1))) return {
|
|
39
|
+
kind: 'yesterday'
|
|
40
|
+
};
|
|
41
|
+
if (daysAgo <= 7) return {
|
|
42
|
+
kind: 'last-week'
|
|
43
|
+
};
|
|
44
|
+
if (daysAgo <= 30) return {
|
|
45
|
+
kind: 'last-30-days'
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
kind: 'months-ago',
|
|
49
|
+
count: (0, external_date_fns_namespaceObject.differenceInMonths)(now, date)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const bucketKey = (bucket)=>'months-ago' === bucket.kind ? `months-ago-${bucket.count}` : bucket.kind;
|
|
53
|
+
function filterHistory(items, query) {
|
|
54
|
+
const needle = query.toLowerCase();
|
|
55
|
+
return needle ? items.filter((item)=>item.name.toLowerCase().includes(needle)) : items;
|
|
56
|
+
}
|
|
57
|
+
const time = (item)=>new Date(item.timestamp).getTime();
|
|
58
|
+
function groupHistory(items, now = new Date()) {
|
|
59
|
+
const groups = [];
|
|
60
|
+
for (const item of items){
|
|
61
|
+
const bucket = getHistoryBucket(item.timestamp, now);
|
|
62
|
+
const key = bucketKey(bucket);
|
|
63
|
+
const group = groups.find((candidate)=>candidate.key === key);
|
|
64
|
+
if (group) group.items.push(item);
|
|
65
|
+
else groups.push({
|
|
66
|
+
key,
|
|
67
|
+
bucket,
|
|
68
|
+
items: [
|
|
69
|
+
item
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
groups.sort((a, b)=>time(b.items[0]) - time(a.items[0]));
|
|
74
|
+
for (const group of groups)group.items.sort((a, b)=>time(b) - time(a));
|
|
75
|
+
return groups;
|
|
76
|
+
}
|
|
77
|
+
exports.filterHistory = __webpack_exports__.filterHistory;
|
|
78
|
+
exports.getHistoryBucket = __webpack_exports__.getHistoryBucket;
|
|
79
|
+
exports.groupHistory = __webpack_exports__.groupHistory;
|
|
80
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
81
|
+
"filterHistory",
|
|
82
|
+
"getHistoryBucket",
|
|
83
|
+
"groupHistory"
|
|
84
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
85
|
+
Object.defineProperty(exports, '__esModule', {
|
|
86
|
+
value: true
|
|
87
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AutopilotChatHistory } from '../../service';
|
|
2
|
+
export type ChatHistoryBucket = {
|
|
3
|
+
kind: 'today';
|
|
4
|
+
} | {
|
|
5
|
+
kind: 'yesterday';
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'last-week';
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'last-30-days';
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'months-ago';
|
|
12
|
+
count: number;
|
|
13
|
+
};
|
|
14
|
+
export interface ChatHistoryGroup {
|
|
15
|
+
key: string;
|
|
16
|
+
bucket: ChatHistoryBucket;
|
|
17
|
+
items: AutopilotChatHistory[];
|
|
18
|
+
}
|
|
19
|
+
export declare function getHistoryBucket(timestamp: string, now: Date): ChatHistoryBucket;
|
|
20
|
+
export declare function filterHistory(items: AutopilotChatHistory[], query: string): AutopilotChatHistory[];
|
|
21
|
+
export declare function groupHistory(items: AutopilotChatHistory[], now?: Date): ChatHistoryGroup[];
|
|
22
|
+
//# sourceMappingURL=history-groups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-groups.d.ts","sourceRoot":"","sources":["../../../../src/chat/headless/history/history-groups.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG1D,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C,MAAM,WAAW,gBAAgB;IAE/B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,GAAG,iBAAiB,CAShF;AASD,wBAAgB,aAAa,CAAC,KAAK,EAAE,oBAAoB,EAAE,EAAE,KAAK,EAAE,MAAM,0BAGzE;AAQD,wBAAgB,YAAY,CAAC,KAAK,EAAE,oBAAoB,EAAE,EAAE,GAAG,OAAa,GAAG,gBAAgB,EAAE,CAqBhG"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { differenceInDays, differenceInMonths, isSameDay, subDays } from "date-fns";
|
|
2
|
+
function getHistoryBucket(timestamp, now) {
|
|
3
|
+
const date = new Date(timestamp);
|
|
4
|
+
const daysAgo = differenceInDays(now, date);
|
|
5
|
+
if (isSameDay(date, now)) return {
|
|
6
|
+
kind: 'today'
|
|
7
|
+
};
|
|
8
|
+
if (isSameDay(date, subDays(now, 1))) return {
|
|
9
|
+
kind: 'yesterday'
|
|
10
|
+
};
|
|
11
|
+
if (daysAgo <= 7) return {
|
|
12
|
+
kind: 'last-week'
|
|
13
|
+
};
|
|
14
|
+
if (daysAgo <= 30) return {
|
|
15
|
+
kind: 'last-30-days'
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
kind: 'months-ago',
|
|
19
|
+
count: differenceInMonths(now, date)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const bucketKey = (bucket)=>'months-ago' === bucket.kind ? `months-ago-${bucket.count}` : bucket.kind;
|
|
23
|
+
function filterHistory(items, query) {
|
|
24
|
+
const needle = query.toLowerCase();
|
|
25
|
+
return needle ? items.filter((item)=>item.name.toLowerCase().includes(needle)) : items;
|
|
26
|
+
}
|
|
27
|
+
const time = (item)=>new Date(item.timestamp).getTime();
|
|
28
|
+
function groupHistory(items, now = new Date()) {
|
|
29
|
+
const groups = [];
|
|
30
|
+
for (const item of items){
|
|
31
|
+
const bucket = getHistoryBucket(item.timestamp, now);
|
|
32
|
+
const key = bucketKey(bucket);
|
|
33
|
+
const group = groups.find((candidate)=>candidate.key === key);
|
|
34
|
+
if (group) group.items.push(item);
|
|
35
|
+
else groups.push({
|
|
36
|
+
key,
|
|
37
|
+
bucket,
|
|
38
|
+
items: [
|
|
39
|
+
item
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
groups.sort((a, b)=>time(b.items[0]) - time(a.items[0]));
|
|
44
|
+
for (const group of groups)group.items.sort((a, b)=>time(b) - time(a));
|
|
45
|
+
return groups;
|
|
46
|
+
}
|
|
47
|
+
export { filterHistory, getHistoryBucket, groupHistory };
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
useAttachmentIntake: ()=>useAttachmentIntake,
|
|
37
|
+
checkAttachmentFiles: ()=>checkAttachmentFiles,
|
|
38
|
+
getAcceptedFileTypes: ()=>getAcceptedFileTypes
|
|
39
|
+
});
|
|
40
|
+
const react_namespaceObject = require("@lingui/react");
|
|
41
|
+
const external_react_namespaceObject = require("react");
|
|
42
|
+
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
43
|
+
const attachments_provider_cjs_namespaceObject = require("../providers/attachments-provider.cjs");
|
|
44
|
+
const chat_state_provider_cjs_namespaceObject = require("../providers/chat-state-provider.cjs");
|
|
45
|
+
const error_provider_cjs_namespaceObject = require("../providers/error-provider.cjs");
|
|
46
|
+
const file_reader_cjs_namespaceObject = require("../utils/file-reader.cjs");
|
|
47
|
+
function getAcceptedFileTypes(types) {
|
|
48
|
+
return [
|
|
49
|
+
...Object.keys(types),
|
|
50
|
+
...Object.values(types).flat()
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
function checkAttachmentFiles(files, allowed, existingCount = 0) {
|
|
54
|
+
const accept = getAcceptedFileTypes(allowed.types).map((entry)=>entry.toLowerCase());
|
|
55
|
+
const remaining = void 0 === allowed.maxCount ? 1 / 0 : allowed.maxCount - existingCount;
|
|
56
|
+
const accepted = [];
|
|
57
|
+
const rejected = [];
|
|
58
|
+
for (const file of files){
|
|
59
|
+
const name = file.name.toLowerCase();
|
|
60
|
+
const typeAccepted = 0 === accept.length || accept.some((entry)=>entry.startsWith('.') ? name.endsWith(entry) : entry === file.type.toLowerCase());
|
|
61
|
+
if (typeAccepted) if (file.size > allowed.maxSize) rejected.push({
|
|
62
|
+
file,
|
|
63
|
+
reason: 'size'
|
|
64
|
+
});
|
|
65
|
+
else if (accepted.length >= remaining) rejected.push({
|
|
66
|
+
file,
|
|
67
|
+
reason: 'count'
|
|
68
|
+
});
|
|
69
|
+
else accepted.push(file);
|
|
70
|
+
else rejected.push({
|
|
71
|
+
file,
|
|
72
|
+
reason: 'type'
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
accepted,
|
|
77
|
+
rejected
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function useAttachmentIntake() {
|
|
81
|
+
const { _ } = (0, react_namespaceObject.useLingui)();
|
|
82
|
+
const { addAttachments, attachments } = (0, attachments_provider_cjs_namespaceObject.useAttachments)();
|
|
83
|
+
const { setError } = (0, error_provider_cjs_namespaceObject.useError)();
|
|
84
|
+
const { allowedAttachments } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
|
|
85
|
+
const attachmentsCount = external_react_default().useRef(attachments.length);
|
|
86
|
+
attachmentsCount.current = attachments.length;
|
|
87
|
+
const handleRejections = external_react_default().useCallback((parsedFiles, rejections)=>{
|
|
88
|
+
if (!allowedAttachments.multiple && (parsedFiles.length > 1 || attachmentsCount.current > 0 || rejections.length > 1)) {
|
|
89
|
+
setError(_({
|
|
90
|
+
id: 'autopilot-chat.error.multiple-files'
|
|
91
|
+
}));
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
if (rejections.some(({ reason })=>'count' === reason)) {
|
|
95
|
+
const maxCount = allowedAttachments.maxCount;
|
|
96
|
+
setError(_({
|
|
97
|
+
id: 'autopilot-chat.error.too-many-files',
|
|
98
|
+
values: {
|
|
99
|
+
maxCount: maxCount
|
|
100
|
+
}
|
|
101
|
+
}));
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
const errorMessages = [];
|
|
105
|
+
for (const { reason, file } of rejections){
|
|
106
|
+
const fileName = file.name;
|
|
107
|
+
if ('size' === reason) {
|
|
108
|
+
const fileSizeMB = Math.round(file.size / 1024 / 1024);
|
|
109
|
+
const maxSize = allowedAttachments.maxSize / 1024 / 1024;
|
|
110
|
+
errorMessages.push(_({
|
|
111
|
+
id: 'autopilot-chat.error.file-too-large',
|
|
112
|
+
values: {
|
|
113
|
+
fileName: fileName,
|
|
114
|
+
fileSizeMB: fileSizeMB,
|
|
115
|
+
maxSize: maxSize
|
|
116
|
+
}
|
|
117
|
+
}));
|
|
118
|
+
} else if ('type' === reason) errorMessages.push(_({
|
|
119
|
+
id: 'autopilot-chat.error.file-invalid-type',
|
|
120
|
+
values: {
|
|
121
|
+
fileName: fileName
|
|
122
|
+
}
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
if (errorMessages.length > 0) setError(errorMessages.join('\n'));
|
|
126
|
+
return false;
|
|
127
|
+
}, [
|
|
128
|
+
_,
|
|
129
|
+
setError,
|
|
130
|
+
allowedAttachments.maxCount,
|
|
131
|
+
allowedAttachments.maxSize,
|
|
132
|
+
allowedAttachments.multiple
|
|
133
|
+
]);
|
|
134
|
+
return external_react_default().useCallback(async (accepted, rejected)=>{
|
|
135
|
+
try {
|
|
136
|
+
const parsedFiles = await (0, file_reader_cjs_namespaceObject.parseFiles)(accepted);
|
|
137
|
+
if (handleRejections(parsedFiles, rejected)) return;
|
|
138
|
+
if (0 === rejected.length) setError(void 0);
|
|
139
|
+
if (allowedAttachments.multiple) addAttachments(parsedFiles);
|
|
140
|
+
else if (1 === parsedFiles.length) addAttachments([
|
|
141
|
+
parsedFiles[0]
|
|
142
|
+
]);
|
|
143
|
+
} catch (error) {
|
|
144
|
+
setError(error);
|
|
145
|
+
}
|
|
146
|
+
}, [
|
|
147
|
+
addAttachments,
|
|
148
|
+
setError,
|
|
149
|
+
allowedAttachments.multiple,
|
|
150
|
+
handleRejections
|
|
151
|
+
]);
|
|
152
|
+
}
|
|
153
|
+
exports.checkAttachmentFiles = __webpack_exports__.checkAttachmentFiles;
|
|
154
|
+
exports.getAcceptedFileTypes = __webpack_exports__.getAcceptedFileTypes;
|
|
155
|
+
exports.useAttachmentIntake = __webpack_exports__.useAttachmentIntake;
|
|
156
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
157
|
+
"checkAttachmentFiles",
|
|
158
|
+
"getAcceptedFileTypes",
|
|
159
|
+
"useAttachmentIntake"
|
|
160
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
161
|
+
Object.defineProperty(exports, '__esModule', {
|
|
162
|
+
value: true
|
|
163
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AutopilotChatAllowedAttachments } from '../../service';
|
|
2
|
+
export type ChatAttachmentRejectionReason = 'type' | 'size' | 'count' | 'other';
|
|
3
|
+
export interface ChatAttachmentRejection {
|
|
4
|
+
file: File;
|
|
5
|
+
reason: ChatAttachmentRejectionReason;
|
|
6
|
+
}
|
|
7
|
+
export declare function getAcceptedFileTypes(types: AutopilotChatAllowedAttachments['types']): string[];
|
|
8
|
+
export declare function checkAttachmentFiles(files: readonly File[], allowed: AutopilotChatAllowedAttachments, existingCount?: number): {
|
|
9
|
+
accepted: File[];
|
|
10
|
+
rejected: ChatAttachmentRejection[];
|
|
11
|
+
};
|
|
12
|
+
export declare function useAttachmentIntake(): (accepted: File[], rejected: ChatAttachmentRejection[]) => Promise<void>;
|
|
13
|
+
//# sourceMappingURL=use-attachment-intake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-attachment-intake.d.ts","sourceRoot":"","sources":["../../../../src/chat/headless/hooks/use-attachment-intake.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,+BAA+B,EAAyB,MAAM,eAAe,CAAC;AAU5F,MAAM,MAAM,6BAA6B,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAEhF,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,6BAA6B,CAAC;CACvC;AAMD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,+BAA+B,CAAC,OAAO,CAAC,GAAG,MAAM,EAAE,CAE9F;AAMD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,OAAO,EAAE,+BAA+B,EACxC,aAAa,SAAI,GAChB;IAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAAC,QAAQ,EAAE,uBAAuB,EAAE,CAAA;CAAE,CAyB3D;AAQD,wBAAgB,mBAAmB,eA8Ed,IAAI,EAAE,YAAY,uBAAuB,EAAE,mBAoB/D"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { useLingui } from "@lingui/react";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { useAttachments } from "../providers/attachments-provider.js";
|
|
4
|
+
import { useChatState } from "../providers/chat-state-provider.js";
|
|
5
|
+
import { useError } from "../providers/error-provider.js";
|
|
6
|
+
import { parseFiles } from "../utils/file-reader.js";
|
|
7
|
+
function getAcceptedFileTypes(types) {
|
|
8
|
+
return [
|
|
9
|
+
...Object.keys(types),
|
|
10
|
+
...Object.values(types).flat()
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
function checkAttachmentFiles(files, allowed, existingCount = 0) {
|
|
14
|
+
const accept = getAcceptedFileTypes(allowed.types).map((entry)=>entry.toLowerCase());
|
|
15
|
+
const remaining = void 0 === allowed.maxCount ? 1 / 0 : allowed.maxCount - existingCount;
|
|
16
|
+
const accepted = [];
|
|
17
|
+
const rejected = [];
|
|
18
|
+
for (const file of files){
|
|
19
|
+
const name = file.name.toLowerCase();
|
|
20
|
+
const typeAccepted = 0 === accept.length || accept.some((entry)=>entry.startsWith('.') ? name.endsWith(entry) : entry === file.type.toLowerCase());
|
|
21
|
+
if (typeAccepted) if (file.size > allowed.maxSize) rejected.push({
|
|
22
|
+
file,
|
|
23
|
+
reason: 'size'
|
|
24
|
+
});
|
|
25
|
+
else if (accepted.length >= remaining) rejected.push({
|
|
26
|
+
file,
|
|
27
|
+
reason: 'count'
|
|
28
|
+
});
|
|
29
|
+
else accepted.push(file);
|
|
30
|
+
else rejected.push({
|
|
31
|
+
file,
|
|
32
|
+
reason: 'type'
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
accepted,
|
|
37
|
+
rejected
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function useAttachmentIntake() {
|
|
41
|
+
const { _ } = useLingui();
|
|
42
|
+
const { addAttachments, attachments } = useAttachments();
|
|
43
|
+
const { setError } = useError();
|
|
44
|
+
const { allowedAttachments } = useChatState();
|
|
45
|
+
const attachmentsCount = react.useRef(attachments.length);
|
|
46
|
+
attachmentsCount.current = attachments.length;
|
|
47
|
+
const handleRejections = react.useCallback((parsedFiles, rejections)=>{
|
|
48
|
+
if (!allowedAttachments.multiple && (parsedFiles.length > 1 || attachmentsCount.current > 0 || rejections.length > 1)) {
|
|
49
|
+
setError(_({
|
|
50
|
+
id: 'autopilot-chat.error.multiple-files'
|
|
51
|
+
}));
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (rejections.some(({ reason })=>'count' === reason)) {
|
|
55
|
+
const maxCount = allowedAttachments.maxCount;
|
|
56
|
+
setError(_({
|
|
57
|
+
id: 'autopilot-chat.error.too-many-files',
|
|
58
|
+
values: {
|
|
59
|
+
maxCount: maxCount
|
|
60
|
+
}
|
|
61
|
+
}));
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
const errorMessages = [];
|
|
65
|
+
for (const { reason, file } of rejections){
|
|
66
|
+
const fileName = file.name;
|
|
67
|
+
if ('size' === reason) {
|
|
68
|
+
const fileSizeMB = Math.round(file.size / 1024 / 1024);
|
|
69
|
+
const maxSize = allowedAttachments.maxSize / 1024 / 1024;
|
|
70
|
+
errorMessages.push(_({
|
|
71
|
+
id: 'autopilot-chat.error.file-too-large',
|
|
72
|
+
values: {
|
|
73
|
+
fileName: fileName,
|
|
74
|
+
fileSizeMB: fileSizeMB,
|
|
75
|
+
maxSize: maxSize
|
|
76
|
+
}
|
|
77
|
+
}));
|
|
78
|
+
} else if ('type' === reason) errorMessages.push(_({
|
|
79
|
+
id: 'autopilot-chat.error.file-invalid-type',
|
|
80
|
+
values: {
|
|
81
|
+
fileName: fileName
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
if (errorMessages.length > 0) setError(errorMessages.join('\n'));
|
|
86
|
+
return false;
|
|
87
|
+
}, [
|
|
88
|
+
_,
|
|
89
|
+
setError,
|
|
90
|
+
allowedAttachments.maxCount,
|
|
91
|
+
allowedAttachments.maxSize,
|
|
92
|
+
allowedAttachments.multiple
|
|
93
|
+
]);
|
|
94
|
+
return react.useCallback(async (accepted, rejected)=>{
|
|
95
|
+
try {
|
|
96
|
+
const parsedFiles = await parseFiles(accepted);
|
|
97
|
+
if (handleRejections(parsedFiles, rejected)) return;
|
|
98
|
+
if (0 === rejected.length) setError(void 0);
|
|
99
|
+
if (allowedAttachments.multiple) addAttachments(parsedFiles);
|
|
100
|
+
else if (1 === parsedFiles.length) addAttachments([
|
|
101
|
+
parsedFiles[0]
|
|
102
|
+
]);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
setError(error);
|
|
105
|
+
}
|
|
106
|
+
}, [
|
|
107
|
+
addAttachments,
|
|
108
|
+
setError,
|
|
109
|
+
allowedAttachments.multiple,
|
|
110
|
+
handleRejections
|
|
111
|
+
]);
|
|
112
|
+
}
|
|
113
|
+
export { checkAttachmentFiles, getAcceptedFileTypes, useAttachmentIntake };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
useAttachmentLimits: ()=>useAttachmentLimits
|
|
37
|
+
});
|
|
38
|
+
const react_namespaceObject = require("@lingui/react");
|
|
39
|
+
const external_react_namespaceObject = require("react");
|
|
40
|
+
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
41
|
+
function useAttachmentLimits(allowed) {
|
|
42
|
+
const { _ } = (0, react_namespaceObject.useLingui)();
|
|
43
|
+
return external_react_default().useMemo(()=>{
|
|
44
|
+
const lines = [];
|
|
45
|
+
const maxCount = allowed.maxCount;
|
|
46
|
+
const maxSize = allowed.maxSize / 1024 / 1024;
|
|
47
|
+
const fileTypes = Object.values(allowed.types).flat().join(', ');
|
|
48
|
+
if (maxCount && maxCount > 1 && allowed.multiple) lines.push(_({
|
|
49
|
+
id: 'autopilot-chat.input.actions.attachments.max-count',
|
|
50
|
+
values: {
|
|
51
|
+
maxCount: maxCount
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
lines.push(_({
|
|
55
|
+
id: 'autopilot-chat.input.actions.attachments.max-size',
|
|
56
|
+
values: {
|
|
57
|
+
maxSize: maxSize
|
|
58
|
+
}
|
|
59
|
+
}), _({
|
|
60
|
+
id: 'autopilot-chat.input.actions.attachments.allowed-types',
|
|
61
|
+
values: {
|
|
62
|
+
fileTypes: fileTypes
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
return lines;
|
|
66
|
+
}, [
|
|
67
|
+
_,
|
|
68
|
+
allowed
|
|
69
|
+
]);
|
|
70
|
+
}
|
|
71
|
+
exports.useAttachmentLimits = __webpack_exports__.useAttachmentLimits;
|
|
72
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
73
|
+
"useAttachmentLimits"
|
|
74
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
75
|
+
Object.defineProperty(exports, '__esModule', {
|
|
76
|
+
value: true
|
|
77
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-attachment-limits.d.ts","sourceRoot":"","sources":["../../../../src/chat/headless/hooks/use-attachment-limits.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAMrE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,EAAE,CAkCtF"}
|