@copilotkit/vue 2.0.0-rc.1 → 2.0.0-rc.3
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/index.cjs +43 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +10170 -7506
- package/dist/index.mjs.map +1 -1
- 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/a2ui/A2UIBuiltInToolCallRenderer.d.ts +11 -2
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +136 -0
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -0
- package/dist/v2/components/chat/BasicMarkdown.vue.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 +69 -16
- 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/index.d.ts +17 -0
- 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 +39 -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 +144 -0
- package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -0
- package/dist/v2/components/chat/tool-call-layout.d.ts +115 -0
- package/dist/v2/components/chat/tool-call-layout.d.ts.map +1 -0
- package/dist/v2/components/chat/turn-work.d.ts +35 -0
- package/dist/v2/components/chat/turn-work.d.ts.map +1 -0
- package/dist/v2/components/chat/types.d.ts +104 -4
- package/dist/v2/components/chat/types.d.ts.map +1 -1
- 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 +1 -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-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 +165 -162
- package/dist/v2/lib/message-feedback.d.ts +33 -0
- package/dist/v2/lib/message-feedback.d.ts.map +1 -0
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +56 -1
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +5 -1
- 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 +9 -0
- 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/vue-tool-call-renderer.d.ts +7 -0
- package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -1
- package/package.json +11 -23
- package/src/components/copilot-provider/CopilotKit.vue +4 -1
- package/src/v2/__tests__/exports.test.ts +4 -2
- package/src/v2/components/A2UIMessageRenderer.ts +55 -67
- package/src/v2/components/A2UISurfaceActivityRenderer.vue +11 -23
- package/src/v2/components/__tests__/A2UIBasicCatalogColors.test.ts +8 -9
- package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +63 -36
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +14 -257
- package/src/v2/components/a2ui/A2UIRecoveryStates.ts +444 -0
- package/src/v2/components/a2ui/__tests__/A2UIRecoveryStates.test.ts +175 -0
- package/src/v2/components/chat/BasicMarkdown.vue +8 -6
- package/src/v2/components/chat/CopilotChat.vue +7 -0
- 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 +141 -168
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +67 -18
- 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 +210 -161
- 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 +261 -18
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +21 -22
- 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 +330 -0
- package/src/v2/components/chat/CopilotChatToolCallItem.vue +21 -11
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +192 -21
- package/src/v2/components/chat/CopilotChatUserMessage.vue +105 -42
- package/src/v2/components/chat/CopilotChatView.vue +33 -38
- package/src/v2/components/chat/CopilotChatWorkSummary.vue +85 -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__/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 +22 -13
- package/src/v2/components/chat/__tests__/CopilotChatLightbox.test.ts +160 -0
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.toolCallDisplay.test.ts +735 -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/index.ts +2 -0
- 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 +49 -0
- package/src/v2/components/chat/tool-call-group-parts.ts +292 -0
- package/src/v2/components/chat/tool-call-layout.ts +304 -0
- package/src/v2/components/chat/turn-work.ts +61 -0
- package/src/v2/components/chat/types.ts +113 -3
- package/src/v2/components/chat/use-lightbox.ts +64 -0
- package/src/v2/components/icons/index.ts +4 -0
- 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/use-default-render-tool.ts +123 -62
- 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/providers/CopilotChatConfigurationProvider.vue +29 -2
- package/src/v2/providers/CopilotKitProvider.types.ts +57 -0
- package/src/v2/providers/CopilotKitProvider.vue +125 -3
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.openThread.test.ts +69 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.learning.test.ts +534 -0
- package/src/v2/providers/index.ts +4 -1
- package/src/v2/providers/keys.ts +12 -0
- package/src/v2/providers/types.ts +11 -0
- 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/defineToolCallRenderer.ts +4 -0
- package/src/v2/types/vue-tool-call-renderer.ts +7 -0
- package/vite.config.ts +2 -1
- package/dist/styles.css +0 -2
- package/scripts/scope-preflight.mjs +0 -100
- package/src/styles/globals.css +0 -233
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, onBeforeUnmount, ref } from "vue";
|
|
3
3
|
import type { UserMessage } from "@ag-ui/core";
|
|
4
|
+
import type {
|
|
5
|
+
AudioInputPart,
|
|
6
|
+
DocumentInputPart,
|
|
7
|
+
ImageInputPart,
|
|
8
|
+
VideoInputPart,
|
|
9
|
+
} from "@copilotkit/shared";
|
|
4
10
|
import { useCopilotChatConfiguration } from "../../providers/useCopilotChatConfiguration";
|
|
5
11
|
import { CopilotChatDefaultLabels } from "../../providers/types";
|
|
6
12
|
import {
|
|
@@ -10,6 +16,8 @@ import {
|
|
|
10
16
|
IconCopy,
|
|
11
17
|
IconEdit,
|
|
12
18
|
} from "../icons";
|
|
19
|
+
import CopilotTooltip from "../ui/CopilotTooltip.vue";
|
|
20
|
+
import CopilotChatAttachmentRenderer from "./CopilotChatAttachmentRenderer.vue";
|
|
13
21
|
import type {
|
|
14
22
|
CopilotChatUserMessageBranchNavigationSlotProps,
|
|
15
23
|
CopilotChatUserMessageCopyButtonSlotProps,
|
|
@@ -61,12 +69,9 @@ const labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);
|
|
|
61
69
|
const copied = ref(false);
|
|
62
70
|
let copiedResetTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
63
71
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"cpk
|
|
67
|
-
"cpk:hover:text-[rgb(93,93,93)] cpk:dark:text-[rgb(243,243,243)] cpk:dark:hover:bg-[#303030]",
|
|
68
|
-
"cpk:dark:hover:text-[rgb(243,243,243)] cpk:disabled:pointer-events-none cpk:disabled:opacity-50",
|
|
69
|
-
].join(" ");
|
|
72
|
+
// Styles live in @copilotkit/core (ui/button.css, user-message.css).
|
|
73
|
+
const toolbarButtonClass =
|
|
74
|
+
"cpk-button cpk-button-assistant-message-toolbar cpk-button-size-default";
|
|
70
75
|
|
|
71
76
|
function flattenUserMessageContent(content?: UserMessage["content"]): string {
|
|
72
77
|
if (!content) {
|
|
@@ -94,6 +99,38 @@ function flattenUserMessageContent(content?: UserMessage["content"]): string {
|
|
|
94
99
|
.join("\n");
|
|
95
100
|
}
|
|
96
101
|
|
|
102
|
+
type MediaPart =
|
|
103
|
+
| ImageInputPart
|
|
104
|
+
| AudioInputPart
|
|
105
|
+
| VideoInputPart
|
|
106
|
+
| DocumentInputPart;
|
|
107
|
+
|
|
108
|
+
function getMediaParts(content: UserMessage["content"]): MediaPart[] {
|
|
109
|
+
if (!content || typeof content === "string") return [];
|
|
110
|
+
return content.filter(
|
|
111
|
+
(part): part is MediaPart =>
|
|
112
|
+
part.type === "image" ||
|
|
113
|
+
part.type === "audio" ||
|
|
114
|
+
part.type === "video" ||
|
|
115
|
+
part.type === "document",
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function getFilename(part: MediaPart): string | undefined {
|
|
120
|
+
const meta = part.metadata;
|
|
121
|
+
if (
|
|
122
|
+
meta != null &&
|
|
123
|
+
typeof meta === "object" &&
|
|
124
|
+
"filename" in meta &&
|
|
125
|
+
typeof meta.filename === "string"
|
|
126
|
+
) {
|
|
127
|
+
return meta.filename;
|
|
128
|
+
}
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const mediaParts = computed(() => getMediaParts(props.message.content));
|
|
133
|
+
|
|
97
134
|
const flattenedContent = computed(() =>
|
|
98
135
|
flattenUserMessageContent(props.message.content),
|
|
99
136
|
);
|
|
@@ -204,21 +241,31 @@ onBeforeUnmount(() => {
|
|
|
204
241
|
<div
|
|
205
242
|
data-copilotkit
|
|
206
243
|
data-testid="copilot-user-message"
|
|
207
|
-
class="
|
|
244
|
+
class="copilotKitMessage copilotKitUserMessage cpk-user-message"
|
|
208
245
|
:data-message-id="message.id"
|
|
209
246
|
v-bind="$attrs"
|
|
210
247
|
>
|
|
248
|
+
<div
|
|
249
|
+
v-if="mediaParts.length > 0"
|
|
250
|
+
class="cpk-user-message-attachments"
|
|
251
|
+
data-testid="copilot-user-message-attachments"
|
|
252
|
+
>
|
|
253
|
+
<CopilotChatAttachmentRenderer
|
|
254
|
+
v-for="(part, index) in mediaParts"
|
|
255
|
+
:key="index"
|
|
256
|
+
:type="part.type"
|
|
257
|
+
:source="part.source"
|
|
258
|
+
:filename="getFilename(part)"
|
|
259
|
+
/>
|
|
260
|
+
</div>
|
|
261
|
+
|
|
211
262
|
<slot
|
|
212
263
|
name="message-renderer"
|
|
213
264
|
:message="message"
|
|
214
265
|
:content="flattenedContent"
|
|
215
266
|
:is-multiline="isMultiline"
|
|
216
267
|
>
|
|
217
|
-
<div
|
|
218
|
-
class="cpk:prose cpk:dark:prose-invert cpk:bg-muted cpk:relative cpk:max-w-[80%] cpk:rounded-[18px] cpk:px-4 cpk:py-1.5 cpk:inline-block cpk:whitespace-pre-wrap"
|
|
219
|
-
:data-multiline="isMultiline ? 'true' : undefined"
|
|
220
|
-
:class="{ 'cpk:py-3': isMultiline }"
|
|
221
|
-
>
|
|
268
|
+
<div class="cpk-user-message-bubble">
|
|
222
269
|
{{ flattenedContent }}
|
|
223
270
|
</div>
|
|
224
271
|
</slot>
|
|
@@ -230,9 +277,10 @@ onBeforeUnmount(() => {
|
|
|
230
277
|
:has-edit-action="hasEditAction"
|
|
231
278
|
>
|
|
232
279
|
<div
|
|
233
|
-
|
|
280
|
+
data-testid="copilot-user-toolbar"
|
|
281
|
+
class="cpk-user-message-toolbar"
|
|
234
282
|
>
|
|
235
|
-
<div class="cpk
|
|
283
|
+
<div class="cpk-user-message-toolbar-items">
|
|
236
284
|
<slot name="toolbar-items" />
|
|
237
285
|
|
|
238
286
|
<slot
|
|
@@ -241,17 +289,26 @@ onBeforeUnmount(() => {
|
|
|
241
289
|
:copied="copied"
|
|
242
290
|
:label="labels.userMessageToolbarCopyMessageLabel"
|
|
243
291
|
>
|
|
244
|
-
<
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
:aria-label="labels.userMessageToolbarCopyMessageLabel"
|
|
249
|
-
:title="labels.userMessageToolbarCopyMessageLabel"
|
|
250
|
-
@click="handleCopyMessage"
|
|
292
|
+
<CopilotTooltip
|
|
293
|
+
v-slot="{ triggerProps }"
|
|
294
|
+
:content="labels.userMessageToolbarCopyMessageLabel"
|
|
295
|
+
side="bottom"
|
|
251
296
|
>
|
|
252
|
-
<
|
|
253
|
-
|
|
254
|
-
|
|
297
|
+
<button
|
|
298
|
+
data-testid="copilot-user-copy-button"
|
|
299
|
+
type="button"
|
|
300
|
+
:class="toolbarButtonClass"
|
|
301
|
+
:aria-label="labels.userMessageToolbarCopyMessageLabel"
|
|
302
|
+
v-bind="triggerProps"
|
|
303
|
+
@click="handleCopyMessage"
|
|
304
|
+
>
|
|
305
|
+
<IconCheck
|
|
306
|
+
v-if="copied"
|
|
307
|
+
class="cpk-user-message-toolbar-icon"
|
|
308
|
+
/>
|
|
309
|
+
<IconCopy v-else class="cpk-user-message-toolbar-icon" />
|
|
310
|
+
</button>
|
|
311
|
+
</CopilotTooltip>
|
|
255
312
|
</slot>
|
|
256
313
|
|
|
257
314
|
<slot
|
|
@@ -260,15 +317,22 @@ onBeforeUnmount(() => {
|
|
|
260
317
|
:on-edit="handleEditMessage"
|
|
261
318
|
:label="labels.userMessageToolbarEditMessageLabel"
|
|
262
319
|
>
|
|
263
|
-
<
|
|
264
|
-
|
|
265
|
-
:
|
|
266
|
-
|
|
267
|
-
:title="labels.userMessageToolbarEditMessageLabel"
|
|
268
|
-
@click="handleEditMessage"
|
|
320
|
+
<CopilotTooltip
|
|
321
|
+
v-slot="{ triggerProps }"
|
|
322
|
+
:content="labels.userMessageToolbarEditMessageLabel"
|
|
323
|
+
side="bottom"
|
|
269
324
|
>
|
|
270
|
-
<
|
|
271
|
-
|
|
325
|
+
<button
|
|
326
|
+
data-testid="copilot-edit-button"
|
|
327
|
+
type="button"
|
|
328
|
+
:class="toolbarButtonClass"
|
|
329
|
+
:aria-label="labels.userMessageToolbarEditMessageLabel"
|
|
330
|
+
v-bind="triggerProps"
|
|
331
|
+
@click="handleEditMessage"
|
|
332
|
+
>
|
|
333
|
+
<IconEdit class="cpk-user-message-toolbar-icon" />
|
|
334
|
+
</button>
|
|
335
|
+
</CopilotTooltip>
|
|
272
336
|
</slot>
|
|
273
337
|
|
|
274
338
|
<slot
|
|
@@ -284,33 +348,32 @@ onBeforeUnmount(() => {
|
|
|
284
348
|
:go-prev="goPrev"
|
|
285
349
|
:go-next="goNext"
|
|
286
350
|
>
|
|
287
|
-
<div
|
|
351
|
+
<div
|
|
352
|
+
data-testid="copilot-branch-navigation"
|
|
353
|
+
class="cpk-user-message-branch-navigation"
|
|
354
|
+
>
|
|
288
355
|
<button
|
|
289
356
|
type="button"
|
|
290
357
|
:class="toolbarButtonClass"
|
|
291
|
-
class="cpk
|
|
358
|
+
class="cpk-user-message-branch-button"
|
|
292
359
|
:disabled="!canGoPrev"
|
|
293
360
|
:aria-label="labels.userMessageToolbarPreviousBranchLabel"
|
|
294
|
-
:title="labels.userMessageToolbarPreviousBranchLabel"
|
|
295
361
|
@click="goPrev"
|
|
296
362
|
>
|
|
297
|
-
<IconChevronLeft class="cpk
|
|
363
|
+
<IconChevronLeft class="cpk-user-message-branch-icon" />
|
|
298
364
|
</button>
|
|
299
|
-
<span
|
|
300
|
-
class="cpk:text-sm cpk:text-muted-foreground cpk:px-0 cpk:font-medium"
|
|
301
|
-
>
|
|
365
|
+
<span class="cpk-user-message-branch-counter">
|
|
302
366
|
{{ branchIndex + 1 }}/{{ numberOfBranches }}
|
|
303
367
|
</span>
|
|
304
368
|
<button
|
|
305
369
|
type="button"
|
|
306
370
|
:class="toolbarButtonClass"
|
|
307
|
-
class="cpk
|
|
371
|
+
class="cpk-user-message-branch-button"
|
|
308
372
|
:disabled="!canGoNext"
|
|
309
373
|
:aria-label="labels.userMessageToolbarNextBranchLabel"
|
|
310
|
-
:title="labels.userMessageToolbarNextBranchLabel"
|
|
311
374
|
@click="goNext"
|
|
312
375
|
>
|
|
313
|
-
<IconChevronRight class="cpk
|
|
376
|
+
<IconChevronRight class="cpk-user-message-branch-icon" />
|
|
314
377
|
</button>
|
|
315
378
|
</div>
|
|
316
379
|
</slot>
|
|
@@ -15,7 +15,7 @@ import { useCopilotChatConfiguration } from "../../providers/useCopilotChatConfi
|
|
|
15
15
|
import { CopilotChatDefaultLabels } from "../../providers/types";
|
|
16
16
|
import { useKeyboardHeight } from "../../hooks/use-keyboard-height";
|
|
17
17
|
import { usePinToSend } from "../../hooks/use-pin-to-send";
|
|
18
|
-
import { IconChevronDown } from "../icons";
|
|
18
|
+
import { IconChevronDown, IconUpload } from "../icons";
|
|
19
19
|
import CopilotChatInput from "./CopilotChatInput.vue";
|
|
20
20
|
import CopilotChatAttachmentQueue from "./CopilotChatAttachmentQueue.vue";
|
|
21
21
|
import CopilotChatMessageView from "./CopilotChatMessageView.vue";
|
|
@@ -34,6 +34,7 @@ const SCROLL_BUTTON_OFFSET = 16;
|
|
|
34
34
|
const SCROLL_BOTTOM_THRESHOLD = 12;
|
|
35
35
|
|
|
36
36
|
const props = withDefaults(defineProps<CopilotChatViewProps>(), {
|
|
37
|
+
messageFeedback: true,
|
|
37
38
|
messages: () => [],
|
|
38
39
|
autoScroll: true,
|
|
39
40
|
isRunning: false,
|
|
@@ -441,8 +442,9 @@ onBeforeUnmount(() => {
|
|
|
441
442
|
<template>
|
|
442
443
|
<div
|
|
443
444
|
data-copilotkit
|
|
444
|
-
class="copilotKitChat cpk
|
|
445
|
+
class="copilotKitChat cpk-chat-view"
|
|
445
446
|
data-testid="copilot-chat-view"
|
|
447
|
+
:data-copilot-running="isRunning ? 'true' : 'false'"
|
|
446
448
|
v-bind="$attrs"
|
|
447
449
|
@dragover="handleDragOver"
|
|
448
450
|
@dragleave="handleDragLeave"
|
|
@@ -450,12 +452,13 @@ onBeforeUnmount(() => {
|
|
|
450
452
|
>
|
|
451
453
|
<div
|
|
452
454
|
v-if="dragOver"
|
|
453
|
-
class="cpk
|
|
455
|
+
class="cpk-chat-view-drop-overlay"
|
|
454
456
|
data-testid="copilot-chat-drop-overlay"
|
|
455
457
|
>
|
|
456
|
-
<
|
|
457
|
-
|
|
458
|
-
|
|
458
|
+
<div class="cpk-chat-view-drop-overlay-content">
|
|
459
|
+
<IconUpload class="cpk-chat-view-drop-overlay-icon" />
|
|
460
|
+
<span class="cpk-chat-view-drop-overlay-label">Drop files here</span>
|
|
461
|
+
</div>
|
|
459
462
|
</div>
|
|
460
463
|
<slot
|
|
461
464
|
v-if="shouldShowWelcomeScreen"
|
|
@@ -481,27 +484,25 @@ onBeforeUnmount(() => {
|
|
|
481
484
|
:on-select-suggestion="handleSelectSuggestion"
|
|
482
485
|
>
|
|
483
486
|
<div
|
|
484
|
-
class="cpk
|
|
487
|
+
class="cpk-chat-view-welcome-screen"
|
|
485
488
|
data-testid="copilot-chat-view-welcome-screen"
|
|
486
489
|
>
|
|
487
|
-
<div
|
|
488
|
-
class="cpk
|
|
489
|
-
>
|
|
490
|
-
<div class="cpk:mb-6">
|
|
490
|
+
<div class="cpk-chat-view-welcome-screen-content">
|
|
491
|
+
<div class="cpk-chat-view-welcome-screen-message">
|
|
491
492
|
<slot name="welcome-message">
|
|
492
|
-
<h1
|
|
493
|
-
class="cpk:text-xl cpk:sm:text-2xl cpk:font-medium cpk:text-foreground cpk:text-center"
|
|
494
|
-
>
|
|
493
|
+
<h1 class="cpk-chat-view-welcome-message">
|
|
495
494
|
{{ labels.welcomeMessageText }}
|
|
496
495
|
</h1>
|
|
497
496
|
</slot>
|
|
498
497
|
</div>
|
|
499
498
|
|
|
500
|
-
<div
|
|
499
|
+
<div
|
|
500
|
+
class="cpk-chat-view-welcome-screen-input cpk-chat-view-welcome-input-group"
|
|
501
|
+
>
|
|
501
502
|
<CopilotChatAttachmentQueue
|
|
502
503
|
v-if="hasAttachments"
|
|
503
504
|
:attachments="attachments ?? []"
|
|
504
|
-
class-name="cpk
|
|
505
|
+
class-name="cpk-chat-view-welcome-attachment-queue"
|
|
505
506
|
@remove-attachment="
|
|
506
507
|
(id: string) => onRemoveAttachment && onRemoveAttachment(id)
|
|
507
508
|
"
|
|
@@ -540,7 +541,7 @@ onBeforeUnmount(() => {
|
|
|
540
541
|
|
|
541
542
|
<div
|
|
542
543
|
v-if="hasSuggestions"
|
|
543
|
-
class="cpk
|
|
544
|
+
class="cpk-chat-view-welcome-screen-suggestions"
|
|
544
545
|
>
|
|
545
546
|
<slot
|
|
546
547
|
name="suggestion-view"
|
|
@@ -549,6 +550,7 @@ onBeforeUnmount(() => {
|
|
|
549
550
|
:on-select-suggestion="handleSelectSuggestion"
|
|
550
551
|
>
|
|
551
552
|
<CopilotChatSuggestionView
|
|
553
|
+
class="cpk-chat-view-suggestion-view"
|
|
552
554
|
:suggestions="suggestions"
|
|
553
555
|
:loading-indexes="suggestionLoadingIndexes"
|
|
554
556
|
@select-suggestion="handleSelectSuggestion"
|
|
@@ -575,18 +577,16 @@ onBeforeUnmount(() => {
|
|
|
575
577
|
<div
|
|
576
578
|
ref="scrollContainerRef"
|
|
577
579
|
data-testid="copilot-chat-view-scroll"
|
|
578
|
-
class="cpk
|
|
580
|
+
class="cpk-chat-view-scroll-area cpk-chat-view-scroll-viewport"
|
|
579
581
|
@scroll="handleScroll"
|
|
580
582
|
>
|
|
581
|
-
<div
|
|
582
|
-
class="cpk:px-4 cpk:@3xl:px-0 cpk:[div[data-sidebar-chat]_&]:px-8 cpk:[div[data-popup-chat]_&]:px-6"
|
|
583
|
-
>
|
|
583
|
+
<div class="cpk-chat-view-scroll-content">
|
|
584
584
|
<div
|
|
585
585
|
ref="scrollContentRef"
|
|
586
586
|
data-testid="copilot-scroll-content"
|
|
587
587
|
:style="{ paddingBottom: messagePaddingBottom }"
|
|
588
588
|
>
|
|
589
|
-
<div class="cpk
|
|
589
|
+
<div class="cpk-chat-view-feed">
|
|
590
590
|
<slot
|
|
591
591
|
name="message-view"
|
|
592
592
|
:messages="messages"
|
|
@@ -595,6 +595,8 @@ onBeforeUnmount(() => {
|
|
|
595
595
|
<CopilotChatMessageView
|
|
596
596
|
:messages="messages"
|
|
597
597
|
:is-running="isRunning"
|
|
598
|
+
:tool-call-display="toolCallDisplay"
|
|
599
|
+
:message-feedback="messageFeedback"
|
|
598
600
|
>
|
|
599
601
|
<template
|
|
600
602
|
v-for="slotName in forwardedMessageViewSlotNames"
|
|
@@ -605,10 +607,7 @@ onBeforeUnmount(() => {
|
|
|
605
607
|
</template>
|
|
606
608
|
</CopilotChatMessageView>
|
|
607
609
|
</slot>
|
|
608
|
-
<div
|
|
609
|
-
v-if="hasSuggestions"
|
|
610
|
-
class="cpk:mt-4 cpk:pl-0 cpk:pr-4 cpk:@3xl:px-0"
|
|
611
|
-
>
|
|
610
|
+
<div v-if="hasSuggestions" class="cpk-chat-view-suggestions">
|
|
612
611
|
<slot
|
|
613
612
|
name="suggestion-view"
|
|
614
613
|
:suggestions="suggestions"
|
|
@@ -616,7 +615,7 @@ onBeforeUnmount(() => {
|
|
|
616
615
|
:on-select-suggestion="handleSelectSuggestion"
|
|
617
616
|
>
|
|
618
617
|
<CopilotChatSuggestionView
|
|
619
|
-
class="cpk
|
|
618
|
+
class="cpk-chat-view-suggestion-view"
|
|
620
619
|
:suggestions="suggestions"
|
|
621
620
|
:loading-indexes="suggestionLoadingIndexes"
|
|
622
621
|
@select-suggestion="handleSelectSuggestion"
|
|
@@ -653,7 +652,7 @@ onBeforeUnmount(() => {
|
|
|
653
652
|
|
|
654
653
|
<div
|
|
655
654
|
v-if="showScrollToBottomButton"
|
|
656
|
-
class="cpk
|
|
655
|
+
class="cpk-chat-view-scroll-to-bottom"
|
|
657
656
|
:style="{ bottom: `${inputContainerHeight + SCROLL_BUTTON_OFFSET}px` }"
|
|
658
657
|
>
|
|
659
658
|
<slot name="scroll-to-bottom-button" :on-click="() => scrollToBottom()">
|
|
@@ -661,12 +660,11 @@ onBeforeUnmount(() => {
|
|
|
661
660
|
type="button"
|
|
662
661
|
data-testid="copilot-chat-view-scroll-to-bottom"
|
|
663
662
|
:aria-label="labels.chatScrollToBottomLabel"
|
|
664
|
-
|
|
663
|
+
data-slot="button"
|
|
664
|
+
class="cpk-button cpk-button-outline cpk-button-size-sm cpk-chat-view-scroll-to-bottom-button"
|
|
665
665
|
@click="scrollToBottom()"
|
|
666
666
|
>
|
|
667
|
-
<IconChevronDown
|
|
668
|
-
class="cpk:w-4 cpk:h-4 cpk:text-gray-600 cpk:dark:text-white"
|
|
669
|
-
/>
|
|
667
|
+
<IconChevronDown class="cpk-chat-view-scroll-to-bottom-icon" />
|
|
670
668
|
</button>
|
|
671
669
|
</slot>
|
|
672
670
|
</div>
|
|
@@ -681,16 +679,13 @@ onBeforeUnmount(() => {
|
|
|
681
679
|
-->
|
|
682
680
|
<div
|
|
683
681
|
ref="inputContainerRef"
|
|
684
|
-
class="cpk
|
|
682
|
+
class="cpk-chat-view-input-overlay"
|
|
685
683
|
data-testid="copilot-input-overlay"
|
|
686
684
|
>
|
|
687
|
-
<div
|
|
688
|
-
v-if="hasAttachments"
|
|
689
|
-
class="cpk:max-w-3xl cpk:mx-auto cpk:w-full cpk:pointer-events-auto"
|
|
690
|
-
>
|
|
685
|
+
<div v-if="hasAttachments" class="cpk-chat-view-attachments">
|
|
691
686
|
<CopilotChatAttachmentQueue
|
|
692
687
|
:attachments="attachments ?? []"
|
|
693
|
-
class-name="cpk
|
|
688
|
+
class-name="cpk-chat-view-attachment-queue"
|
|
694
689
|
@remove-attachment="
|
|
695
690
|
(id: string) => onRemoveAttachment && onRemoveAttachment(id)
|
|
696
691
|
"
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The line at the top of a reply in the `"turn"` tool-call display. While the
|
|
4
|
+
* agent works it reads "Working 4s"; once the reply is done it reads "Worked
|
|
5
|
+
* for 9s · 7 tools" and toggles the work it folded away.
|
|
6
|
+
*/
|
|
7
|
+
import { computed, ref, watch } from "vue";
|
|
8
|
+
import { IconChevronRight } from "../icons";
|
|
9
|
+
import type { CopilotChatWorkSummarySlotProps } from "./types";
|
|
10
|
+
import { pluralize } from "./tool-call-group-parts";
|
|
11
|
+
import { formatDuration } from "./turn-work";
|
|
12
|
+
|
|
13
|
+
// `onClick` falls through to the button.
|
|
14
|
+
const props = defineProps<Omit<CopilotChatWorkSummarySlotProps, "onClick">>();
|
|
15
|
+
|
|
16
|
+
// The current time, updated every second while the agent works.
|
|
17
|
+
const now = ref(Date.now());
|
|
18
|
+
watch(
|
|
19
|
+
() => props.isWorking,
|
|
20
|
+
(working, _previous, onCleanup) => {
|
|
21
|
+
if (!working) return;
|
|
22
|
+
now.value = Date.now();
|
|
23
|
+
const timer = setInterval(() => {
|
|
24
|
+
now.value = Date.now();
|
|
25
|
+
}, 1000);
|
|
26
|
+
onCleanup(() => clearInterval(timer));
|
|
27
|
+
},
|
|
28
|
+
{ immediate: true },
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const failed = computed(
|
|
32
|
+
() => props.calls.filter((call) => call.toolMessage?.error).length,
|
|
33
|
+
);
|
|
34
|
+
const liveMs = computed(() =>
|
|
35
|
+
props.elapsedMs !== undefined && props.workingSince !== undefined
|
|
36
|
+
? props.elapsedMs + Math.max(0, now.value - props.workingSince)
|
|
37
|
+
: undefined,
|
|
38
|
+
);
|
|
39
|
+
// A finished reply worked for at least a second.
|
|
40
|
+
const duration = computed(() =>
|
|
41
|
+
props.elapsedMs !== undefined
|
|
42
|
+
? formatDuration(Math.max(1000, props.elapsedMs))
|
|
43
|
+
: undefined,
|
|
44
|
+
);
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<template>
|
|
48
|
+
<button
|
|
49
|
+
type="button"
|
|
50
|
+
data-copilotkit
|
|
51
|
+
data-testid="copilot-work-summary"
|
|
52
|
+
:data-state="isWorking ? 'working' : 'done'"
|
|
53
|
+
:aria-expanded="isOpen ? 'true' : 'false'"
|
|
54
|
+
class="cpk-work-summary"
|
|
55
|
+
>
|
|
56
|
+
<template v-if="isWorking">
|
|
57
|
+
<span class="cpk-work-summary-label cpk-shimmer">Working</span>
|
|
58
|
+
<span
|
|
59
|
+
v-if="liveMs !== undefined"
|
|
60
|
+
class="cpk-work-summary-detail cpk-work-summary-timer"
|
|
61
|
+
>{{ formatDuration(liveMs) }}</span
|
|
62
|
+
>
|
|
63
|
+
</template>
|
|
64
|
+
<template v-else>
|
|
65
|
+
<span class="cpk-work-summary-label">{{
|
|
66
|
+
duration
|
|
67
|
+
? `Worked for ${duration}`
|
|
68
|
+
: `Used ${pluralize(calls.length, "tool")}`
|
|
69
|
+
}}</span>
|
|
70
|
+
<span v-if="duration" class="cpk-work-summary-detail">{{
|
|
71
|
+
pluralize(calls.length, "tool")
|
|
72
|
+
}}</span>
|
|
73
|
+
<span v-if="failed > 0" class="cpk-work-summary-failed"
|
|
74
|
+
>{{ failed }} failed</span
|
|
75
|
+
>
|
|
76
|
+
</template>
|
|
77
|
+
<IconChevronRight
|
|
78
|
+
aria-hidden="true"
|
|
79
|
+
:class="[
|
|
80
|
+
'cpk-work-summary-chevron',
|
|
81
|
+
isOpen && 'cpk-work-summary-chevron-open',
|
|
82
|
+
]"
|
|
83
|
+
/>
|
|
84
|
+
</button>
|
|
85
|
+
</template>
|
|
@@ -33,8 +33,7 @@ const resolvedTitle = computed(
|
|
|
33
33
|
CopilotChatDefaultLabels.modalHeaderTitle,
|
|
34
34
|
);
|
|
35
35
|
const headerClass = computed(() => [
|
|
36
|
-
"
|
|
37
|
-
"cpk:bg-background/95 cpk:backdrop-blur cpk:supports-[backdrop-filter]:bg-background/80",
|
|
36
|
+
"copilotKitHeader cpk-modal-header",
|
|
38
37
|
attrs.class,
|
|
39
38
|
]);
|
|
40
39
|
const headerAttrs = computed(() => {
|
|
@@ -99,13 +98,13 @@ function toggleDrawer() {
|
|
|
99
98
|
v-bind="headerAttrs"
|
|
100
99
|
>
|
|
101
100
|
<slot name="layout" :title="resolvedTitle" :on-close="handleClose">
|
|
102
|
-
<div class="cpk
|
|
103
|
-
<div class="cpk
|
|
101
|
+
<div class="cpk-modal-header-content">
|
|
102
|
+
<div class="cpk-modal-header-start">
|
|
104
103
|
<button
|
|
105
104
|
v-if="showDrawerLauncher"
|
|
106
105
|
type="button"
|
|
107
106
|
data-testid="drawer-launcher"
|
|
108
|
-
class="cpk
|
|
107
|
+
class="cpk-modal-header-drawer-launcher"
|
|
109
108
|
:aria-expanded="config?.drawerOpen ?? false"
|
|
110
109
|
:aria-label="
|
|
111
110
|
config?.labels.modalHeaderThreadsButtonLabel ??
|
|
@@ -113,18 +112,21 @@ function toggleDrawer() {
|
|
|
113
112
|
"
|
|
114
113
|
@click="toggleDrawer"
|
|
115
114
|
>
|
|
116
|
-
<IconPanelLeftOpen
|
|
115
|
+
<IconPanelLeftOpen
|
|
116
|
+
class="cpk-modal-header-drawer-launcher-icon"
|
|
117
|
+
aria-hidden="true"
|
|
118
|
+
/>
|
|
117
119
|
</button>
|
|
118
120
|
<span v-else aria-hidden="true" />
|
|
119
121
|
</div>
|
|
120
|
-
<div class="cpk
|
|
122
|
+
<div class="cpk-modal-header-center">
|
|
121
123
|
<slot name="title-content" :title="resolvedTitle">
|
|
122
124
|
<CopilotModalHeaderTitle>
|
|
123
125
|
{{ resolvedTitle }}
|
|
124
126
|
</CopilotModalHeaderTitle>
|
|
125
127
|
</slot>
|
|
126
128
|
</div>
|
|
127
|
-
<div class="cpk
|
|
129
|
+
<div class="cpk-modal-header-end">
|
|
128
130
|
<slot name="close-button" :on-close="handleClose">
|
|
129
131
|
<CopilotModalHeaderCloseButton @click="handleClose" />
|
|
130
132
|
</slot>
|
|
@@ -32,16 +32,17 @@ export default defineComponent({
|
|
|
32
32
|
{
|
|
33
33
|
...rest,
|
|
34
34
|
type: typeof type === "string" ? type : "button",
|
|
35
|
-
class: [
|
|
36
|
-
"cpk:inline-flex cpk:size-8 cpk:items-center cpk:justify-center cpk:rounded-full cpk:text-muted-foreground cpk:transition cpk:cursor-pointer",
|
|
37
|
-
"cpk:hover:bg-muted cpk:hover:text-foreground cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-ring",
|
|
38
|
-
className,
|
|
39
|
-
],
|
|
35
|
+
class: ["cpk-modal-header-close-button", className],
|
|
40
36
|
"aria-label": ariaLabel.value,
|
|
41
37
|
},
|
|
42
38
|
slots.default
|
|
43
39
|
? slots.default()
|
|
44
|
-
: [
|
|
40
|
+
: [
|
|
41
|
+
h(IconX, {
|
|
42
|
+
class: "cpk-modal-header-close-icon",
|
|
43
|
+
"aria-hidden": true,
|
|
44
|
+
}),
|
|
45
|
+
],
|
|
45
46
|
);
|
|
46
47
|
};
|
|
47
48
|
},
|
|
@@ -10,10 +10,7 @@ export default defineComponent({
|
|
|
10
10
|
"div",
|
|
11
11
|
{
|
|
12
12
|
...rest,
|
|
13
|
-
class: [
|
|
14
|
-
"cpk:w-full cpk:text-base cpk:font-medium cpk:leading-none cpk:tracking-tight cpk:text-foreground",
|
|
15
|
-
className,
|
|
16
|
-
],
|
|
13
|
+
class: ["cpk-modal-header-title", className],
|
|
17
14
|
},
|
|
18
15
|
slots.default ? slots.default() : [],
|
|
19
16
|
);
|
|
@@ -36,6 +36,7 @@ function popupViewEventBindings(slotProps: CopilotChatViewOverrideSlotProps) {
|
|
|
36
36
|
|
|
37
37
|
const props = withDefaults(defineProps<CopilotPopupProps>(), {
|
|
38
38
|
autoScroll: true,
|
|
39
|
+
messageFeedback: true,
|
|
39
40
|
welcomeScreen: true,
|
|
40
41
|
inputValue: undefined,
|
|
41
42
|
inputMode: "input",
|
|
@@ -116,6 +117,8 @@ watch(
|
|
|
116
117
|
:input-mode="slotProps.inputMode"
|
|
117
118
|
:input-tools-menu="slotProps.inputToolsMenu"
|
|
118
119
|
:width="width"
|
|
120
|
+
:tool-call-display="slotProps.toolCallDisplay"
|
|
121
|
+
:message-feedback="slotProps.messageFeedback"
|
|
119
122
|
:height="height"
|
|
120
123
|
:click-outside-to-close="clickOutsideToClose"
|
|
121
124
|
:default-open="defaultOpen"
|
|
@@ -20,6 +20,7 @@ defineOptions({ inheritAttrs: false });
|
|
|
20
20
|
const props = withDefaults(defineProps<CopilotPopupViewProps>(), {
|
|
21
21
|
messages: () => [],
|
|
22
22
|
autoScroll: true,
|
|
23
|
+
messageFeedback: true,
|
|
23
24
|
isRunning: false,
|
|
24
25
|
suggestions: () => [],
|
|
25
26
|
suggestionLoadingIndexes: () => [],
|