@copilotkit/react-ui 0.22.0 → 0.36.0-mme-pre.1
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/.turbo/turbo-build.log +211 -178
- package/CHANGELOG.md +24 -0
- package/dist/chunk-4MKP23AD.mjs +97 -0
- package/dist/chunk-4MKP23AD.mjs.map +1 -0
- package/dist/{chunk-T3WYKWNC.mjs → chunk-6XLZXLM5.mjs} +6 -6
- package/dist/chunk-6XLZXLM5.mjs.map +1 -0
- package/dist/{chunk-73EBDGYK.mjs → chunk-7FES2IQA.mjs} +5 -5
- package/dist/chunk-7FES2IQA.mjs.map +1 -0
- package/dist/chunk-ANO23V2M.mjs +135 -0
- package/dist/chunk-ANO23V2M.mjs.map +1 -0
- package/dist/chunk-BL65ZC6L.mjs +83 -0
- package/dist/chunk-BL65ZC6L.mjs.map +1 -0
- package/dist/{chunk-YEHO5VMA.mjs → chunk-CE7PJAAO.mjs} +2 -2
- package/dist/{chunk-7YXG7D47.mjs → chunk-FZC7X5PK.mjs} +57 -2
- package/dist/chunk-FZC7X5PK.mjs.map +1 -0
- package/dist/chunk-LTCJCXCP.mjs +29 -0
- package/dist/chunk-LTCJCXCP.mjs.map +1 -0
- package/dist/chunk-MRFF7GSQ.mjs +1 -0
- package/dist/{chunk-7JYUCW7H.mjs → chunk-PAQWLSA4.mjs} +2 -2
- package/dist/{chunk-YTIGBBTC.mjs → chunk-RT2XG2T7.mjs} +2 -2
- package/dist/chunk-RT2XG2T7.mjs.map +1 -0
- package/dist/chunk-T26KLXLH.mjs +1 -0
- package/dist/{chunk-6U3O2JZP.mjs → chunk-T3JTSIHT.mjs} +32 -39
- package/dist/chunk-T3JTSIHT.mjs.map +1 -0
- package/dist/{chunk-MBYUBR3F.mjs → chunk-UPTB2MVO.mjs} +2 -2
- package/dist/chunk-VUZA5AFH.mjs +73 -0
- package/dist/chunk-VUZA5AFH.mjs.map +1 -0
- package/dist/{chunk-YAORLSQ3.mjs → chunk-XRODMID5.mjs} +6 -6
- package/dist/chunk-XRODMID5.mjs.map +1 -0
- package/dist/{chunk-WDHLWSSU.mjs → chunk-YQ3D5IQV.mjs} +2 -2
- package/dist/{chunk-WM6BS77F.mjs → chunk-YQFVRDNC.mjs} +2 -2
- package/dist/{chunk-WM6BS77F.mjs.map → chunk-YQFVRDNC.mjs.map} +1 -1
- package/dist/chunk-ZO3GLN23.mjs +137 -0
- package/dist/chunk-ZO3GLN23.mjs.map +1 -0
- package/dist/components/chat/Button.js.map +1 -1
- package/dist/components/chat/Button.mjs +3 -3
- package/dist/components/chat/Chat.d.ts +66 -46
- package/dist/components/chat/Chat.js +433 -278
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +15 -14
- package/dist/components/chat/ChatContext.d.ts +16 -16
- package/dist/components/chat/ChatContext.js +43 -27
- package/dist/components/chat/ChatContext.js.map +1 -1
- package/dist/components/chat/ChatContext.mjs +2 -2
- package/dist/components/chat/CodeBlock.js.map +1 -1
- package/dist/components/chat/CodeBlock.mjs +2 -2
- package/dist/components/chat/Header.js.map +1 -1
- package/dist/components/chat/Header.mjs +3 -3
- package/dist/components/chat/Icons.d.ts +7 -5
- package/dist/components/chat/Icons.js +57 -0
- package/dist/components/chat/Icons.js.map +1 -1
- package/dist/components/chat/Icons.mjs +5 -1
- package/dist/components/chat/Input.d.ts +1 -1
- package/dist/components/chat/Input.js +148 -11
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +5 -4
- package/dist/components/chat/Markdown.js.map +1 -1
- package/dist/components/chat/Markdown.mjs +3 -3
- package/dist/components/chat/Messages.d.ts +1 -1
- package/dist/components/chat/Messages.js +2 -2
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +5 -5
- package/dist/components/chat/Modal.d.ts +50 -0
- package/dist/components/chat/Modal.js +1584 -0
- package/dist/components/chat/Modal.js.map +1 -0
- package/dist/components/chat/Modal.mjs +23 -0
- package/dist/components/chat/Modal.mjs.map +1 -0
- package/dist/components/chat/Popup.d.ts +56 -4
- package/dist/components/chat/Popup.js +428 -78
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +15 -12
- package/dist/components/chat/Response.js.map +1 -1
- package/dist/components/chat/Response.mjs +3 -3
- package/dist/components/chat/Sidebar.d.ts +7 -8
- package/dist/components/chat/Sidebar.js +430 -80
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +15 -12
- package/dist/components/chat/Suggestion.d.ts +13 -0
- package/dist/components/chat/Suggestion.js +172 -0
- package/dist/components/chat/Suggestion.js.map +1 -0
- package/dist/components/chat/Suggestion.mjs +11 -0
- package/dist/components/chat/Suggestion.mjs.map +1 -0
- package/dist/components/chat/Textarea.d.ts +4 -4
- package/dist/components/chat/Textarea.js +1 -1
- package/dist/components/chat/Textarea.js.map +1 -1
- package/dist/components/chat/Textarea.mjs +1 -1
- package/dist/components/chat/index.d.ts +4 -2
- package/dist/components/chat/index.js +436 -84
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +22 -16
- package/dist/components/chat/props.d.ts +10 -3
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/index.d.ts +4 -2
- package/dist/components/index.js +436 -84
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +22 -16
- package/dist/hooks/index.d.ts +1 -2
- package/dist/hooks/index.js +36 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +8 -1
- package/dist/hooks/use-copilot-chat-suggestions.d.ts +87 -0
- package/dist/hooks/use-copilot-chat-suggestions.js +53 -0
- package/dist/hooks/use-copilot-chat-suggestions.js.map +1 -0
- package/dist/hooks/use-copilot-chat-suggestions.mjs +8 -0
- package/dist/hooks/use-copilot-chat-suggestions.mjs.map +1 -0
- package/dist/hooks/use-push-to-talk.d.ts +19 -0
- package/dist/hooks/use-push-to-talk.js +177 -0
- package/dist/hooks/use-push-to-talk.js.map +1 -0
- package/dist/hooks/use-push-to-talk.mjs +12 -0
- package/dist/hooks/use-push-to-talk.mjs.map +1 -0
- package/dist/index.css +101 -13
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +465 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -19
- package/dist/types/suggestions.d.ts +8 -0
- package/dist/types/suggestions.js +19 -0
- package/dist/types/suggestions.js.map +1 -0
- package/dist/types/suggestions.mjs +1 -0
- package/dist/types/suggestions.mjs.map +1 -0
- package/package.json +6 -6
- package/src/components/chat/Button.tsx +1 -2
- package/src/components/chat/Chat.tsx +163 -104
- package/src/components/chat/ChatContext.tsx +36 -38
- package/src/components/chat/Icons.tsx +44 -0
- package/src/components/chat/Input.tsx +38 -7
- package/src/components/chat/Messages.tsx +3 -3
- package/src/components/chat/Modal.tsx +115 -0
- package/src/components/chat/Popup.tsx +53 -7
- package/src/components/chat/Sidebar.tsx +62 -9
- package/src/components/chat/Suggestion.tsx +109 -0
- package/src/components/chat/Textarea.tsx +1 -1
- package/src/components/chat/index.tsx +1 -0
- package/src/components/chat/props.ts +10 -2
- package/src/css/input.css +18 -8
- package/src/css/messages.css +7 -1
- package/src/css/panel.css +38 -0
- package/src/css/response.css +1 -4
- package/src/css/suggestions.css +35 -0
- package/src/css/window.css +3 -1
- package/src/hooks/index.ts +1 -1
- package/src/hooks/use-copilot-chat-suggestions.tsx +117 -0
- package/src/hooks/use-push-to-talk.tsx +162 -0
- package/src/styles.css +2 -0
- package/src/types/suggestions.ts +6 -0
- package/typedoc.json +4 -0
- package/dist/chunk-6U3O2JZP.mjs.map +0 -1
- package/dist/chunk-73EBDGYK.mjs.map +0 -1
- package/dist/chunk-7LMXXGJT.mjs +0 -75
- package/dist/chunk-7LMXXGJT.mjs.map +0 -1
- package/dist/chunk-7YXG7D47.mjs.map +0 -1
- package/dist/chunk-H4VKQGVU.mjs +0 -1
- package/dist/chunk-KE3N45ZY.mjs +0 -63
- package/dist/chunk-KE3N45ZY.mjs.map +0 -1
- package/dist/chunk-T3WYKWNC.mjs.map +0 -1
- package/dist/chunk-UGQQ4WEQ.mjs +0 -1
- package/dist/chunk-YAORLSQ3.mjs.map +0 -1
- package/dist/chunk-YTIGBBTC.mjs.map +0 -1
- /package/dist/{chunk-YEHO5VMA.mjs.map → chunk-CE7PJAAO.mjs.map} +0 -0
- /package/dist/{chunk-H4VKQGVU.mjs.map → chunk-MRFF7GSQ.mjs.map} +0 -0
- /package/dist/{chunk-7JYUCW7H.mjs.map → chunk-PAQWLSA4.mjs.map} +0 -0
- /package/dist/{chunk-UGQQ4WEQ.mjs.map → chunk-T26KLXLH.mjs.map} +0 -0
- /package/dist/{chunk-MBYUBR3F.mjs.map → chunk-UPTB2MVO.mjs.map} +0 -0
- /package/dist/{chunk-WDHLWSSU.mjs.map → chunk-YQ3D5IQV.mjs.map} +0 -0
|
@@ -1,8 +1,55 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { CopilotChatIcons, CopilotChatLabels } from './ChatContext.js';
|
|
2
|
+
import React__default from 'react';
|
|
3
3
|
import { SystemMessageFunction } from '@copilotkit/react-core';
|
|
4
|
-
import {
|
|
5
|
-
import '@copilotkit/shared';
|
|
4
|
+
import { CopilotChatSuggestion } from '../../types/suggestions.js';
|
|
5
|
+
import { Message } from '@copilotkit/shared';
|
|
6
|
+
import { MessagesProps, InputProps, ResponseButtonProps } from './props.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* An embeddable chat panel for CopilotKit.
|
|
10
|
+
*
|
|
11
|
+
* <img src="/images/CopilotChat/CopilotChat.gif" width="500" />
|
|
12
|
+
*
|
|
13
|
+
* A chatbot panel component for the CopilotKit framework. The component allows for a high degree
|
|
14
|
+
* of customization through various props and custom CSS.
|
|
15
|
+
*
|
|
16
|
+
* <RequestExample>
|
|
17
|
+
* ```jsx CopilotChat Example
|
|
18
|
+
* import { CopilotChat } from "@copilotkit/react-ui";
|
|
19
|
+
*
|
|
20
|
+
* <CopilotChat
|
|
21
|
+
* labels={{
|
|
22
|
+
* title: "Your Assistant",
|
|
23
|
+
* initial: "Hi! 👋 How can I assist you today?",
|
|
24
|
+
* }}
|
|
25
|
+
* />
|
|
26
|
+
* ```
|
|
27
|
+
* </RequestExample>
|
|
28
|
+
*
|
|
29
|
+
* ## Custom CSS
|
|
30
|
+
*
|
|
31
|
+
* You can customize the colors of the panel by overriding the CSS variables
|
|
32
|
+
* defined in the [default styles](https://github.com/CopilotKit/CopilotKit/blob/main/CopilotKit/packages/react-ui/src/css/colors.css).
|
|
33
|
+
*
|
|
34
|
+
* For example, to set the primary color to purple:
|
|
35
|
+
*
|
|
36
|
+
* ```jsx
|
|
37
|
+
* <div style={{ "--copilot-kit-primary-color": "#7D5BA6" }}>
|
|
38
|
+
* <CopilotPopup />
|
|
39
|
+
* </div>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* To further customize the panel, you can override the CSS classes defined
|
|
43
|
+
* [here](https://github.com/CopilotKit/CopilotKit/blob/main/CopilotKit/packages/react-ui/src/css/).
|
|
44
|
+
*
|
|
45
|
+
* For example:
|
|
46
|
+
*
|
|
47
|
+
* ```css
|
|
48
|
+
* .copilotKitButton {
|
|
49
|
+
* border-radius: 0;
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
6
53
|
|
|
7
54
|
/**
|
|
8
55
|
* Props for CopilotChat component.
|
|
@@ -17,25 +64,6 @@ interface CopilotChatProps {
|
|
|
17
64
|
* user's needs or the application's requirements.
|
|
18
65
|
*/
|
|
19
66
|
instructions?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Whether the chat window should be open by default.
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
defaultOpen?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* If the chat window should close when the user clicks outside of it.
|
|
27
|
-
* @default true
|
|
28
|
-
*/
|
|
29
|
-
clickOutsideToClose?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* If the chat window should close when the user hits the Escape key.
|
|
32
|
-
* @default true
|
|
33
|
-
*/
|
|
34
|
-
hitEscapeToClose?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* A callback that gets called when the chat window opens or closes.
|
|
37
|
-
*/
|
|
38
|
-
onSetOpen?: (open: boolean) => void;
|
|
39
67
|
/**
|
|
40
68
|
* A callback that gets called when the in progress state changes.
|
|
41
69
|
*/
|
|
@@ -44,12 +72,6 @@ interface CopilotChatProps {
|
|
|
44
72
|
* A callback that gets called when a new message it submitted.
|
|
45
73
|
*/
|
|
46
74
|
onSubmitMessage?: (message: string) => void;
|
|
47
|
-
/**
|
|
48
|
-
* The shortcut key to open the chat window.
|
|
49
|
-
* Uses Command-<shortcut> on a Mac and Ctrl-<shortcut> on Windows.
|
|
50
|
-
* @default "e"
|
|
51
|
-
*/
|
|
52
|
-
shortcut?: string;
|
|
53
75
|
/**
|
|
54
76
|
* Icons can be used to set custom icons for the chat window.
|
|
55
77
|
*/
|
|
@@ -70,30 +92,18 @@ interface CopilotChatProps {
|
|
|
70
92
|
* @default true
|
|
71
93
|
*/
|
|
72
94
|
showResponseButton?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* A custom Window component to use instead of the default.
|
|
75
|
-
*/
|
|
76
|
-
Window?: React.ComponentType<WindowProps>;
|
|
77
|
-
/**
|
|
78
|
-
* A custom Button component to use instead of the default.
|
|
79
|
-
*/
|
|
80
|
-
Button?: React.ComponentType<ButtonProps>;
|
|
81
|
-
/**
|
|
82
|
-
* A custom Header component to use instead of the default.
|
|
83
|
-
*/
|
|
84
|
-
Header?: React.ComponentType<HeaderProps>;
|
|
85
95
|
/**
|
|
86
96
|
* A custom Messages component to use instead of the default.
|
|
87
97
|
*/
|
|
88
|
-
Messages?:
|
|
98
|
+
Messages?: React__default.ComponentType<MessagesProps>;
|
|
89
99
|
/**
|
|
90
100
|
* A custom Input component to use instead of the default.
|
|
91
101
|
*/
|
|
92
|
-
Input?:
|
|
102
|
+
Input?: React__default.ComponentType<InputProps>;
|
|
93
103
|
/**
|
|
94
104
|
* A custom ResponseButton component to use instead of the default.
|
|
95
105
|
*/
|
|
96
|
-
ResponseButton?:
|
|
106
|
+
ResponseButton?: React__default.ComponentType<ResponseButtonProps>;
|
|
97
107
|
/**
|
|
98
108
|
* A class name to apply to the root element.
|
|
99
109
|
*/
|
|
@@ -101,8 +111,18 @@ interface CopilotChatProps {
|
|
|
101
111
|
/**
|
|
102
112
|
* Children to render.
|
|
103
113
|
*/
|
|
104
|
-
children?:
|
|
114
|
+
children?: React__default.ReactNode;
|
|
105
115
|
}
|
|
106
|
-
declare
|
|
116
|
+
declare function CopilotChat({ instructions, onSubmitMessage, icons, labels, makeSystemMessage, showResponseButton, onInProgress, Messages, Input, ResponseButton, className, }: CopilotChatProps): JSX.Element;
|
|
117
|
+
declare const useCopilotChatLogic: (instructions?: string, makeSystemMessage?: SystemMessageFunction, onInProgress?: ((isLoading: boolean) => void) | undefined, onSubmitMessage?: ((messageContent: string) => void) | undefined) => {
|
|
118
|
+
visibleMessages: Message[];
|
|
119
|
+
isLoading: boolean;
|
|
120
|
+
currentSuggestions: CopilotChatSuggestion[];
|
|
121
|
+
sendMessage: (messageContent: string) => Promise<Message>;
|
|
122
|
+
stop: () => void;
|
|
123
|
+
reload: () => Promise<void>;
|
|
124
|
+
input: string;
|
|
125
|
+
setInput: React__default.Dispatch<React__default.SetStateAction<string>>;
|
|
126
|
+
};
|
|
107
127
|
|
|
108
|
-
export { CopilotChat, CopilotChatProps };
|
|
128
|
+
export { CopilotChat, CopilotChatProps, useCopilotChatLogic };
|