@copilotkit/svelte 0.0.1 → 0.1.1-canary.svelte-preview
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +324 -3
- package/dist/app.d.ts +7 -0
- package/dist/components/chat/CopilotChat.svelte +247 -0
- package/dist/components/chat/CopilotChat.svelte.d.ts +5 -0
- package/dist/components/chat/CopilotChat.svelte.d.ts.map +1 -0
- package/dist/components/chat/CopilotChatAssistantMessage.svelte +295 -0
- package/dist/components/chat/CopilotChatAssistantMessage.svelte.d.ts +80 -0
- package/dist/components/chat/CopilotChatAssistantMessage.svelte.d.ts.map +1 -0
- package/dist/components/chat/CopilotChatAttachmentQueue.svelte +241 -0
- package/dist/components/chat/CopilotChatAttachmentQueue.svelte.d.ts +9 -0
- package/dist/components/chat/CopilotChatAttachmentQueue.svelte.d.ts.map +1 -0
- package/dist/components/chat/CopilotChatInput.svelte +192 -0
- package/dist/components/chat/CopilotChatInput.svelte.d.ts +20 -0
- package/dist/components/chat/CopilotChatInput.svelte.d.ts.map +1 -0
- package/dist/components/chat/CopilotChatMessage.svelte +37 -0
- package/dist/components/chat/CopilotChatMessage.svelte.d.ts +10 -0
- package/dist/components/chat/CopilotChatMessage.svelte.d.ts.map +1 -0
- package/dist/components/chat/CopilotChatMessageView.svelte +76 -0
- package/dist/components/chat/CopilotChatMessageView.svelte.d.ts +14 -0
- package/dist/components/chat/CopilotChatMessageView.svelte.d.ts.map +1 -0
- package/dist/components/chat/CopilotChatReasoningMessage.svelte +210 -0
- package/dist/components/chat/CopilotChatReasoningMessage.svelte.d.ts +40 -0
- package/dist/components/chat/CopilotChatReasoningMessage.svelte.d.ts.map +1 -0
- package/dist/components/chat/CopilotChatSuggestionPill.svelte +66 -0
- package/dist/components/chat/CopilotChatSuggestionPill.svelte.d.ts +10 -0
- package/dist/components/chat/CopilotChatSuggestionPill.svelte.d.ts.map +1 -0
- package/dist/components/chat/CopilotChatSuggestionView.svelte +36 -0
- package/dist/components/chat/CopilotChatSuggestionView.svelte.d.ts +10 -0
- package/dist/components/chat/CopilotChatSuggestionView.svelte.d.ts.map +1 -0
- package/dist/components/chat/CopilotChatToggleButton.svelte +47 -0
- package/dist/components/chat/CopilotChatToggleButton.svelte.d.ts +8 -0
- package/dist/components/chat/CopilotChatToggleButton.svelte.d.ts.map +1 -0
- package/dist/components/chat/CopilotChatToolCallsView.svelte +187 -0
- package/dist/components/chat/CopilotChatToolCallsView.svelte.d.ts +12 -0
- package/dist/components/chat/CopilotChatToolCallsView.svelte.d.ts.map +1 -0
- package/dist/components/chat/CopilotChatUserMessage.svelte +312 -0
- package/dist/components/chat/CopilotChatUserMessage.svelte.d.ts +62 -0
- package/dist/components/chat/CopilotChatUserMessage.svelte.d.ts.map +1 -0
- package/dist/components/chat/CopilotChatView.svelte +177 -0
- package/dist/components/chat/CopilotChatView.svelte.d.ts +32 -0
- package/dist/components/chat/CopilotChatView.svelte.d.ts.map +1 -0
- package/dist/components/chat/CopilotPopup.svelte +187 -0
- package/dist/components/chat/CopilotPopup.svelte.d.ts +5 -0
- package/dist/components/chat/CopilotPopup.svelte.d.ts.map +1 -0
- package/dist/components/chat/CopilotSidebar.svelte +138 -0
- package/dist/components/chat/CopilotSidebar.svelte.d.ts +5 -0
- package/dist/components/chat/CopilotSidebar.svelte.d.ts.map +1 -0
- package/dist/components/chat/StreamMarkdown.svelte +30 -0
- package/dist/components/chat/StreamMarkdown.svelte.d.ts +7 -0
- package/dist/components/chat/StreamMarkdown.svelte.d.ts.map +1 -0
- package/dist/components/chat/chat-config-context.svelte.d.ts +10 -0
- package/dist/components/chat/chat-config-context.svelte.d.ts.map +1 -0
- package/dist/components/chat/chat-config-context.svelte.js +20 -0
- package/dist/components/chat/dispatch-after-active-run.d.ts +3 -0
- package/dist/components/chat/dispatch-after-active-run.d.ts.map +1 -0
- package/dist/components/chat/dispatch-after-active-run.js +31 -0
- package/dist/components/chat/markdown/CodeBlock.svelte +78 -0
- package/dist/components/chat/markdown/CodeBlock.svelte.d.ts +8 -0
- package/dist/components/chat/markdown/CodeBlock.svelte.d.ts.map +1 -0
- package/dist/components/chat/markdown/CodeSpan.svelte +29 -0
- package/dist/components/chat/markdown/CodeSpan.svelte.d.ts +9 -0
- package/dist/components/chat/markdown/CodeSpan.svelte.d.ts.map +1 -0
- package/dist/components/chat/markdown/Table.svelte +15 -0
- package/dist/components/chat/markdown/Table.svelte.d.ts +8 -0
- package/dist/components/chat/markdown/Table.svelte.d.ts.map +1 -0
- package/dist/components/chat/markdown/TableBody.svelte +11 -0
- package/dist/components/chat/markdown/TableBody.svelte.d.ts +8 -0
- package/dist/components/chat/markdown/TableBody.svelte.d.ts.map +1 -0
- package/dist/components/chat/markdown/TableCell.svelte +29 -0
- package/dist/components/chat/markdown/TableCell.svelte.d.ts +10 -0
- package/dist/components/chat/markdown/TableCell.svelte.d.ts.map +1 -0
- package/dist/components/chat/markdown/TableHead.svelte +11 -0
- package/dist/components/chat/markdown/TableHead.svelte.d.ts +8 -0
- package/dist/components/chat/markdown/TableHead.svelte.d.ts.map +1 -0
- package/dist/components/chat/markdown/TableRow.svelte +11 -0
- package/dist/components/chat/markdown/TableRow.svelte.d.ts +8 -0
- package/dist/components/chat/markdown/TableRow.svelte.d.ts.map +1 -0
- package/dist/components/chat/markdown/highlight.d.ts +8 -0
- package/dist/components/chat/markdown/highlight.d.ts.map +1 -0
- package/dist/components/chat/markdown/highlight.js +91 -0
- package/dist/components/chat/media-parts.d.ts +11 -0
- package/dist/components/chat/media-parts.d.ts.map +1 -0
- package/dist/components/chat/media-parts.js +17 -0
- package/dist/components/chat/types.d.ts +139 -0
- package/dist/components/chat/types.d.ts.map +1 -0
- package/dist/components/chat/types.js +7 -0
- package/dist/components/icons/index.d.ts +2 -0
- package/dist/components/icons/index.d.ts.map +1 -0
- package/dist/components/icons/index.js +1 -0
- package/dist/components/index.d.ts +18 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +17 -0
- package/dist/hooks/connect-agent-context.svelte.d.ts +9 -0
- package/dist/hooks/connect-agent-context.svelte.d.ts.map +1 -0
- package/dist/hooks/connect-agent-context.svelte.js +25 -0
- package/dist/hooks/create-agent.svelte.d.ts +23 -0
- package/dist/hooks/create-agent.svelte.d.ts.map +1 -0
- package/dist/hooks/create-agent.svelte.js +341 -0
- package/dist/hooks/create-attachments.svelte.d.ts +33 -0
- package/dist/hooks/create-attachments.svelte.d.ts.map +1 -0
- package/dist/hooks/create-attachments.svelte.js +232 -0
- package/dist/hooks/create-capabilities.svelte.d.ts +6 -0
- package/dist/hooks/create-capabilities.svelte.d.ts.map +1 -0
- package/dist/hooks/create-capabilities.svelte.js +17 -0
- package/dist/hooks/create-interrupt.svelte.d.ts +24 -0
- package/dist/hooks/create-interrupt.svelte.d.ts.map +1 -0
- package/dist/hooks/create-interrupt.svelte.js +333 -0
- package/dist/hooks/create-suggestions.svelte.d.ts +12 -0
- package/dist/hooks/create-suggestions.svelte.d.ts.map +1 -0
- package/dist/hooks/create-suggestions.svelte.js +61 -0
- package/dist/hooks/create-threads.svelte.d.ts +33 -0
- package/dist/hooks/create-threads.svelte.d.ts.map +1 -0
- package/dist/hooks/create-threads.svelte.js +230 -0
- package/dist/hooks/index.d.ts +20 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +11 -0
- package/dist/hooks/load-katex-styles.svelte.d.ts +2 -0
- package/dist/hooks/load-katex-styles.svelte.d.ts.map +1 -0
- package/dist/hooks/load-katex-styles.svelte.js +11 -0
- package/dist/hooks/register-frontend-tool.svelte.d.ts +3 -0
- package/dist/hooks/register-frontend-tool.svelte.d.ts.map +1 -0
- package/dist/hooks/register-frontend-tool.svelte.js +32 -0
- package/dist/hooks/register-human-in-the-loop.svelte.d.ts +3 -0
- package/dist/hooks/register-human-in-the-loop.svelte.d.ts.map +1 -0
- package/dist/hooks/register-human-in-the-loop.svelte.js +84 -0
- package/dist/hooks/register-render-tool-call.svelte.d.ts +30 -0
- package/dist/hooks/register-render-tool-call.svelte.d.ts.map +1 -0
- package/dist/hooks/register-render-tool-call.svelte.js +26 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/lib/svelte-core.d.ts +54 -0
- package/dist/lib/svelte-core.d.ts.map +1 -0
- package/dist/lib/svelte-core.js +145 -0
- package/dist/providers/CopilotKitProvider.svelte +291 -0
- package/dist/providers/CopilotKitProvider.svelte.d.ts +9 -0
- package/dist/providers/CopilotKitProvider.svelte.d.ts.map +1 -0
- package/dist/providers/CopilotKitProvider.types.d.ts +47 -0
- package/dist/providers/CopilotKitProvider.types.d.ts.map +1 -0
- package/dist/providers/CopilotKitProvider.types.js +1 -0
- package/dist/providers/context.d.ts +19 -0
- package/dist/providers/context.d.ts.map +1 -0
- package/dist/providers/context.js +2 -0
- package/dist/providers/index.d.ts +6 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +2 -0
- package/dist/providers/useCopilotKit.d.ts +3 -0
- package/dist/providers/useCopilotKit.d.ts.map +1 -0
- package/dist/providers/useCopilotKit.js +9 -0
- package/dist/styles/globals.css +691 -0
- package/dist/styles.css +2 -0
- package/dist/styles.d.ts +1 -0
- package/dist/types/a2ui.d.ts +5 -0
- package/dist/types/a2ui.d.ts.map +1 -0
- package/dist/types/a2ui.js +1 -0
- package/dist/types/activity-message-renderer.d.ts +17 -0
- package/dist/types/activity-message-renderer.d.ts.map +1 -0
- package/dist/types/activity-message-renderer.js +1 -0
- package/dist/types/custom-message-renderer.d.ts +18 -0
- package/dist/types/custom-message-renderer.d.ts.map +1 -0
- package/dist/types/custom-message-renderer.js +1 -0
- package/dist/types/frontend-tool.d.ts +6 -0
- package/dist/types/frontend-tool.d.ts.map +1 -0
- package/dist/types/frontend-tool.js +1 -0
- package/dist/types/human-in-the-loop.d.ts +31 -0
- package/dist/types/human-in-the-loop.d.ts.map +1 -0
- package/dist/types/human-in-the-loop.js +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +8 -0
- package/dist/types/interrupt.d.ts +23 -0
- package/dist/types/interrupt.d.ts.map +1 -0
- package/dist/types/interrupt.js +1 -0
- package/dist/types/sandbox-function.d.ts +8 -0
- package/dist/types/sandbox-function.d.ts.map +1 -0
- package/dist/types/sandbox-function.js +1 -0
- package/dist/types/tool-call-renderer.d.ts +29 -0
- package/dist/types/tool-call-renderer.d.ts.map +1 -0
- package/dist/types/tool-call-renderer.js +1 -0
- package/package.json +103 -8
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { AssistantMessage, Message } from "@ag-ui/core";
|
|
3
|
+
import type { Snippet } from "svelte";
|
|
4
|
+
import { IconCheck, IconCopy, IconThumbsUp, IconThumbsDown, IconVolume2, IconRefreshCw } from "../icons";
|
|
5
|
+
import { getChatConfig } from "./chat-config-context.svelte";
|
|
6
|
+
import StreamMarkdown from "./StreamMarkdown.svelte";
|
|
7
|
+
import CopilotChatToolCallsView from "./CopilotChatToolCallsView.svelte";
|
|
8
|
+
|
|
9
|
+
interface MessageRendererProps {
|
|
10
|
+
message: AssistantMessage;
|
|
11
|
+
content: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface ToolbarProps {
|
|
15
|
+
message: AssistantMessage;
|
|
16
|
+
shouldShowToolbar: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface CopyButtonProps {
|
|
20
|
+
onCopy: () => Promise<void>;
|
|
21
|
+
copied: boolean;
|
|
22
|
+
label: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface ThumbsUpButtonProps {
|
|
26
|
+
onThumbsUp: () => void;
|
|
27
|
+
label: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface ThumbsDownButtonProps {
|
|
31
|
+
onThumbsDown: () => void;
|
|
32
|
+
label: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface ReadAloudButtonProps {
|
|
36
|
+
onReadAloud: () => void;
|
|
37
|
+
label: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface RegenerateButtonProps {
|
|
41
|
+
onRegenerate: () => void;
|
|
42
|
+
label: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface ToolCallsViewProps {
|
|
46
|
+
message: AssistantMessage;
|
|
47
|
+
messages: Message[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface LayoutProps {
|
|
51
|
+
message: AssistantMessage;
|
|
52
|
+
content: string;
|
|
53
|
+
isRunning: boolean;
|
|
54
|
+
toolbarVisible: boolean;
|
|
55
|
+
shouldShowToolbar: boolean;
|
|
56
|
+
messageRenderer: unknown;
|
|
57
|
+
toolbar: unknown;
|
|
58
|
+
copyButton: unknown;
|
|
59
|
+
thumbsUpButton: unknown;
|
|
60
|
+
thumbsDownButton: unknown;
|
|
61
|
+
readAloudButton: unknown;
|
|
62
|
+
regenerateButton: unknown;
|
|
63
|
+
toolCallsView: unknown;
|
|
64
|
+
onCopy: () => Promise<void>;
|
|
65
|
+
onThumbsUp: () => void;
|
|
66
|
+
onThumbsDown: () => void;
|
|
67
|
+
onReadAloud: () => void;
|
|
68
|
+
onRegenerate: () => void;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const defaultLabels = {
|
|
72
|
+
assistantMessageToolbarCopyMessageLabel: "Copy",
|
|
73
|
+
assistantMessageToolbarThumbsUpLabel: "Good response",
|
|
74
|
+
assistantMessageToolbarThumbsDownLabel: "Bad response",
|
|
75
|
+
assistantMessageToolbarReadAloudLabel: "Read aloud",
|
|
76
|
+
assistantMessageToolbarRegenerateLabel: "Regenerate",
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
let {
|
|
80
|
+
message,
|
|
81
|
+
messages = [] as Message[],
|
|
82
|
+
isRunning = false,
|
|
83
|
+
toolbarVisible = true,
|
|
84
|
+
messageRenderer,
|
|
85
|
+
toolbar: toolbarSnippet,
|
|
86
|
+
copyButton,
|
|
87
|
+
thumbsUpButton,
|
|
88
|
+
thumbsDownButton,
|
|
89
|
+
readAloudButton,
|
|
90
|
+
regenerateButton,
|
|
91
|
+
toolCallsView,
|
|
92
|
+
toolbarItems,
|
|
93
|
+
onThumbsUp,
|
|
94
|
+
onThumbsDown,
|
|
95
|
+
onReadAloud,
|
|
96
|
+
onRegenerate,
|
|
97
|
+
}: {
|
|
98
|
+
message: AssistantMessage;
|
|
99
|
+
messages?: Message[];
|
|
100
|
+
isRunning?: boolean;
|
|
101
|
+
toolbarVisible?: boolean;
|
|
102
|
+
layout?: Snippet<[LayoutProps]>;
|
|
103
|
+
messageRenderer?: Snippet<[MessageRendererProps]>;
|
|
104
|
+
toolbar?: Snippet<[ToolbarProps]>;
|
|
105
|
+
copyButton?: Snippet<[CopyButtonProps]>;
|
|
106
|
+
thumbsUpButton?: Snippet<[ThumbsUpButtonProps]>;
|
|
107
|
+
thumbsDownButton?: Snippet<[ThumbsDownButtonProps]>;
|
|
108
|
+
readAloudButton?: Snippet<[ReadAloudButtonProps]>;
|
|
109
|
+
regenerateButton?: Snippet<[RegenerateButtonProps]>;
|
|
110
|
+
toolCallsView?: Snippet<[ToolCallsViewProps]>;
|
|
111
|
+
toolbarItems?: Snippet<[]>;
|
|
112
|
+
children?: Snippet<[]>;
|
|
113
|
+
onThumbsUp?: (message: AssistantMessage) => void;
|
|
114
|
+
onThumbsDown?: (message: AssistantMessage) => void;
|
|
115
|
+
onReadAloud?: (message: AssistantMessage) => void;
|
|
116
|
+
onRegenerate?: (message: AssistantMessage) => void;
|
|
117
|
+
} = $props();
|
|
118
|
+
|
|
119
|
+
let copied = $state(false);
|
|
120
|
+
let copiedResetTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
121
|
+
|
|
122
|
+
const config = getChatConfig();
|
|
123
|
+
const labels = { ...defaultLabels, ...config?.labels };
|
|
124
|
+
|
|
125
|
+
function normalizeContent(content: unknown): string {
|
|
126
|
+
if (!content) return "";
|
|
127
|
+
if (typeof content === "string") return content;
|
|
128
|
+
if (Array.isArray(content)) {
|
|
129
|
+
return content
|
|
130
|
+
.map((part) => {
|
|
131
|
+
if (part && typeof part === "object" && "type" in part && part.type === "text" && typeof part.text === "string") {
|
|
132
|
+
return part.text;
|
|
133
|
+
}
|
|
134
|
+
return "";
|
|
135
|
+
})
|
|
136
|
+
.filter((text) => text.length > 0)
|
|
137
|
+
.join("\n");
|
|
138
|
+
}
|
|
139
|
+
return "";
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const normalizedContent = $derived(normalizeContent(message.content));
|
|
143
|
+
const hasContent = $derived(normalizedContent.trim().length > 0);
|
|
144
|
+
const isLatestAssistantMessage = $derived(
|
|
145
|
+
messages.filter((m) => m.role === "assistant").at(-1)?.id === message.id
|
|
146
|
+
);
|
|
147
|
+
const shouldShowToolbar = $derived(toolbarVisible && hasContent && !(isRunning && isLatestAssistantMessage));
|
|
148
|
+
|
|
149
|
+
function resetCopiedStateWithDelay() {
|
|
150
|
+
if (copiedResetTimeout) clearTimeout(copiedResetTimeout);
|
|
151
|
+
copied = true;
|
|
152
|
+
copiedResetTimeout = setTimeout(() => {
|
|
153
|
+
copied = false;
|
|
154
|
+
copiedResetTimeout = null;
|
|
155
|
+
}, 2000);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async function handleCopyMessage() {
|
|
159
|
+
if (!normalizedContent) return;
|
|
160
|
+
if (typeof navigator === "undefined" || typeof navigator.clipboard?.writeText !== "function") return;
|
|
161
|
+
try {
|
|
162
|
+
await navigator.clipboard.writeText(normalizedContent);
|
|
163
|
+
resetCopiedStateWithDelay();
|
|
164
|
+
} catch (error) {
|
|
165
|
+
console.error("Failed to copy to clipboard:", error);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function handleThumbsUp() { onThumbsUp?.(message); }
|
|
170
|
+
function handleThumbsDown() { onThumbsDown?.(message); }
|
|
171
|
+
function handleReadAloud() { onReadAloud?.(message); }
|
|
172
|
+
function handleRegenerate() { onRegenerate?.(message); }
|
|
173
|
+
|
|
174
|
+
const toolbarBtnClass = "cpk:inline-flex cpk:h-8 cpk:w-8 cpk:items-center cpk:justify-center cpk:rounded-md cpk:p-0 cpk:cursor-pointer cpk:text-[rgb(93,93,93)] cpk:transition-colors cpk:hover:bg-[#E8E8E8] cpk:hover:text-[rgb(93,93,93)] cpk:dark:text-[rgb(243,243,243)] cpk:dark:hover:bg-[#303030] cpk:dark:hover:text-[rgb(243,243,243)] cpk:disabled:pointer-events-none cpk:disabled:opacity-50";
|
|
175
|
+
</script>
|
|
176
|
+
|
|
177
|
+
<div
|
|
178
|
+
data-copilotkit
|
|
179
|
+
data-testid="copilot-assistant-message"
|
|
180
|
+
class="cpk:w-full cpk:group cpk:pt-10"
|
|
181
|
+
data-message-id={message.id}
|
|
182
|
+
>
|
|
183
|
+
<div class="cpk:prose cpk:max-w-full cpk:break-words cpk:dark:prose-invert">
|
|
184
|
+
{#if messageRenderer}
|
|
185
|
+
{@render messageRenderer({ message, content: normalizedContent })}
|
|
186
|
+
{:else}
|
|
187
|
+
{#if hasContent}
|
|
188
|
+
<StreamMarkdown content={normalizedContent} />
|
|
189
|
+
{/if}
|
|
190
|
+
{/if}
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<div class="cpk:flex cpk:w-full cpk:flex-col cpk:items-stretch">
|
|
194
|
+
{#if toolCallsView}
|
|
195
|
+
{@render toolCallsView({ message, messages })}
|
|
196
|
+
{:else}
|
|
197
|
+
<CopilotChatToolCallsView {message} {messages} />
|
|
198
|
+
{/if}
|
|
199
|
+
</div>
|
|
200
|
+
|
|
201
|
+
{#if shouldShowToolbar}
|
|
202
|
+
{#if toolbarSnippet}
|
|
203
|
+
{@render toolbarSnippet({ message, shouldShowToolbar })}
|
|
204
|
+
{:else}
|
|
205
|
+
<div class="cpk:w-full cpk:bg-transparent cpk:flex cpk:items-center cpk:-ml-[5px] cpk:-mt-[0px]">
|
|
206
|
+
<div class="cpk:flex cpk:items-center cpk:gap-1">
|
|
207
|
+
{#if copyButton}
|
|
208
|
+
{@render copyButton({ onCopy: handleCopyMessage, copied, label: labels.assistantMessageToolbarCopyMessageLabel as string })}
|
|
209
|
+
{:else}
|
|
210
|
+
<button
|
|
211
|
+
data-testid="copilot-copy-button"
|
|
212
|
+
type="button"
|
|
213
|
+
class={toolbarBtnClass}
|
|
214
|
+
aria-label={labels.assistantMessageToolbarCopyMessageLabel as string}
|
|
215
|
+
title={labels.assistantMessageToolbarCopyMessageLabel as string}
|
|
216
|
+
onclick={handleCopyMessage}
|
|
217
|
+
>
|
|
218
|
+
{#if copied}
|
|
219
|
+
<IconCheck class="cpk:size-[18px]" />
|
|
220
|
+
{:else}
|
|
221
|
+
<IconCopy class="cpk:size-[18px]" />
|
|
222
|
+
{/if}
|
|
223
|
+
</button>
|
|
224
|
+
{/if}
|
|
225
|
+
|
|
226
|
+
{#if onThumbsUp}
|
|
227
|
+
{#if thumbsUpButton}
|
|
228
|
+
{@render thumbsUpButton({ onThumbsUp: handleThumbsUp, label: labels.assistantMessageToolbarThumbsUpLabel as string })}
|
|
229
|
+
{:else}
|
|
230
|
+
<button
|
|
231
|
+
type="button"
|
|
232
|
+
class={toolbarBtnClass}
|
|
233
|
+
aria-label={labels.assistantMessageToolbarThumbsUpLabel as string}
|
|
234
|
+
title={labels.assistantMessageToolbarThumbsUpLabel as string}
|
|
235
|
+
onclick={handleThumbsUp}
|
|
236
|
+
>
|
|
237
|
+
<IconThumbsUp class="cpk:size-[18px]" />
|
|
238
|
+
</button>
|
|
239
|
+
{/if}
|
|
240
|
+
{/if}
|
|
241
|
+
|
|
242
|
+
{#if onThumbsDown}
|
|
243
|
+
{#if thumbsDownButton}
|
|
244
|
+
{@render thumbsDownButton({ onThumbsDown: handleThumbsDown, label: labels.assistantMessageToolbarThumbsDownLabel as string })}
|
|
245
|
+
{:else}
|
|
246
|
+
<button
|
|
247
|
+
type="button"
|
|
248
|
+
class={toolbarBtnClass}
|
|
249
|
+
aria-label={labels.assistantMessageToolbarThumbsDownLabel as string}
|
|
250
|
+
title={labels.assistantMessageToolbarThumbsDownLabel as string}
|
|
251
|
+
onclick={handleThumbsDown}
|
|
252
|
+
>
|
|
253
|
+
<IconThumbsDown class="cpk:size-[18px]" />
|
|
254
|
+
</button>
|
|
255
|
+
{/if}
|
|
256
|
+
{/if}
|
|
257
|
+
|
|
258
|
+
{#if onReadAloud}
|
|
259
|
+
{#if readAloudButton}
|
|
260
|
+
{@render readAloudButton({ onReadAloud: handleReadAloud, label: labels.assistantMessageToolbarReadAloudLabel as string })}
|
|
261
|
+
{:else}
|
|
262
|
+
<button
|
|
263
|
+
type="button"
|
|
264
|
+
class={toolbarBtnClass}
|
|
265
|
+
aria-label={labels.assistantMessageToolbarReadAloudLabel as string}
|
|
266
|
+
title={labels.assistantMessageToolbarReadAloudLabel as string}
|
|
267
|
+
onclick={handleReadAloud}
|
|
268
|
+
>
|
|
269
|
+
<IconVolume2 class="cpk:size-[20px]" />
|
|
270
|
+
</button>
|
|
271
|
+
{/if}
|
|
272
|
+
{/if}
|
|
273
|
+
|
|
274
|
+
{#if onRegenerate}
|
|
275
|
+
{#if regenerateButton}
|
|
276
|
+
{@render regenerateButton({ onRegenerate: handleRegenerate, label: labels.assistantMessageToolbarRegenerateLabel as string })}
|
|
277
|
+
{:else}
|
|
278
|
+
<button
|
|
279
|
+
type="button"
|
|
280
|
+
class={toolbarBtnClass}
|
|
281
|
+
aria-label={labels.assistantMessageToolbarRegenerateLabel as string}
|
|
282
|
+
title={labels.assistantMessageToolbarRegenerateLabel as string}
|
|
283
|
+
onclick={handleRegenerate}
|
|
284
|
+
>
|
|
285
|
+
<IconRefreshCw class="cpk:size-[18px]" />
|
|
286
|
+
</button>
|
|
287
|
+
{/if}
|
|
288
|
+
{/if}
|
|
289
|
+
|
|
290
|
+
{#if toolbarItems}{@render toolbarItems()}{/if}
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
{/if}
|
|
294
|
+
{/if}
|
|
295
|
+
</div>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { AssistantMessage, Message } from "@ag-ui/core";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
interface MessageRendererProps {
|
|
4
|
+
message: AssistantMessage;
|
|
5
|
+
content: string;
|
|
6
|
+
}
|
|
7
|
+
interface ToolbarProps {
|
|
8
|
+
message: AssistantMessage;
|
|
9
|
+
shouldShowToolbar: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface CopyButtonProps {
|
|
12
|
+
onCopy: () => Promise<void>;
|
|
13
|
+
copied: boolean;
|
|
14
|
+
label: string;
|
|
15
|
+
}
|
|
16
|
+
interface ThumbsUpButtonProps {
|
|
17
|
+
onThumbsUp: () => void;
|
|
18
|
+
label: string;
|
|
19
|
+
}
|
|
20
|
+
interface ThumbsDownButtonProps {
|
|
21
|
+
onThumbsDown: () => void;
|
|
22
|
+
label: string;
|
|
23
|
+
}
|
|
24
|
+
interface ReadAloudButtonProps {
|
|
25
|
+
onReadAloud: () => void;
|
|
26
|
+
label: string;
|
|
27
|
+
}
|
|
28
|
+
interface RegenerateButtonProps {
|
|
29
|
+
onRegenerate: () => void;
|
|
30
|
+
label: string;
|
|
31
|
+
}
|
|
32
|
+
interface ToolCallsViewProps {
|
|
33
|
+
message: AssistantMessage;
|
|
34
|
+
messages: Message[];
|
|
35
|
+
}
|
|
36
|
+
interface LayoutProps {
|
|
37
|
+
message: AssistantMessage;
|
|
38
|
+
content: string;
|
|
39
|
+
isRunning: boolean;
|
|
40
|
+
toolbarVisible: boolean;
|
|
41
|
+
shouldShowToolbar: boolean;
|
|
42
|
+
messageRenderer: unknown;
|
|
43
|
+
toolbar: unknown;
|
|
44
|
+
copyButton: unknown;
|
|
45
|
+
thumbsUpButton: unknown;
|
|
46
|
+
thumbsDownButton: unknown;
|
|
47
|
+
readAloudButton: unknown;
|
|
48
|
+
regenerateButton: unknown;
|
|
49
|
+
toolCallsView: unknown;
|
|
50
|
+
onCopy: () => Promise<void>;
|
|
51
|
+
onThumbsUp: () => void;
|
|
52
|
+
onThumbsDown: () => void;
|
|
53
|
+
onReadAloud: () => void;
|
|
54
|
+
onRegenerate: () => void;
|
|
55
|
+
}
|
|
56
|
+
type $$ComponentProps = {
|
|
57
|
+
message: AssistantMessage;
|
|
58
|
+
messages?: Message[];
|
|
59
|
+
isRunning?: boolean;
|
|
60
|
+
toolbarVisible?: boolean;
|
|
61
|
+
layout?: Snippet<[LayoutProps]>;
|
|
62
|
+
messageRenderer?: Snippet<[MessageRendererProps]>;
|
|
63
|
+
toolbar?: Snippet<[ToolbarProps]>;
|
|
64
|
+
copyButton?: Snippet<[CopyButtonProps]>;
|
|
65
|
+
thumbsUpButton?: Snippet<[ThumbsUpButtonProps]>;
|
|
66
|
+
thumbsDownButton?: Snippet<[ThumbsDownButtonProps]>;
|
|
67
|
+
readAloudButton?: Snippet<[ReadAloudButtonProps]>;
|
|
68
|
+
regenerateButton?: Snippet<[RegenerateButtonProps]>;
|
|
69
|
+
toolCallsView?: Snippet<[ToolCallsViewProps]>;
|
|
70
|
+
toolbarItems?: Snippet<[]>;
|
|
71
|
+
children?: Snippet<[]>;
|
|
72
|
+
onThumbsUp?: (message: AssistantMessage) => void;
|
|
73
|
+
onThumbsDown?: (message: AssistantMessage) => void;
|
|
74
|
+
onReadAloud?: (message: AssistantMessage) => void;
|
|
75
|
+
onRegenerate?: (message: AssistantMessage) => void;
|
|
76
|
+
};
|
|
77
|
+
declare const CopilotChatAssistantMessage: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
78
|
+
type CopilotChatAssistantMessage = ReturnType<typeof CopilotChatAssistantMessage>;
|
|
79
|
+
export default CopilotChatAssistantMessage;
|
|
80
|
+
//# sourceMappingURL=CopilotChatAssistantMessage.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopilotChatAssistantMessage.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/chat/CopilotChatAssistantMessage.svelte"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { formatFileSize, getDocumentIcon, getSourceUrl } from "@copilotkit/shared";
|
|
3
|
+
import type { Attachment } from "@copilotkit/shared";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
attachments = [] as Attachment[],
|
|
7
|
+
onRemoveAttachment,
|
|
8
|
+
}: {
|
|
9
|
+
attachments?: Attachment[];
|
|
10
|
+
onRemoveAttachment?: (id: string) => void;
|
|
11
|
+
} = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
{#if attachments.length > 0}
|
|
15
|
+
<div data-testid="copilot-attachment-queue" class="copilotkit-attachment-queue">
|
|
16
|
+
{#each attachments as attachment (attachment.id)}
|
|
17
|
+
<div
|
|
18
|
+
data-testid="copilot-chat-attachment-item"
|
|
19
|
+
data-card-type={attachment.type}
|
|
20
|
+
class="copilotkit-attachment-card"
|
|
21
|
+
class:is-media={attachment.type === "image" || attachment.type === "video"}
|
|
22
|
+
>
|
|
23
|
+
{#if attachment.status === "uploading"}
|
|
24
|
+
<div
|
|
25
|
+
data-testid="copilot-chat-attachment-uploading-overlay"
|
|
26
|
+
class="copilotkit-attachment-uploading"
|
|
27
|
+
aria-label="Uploading"
|
|
28
|
+
>
|
|
29
|
+
<div class="copilotkit-attachment-spinner"></div>
|
|
30
|
+
</div>
|
|
31
|
+
{/if}
|
|
32
|
+
{#if attachment.status === "ready"}
|
|
33
|
+
{#if attachment.type === "image"}
|
|
34
|
+
<img
|
|
35
|
+
src={getSourceUrl(attachment.source)}
|
|
36
|
+
alt={attachment.filename || "Image attachment"}
|
|
37
|
+
class="copilotkit-attachment-image"
|
|
38
|
+
data-testid="copilot-chat-attachment-image-thumbnail"
|
|
39
|
+
/>
|
|
40
|
+
{:else if attachment.type === "video"}
|
|
41
|
+
{#if attachment.thumbnail}
|
|
42
|
+
<img
|
|
43
|
+
src={attachment.thumbnail}
|
|
44
|
+
alt={attachment.filename || "Video thumbnail"}
|
|
45
|
+
class="copilotkit-attachment-image"
|
|
46
|
+
data-testid="copilot-chat-attachment-video-thumbnail"
|
|
47
|
+
/>
|
|
48
|
+
{:else}
|
|
49
|
+
<video
|
|
50
|
+
src={getSourceUrl(attachment.source)}
|
|
51
|
+
preload="metadata"
|
|
52
|
+
muted
|
|
53
|
+
class="copilotkit-attachment-image"
|
|
54
|
+
data-testid="copilot-chat-attachment-video-fallback"
|
|
55
|
+
></video>
|
|
56
|
+
{/if}
|
|
57
|
+
{:else if attachment.type === "audio"}
|
|
58
|
+
<div class="copilotkit-attachment-audio">
|
|
59
|
+
<audio
|
|
60
|
+
src={getSourceUrl(attachment.source)}
|
|
61
|
+
controls
|
|
62
|
+
preload="metadata"
|
|
63
|
+
class="copilotkit-attachment-audio-player"
|
|
64
|
+
data-testid="copilot-chat-attachment-audio-player"
|
|
65
|
+
></audio>
|
|
66
|
+
{#if attachment.filename}
|
|
67
|
+
<span class="copilotkit-attachment-name">{attachment.filename}</span>
|
|
68
|
+
{/if}
|
|
69
|
+
</div>
|
|
70
|
+
{:else}
|
|
71
|
+
<div class="copilotkit-attachment-doc">
|
|
72
|
+
<div class="copilotkit-attachment-doc-icon">
|
|
73
|
+
{getDocumentIcon(attachment.source.mimeType ?? "")}
|
|
74
|
+
</div>
|
|
75
|
+
<div class="copilotkit-attachment-doc-meta">
|
|
76
|
+
<span
|
|
77
|
+
class="copilotkit-attachment-name"
|
|
78
|
+
data-testid="copilot-chat-attachment-document-filename"
|
|
79
|
+
>
|
|
80
|
+
{attachment.filename || "Document"}
|
|
81
|
+
</span>
|
|
82
|
+
{#if attachment.size != null}
|
|
83
|
+
<span class="copilotkit-attachment-size">
|
|
84
|
+
{formatFileSize(attachment.size)}
|
|
85
|
+
</span>
|
|
86
|
+
{/if}
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
{/if}
|
|
90
|
+
{:else}
|
|
91
|
+
<div
|
|
92
|
+
class="copilotkit-attachment-placeholder"
|
|
93
|
+
data-testid="copilot-chat-attachment-placeholder"
|
|
94
|
+
></div>
|
|
95
|
+
{/if}
|
|
96
|
+
<button
|
|
97
|
+
type="button"
|
|
98
|
+
class="copilotkit-attachment-remove"
|
|
99
|
+
aria-label="Remove attachment"
|
|
100
|
+
onclick={() => onRemoveAttachment?.(attachment.id)}
|
|
101
|
+
>
|
|
102
|
+
✕
|
|
103
|
+
</button>
|
|
104
|
+
</div>
|
|
105
|
+
{/each}
|
|
106
|
+
</div>
|
|
107
|
+
{/if}
|
|
108
|
+
|
|
109
|
+
<style>
|
|
110
|
+
.copilotkit-attachment-queue {
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-wrap: wrap;
|
|
113
|
+
gap: 8px;
|
|
114
|
+
padding: 8px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.copilotkit-attachment-card {
|
|
118
|
+
position: relative;
|
|
119
|
+
display: inline-flex;
|
|
120
|
+
border-radius: 8px;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
border: 1px solid #e5e7eb;
|
|
123
|
+
background: #fff;
|
|
124
|
+
padding: 8px 28px 8px 12px;
|
|
125
|
+
max-width: 240px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.copilotkit-attachment-card.is-media {
|
|
129
|
+
width: 72px;
|
|
130
|
+
height: 72px;
|
|
131
|
+
padding: 0 0 0 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.copilotkit-attachment-image {
|
|
135
|
+
width: 100%;
|
|
136
|
+
height: 100%;
|
|
137
|
+
object-fit: cover;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.copilotkit-attachment-uploading {
|
|
141
|
+
position: absolute;
|
|
142
|
+
inset: 0;
|
|
143
|
+
display: flex;
|
|
144
|
+
align-items: center;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
background: rgba(0, 0, 0, 0.4);
|
|
147
|
+
z-index: 10;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.copilotkit-attachment-spinner {
|
|
151
|
+
width: 20px;
|
|
152
|
+
height: 20px;
|
|
153
|
+
border: 2px solid #fff;
|
|
154
|
+
border-top-color: transparent;
|
|
155
|
+
border-radius: 9999px;
|
|
156
|
+
animation: copilotkit-spin 0.8s linear infinite;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@keyframes copilotkit-spin {
|
|
160
|
+
to {
|
|
161
|
+
transform: rotate(360deg);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.copilotkit-attachment-audio {
|
|
166
|
+
display: flex;
|
|
167
|
+
flex-direction: column;
|
|
168
|
+
gap: 4px;
|
|
169
|
+
width: 100%;
|
|
170
|
+
min-width: 200px;
|
|
171
|
+
max-width: 280px;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.copilotkit-attachment-audio-player {
|
|
175
|
+
width: 100%;
|
|
176
|
+
height: 32px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.copilotkit-attachment-doc {
|
|
180
|
+
display: flex;
|
|
181
|
+
align-items: center;
|
|
182
|
+
gap: 8px;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.copilotkit-attachment-doc-icon {
|
|
186
|
+
width: 32px;
|
|
187
|
+
height: 32px;
|
|
188
|
+
border-radius: 6px;
|
|
189
|
+
background: #3b82f6;
|
|
190
|
+
color: #fff;
|
|
191
|
+
display: flex;
|
|
192
|
+
align-items: center;
|
|
193
|
+
justify-content: center;
|
|
194
|
+
font-size: 10px;
|
|
195
|
+
font-weight: 600;
|
|
196
|
+
flex-shrink: 0;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.copilotkit-attachment-doc-meta {
|
|
200
|
+
display: flex;
|
|
201
|
+
flex-direction: column;
|
|
202
|
+
min-width: 0;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.copilotkit-attachment-name {
|
|
206
|
+
font-size: 12px;
|
|
207
|
+
font-weight: 500;
|
|
208
|
+
word-break: break-all;
|
|
209
|
+
line-height: 1.25;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.copilotkit-attachment-size {
|
|
213
|
+
font-size: 11px;
|
|
214
|
+
color: #6b7280;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.copilotkit-attachment-placeholder {
|
|
218
|
+
width: 100%;
|
|
219
|
+
height: 100%;
|
|
220
|
+
min-height: 40px;
|
|
221
|
+
background: rgba(107, 114, 128, 0.2);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.copilotkit-attachment-remove {
|
|
225
|
+
position: absolute;
|
|
226
|
+
top: 4px;
|
|
227
|
+
right: 4px;
|
|
228
|
+
background: rgba(0, 0, 0, 0.6);
|
|
229
|
+
color: #fff;
|
|
230
|
+
border: none;
|
|
231
|
+
border-radius: 9999px;
|
|
232
|
+
width: 20px;
|
|
233
|
+
height: 20px;
|
|
234
|
+
display: flex;
|
|
235
|
+
align-items: center;
|
|
236
|
+
justify-content: center;
|
|
237
|
+
cursor: pointer;
|
|
238
|
+
font-size: 10px;
|
|
239
|
+
z-index: 20;
|
|
240
|
+
}
|
|
241
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Attachment } from "@copilotkit/shared";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
attachments?: Attachment[];
|
|
4
|
+
onRemoveAttachment?: (id: string) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const CopilotChatAttachmentQueue: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type CopilotChatAttachmentQueue = ReturnType<typeof CopilotChatAttachmentQueue>;
|
|
8
|
+
export default CopilotChatAttachmentQueue;
|
|
9
|
+
//# sourceMappingURL=CopilotChatAttachmentQueue.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopilotChatAttachmentQueue.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/chat/CopilotChatAttachmentQueue.svelte"],"names":[],"mappings":"AAIE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEtD,KAAK,gBAAgB,GAAI;IACtB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AAkEJ,QAAA,MAAM,0BAA0B,sDAAwC,CAAC;AACzE,KAAK,0BAA0B,GAAG,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAChF,eAAe,0BAA0B,CAAC"}
|