@copilotkit/vue 2.0.0-rc.1 → 2.0.0-rc.10
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/PARITY.md +13 -12
- package/README.md +1 -2
- package/dist/components/copilot-provider/CopilotKit.vue.d.ts +3 -1
- package/dist/components/copilot-provider/CopilotKit.vue.d.ts.map +1 -1
- package/dist/hooks/use-copilot-action.d.ts.map +1 -1
- package/dist/hooks/use-frontend-tool.d.ts +1 -1
- package/dist/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/hooks/zod-parameters.d.ts +14 -0
- package/dist/hooks/zod-parameters.d.ts.map +1 -0
- package/dist/index.cjs +1 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +384 -14275
- package/dist/index.mjs.map +1 -1
- package/dist/use-render-activity-message-CTR_ziWV.js +18097 -0
- package/dist/use-render-activity-message-CTR_ziWV.js.map +1 -0
- package/dist/use-render-activity-message-Dky9_GRG.cjs +92 -0
- package/dist/use-render-activity-message-Dky9_GRG.cjs.map +1 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts +7 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -1
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -1
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +13 -45
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +11 -2
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +144 -0
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -0
- package/dist/v2/components/a2ui.d.ts +3 -7
- package/dist/v2/components/a2ui.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChat.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts +3 -1
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAssistantToolbarButton.vue.d.ts +16 -0
- package/dist/v2/components/chat/CopilotChatAssistantToolbarButton.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts +22 -0
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +21 -232
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts +12 -0
- package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts +22 -0
- package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +20 -0
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatSuggestionPill.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatSuggestionView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToggleButton.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts +32 -0
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +11 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts +5 -0
- package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeaderTitle.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupWelcomeScreen.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +2 -0
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +2 -0
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +2 -0
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarWelcomeScreen.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts +0 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
- package/dist/v2/components/chat/index.d.ts +17 -1
- package/dist/v2/components/chat/index.d.ts.map +1 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts +12 -0
- package/dist/v2/components/chat/inspector-shortcuts.d.ts.map +1 -0
- package/dist/v2/components/chat/message-feedback.d.ts +89 -0
- package/dist/v2/components/chat/message-feedback.d.ts.map +1 -0
- package/dist/v2/components/chat/tool-call-capture.d.ts +39 -0
- package/dist/v2/components/chat/tool-call-capture.d.ts.map +1 -0
- package/dist/v2/components/chat/tool-call-display-context.d.ts +22 -0
- package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -0
- package/dist/v2/components/chat/tool-call-group-parts.d.ts +131 -0
- package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -0
- package/dist/v2/components/chat/turn-work.d.ts +33 -0
- package/dist/v2/components/chat/turn-work.d.ts.map +1 -0
- package/dist/v2/components/chat/types.d.ts +104 -5
- package/dist/v2/components/chat/types.d.ts.map +1 -1
- package/dist/v2/components/chat/use-chat-labels.d.ts +8 -0
- package/dist/v2/components/chat/use-chat-labels.d.ts.map +1 -0
- package/dist/v2/components/chat/use-lightbox.d.ts +18 -0
- package/dist/v2/components/chat/use-lightbox.d.ts.map +1 -0
- package/dist/v2/components/icons/index.d.ts +968 -1
- package/dist/v2/components/icons/index.d.ts.map +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts +55 -0
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts.map +1 -0
- package/dist/v2/components/ui/CopilotPopover.vue.d.ts +40 -0
- package/dist/v2/components/ui/CopilotPopover.vue.d.ts.map +1 -0
- package/dist/v2/components/ui/CopilotTooltip.vue.d.ts +37 -0
- package/dist/v2/components/ui/CopilotTooltip.vue.d.ts.map +1 -0
- package/dist/v2/components/ui/dropdown-menu.d.ts +14 -0
- package/dist/v2/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/v2/components/ui/floating.d.ts +84 -0
- package/dist/v2/components/ui/floating.d.ts.map +1 -0
- package/dist/v2/components/ui/presence.d.ts +9 -0
- package/dist/v2/components/ui/presence.d.ts.map +1 -0
- package/dist/v2/components/ui/use-id.d.ts +9 -0
- package/dist/v2/components/ui/use-id.d.ts.map +1 -0
- package/dist/v2/hooks/use-default-render-tool.d.ts +6 -0
- package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-frontend-tool.d.ts +5 -0
- package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-activity-message.d.ts +13 -9
- package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-custom-messages.d.ts +5 -7
- package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-tool.d.ts +4 -0
- package/dist/v2/hooks/use-render-tool.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.d.cts +3 -0
- package/dist/v2/index.d.mts +3 -0
- package/dist/v2/index.d.ts +3 -0
- package/dist/v2/index.d.ts.map +1 -1
- package/dist/v2/index.mjs +197 -197
- package/dist/v2/index.mjs.map +1 -1
- package/dist/v2/lib/message-feedback.d.ts +33 -0
- package/dist/v2/lib/message-feedback.d.ts.map +1 -0
- package/dist/v2/lib/processPartialHtml.d.ts +1 -2
- package/dist/v2/lib/processPartialHtml.d.ts.map +1 -1
- package/dist/v2/lib/vue-core.d.ts +0 -1
- package/dist/v2/lib/vue-core.d.ts.map +1 -1
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +56 -6
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +6 -2
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/index.d.ts +1 -1
- package/dist/v2/providers/index.d.ts.map +1 -1
- package/dist/v2/providers/keys.d.ts +8 -0
- package/dist/v2/providers/keys.d.ts.map +1 -1
- package/dist/v2/providers/types.d.ts +3 -37
- package/dist/v2/providers/types.d.ts.map +1 -1
- package/dist/v2/styles/CopilotKitStyles.d.ts +18 -0
- package/dist/v2/styles/CopilotKitStyles.d.ts.map +1 -0
- package/dist/v2/types/defineToolCallRenderer.d.ts +2 -0
- package/dist/v2/types/defineToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/types/human-in-the-loop.d.ts +8 -29
- package/dist/v2/types/human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/types/interrupt.d.ts +1 -22
- package/dist/v2/types/interrupt.d.ts.map +1 -1
- package/dist/v2/types/vue-activity-message-renderer.d.ts +16 -15
- package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-custom-message-renderer.d.ts +7 -16
- package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-tool-call-renderer.d.ts +16 -28
- package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -1
- package/package.json +14 -27
- package/src/__tests__/build-entries.test.ts +27 -0
- package/src/components/copilot-provider/CopilotKit.vue +4 -1
- package/src/hooks/__tests__/zod-parameters.test.ts +520 -0
- package/src/hooks/use-copilot-action.ts +2 -1
- package/src/hooks/use-frontend-tool.ts +3 -6
- package/src/hooks/zod-parameters.ts +162 -0
- package/src/v2/__tests__/exports.test.ts +4 -2
- package/src/v2/components/A2UIMessageRenderer.ts +56 -68
- package/src/v2/components/A2UISurfaceActivityRenderer.vue +11 -23
- package/src/v2/components/LicenseWarningBanner.vue +31 -15
- package/src/v2/components/OpenGenerativeUIRenderer.ts +51 -373
- package/src/v2/components/__tests__/A2UIBasicCatalogColors.test.ts +8 -9
- package/src/v2/components/__tests__/A2UICatalogContext.test.ts +1 -1
- package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +63 -36
- package/src/v2/components/__tests__/LicenseWarningBanner.test.ts +20 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +55 -6
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +15 -258
- package/src/v2/components/a2ui/A2UICatalogContext.ts +10 -102
- package/src/v2/components/a2ui/A2UIRecoveryStates.ts +444 -0
- package/src/v2/components/a2ui/__tests__/A2UIRecoveryStates.test.ts +175 -0
- package/src/v2/components/a2ui.ts +1 -1
- package/src/v2/components/chat/CopilotChat.vue +26 -40
- package/src/v2/components/chat/CopilotChatAssistantMessage.vue +267 -67
- package/src/v2/components/chat/CopilotChatAssistantToolbarButton.vue +46 -0
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +150 -173
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +77 -20
- package/src/v2/components/chat/CopilotChatAudioRecorder.vue +2 -2
- package/src/v2/components/chat/CopilotChatFeedbackCommentPopover.vue +240 -0
- package/src/v2/components/chat/CopilotChatInput.vue +250 -191
- package/src/v2/components/chat/CopilotChatInspectorButton.vue +331 -0
- package/src/v2/components/chat/CopilotChatLightbox.vue +105 -0
- package/src/v2/components/chat/CopilotChatMessageView.vue +262 -87
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +52 -35
- package/src/v2/components/chat/CopilotChatSuggestionPill.vue +5 -14
- package/src/v2/components/chat/CopilotChatSuggestionView.vue +1 -4
- package/src/v2/components/chat/CopilotChatToggleButton.vue +3 -9
- package/src/v2/components/chat/CopilotChatToggleButtonCloseIcon.ts +1 -1
- package/src/v2/components/chat/CopilotChatToggleButtonOpenIcon.ts +1 -1
- package/src/v2/components/chat/CopilotChatToolCallGroup.vue +353 -0
- package/src/v2/components/chat/CopilotChatToolCallItem.vue +24 -14
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +194 -21
- package/src/v2/components/chat/CopilotChatUserMessage.vue +105 -42
- package/src/v2/components/chat/CopilotChatView.vue +37 -42
- package/src/v2/components/chat/CopilotChatWorkSummary.vue +111 -0
- package/src/v2/components/chat/CopilotModalHeader.vue +10 -8
- package/src/v2/components/chat/CopilotModalHeaderCloseButton.ts +7 -6
- package/src/v2/components/chat/CopilotModalHeaderTitle.ts +1 -4
- package/src/v2/components/chat/CopilotPopup.vue +3 -0
- package/src/v2/components/chat/CopilotPopupView.vue +1 -0
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +9 -19
- package/src/v2/components/chat/CopilotPopupWelcomeScreen.vue +5 -8
- package/src/v2/components/chat/CopilotSidebar.vue +5 -0
- package/src/v2/components/chat/CopilotSidebarView.vue +2 -0
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +24 -17
- package/src/v2/components/chat/CopilotSidebarWelcomeScreen.vue +7 -10
- package/src/v2/components/chat/StreamingMarkdownDefault.vue +3 -5
- package/src/v2/components/chat/__tests__/CopilotChat.labels.test.ts +19 -4
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +26 -9
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.inspector.test.ts +269 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.learningFeedback.test.ts +760 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.slots.e2e.test.ts +3 -5
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.ts +2 -2
- package/src/v2/components/chat/__tests__/CopilotChatInput.addMenu.test.ts +328 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.slots.e2e.test.ts +6 -3
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +55 -14
- package/src/v2/components/chat/__tests__/CopilotChatLightbox.test.ts +160 -0
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +247 -403
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.toolCallDisplay.test.ts +637 -0
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionPill.test.ts +1 -1
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.slots.e2e.test.ts +3 -1
- package/src/v2/components/chat/__tests__/CopilotChatToolCallsView.learning.test.ts +75 -0
- package/src/v2/components/chat/__tests__/CopilotChatUserMessage.attachments.test.ts +143 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.inputOverlay.test.ts +5 -4
- package/src/v2/components/chat/__tests__/CopilotChatView.rootWidth.test.ts +7 -33
- package/src/v2/components/chat/__tests__/CopilotModalHeader.slots.e2e.test.ts +1 -1
- package/src/v2/components/chat/__tests__/CopilotPopupView.slots.e2e.test.ts +3 -3
- package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.ts +126 -0
- package/src/v2/components/chat/__tests__/messageFeedbackDefaults.test.ts +33 -0
- package/src/v2/components/chat/__tests__/modalChatDisplayProps.test.ts +44 -0
- package/src/v2/components/chat/copilotChatToolCallItemRender.ts +3 -19
- package/src/v2/components/chat/index.ts +2 -1
- package/src/v2/components/chat/inspector-shortcuts.ts +34 -0
- package/src/v2/components/chat/message-feedback.ts +291 -0
- package/src/v2/components/chat/tool-call-capture.ts +55 -0
- package/src/v2/components/chat/tool-call-display-context.ts +28 -0
- package/src/v2/components/chat/tool-call-group-parts.ts +251 -0
- package/src/v2/components/chat/turn-work.ts +52 -0
- package/src/v2/components/chat/types.ts +114 -4
- package/src/v2/components/chat/use-chat-labels.ts +16 -0
- package/src/v2/components/chat/use-lightbox.ts +64 -0
- package/src/v2/components/icons/__tests__/icons.test.ts +72 -68
- package/src/v2/components/icons/index.ts +109 -23
- package/src/v2/components/ui/CopilotDropdownMenuContent.vue +465 -0
- package/src/v2/components/ui/CopilotPopover.vue +138 -0
- package/src/v2/components/ui/CopilotTooltip.vue +237 -0
- package/src/v2/components/ui/__tests__/CopilotTooltip.test.ts +168 -0
- package/src/v2/components/ui/dropdown-menu.ts +15 -0
- package/src/v2/components/ui/floating.ts +321 -0
- package/src/v2/components/ui/presence.ts +54 -0
- package/src/v2/components/ui/use-id.ts +16 -0
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +62 -1
- package/src/v2/hooks/__tests__/use-render-activity-message.test.ts +105 -0
- package/src/v2/hooks/__tests__/use-render-tool.test.ts +3 -6
- package/src/v2/hooks/__tests__/zod-regression.test.ts +5 -4
- package/src/v2/hooks/use-default-render-tool.ts +123 -62
- package/src/v2/hooks/use-frontend-tool.ts +10 -10
- package/src/v2/hooks/use-render-activity-message.ts +27 -48
- package/src/v2/hooks/use-render-custom-messages.ts +14 -35
- package/src/v2/hooks/use-render-tool.ts +8 -0
- package/src/v2/index.ts +3 -0
- package/src/v2/lib/__tests__/message-feedback.test.ts +152 -0
- package/src/v2/lib/message-feedback.ts +120 -0
- package/src/v2/lib/processPartialHtml.ts +6 -21
- package/src/v2/lib/vue-core.ts +3 -5
- package/src/v2/providers/CopilotChatConfigurationProvider.vue +29 -2
- package/src/v2/providers/CopilotKitProvider.types.ts +57 -5
- package/src/v2/providers/CopilotKitProvider.vue +177 -114
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.openThread.test.ts +69 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +1 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.headersAtSendTime.test.ts +3 -3
- package/src/v2/providers/__tests__/CopilotKitProvider.learning.test.ts +536 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +17 -33
- package/src/v2/providers/index.ts +4 -1
- package/src/v2/providers/keys.ts +12 -0
- package/src/v2/providers/types.ts +3 -38
- package/src/v2/styles/CopilotKitStyles.ts +95 -0
- package/src/v2/styles/__tests__/CopilotKitStyles.client.test.ts +149 -0
- package/src/v2/styles/__tests__/CopilotKitStyles.ssr.test.ts +71 -0
- package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +28 -33
- package/src/v2/types/defineToolCallRenderer.ts +9 -4
- package/src/v2/types/human-in-the-loop.ts +8 -32
- package/src/v2/types/interrupt.ts +7 -31
- package/src/v2/types/vue-activity-message-renderer.ts +24 -15
- package/src/v2/types/vue-custom-message-renderer.ts +12 -16
- package/src/v2/types/vue-tool-call-renderer.ts +23 -31
- package/vite.config.ts +5 -5
- package/dist/styles.css +0 -2
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts +0 -9
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts.map +0 -1
- package/dist/v2/lib/transcription-client.d.ts +0 -19
- package/dist/v2/lib/transcription-client.d.ts.map +0 -1
- package/scripts/scope-preflight.mjs +0 -100
- package/src/styles/globals.css +0 -233
- package/src/v2/components/chat/BasicMarkdown.vue +0 -158
- package/src/v2/components/chat/__tests__/BasicMarkdown.test.ts +0 -69
- package/src/v2/lib/__tests__/processPartialHtml.test.ts +0 -84
- package/src/v2/lib/__tests__/transcription-client.test.ts +0 -67
- package/src/v2/lib/transcription-client.ts +0 -151
|
@@ -7,8 +7,9 @@ import {
|
|
|
7
7
|
} from "@copilotkit/shared";
|
|
8
8
|
import type { Attachment } from "@copilotkit/shared";
|
|
9
9
|
import type { CopilotChatAttachmentQueueProps } from "./types";
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
10
|
+
import { IconPlay } from "../icons";
|
|
11
|
+
import CopilotChatLightbox from "./CopilotChatLightbox.vue";
|
|
12
|
+
import { useChatLabels } from "./use-chat-labels";
|
|
12
13
|
|
|
13
14
|
const props = withDefaults(defineProps<CopilotChatAttachmentQueueProps>(), {
|
|
14
15
|
attachments: () => [],
|
|
@@ -19,13 +20,21 @@ const emit = defineEmits<{
|
|
|
19
20
|
"remove-attachment": [id: string];
|
|
20
21
|
}>();
|
|
21
22
|
|
|
22
|
-
const
|
|
23
|
-
const labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);
|
|
23
|
+
const labels = useChatLabels();
|
|
24
24
|
|
|
25
25
|
const activeLightboxAttachment = ref<Attachment | null>(null);
|
|
26
26
|
const documentBlobUrl = ref<string | null>(null);
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const lightboxLabel = computed(() => {
|
|
29
|
+
const attachment = activeLightboxAttachment.value;
|
|
30
|
+
if (!attachment) return undefined;
|
|
31
|
+
if (attachment.filename) return attachment.filename;
|
|
32
|
+
return attachment.type === "image"
|
|
33
|
+
? labels.value.attachmentImageAltText
|
|
34
|
+
: attachment.type === "video"
|
|
35
|
+
? "Video attachment"
|
|
36
|
+
: labels.value.attachmentDocumentLabel;
|
|
37
|
+
});
|
|
29
38
|
const isPreviewableDocument = computed(() => {
|
|
30
39
|
const attachment = activeLightboxAttachment.value;
|
|
31
40
|
if (!attachment || attachment.type !== "document") return false;
|
|
@@ -78,20 +87,6 @@ watch(
|
|
|
78
87
|
{ immediate: true },
|
|
79
88
|
);
|
|
80
89
|
|
|
81
|
-
watch(isLightboxOpen, (open, _previous, onCleanup) => {
|
|
82
|
-
if (!open || typeof document === "undefined") return;
|
|
83
|
-
|
|
84
|
-
const handleKeydown = (event: KeyboardEvent) => {
|
|
85
|
-
if (event.key === "Escape") {
|
|
86
|
-
closeLightbox();
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
document.addEventListener("keydown", handleKeydown);
|
|
90
|
-
onCleanup(() => {
|
|
91
|
-
document.removeEventListener("keydown", handleKeydown);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
|
|
95
90
|
onBeforeUnmount(() => {
|
|
96
91
|
if (documentBlobUrl.value) {
|
|
97
92
|
URL.revokeObjectURL(documentBlobUrl.value);
|
|
@@ -120,12 +115,12 @@ function closeLightbox() {
|
|
|
120
115
|
|
|
121
116
|
function cardClassName(attachment: Attachment) {
|
|
122
117
|
if (attachment.type === "image" || attachment.type === "video") {
|
|
123
|
-
return "cpk
|
|
118
|
+
return "cpk-attachment-queue-item-media";
|
|
124
119
|
}
|
|
125
120
|
if (attachment.type === "audio") {
|
|
126
|
-
return "cpk
|
|
121
|
+
return "cpk-attachment-queue-item-audio";
|
|
127
122
|
}
|
|
128
|
-
return "cpk
|
|
123
|
+
return "cpk-attachment-queue-item-document";
|
|
129
124
|
}
|
|
130
125
|
|
|
131
126
|
function isPdf(mimeType: string | undefined): boolean {
|
|
@@ -160,92 +155,87 @@ function createBlobUrl(
|
|
|
160
155
|
<template>
|
|
161
156
|
<div
|
|
162
157
|
v-if="props.attachments.length > 0"
|
|
163
|
-
class="cpk
|
|
158
|
+
class="cpk-attachment-queue"
|
|
164
159
|
:class="props.className"
|
|
165
160
|
data-testid="copilot-chat-attachment-queue"
|
|
166
161
|
>
|
|
167
162
|
<div
|
|
168
163
|
v-for="attachment in props.attachments"
|
|
169
164
|
:key="attachment.id"
|
|
170
|
-
class="cpk
|
|
165
|
+
class="cpk-attachment-queue-item"
|
|
171
166
|
:class="cardClassName(attachment)"
|
|
172
167
|
data-testid="copilot-chat-attachment-item"
|
|
173
168
|
:data-card-type="attachment.type"
|
|
174
169
|
>
|
|
175
170
|
<div
|
|
176
171
|
v-if="attachment.status === 'uploading'"
|
|
177
|
-
class="cpk
|
|
172
|
+
class="cpk-attachment-queue-uploading-overlay"
|
|
178
173
|
data-testid="copilot-chat-attachment-uploading-overlay"
|
|
179
174
|
>
|
|
180
|
-
<div
|
|
181
|
-
class="cpk:w-5 cpk:h-5 cpk:border-2 cpk:border-white cpk:border-t-transparent cpk:rounded-full cpk:animate-spin"
|
|
182
|
-
/>
|
|
175
|
+
<div class="cpk-attachment-queue-uploading-spinner" />
|
|
183
176
|
</div>
|
|
184
177
|
|
|
185
178
|
<template v-if="attachment.status === 'ready'">
|
|
186
179
|
<button
|
|
187
180
|
v-if="attachment.type === 'image'"
|
|
188
181
|
type="button"
|
|
189
|
-
class="cpk
|
|
182
|
+
class="cpk-attachment-queue-preview-button"
|
|
190
183
|
data-testid="copilot-chat-attachment-image-button"
|
|
191
184
|
@click="openLightbox(attachment)"
|
|
192
185
|
>
|
|
193
186
|
<img
|
|
194
187
|
:src="getSourceUrl(attachment.source)"
|
|
195
188
|
:alt="attachment.filename || 'Image attachment'"
|
|
196
|
-
class="cpk
|
|
189
|
+
class="cpk-attachment-queue-image"
|
|
197
190
|
data-testid="copilot-chat-attachment-image-thumbnail"
|
|
198
191
|
/>
|
|
199
192
|
</button>
|
|
200
193
|
|
|
201
|
-
<
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
/>
|
|
194
|
+
<template v-else-if="attachment.type === 'video'">
|
|
195
|
+
<div class="cpk-attachment-queue-video">
|
|
196
|
+
<img
|
|
197
|
+
v-if="attachment.thumbnail"
|
|
198
|
+
:src="attachment.thumbnail"
|
|
199
|
+
:alt="attachment.filename || 'Video thumbnail'"
|
|
200
|
+
class="cpk-attachment-queue-video-thumbnail"
|
|
201
|
+
data-testid="copilot-chat-attachment-video-thumbnail"
|
|
202
|
+
/>
|
|
203
|
+
<video
|
|
204
|
+
v-else
|
|
205
|
+
:src="getSourceUrl(attachment.source)"
|
|
206
|
+
preload="metadata"
|
|
207
|
+
muted
|
|
208
|
+
class="cpk-attachment-queue-video-thumbnail"
|
|
209
|
+
data-testid="copilot-chat-attachment-video-fallback"
|
|
210
|
+
/>
|
|
211
|
+
</div>
|
|
220
212
|
<button
|
|
221
213
|
type="button"
|
|
222
|
-
class="cpk
|
|
214
|
+
class="cpk-attachment-queue-video-play-button"
|
|
223
215
|
:aria-label="labels.attachmentPlayVideoButtonLabel"
|
|
224
216
|
data-testid="copilot-chat-attachment-video-play"
|
|
225
217
|
@click="openLightbox(attachment)"
|
|
226
218
|
>
|
|
227
|
-
<div
|
|
228
|
-
class="cpk
|
|
229
|
-
>
|
|
230
|
-
▶
|
|
219
|
+
<div class="cpk-attachment-queue-video-play-badge">
|
|
220
|
+
<IconPlay class="cpk-attachment-queue-video-play-icon" />
|
|
231
221
|
</div>
|
|
232
222
|
</button>
|
|
233
|
-
</
|
|
223
|
+
</template>
|
|
234
224
|
|
|
235
225
|
<div
|
|
236
226
|
v-else-if="attachment.type === 'audio'"
|
|
237
|
-
class="cpk
|
|
227
|
+
class="cpk-attachment-queue-audio"
|
|
238
228
|
>
|
|
239
229
|
<audio
|
|
240
230
|
:src="getSourceUrl(attachment.source)"
|
|
241
231
|
controls
|
|
242
232
|
preload="metadata"
|
|
243
|
-
class="cpk
|
|
233
|
+
class="cpk-attachment-queue-audio-player"
|
|
244
234
|
data-testid="copilot-chat-attachment-audio-player"
|
|
245
235
|
/>
|
|
246
236
|
<span
|
|
247
237
|
v-if="attachment.filename"
|
|
248
|
-
class="cpk
|
|
238
|
+
class="cpk-attachment-queue-audio-filename"
|
|
249
239
|
>
|
|
250
240
|
{{ attachment.filename }}
|
|
251
241
|
</span>
|
|
@@ -254,13 +244,12 @@ function createBlobUrl(
|
|
|
254
244
|
<button
|
|
255
245
|
v-else
|
|
256
246
|
type="button"
|
|
257
|
-
class="cpk
|
|
258
|
-
:class="
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
"
|
|
247
|
+
class="cpk-attachment-queue-preview-button cpk-attachment-queue-document"
|
|
248
|
+
:class="{
|
|
249
|
+
'cpk-attachment-queue-document-previewable':
|
|
250
|
+
isPdf(attachment.source.mimeType) ||
|
|
251
|
+
isText(attachment.source.mimeType),
|
|
252
|
+
}"
|
|
264
253
|
data-testid="copilot-chat-attachment-document-button"
|
|
265
254
|
@click="
|
|
266
255
|
(isPdf(attachment.source.mimeType) ||
|
|
@@ -268,21 +257,19 @@ function createBlobUrl(
|
|
|
268
257
|
openLightbox(attachment)
|
|
269
258
|
"
|
|
270
259
|
>
|
|
271
|
-
<div
|
|
272
|
-
class="cpk:w-8 cpk:h-8 cpk:rounded-md cpk:bg-primary cpk:text-primary-foreground cpk:flex cpk:items-center cpk:justify-center cpk:text-[10px] cpk:font-semibold cpk:shrink-0"
|
|
273
|
-
>
|
|
260
|
+
<div class="cpk-attachment-queue-document-icon">
|
|
274
261
|
{{ getDocumentIcon(attachment.source.mimeType ?? "") }}
|
|
275
262
|
</div>
|
|
276
|
-
<div class="cpk
|
|
263
|
+
<div class="cpk-attachment-queue-document-info">
|
|
277
264
|
<span
|
|
278
|
-
class="cpk
|
|
265
|
+
class="cpk-attachment-queue-document-name"
|
|
279
266
|
data-testid="copilot-chat-attachment-document-filename"
|
|
280
267
|
>
|
|
281
|
-
{{ attachment.filename ||
|
|
268
|
+
{{ attachment.filename || labels.attachmentDocumentLabel }}
|
|
282
269
|
</span>
|
|
283
270
|
<span
|
|
284
271
|
v-if="attachment.size != null"
|
|
285
|
-
class="cpk
|
|
272
|
+
class="cpk-attachment-queue-document-size"
|
|
286
273
|
>
|
|
287
274
|
{{ formatFileSize(attachment.size) }}
|
|
288
275
|
</span>
|
|
@@ -292,13 +279,13 @@ function createBlobUrl(
|
|
|
292
279
|
|
|
293
280
|
<div
|
|
294
281
|
v-else
|
|
295
|
-
class="cpk
|
|
282
|
+
class="cpk-attachment-queue-placeholder"
|
|
296
283
|
data-testid="copilot-chat-attachment-placeholder"
|
|
297
284
|
/>
|
|
298
285
|
|
|
299
286
|
<button
|
|
300
287
|
type="button"
|
|
301
|
-
class="cpk
|
|
288
|
+
class="cpk-attachment-queue-remove-button"
|
|
302
289
|
:aria-label="labels.attachmentRemoveButtonLabel"
|
|
303
290
|
@click="emit('remove-attachment', attachment.id)"
|
|
304
291
|
>
|
|
@@ -307,110 +294,100 @@ function createBlobUrl(
|
|
|
307
294
|
</div>
|
|
308
295
|
</div>
|
|
309
296
|
|
|
310
|
-
<
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
>
|
|
323
|
-
✕
|
|
324
|
-
</button>
|
|
297
|
+
<CopilotChatLightbox
|
|
298
|
+
v-if="activeLightboxAttachment"
|
|
299
|
+
:label="lightboxLabel"
|
|
300
|
+
@close="closeLightbox"
|
|
301
|
+
>
|
|
302
|
+
<img
|
|
303
|
+
v-if="activeLightboxAttachment.type === 'image'"
|
|
304
|
+
:src="getSourceUrl(activeLightboxAttachment.source)"
|
|
305
|
+
:alt="activeLightboxAttachment.filename || 'Image attachment'"
|
|
306
|
+
class="cpk-attachment-queue-lightbox-image"
|
|
307
|
+
data-testid="copilot-chat-attachment-lightbox-image"
|
|
308
|
+
/>
|
|
325
309
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
310
|
+
<video
|
|
311
|
+
v-else-if="activeLightboxAttachment.type === 'video'"
|
|
312
|
+
:src="getSourceUrl(activeLightboxAttachment.source)"
|
|
313
|
+
controls
|
|
314
|
+
autoplay
|
|
315
|
+
class="cpk-attachment-queue-lightbox-video"
|
|
316
|
+
data-testid="copilot-chat-attachment-lightbox-video"
|
|
317
|
+
/>
|
|
334
318
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
319
|
+
<template v-else-if="activeLightboxAttachment.type === 'document'">
|
|
320
|
+
<iframe
|
|
321
|
+
v-if="
|
|
322
|
+
isPreviewableDocument &&
|
|
323
|
+
isPdf(activeLightboxAttachment.source.mimeType) &&
|
|
324
|
+
lightboxDocumentSource
|
|
325
|
+
"
|
|
326
|
+
:src="lightboxDocumentSource"
|
|
327
|
+
:title="activeLightboxAttachment.filename || 'PDF preview'"
|
|
328
|
+
class="cpk-attachment-queue-pdf-preview"
|
|
329
|
+
data-testid="copilot-chat-attachment-lightbox-document-iframe"
|
|
330
|
+
/>
|
|
343
331
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
332
|
+
<div
|
|
333
|
+
v-else-if="
|
|
334
|
+
isPreviewableDocument &&
|
|
335
|
+
isText(activeLightboxAttachment.source.mimeType)
|
|
336
|
+
"
|
|
337
|
+
class="cpk-attachment-queue-text-preview"
|
|
338
|
+
>
|
|
339
|
+
<div
|
|
340
|
+
v-if="activeLightboxAttachment.filename"
|
|
341
|
+
class="cpk-attachment-queue-text-preview-filename"
|
|
342
|
+
>
|
|
343
|
+
{{ activeLightboxAttachment.filename }}
|
|
344
|
+
</div>
|
|
345
|
+
<pre
|
|
346
|
+
v-if="decodedTextPreview !== null"
|
|
347
|
+
class="cpk-attachment-queue-text-preview-content"
|
|
348
|
+
data-testid="copilot-chat-attachment-lightbox-document-text"
|
|
349
|
+
>{{ decodedTextPreview }}</pre
|
|
350
|
+
>
|
|
351
|
+
<iframe
|
|
352
|
+
v-else-if="lightboxDocumentSource"
|
|
353
|
+
:src="lightboxDocumentSource"
|
|
354
|
+
:title="activeLightboxAttachment.filename || 'Text preview'"
|
|
355
|
+
class="cpk-attachment-queue-text-preview-frame"
|
|
356
|
+
data-testid="copilot-chat-attachment-lightbox-document-iframe"
|
|
357
|
+
/>
|
|
358
|
+
</div>
|
|
356
359
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
v-else-if="lightboxDocumentSource"
|
|
372
|
-
:src="lightboxDocumentSource"
|
|
373
|
-
:title="activeLightboxAttachment.filename || 'Text preview'"
|
|
374
|
-
class="cpk:w-full cpk:h-[80vh] cpk:border-none"
|
|
375
|
-
data-testid="copilot-chat-attachment-lightbox-document-iframe"
|
|
376
|
-
/>
|
|
360
|
+
<div
|
|
361
|
+
v-else
|
|
362
|
+
class="cpk-attachment-queue-document-card"
|
|
363
|
+
data-testid="copilot-chat-attachment-lightbox-document-fallback"
|
|
364
|
+
>
|
|
365
|
+
<div class="cpk-attachment-queue-document-card-icon">
|
|
366
|
+
{{ getDocumentIcon(activeLightboxAttachment.source.mimeType ?? "") }}
|
|
367
|
+
</div>
|
|
368
|
+
<div class="cpk-attachment-queue-document-card-details">
|
|
369
|
+
<div class="cpk-attachment-queue-document-card-name">
|
|
370
|
+
{{
|
|
371
|
+
activeLightboxAttachment.filename ||
|
|
372
|
+
labels.attachmentDocumentLabel
|
|
373
|
+
}}
|
|
377
374
|
</div>
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
getDocumentIcon(activeLightboxAttachment.source.mimeType ?? "")
|
|
389
|
-
}}
|
|
390
|
-
</div>
|
|
391
|
-
<div class="cpk:text-center">
|
|
392
|
-
<div
|
|
393
|
-
class="cpk:text-base cpk:font-medium cpk:text-gray-800 cpk:dark:text-gray-200"
|
|
394
|
-
>
|
|
395
|
-
{{ activeLightboxAttachment.filename || "Document" }}
|
|
396
|
-
</div>
|
|
397
|
-
<div
|
|
398
|
-
class="cpk:text-sm cpk:text-gray-500 cpk:dark:text-gray-400 cpk:mt-1"
|
|
399
|
-
>
|
|
400
|
-
{{ activeLightboxAttachment.source.mimeType || "Unknown type" }}
|
|
401
|
-
{{
|
|
402
|
-
activeLightboxAttachment.size != null
|
|
403
|
-
? ` · ${formatFileSize(activeLightboxAttachment.size)}`
|
|
404
|
-
: ""
|
|
405
|
-
}}
|
|
406
|
-
</div>
|
|
407
|
-
</div>
|
|
408
|
-
<div class="cpk:text-xs cpk:text-gray-400 cpk:dark:text-gray-500">
|
|
409
|
-
No preview available for this file type
|
|
410
|
-
</div>
|
|
375
|
+
<div class="cpk-attachment-queue-document-card-meta">
|
|
376
|
+
{{
|
|
377
|
+
activeLightboxAttachment.source.mimeType ||
|
|
378
|
+
labels.attachmentUnknownTypeText
|
|
379
|
+
}}
|
|
380
|
+
{{
|
|
381
|
+
activeLightboxAttachment.size != null
|
|
382
|
+
? ` · ${formatFileSize(activeLightboxAttachment.size)}`
|
|
383
|
+
: ""
|
|
384
|
+
}}
|
|
411
385
|
</div>
|
|
412
|
-
</
|
|
386
|
+
</div>
|
|
387
|
+
<div class="cpk-attachment-queue-document-card-note">
|
|
388
|
+
{{ labels.attachmentNoPreviewText }}
|
|
389
|
+
</div>
|
|
413
390
|
</div>
|
|
414
|
-
</
|
|
415
|
-
</
|
|
391
|
+
</template>
|
|
392
|
+
</CopilotChatLightbox>
|
|
416
393
|
</template>
|
|
@@ -2,41 +2,89 @@
|
|
|
2
2
|
import { computed, ref } from "vue";
|
|
3
3
|
import { getDocumentIcon, getSourceUrl } from "@copilotkit/shared";
|
|
4
4
|
import type { CopilotChatAttachmentRendererProps } from "./types";
|
|
5
|
+
import CopilotChatLightbox from "./CopilotChatLightbox.vue";
|
|
6
|
+
import { useLightbox } from "./use-lightbox";
|
|
7
|
+
import { useChatLabels } from "./use-chat-labels";
|
|
5
8
|
|
|
6
9
|
const props = withDefaults(defineProps<CopilotChatAttachmentRendererProps>(), {
|
|
7
10
|
filename: undefined,
|
|
8
11
|
className: "",
|
|
9
12
|
});
|
|
10
13
|
|
|
14
|
+
const labels = useChatLabels();
|
|
11
15
|
const imageLoadFailed = ref(false);
|
|
12
16
|
const sourceUrl = computed(() => getSourceUrl(props.source));
|
|
13
17
|
const documentLabel = computed(
|
|
14
|
-
() =>
|
|
18
|
+
() =>
|
|
19
|
+
props.filename ||
|
|
20
|
+
props.source.mimeType ||
|
|
21
|
+
labels.value.attachmentUnknownTypeText,
|
|
15
22
|
);
|
|
23
|
+
const documentAriaLabel = computed(
|
|
24
|
+
() =>
|
|
25
|
+
props.filename ||
|
|
26
|
+
props.source.mimeType ||
|
|
27
|
+
labels.value.attachmentDocumentAltText,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const imageButton = ref<HTMLButtonElement | null>(null);
|
|
31
|
+
const {
|
|
32
|
+
thumbnailRef,
|
|
33
|
+
vtName,
|
|
34
|
+
open: lightboxOpen,
|
|
35
|
+
openLightbox,
|
|
36
|
+
closeLightbox,
|
|
37
|
+
} = useLightbox();
|
|
16
38
|
</script>
|
|
17
39
|
|
|
18
40
|
<template>
|
|
19
|
-
<img
|
|
41
|
+
<!-- React opens the lightbox from the <img>; a button around it lets
|
|
42
|
+
keyboard users open it too. The button has no look of its own. -->
|
|
43
|
+
<button
|
|
20
44
|
v-if="props.type === 'image' && !imageLoadFailed"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class="cpk
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
45
|
+
ref="imageButton"
|
|
46
|
+
type="button"
|
|
47
|
+
class="cpk-attachment-renderer-image-button"
|
|
48
|
+
data-testid="copilot-chat-attachment-renderer-image-button"
|
|
49
|
+
@click="openLightbox"
|
|
50
|
+
>
|
|
51
|
+
<img
|
|
52
|
+
ref="thumbnailRef"
|
|
53
|
+
:src="sourceUrl"
|
|
54
|
+
:alt="labels.attachmentImageAltText"
|
|
55
|
+
class="cpk-attachment-renderer cpk-attachment-renderer-image"
|
|
56
|
+
:class="props.className"
|
|
57
|
+
data-testid="copilot-chat-attachment-renderer-image"
|
|
58
|
+
@error="imageLoadFailed = true"
|
|
59
|
+
/>
|
|
60
|
+
<!-- Teleported to the body; inside the button only to keep one root. -->
|
|
61
|
+
<CopilotChatLightbox
|
|
62
|
+
v-if="lightboxOpen"
|
|
63
|
+
:label="labels.attachmentImageAltText"
|
|
64
|
+
:return-focus-to="imageButton"
|
|
65
|
+
@close="closeLightbox"
|
|
66
|
+
>
|
|
67
|
+
<img
|
|
68
|
+
:style="{ viewTransitionName: vtName }"
|
|
69
|
+
:src="sourceUrl"
|
|
70
|
+
:alt="labels.attachmentImageAltText"
|
|
71
|
+
class="cpk-attachment-renderer-lightbox-image"
|
|
72
|
+
data-testid="copilot-chat-attachment-renderer-lightbox-image"
|
|
73
|
+
/>
|
|
74
|
+
</CopilotChatLightbox>
|
|
75
|
+
</button>
|
|
28
76
|
<div
|
|
29
77
|
v-else-if="props.type === 'image'"
|
|
30
|
-
class="cpk
|
|
78
|
+
class="cpk-attachment-renderer cpk-attachment-renderer-image-error"
|
|
31
79
|
:class="props.className"
|
|
32
80
|
data-testid="copilot-chat-attachment-renderer-image-fallback"
|
|
33
81
|
>
|
|
34
|
-
<span>
|
|
82
|
+
<span>{{ labels.attachmentImageLoadErrorText }}</span>
|
|
35
83
|
</div>
|
|
36
84
|
|
|
37
85
|
<div
|
|
38
86
|
v-else-if="props.type === 'audio'"
|
|
39
|
-
class="cpk
|
|
87
|
+
class="cpk-attachment-renderer cpk-attachment-renderer-audio"
|
|
40
88
|
:class="props.className"
|
|
41
89
|
data-testid="copilot-chat-attachment-renderer-audio"
|
|
42
90
|
>
|
|
@@ -44,11 +92,11 @@ const documentLabel = computed(
|
|
|
44
92
|
:src="sourceUrl"
|
|
45
93
|
controls
|
|
46
94
|
preload="metadata"
|
|
47
|
-
class="cpk
|
|
95
|
+
class="cpk-attachment-renderer-audio-player"
|
|
48
96
|
/>
|
|
49
97
|
<span
|
|
50
98
|
v-if="props.filename"
|
|
51
|
-
class="cpk
|
|
99
|
+
class="cpk-attachment-renderer-audio-filename"
|
|
52
100
|
data-testid="copilot-chat-attachment-renderer-audio-filename"
|
|
53
101
|
>
|
|
54
102
|
{{ props.filename }}
|
|
@@ -60,28 +108,37 @@ const documentLabel = computed(
|
|
|
60
108
|
:src="sourceUrl"
|
|
61
109
|
controls
|
|
62
110
|
preload="metadata"
|
|
63
|
-
class="cpk
|
|
111
|
+
class="cpk-attachment-renderer cpk-attachment-renderer-video"
|
|
64
112
|
:class="props.className"
|
|
65
113
|
data-testid="copilot-chat-attachment-renderer-video"
|
|
66
114
|
/>
|
|
67
115
|
|
|
68
|
-
|
|
116
|
+
<!-- `download` is honoured for same-origin, data: and blob: URLs. Browsers
|
|
117
|
+
ignore it for cross-origin URLs unless the server sends
|
|
118
|
+
`Content-Disposition: attachment`; `target="_blank"` keeps those from
|
|
119
|
+
navigating the chat away and opens the file in a new tab instead. -->
|
|
120
|
+
<a
|
|
69
121
|
v-else
|
|
70
|
-
|
|
122
|
+
:href="sourceUrl"
|
|
123
|
+
:download="props.filename ?? ''"
|
|
124
|
+
target="_blank"
|
|
125
|
+
rel="noopener noreferrer"
|
|
126
|
+
:aria-label="documentAriaLabel"
|
|
127
|
+
class="cpk-attachment-renderer cpk-attachment-renderer-document"
|
|
71
128
|
:class="props.className"
|
|
72
129
|
data-testid="copilot-chat-attachment-renderer-document"
|
|
73
130
|
>
|
|
74
131
|
<span
|
|
75
|
-
class="cpk
|
|
132
|
+
class="cpk-attachment-renderer-document-icon"
|
|
76
133
|
data-testid="copilot-chat-attachment-renderer-document-icon"
|
|
77
134
|
>
|
|
78
135
|
{{ getDocumentIcon(props.source.mimeType ?? "") }}
|
|
79
136
|
</span>
|
|
80
137
|
<span
|
|
81
|
-
class="cpk
|
|
138
|
+
class="cpk-attachment-renderer-document-name"
|
|
82
139
|
data-testid="copilot-chat-attachment-renderer-document-label"
|
|
83
140
|
>
|
|
84
141
|
{{ documentLabel }}
|
|
85
142
|
</span>
|
|
86
|
-
</
|
|
143
|
+
</a>
|
|
87
144
|
</template>
|
|
@@ -263,7 +263,7 @@ defineExpose({
|
|
|
263
263
|
</script>
|
|
264
264
|
|
|
265
265
|
<template>
|
|
266
|
-
<div data-copilotkit class="cpk
|
|
267
|
-
<canvas ref="canvasRef" class="cpk
|
|
266
|
+
<div data-copilotkit class="cpk-audio-recorder" v-bind="attrs">
|
|
267
|
+
<canvas ref="canvasRef" class="cpk-audio-recorder-canvas" />
|
|
268
268
|
</div>
|
|
269
269
|
</template>
|