@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,62 @@
|
|
|
1
|
+
import type { UserMessage } from "@ag-ui/core";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
interface MessageRendererProps {
|
|
4
|
+
message: UserMessage;
|
|
5
|
+
content: string;
|
|
6
|
+
isMultiline: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface ToolbarProps {
|
|
9
|
+
message: UserMessage;
|
|
10
|
+
showBranchNavigation: boolean;
|
|
11
|
+
hasEditAction: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface CopyButtonProps {
|
|
14
|
+
onCopy: () => Promise<void>;
|
|
15
|
+
copied: boolean;
|
|
16
|
+
label: string;
|
|
17
|
+
}
|
|
18
|
+
interface EditButtonProps {
|
|
19
|
+
onEdit: () => void;
|
|
20
|
+
label: string;
|
|
21
|
+
}
|
|
22
|
+
interface BranchNavigationProps {
|
|
23
|
+
branchIndex: number;
|
|
24
|
+
numberOfBranches: number;
|
|
25
|
+
canGoPrev: boolean;
|
|
26
|
+
canGoNext: boolean;
|
|
27
|
+
goPrev: () => void;
|
|
28
|
+
goNext: () => void;
|
|
29
|
+
}
|
|
30
|
+
interface LayoutProps {
|
|
31
|
+
message: UserMessage;
|
|
32
|
+
content: string;
|
|
33
|
+
isMultiline: boolean;
|
|
34
|
+
showBranchNavigation: boolean;
|
|
35
|
+
hasEditAction: boolean;
|
|
36
|
+
branchIndex: number;
|
|
37
|
+
numberOfBranches: number;
|
|
38
|
+
canGoPrev: boolean;
|
|
39
|
+
canGoNext: boolean;
|
|
40
|
+
onCopy: () => Promise<void>;
|
|
41
|
+
onEdit: () => void;
|
|
42
|
+
goPrev: () => void;
|
|
43
|
+
goNext: () => void;
|
|
44
|
+
copied: boolean;
|
|
45
|
+
}
|
|
46
|
+
type $$ComponentProps = {
|
|
47
|
+
message: UserMessage;
|
|
48
|
+
branchIndex?: number;
|
|
49
|
+
numberOfBranches?: number;
|
|
50
|
+
layout?: Snippet<[LayoutProps]>;
|
|
51
|
+
messageRenderer?: Snippet<[MessageRendererProps]>;
|
|
52
|
+
toolbar?: Snippet<[ToolbarProps]>;
|
|
53
|
+
copyButton?: Snippet<[CopyButtonProps]>;
|
|
54
|
+
editButton?: Snippet<[EditButtonProps]>;
|
|
55
|
+
branchNavigation?: Snippet<[BranchNavigationProps]>;
|
|
56
|
+
toolbarItems?: Snippet<[]>;
|
|
57
|
+
children?: Snippet<[]>;
|
|
58
|
+
};
|
|
59
|
+
declare const CopilotChatUserMessage: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
60
|
+
type CopilotChatUserMessage = ReturnType<typeof CopilotChatUserMessage>;
|
|
61
|
+
export default CopilotChatUserMessage;
|
|
62
|
+
//# sourceMappingURL=CopilotChatUserMessage.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopilotChatUserMessage.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/chat/CopilotChatUserMessage.svelte"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAMtC,UAAU,oBAAoB;IAC5B,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,YAAY;IACpB,OAAO,EAAE,WAAW,CAAC;IACrB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,qBAAqB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,UAAU,WAAW;IACnB,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;CACjB;AACF,KAAK,gBAAgB,GAAI;IACtB,OAAO,EAAE,WAAW,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;IAChC,eAAe,CAAC,EAAE,OAAO,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC;IACxC,gBAAgB,CAAC,EAAE,OAAO,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC;IACpD,YAAY,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;CACxB,CAAC;AAqMJ,QAAA,MAAM,sBAAsB,sDAAwC,CAAC;AACrE,KAAK,sBAAsB,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACxE,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Message } from "@ag-ui/core";
|
|
3
|
+
import type { Suggestion } from "@copilotkit/core";
|
|
4
|
+
import type { Attachment } from "@copilotkit/shared";
|
|
5
|
+
import type { CopilotChatInputMode, ToolsMenuItem, AutoScrollMode } from "./types";
|
|
6
|
+
import CopilotChatMessageView from "./CopilotChatMessageView.svelte";
|
|
7
|
+
import CopilotChatInput from "./CopilotChatInput.svelte";
|
|
8
|
+
import CopilotChatSuggestionView from "./CopilotChatSuggestionView.svelte";
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
messages = [] as Message[],
|
|
12
|
+
isRunning = false,
|
|
13
|
+
welcomeScreen = false,
|
|
14
|
+
suggestions = [] as Suggestion[],
|
|
15
|
+
attachments = [] as Attachment[],
|
|
16
|
+
dragOver = false,
|
|
17
|
+
inputValue = "",
|
|
18
|
+
inputMode = "input" as CopilotChatInputMode,
|
|
19
|
+
inputToolsMenu = [] as (ToolsMenuItem | "-")[],
|
|
20
|
+
autoScroll = true as AutoScrollMode | boolean,
|
|
21
|
+
sentMessageId = null,
|
|
22
|
+
onSubmitMessage,
|
|
23
|
+
onStop,
|
|
24
|
+
onInputChange,
|
|
25
|
+
onSelectSuggestion,
|
|
26
|
+
onRemoveAttachment,
|
|
27
|
+
onAddFile,
|
|
28
|
+
onDragOver,
|
|
29
|
+
onDragLeave,
|
|
30
|
+
onDrop,
|
|
31
|
+
}: {
|
|
32
|
+
messages?: Message[];
|
|
33
|
+
isRunning?: boolean;
|
|
34
|
+
welcomeScreen?: boolean;
|
|
35
|
+
suggestions?: Suggestion[];
|
|
36
|
+
attachments?: Attachment[];
|
|
37
|
+
dragOver?: boolean;
|
|
38
|
+
inputValue?: string;
|
|
39
|
+
inputMode?: CopilotChatInputMode;
|
|
40
|
+
inputToolsMenu?: (ToolsMenuItem | "-")[];
|
|
41
|
+
isConnecting?: boolean;
|
|
42
|
+
hasExplicitThreadId?: boolean;
|
|
43
|
+
autoScroll?: AutoScrollMode | boolean;
|
|
44
|
+
sentMessageId?: string | null;
|
|
45
|
+
onSubmitMessage: (value: string) => void;
|
|
46
|
+
onStop?: () => void;
|
|
47
|
+
onInputChange: (value: string) => void;
|
|
48
|
+
onSelectSuggestion: (suggestion: Suggestion, index: number) => void;
|
|
49
|
+
onRemoveAttachment?: (id: string) => void;
|
|
50
|
+
onAddFile?: () => void;
|
|
51
|
+
onDragOver?: (event: DragEvent) => void;
|
|
52
|
+
onDragLeave?: (event: DragEvent) => void;
|
|
53
|
+
onDrop?: (event: DragEvent) => void;
|
|
54
|
+
} = $props();
|
|
55
|
+
|
|
56
|
+
let canAddFile = $derived(!!onAddFile);
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<div
|
|
60
|
+
class="copilotkit-chat-view"
|
|
61
|
+
class:drag-over={dragOver}
|
|
62
|
+
role="presentation"
|
|
63
|
+
ondragover={onDragOver}
|
|
64
|
+
ondragleave={onDragLeave}
|
|
65
|
+
ondrop={onDrop}
|
|
66
|
+
>
|
|
67
|
+
{#if welcomeScreen && messages.length === 0}
|
|
68
|
+
<div class="copilotkit-welcome">
|
|
69
|
+
<div class="copilotkit-welcome-content">
|
|
70
|
+
<div class="copilotkit-welcome-icon">🤖</div>
|
|
71
|
+
<h2 class="copilotkit-welcome-title">How can I help you?</h2>
|
|
72
|
+
<p class="copilotkit-welcome-subtitle">Ask me anything to get started.</p>
|
|
73
|
+
</div>
|
|
74
|
+
{#if suggestions.length > 0}
|
|
75
|
+
<CopilotChatSuggestionView
|
|
76
|
+
{suggestions}
|
|
77
|
+
{onSelectSuggestion}
|
|
78
|
+
/>
|
|
79
|
+
{/if}
|
|
80
|
+
</div>
|
|
81
|
+
{:else}
|
|
82
|
+
<CopilotChatMessageView {messages} {isRunning} {autoScroll} {sentMessageId}>
|
|
83
|
+
{#snippet footer()}
|
|
84
|
+
{#if !isRunning && suggestions.length > 0}
|
|
85
|
+
<CopilotChatSuggestionView
|
|
86
|
+
{suggestions}
|
|
87
|
+
{onSelectSuggestion}
|
|
88
|
+
/>
|
|
89
|
+
{/if}
|
|
90
|
+
{/snippet}
|
|
91
|
+
</CopilotChatMessageView>
|
|
92
|
+
{/if}
|
|
93
|
+
<CopilotChatInput
|
|
94
|
+
value={inputValue}
|
|
95
|
+
{isRunning}
|
|
96
|
+
{inputMode}
|
|
97
|
+
toolsMenu={inputToolsMenu}
|
|
98
|
+
onSubmit={onSubmitMessage}
|
|
99
|
+
{onStop}
|
|
100
|
+
onInputChange={onInputChange}
|
|
101
|
+
{attachments}
|
|
102
|
+
{canAddFile}
|
|
103
|
+
{onAddFile}
|
|
104
|
+
{onRemoveAttachment}
|
|
105
|
+
placeholder={welcomeScreen && messages.length === 0
|
|
106
|
+
? "Type your message..."
|
|
107
|
+
: "Type a message..."}
|
|
108
|
+
/>
|
|
109
|
+
{#if dragOver}
|
|
110
|
+
<div class="copilotkit-drag-overlay" data-testid="copilot-drag-overlay">
|
|
111
|
+
Drop files to attach
|
|
112
|
+
</div>
|
|
113
|
+
{/if}
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<style>
|
|
117
|
+
.copilotkit-chat-view {
|
|
118
|
+
display: flex;
|
|
119
|
+
flex-direction: column;
|
|
120
|
+
flex: 1;
|
|
121
|
+
min-height: 0;
|
|
122
|
+
overflow: hidden;
|
|
123
|
+
position: relative;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.copilotkit-chat-view.drag-over {
|
|
127
|
+
outline: 2px dashed #3b82f6;
|
|
128
|
+
outline-offset: -2px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.copilotkit-drag-overlay {
|
|
132
|
+
position: absolute;
|
|
133
|
+
inset: 0;
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
justify-content: center;
|
|
137
|
+
background: rgba(59, 130, 246, 0.08);
|
|
138
|
+
color: #1d4ed8;
|
|
139
|
+
font-size: 14px;
|
|
140
|
+
font-weight: 600;
|
|
141
|
+
pointer-events: none;
|
|
142
|
+
z-index: 5;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.copilotkit-welcome {
|
|
146
|
+
display: flex;
|
|
147
|
+
flex-direction: column;
|
|
148
|
+
align-items: center;
|
|
149
|
+
justify-content: center;
|
|
150
|
+
flex: 1;
|
|
151
|
+
min-height: 0;
|
|
152
|
+
padding: 24px;
|
|
153
|
+
gap: 16px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.copilotkit-welcome-content {
|
|
157
|
+
text-align: center;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.copilotkit-welcome-icon {
|
|
161
|
+
font-size: 48px;
|
|
162
|
+
margin-bottom: 12px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.copilotkit-welcome-title {
|
|
166
|
+
font-size: 20px;
|
|
167
|
+
font-weight: 600;
|
|
168
|
+
color: #1f2937;
|
|
169
|
+
margin: 0;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.copilotkit-welcome-subtitle {
|
|
173
|
+
font-size: 14px;
|
|
174
|
+
color: #6b7280;
|
|
175
|
+
margin: 4px 0 0;
|
|
176
|
+
}
|
|
177
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Message } from "@ag-ui/core";
|
|
2
|
+
import type { Suggestion } from "@copilotkit/core";
|
|
3
|
+
import type { Attachment } from "@copilotkit/shared";
|
|
4
|
+
import type { CopilotChatInputMode, ToolsMenuItem, AutoScrollMode } from "./types";
|
|
5
|
+
type $$ComponentProps = {
|
|
6
|
+
messages?: Message[];
|
|
7
|
+
isRunning?: boolean;
|
|
8
|
+
welcomeScreen?: boolean;
|
|
9
|
+
suggestions?: Suggestion[];
|
|
10
|
+
attachments?: Attachment[];
|
|
11
|
+
dragOver?: boolean;
|
|
12
|
+
inputValue?: string;
|
|
13
|
+
inputMode?: CopilotChatInputMode;
|
|
14
|
+
inputToolsMenu?: (ToolsMenuItem | "-")[];
|
|
15
|
+
isConnecting?: boolean;
|
|
16
|
+
hasExplicitThreadId?: boolean;
|
|
17
|
+
autoScroll?: AutoScrollMode | boolean;
|
|
18
|
+
sentMessageId?: string | null;
|
|
19
|
+
onSubmitMessage: (value: string) => void;
|
|
20
|
+
onStop?: () => void;
|
|
21
|
+
onInputChange: (value: string) => void;
|
|
22
|
+
onSelectSuggestion: (suggestion: Suggestion, index: number) => void;
|
|
23
|
+
onRemoveAttachment?: (id: string) => void;
|
|
24
|
+
onAddFile?: () => void;
|
|
25
|
+
onDragOver?: (event: DragEvent) => void;
|
|
26
|
+
onDragLeave?: (event: DragEvent) => void;
|
|
27
|
+
onDrop?: (event: DragEvent) => void;
|
|
28
|
+
};
|
|
29
|
+
declare const CopilotChatView: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
30
|
+
type CopilotChatView = ReturnType<typeof CopilotChatView>;
|
|
31
|
+
export default CopilotChatView;
|
|
32
|
+
//# sourceMappingURL=CopilotChatView.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopilotChatView.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/chat/CopilotChatView.svelte"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAKpF,KAAK,gBAAgB,GAAI;IACtB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,cAAc,CAAC,EAAE,CAAC,aAAa,GAAG,GAAG,CAAC,EAAE,CAAC;IACzC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC;IACtC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,kBAAkB,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpE,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACxC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CACrC,CAAC;AAgEJ,QAAA,MAAM,eAAe,sDAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tick } from "svelte";
|
|
3
|
+
import CopilotChat from "./CopilotChat.svelte";
|
|
4
|
+
import CopilotChatToggleButton from "./CopilotChatToggleButton.svelte";
|
|
5
|
+
import type { CopilotPopupProps } from "./types";
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
width = "400px",
|
|
9
|
+
height = "600px",
|
|
10
|
+
clickOutsideToClose = true,
|
|
11
|
+
defaultOpen = false,
|
|
12
|
+
...chatProps
|
|
13
|
+
}: CopilotPopupProps = $props();
|
|
14
|
+
|
|
15
|
+
// svelte-ignore state_referenced_locally
|
|
16
|
+
let isOpen = $state(defaultOpen);
|
|
17
|
+
let popupWidth = $derived(typeof width === "number" ? `${width}px` : width);
|
|
18
|
+
let popupHeight = $derived(typeof height === "number" ? `${height}px` : height);
|
|
19
|
+
|
|
20
|
+
let popupRef: HTMLElement | undefined;
|
|
21
|
+
let wrapperRef: HTMLElement | undefined;
|
|
22
|
+
|
|
23
|
+
function toggle() {
|
|
24
|
+
if (isOpen) {
|
|
25
|
+
close();
|
|
26
|
+
} else {
|
|
27
|
+
isOpen = true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function close() {
|
|
32
|
+
wrapperRef?.querySelector<HTMLButtonElement>(".copilotkit-toggle-btn")?.focus();
|
|
33
|
+
isOpen = false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function trapFocus(event: KeyboardEvent) {
|
|
37
|
+
if (event.key === "Escape") {
|
|
38
|
+
close();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (event.key !== "Tab" || !popupRef) return;
|
|
42
|
+
const focusable = [...popupRef.querySelectorAll<HTMLElement>(
|
|
43
|
+
'button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])',
|
|
44
|
+
)].filter((element) => !element.hasAttribute("hidden"));
|
|
45
|
+
if (focusable.length === 0) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
popupRef.focus();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const first = focusable[0]!;
|
|
51
|
+
const last = focusable[focusable.length - 1]!;
|
|
52
|
+
if (!popupRef.contains(document.activeElement)) {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
(event.shiftKey ? last : first).focus();
|
|
55
|
+
} else if (event.shiftKey && document.activeElement === first) {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
last.focus();
|
|
58
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
first.focus();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
$effect(() => {
|
|
65
|
+
if (!isOpen) return;
|
|
66
|
+
void tick().then(() => {
|
|
67
|
+
const firstFocusable = popupRef?.querySelector<HTMLElement>(
|
|
68
|
+
'button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])',
|
|
69
|
+
);
|
|
70
|
+
(firstFocusable ?? popupRef)?.focus();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
function handleOverlayClick(e: MouseEvent) {
|
|
75
|
+
if (clickOutsideToClose && e.target === e.currentTarget) {
|
|
76
|
+
close();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function handleKeydown(e: KeyboardEvent) {
|
|
81
|
+
if (isOpen && e.key === "Escape") close();
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<svelte:window onkeydown={handleKeydown} />
|
|
86
|
+
|
|
87
|
+
<div class="copilotkit-popup-wrapper" bind:this={wrapperRef}>
|
|
88
|
+
<CopilotChatToggleButton isOpen={isOpen} onclick={toggle} />
|
|
89
|
+
|
|
90
|
+
<div
|
|
91
|
+
class="copilotkit-popup-overlay"
|
|
92
|
+
class:is-closed={!isOpen}
|
|
93
|
+
role="presentation"
|
|
94
|
+
aria-hidden={isOpen ? undefined : true}
|
|
95
|
+
inert={!isOpen}
|
|
96
|
+
hidden={!isOpen}
|
|
97
|
+
onclick={handleOverlayClick}
|
|
98
|
+
onkeydown={(e) => e.key === "Escape" && close()}
|
|
99
|
+
>
|
|
100
|
+
<div
|
|
101
|
+
class="copilotkit-popup"
|
|
102
|
+
style="width: {popupWidth}; height: {popupHeight}"
|
|
103
|
+
role="dialog"
|
|
104
|
+
aria-modal="true"
|
|
105
|
+
aria-labelledby="copilot-popup-title"
|
|
106
|
+
tabindex="-1"
|
|
107
|
+
bind:this={popupRef}
|
|
108
|
+
onkeydown={trapFocus}
|
|
109
|
+
>
|
|
110
|
+
<div class="copilotkit-popup-header">
|
|
111
|
+
<h3 id="copilot-popup-title" class="copilotkit-popup-title">Copilot</h3>
|
|
112
|
+
<button type="button" class="copilotkit-popup-close" aria-label="Close chat" onclick={close}>✕</button>
|
|
113
|
+
</div>
|
|
114
|
+
<div class="copilotkit-popup-body">
|
|
115
|
+
<CopilotChat {...chatProps} />
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<style>
|
|
122
|
+
.copilotkit-popup-wrapper {
|
|
123
|
+
position: relative;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.copilotkit-popup-overlay {
|
|
127
|
+
position: fixed;
|
|
128
|
+
inset: 0;
|
|
129
|
+
background: rgba(0, 0, 0, 0.3);
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: flex-end;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
z-index: 99;
|
|
134
|
+
padding: 16px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.copilotkit-popup-overlay.is-closed,
|
|
138
|
+
.copilotkit-popup-overlay[hidden] {
|
|
139
|
+
display: none !important;
|
|
140
|
+
visibility: hidden;
|
|
141
|
+
pointer-events: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.copilotkit-popup {
|
|
145
|
+
background: #fff;
|
|
146
|
+
border-radius: 12px;
|
|
147
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
|
|
148
|
+
display: flex;
|
|
149
|
+
flex-direction: column;
|
|
150
|
+
overflow: hidden;
|
|
151
|
+
max-height: 90vh;
|
|
152
|
+
max-width: 100vw;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.copilotkit-popup-header {
|
|
156
|
+
display: flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
justify-content: space-between;
|
|
159
|
+
padding: 16px;
|
|
160
|
+
border-bottom: 1px solid #e5e7eb;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.copilotkit-popup-title {
|
|
164
|
+
margin: 0;
|
|
165
|
+
font-size: 16px;
|
|
166
|
+
font-weight: 600;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.copilotkit-popup-close {
|
|
170
|
+
border: none;
|
|
171
|
+
background: none;
|
|
172
|
+
font-size: 18px;
|
|
173
|
+
cursor: pointer;
|
|
174
|
+
color: #6b7280;
|
|
175
|
+
padding: 4px;
|
|
176
|
+
border-radius: 4px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.copilotkit-popup-close:hover {
|
|
180
|
+
background: #f3f4f6;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.copilotkit-popup-body {
|
|
184
|
+
flex: 1;
|
|
185
|
+
overflow: hidden;
|
|
186
|
+
}
|
|
187
|
+
</style>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CopilotPopupProps } from "./types";
|
|
2
|
+
declare const CopilotPopup: import("svelte").Component<CopilotPopupProps, {}, "">;
|
|
3
|
+
type CopilotPopup = ReturnType<typeof CopilotPopup>;
|
|
4
|
+
export default CopilotPopup;
|
|
5
|
+
//# sourceMappingURL=CopilotPopup.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopilotPopup.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/chat/CopilotPopup.svelte"],"names":[],"mappings":"AAME,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAwGnD,QAAA,MAAM,YAAY,uDAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tick } from "svelte";
|
|
3
|
+
import CopilotChat from "./CopilotChat.svelte";
|
|
4
|
+
import CopilotChatToggleButton from "./CopilotChatToggleButton.svelte";
|
|
5
|
+
import type { CopilotSidebarProps } from "./types";
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
width = "400px",
|
|
9
|
+
defaultOpen = false,
|
|
10
|
+
...chatProps
|
|
11
|
+
}: CopilotSidebarProps = $props();
|
|
12
|
+
|
|
13
|
+
// svelte-ignore state_referenced_locally
|
|
14
|
+
let isOpen = $state(defaultOpen);
|
|
15
|
+
let sidebarWidth = $derived(typeof width === "number" ? `${width}px` : width);
|
|
16
|
+
let wrapperRef: HTMLElement | undefined;
|
|
17
|
+
let sidebarRef: HTMLElement | undefined;
|
|
18
|
+
|
|
19
|
+
function toggle() {
|
|
20
|
+
isOpen = !isOpen;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function close() {
|
|
24
|
+
const restoreFocus = !!sidebarRef?.contains(document.activeElement);
|
|
25
|
+
isOpen = false;
|
|
26
|
+
if (restoreFocus) {
|
|
27
|
+
void tick().then(() => {
|
|
28
|
+
wrapperRef?.querySelector<HTMLButtonElement>(".copilotkit-toggle-btn")?.focus();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function handleKeydown(e: KeyboardEvent) {
|
|
34
|
+
if (isOpen && e.key === "Escape") close();
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<svelte:window onkeydown={handleKeydown} />
|
|
39
|
+
|
|
40
|
+
<div class="copilotkit-sidebar-wrapper" bind:this={wrapperRef}>
|
|
41
|
+
<CopilotChatToggleButton isOpen={isOpen} onclick={toggle} />
|
|
42
|
+
|
|
43
|
+
<div
|
|
44
|
+
class="copilotkit-sidebar-overlay"
|
|
45
|
+
class:is-closed={!isOpen}
|
|
46
|
+
role="presentation"
|
|
47
|
+
aria-hidden={isOpen ? undefined : true}
|
|
48
|
+
inert={!isOpen}
|
|
49
|
+
hidden={!isOpen}
|
|
50
|
+
onclick={close}
|
|
51
|
+
onkeydown={(e) => e.key === "Escape" && close()}
|
|
52
|
+
></div>
|
|
53
|
+
<div
|
|
54
|
+
class="copilotkit-sidebar"
|
|
55
|
+
class:is-closed={!isOpen}
|
|
56
|
+
style="width: {sidebarWidth}"
|
|
57
|
+
aria-hidden={isOpen ? undefined : true}
|
|
58
|
+
inert={!isOpen}
|
|
59
|
+
hidden={!isOpen}
|
|
60
|
+
bind:this={sidebarRef}
|
|
61
|
+
>
|
|
62
|
+
<div class="copilotkit-sidebar-header">
|
|
63
|
+
<h3 class="copilotkit-sidebar-title">Copilot</h3>
|
|
64
|
+
<button type="button" class="copilotkit-sidebar-close" aria-label="Close chat" onclick={close}>✕</button>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="copilotkit-sidebar-body">
|
|
67
|
+
<CopilotChat {...chatProps} />
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<style>
|
|
73
|
+
.copilotkit-sidebar-wrapper {
|
|
74
|
+
position: relative;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.copilotkit-sidebar-overlay {
|
|
78
|
+
position: fixed;
|
|
79
|
+
inset: 0;
|
|
80
|
+
background: rgba(0, 0, 0, 0.3);
|
|
81
|
+
z-index: 99;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.copilotkit-sidebar-overlay.is-closed,
|
|
85
|
+
.copilotkit-sidebar-overlay[hidden],
|
|
86
|
+
.copilotkit-sidebar.is-closed,
|
|
87
|
+
.copilotkit-sidebar[hidden] {
|
|
88
|
+
display: none !important;
|
|
89
|
+
visibility: hidden;
|
|
90
|
+
pointer-events: none;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.copilotkit-sidebar {
|
|
94
|
+
position: fixed;
|
|
95
|
+
top: 0;
|
|
96
|
+
right: 0;
|
|
97
|
+
height: 100%;
|
|
98
|
+
background: #fff;
|
|
99
|
+
box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
|
|
100
|
+
z-index: 100;
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
max-width: 100vw;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.copilotkit-sidebar-header {
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: space-between;
|
|
110
|
+
padding: 16px;
|
|
111
|
+
border-bottom: 1px solid #e5e7eb;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.copilotkit-sidebar-title {
|
|
115
|
+
margin: 0;
|
|
116
|
+
font-size: 16px;
|
|
117
|
+
font-weight: 600;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.copilotkit-sidebar-close {
|
|
121
|
+
border: none;
|
|
122
|
+
background: none;
|
|
123
|
+
font-size: 20px;
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
color: #6b7280;
|
|
126
|
+
padding: 4px;
|
|
127
|
+
border-radius: 4px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.copilotkit-sidebar-close:hover {
|
|
131
|
+
background: #f3f4f6;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.copilotkit-sidebar-body {
|
|
135
|
+
flex: 1;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
}
|
|
138
|
+
</style>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CopilotSidebarProps } from "./types";
|
|
2
|
+
declare const CopilotSidebar: import("svelte").Component<CopilotSidebarProps, {}, "">;
|
|
3
|
+
type CopilotSidebar = ReturnType<typeof CopilotSidebar>;
|
|
4
|
+
export default CopilotSidebar;
|
|
5
|
+
//# sourceMappingURL=CopilotSidebar.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopilotSidebar.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/chat/CopilotSidebar.svelte"],"names":[],"mappings":"AAME,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAwDrD,QAAA,MAAM,cAAc,yDAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import SvelteMarkdown from "@humanspeak/svelte-markdown";
|
|
3
|
+
import CodeBlock from "./markdown/CodeBlock.svelte";
|
|
4
|
+
import CodeSpan from "./markdown/CodeSpan.svelte";
|
|
5
|
+
import Table from "./markdown/Table.svelte";
|
|
6
|
+
import TableHead from "./markdown/TableHead.svelte";
|
|
7
|
+
import TableBody from "./markdown/TableBody.svelte";
|
|
8
|
+
import TableRow from "./markdown/TableRow.svelte";
|
|
9
|
+
import TableCell from "./markdown/TableCell.svelte";
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
content = "",
|
|
13
|
+
}: {
|
|
14
|
+
content?: string;
|
|
15
|
+
} = $props();
|
|
16
|
+
|
|
17
|
+
// Renderers emit the same `data-streamdown` attributes as the React package so
|
|
18
|
+
// the shared stylesheet in `globals.css` styles both implementations alike.
|
|
19
|
+
const renderers = {
|
|
20
|
+
code: CodeBlock,
|
|
21
|
+
codespan: CodeSpan,
|
|
22
|
+
table: Table,
|
|
23
|
+
tablehead: TableHead,
|
|
24
|
+
tablebody: TableBody,
|
|
25
|
+
tablerow: TableRow,
|
|
26
|
+
tablecell: TableCell,
|
|
27
|
+
};
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<SvelteMarkdown source={content} streaming={true} {renderers} />
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
content?: string;
|
|
3
|
+
};
|
|
4
|
+
declare const StreamMarkdown: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
5
|
+
type StreamMarkdown = ReturnType<typeof StreamMarkdown>;
|
|
6
|
+
export default StreamMarkdown;
|
|
7
|
+
//# sourceMappingURL=StreamMarkdown.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StreamMarkdown.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/chat/StreamMarkdown.svelte"],"names":[],"mappings":"AAYC,KAAK,gBAAgB,GAAI;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAwBJ,QAAA,MAAM,cAAc,sDAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class ChatConfig {
|
|
2
|
+
agentId: string;
|
|
3
|
+
threadId: string | undefined;
|
|
4
|
+
hasExplicitThreadId: boolean;
|
|
5
|
+
labels: Record<string, string>;
|
|
6
|
+
constructor(agentId: string, threadId?: string, hasExplicitThreadId?: boolean);
|
|
7
|
+
}
|
|
8
|
+
export declare function setChatConfig(config: ChatConfig): void;
|
|
9
|
+
export declare function getChatConfig(): ChatConfig | undefined;
|
|
10
|
+
//# sourceMappingURL=chat-config-context.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-config-context.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/chat/chat-config-context.svelte.ts"],"names":[],"mappings":"AAGA,qBAAa,UAAU;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAG7B,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,EACjB,mBAAmB,CAAC,EAAE,OAAO;CAOhC;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAEtD;AAED,wBAAgB,aAAa,IAAI,UAAU,GAAG,SAAS,CAEtD"}
|