@copilotkit/react-ui 1.7.2-next.2 → 1.8.0-next.4
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/CHANGELOG.md +21 -0
- package/dist/{chunk-CBBFRI3Q.mjs → chunk-5JY5QJ2W.mjs} +9 -5
- package/dist/chunk-5JY5QJ2W.mjs.map +1 -0
- package/dist/{chunk-OFYI4UU4.mjs → chunk-7RIBDD4K.mjs} +19 -3
- package/dist/chunk-7RIBDD4K.mjs.map +1 -0
- package/dist/{chunk-AELKLZSG.mjs → chunk-AIR3MXUU.mjs} +12 -12
- package/dist/{chunk-YAGE7RCE.mjs → chunk-CGVOCLHN.mjs} +2 -2
- package/dist/{chunk-DLG7BZTA.mjs → chunk-CZUP2N4J.mjs} +2 -2
- package/dist/chunk-FBYETUFL.mjs +118 -0
- package/dist/chunk-FBYETUFL.mjs.map +1 -0
- package/dist/chunk-GIPO7UB2.mjs +24 -0
- package/dist/chunk-GIPO7UB2.mjs.map +1 -0
- package/dist/{chunk-6FTRYYR5.mjs → chunk-GJME6MK4.mjs} +72 -62
- package/dist/chunk-GJME6MK4.mjs.map +1 -0
- package/dist/{chunk-QXQDIFOC.mjs → chunk-H24B7QWO.mjs} +49 -38
- package/dist/chunk-H24B7QWO.mjs.map +1 -0
- package/dist/{chunk-QXTRFMPM.mjs → chunk-LYHZXHTJ.mjs} +15 -12
- package/dist/chunk-LYHZXHTJ.mjs.map +1 -0
- package/dist/chunk-ORSMX3SE.mjs +244 -0
- package/dist/chunk-ORSMX3SE.mjs.map +1 -0
- package/dist/{chunk-UPTB2MVO.mjs → chunk-PCTCOQK2.mjs} +4 -10
- package/dist/chunk-PCTCOQK2.mjs.map +1 -0
- package/dist/{chunk-ZIF5JJCH.mjs → chunk-QQ4FBIGN.mjs} +30 -59
- package/dist/chunk-QQ4FBIGN.mjs.map +1 -0
- package/dist/{chunk-R2O33F44.mjs → chunk-TFIQA2P5.mjs} +2 -2
- package/dist/{chunk-WGAZXTUA.mjs → chunk-TOQ7P4DO.mjs} +6 -9
- package/dist/chunk-TOQ7P4DO.mjs.map +1 -0
- package/dist/{chunk-3XAXY2Z3.mjs → chunk-UZTZXMYS.mjs} +2 -2
- package/dist/{chunk-RQNJNK2W.mjs → chunk-VC4NO5QZ.mjs} +2 -2
- package/dist/{chunk-YQ3D5IQV.mjs → chunk-XNQO5AZZ.mjs} +2 -5
- package/dist/chunk-XNQO5AZZ.mjs.map +1 -0
- package/dist/chunk-YC4NBUGE.mjs +97 -0
- package/dist/chunk-YC4NBUGE.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 +17 -1
- package/dist/components/chat/Chat.js +380 -906
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +11 -18
- package/dist/components/chat/ChatContext.d.ts +20 -0
- package/dist/components/chat/ChatContext.js +44 -74
- package/dist/components/chat/ChatContext.js.map +1 -1
- package/dist/components/chat/ChatContext.mjs +2 -2
- package/dist/components/chat/CodeBlock.js +58 -82
- package/dist/components/chat/CodeBlock.js.map +1 -1
- package/dist/components/chat/CodeBlock.mjs +2 -2
- package/dist/components/chat/Header.js +516 -4
- package/dist/components/chat/Header.js.map +1 -1
- package/dist/components/chat/Header.mjs +10 -3
- package/dist/components/chat/Icons.d.ts +10 -9
- package/dist/components/chat/Icons.js +125 -164
- package/dist/components/chat/Icons.js.map +1 -1
- package/dist/components/chat/Icons.mjs +9 -5
- package/dist/components/chat/Input.d.ts +1 -1
- package/dist/components/chat/Input.js +13 -10
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +3 -3
- package/dist/components/chat/Markdown.js +58 -56
- 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 +70 -60
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +3 -3
- package/dist/components/chat/Modal.js +1709 -1749
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +20 -20
- package/dist/components/chat/Popup.js +1709 -1749
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +21 -21
- package/dist/components/chat/Response.js.map +1 -1
- package/dist/components/chat/Response.mjs +3 -3
- package/dist/components/chat/Sidebar.js +1711 -1751
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +21 -21
- package/dist/components/chat/Suggestion.js +4 -40
- package/dist/components/chat/Suggestion.js.map +1 -1
- package/dist/components/chat/Suggestion.mjs +2 -2
- package/dist/components/chat/Window.js.map +1 -1
- package/dist/components/chat/Window.mjs +3 -3
- package/dist/components/chat/index.js +1711 -1751
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +24 -24
- package/dist/components/chat/messages/AssistantMessage.js +211 -59
- package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
- package/dist/components/chat/messages/AssistantMessage.mjs +5 -5
- package/dist/components/chat/messages/RenderTextMessage.js +18 -2
- package/dist/components/chat/messages/RenderTextMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderTextMessage.mjs +1 -1
- package/dist/components/chat/props.d.ts +53 -0
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/crew/index.mjs +1 -1
- package/dist/components/dev-console/console.js +51 -233
- package/dist/components/dev-console/console.js.map +1 -1
- package/dist/components/dev-console/console.mjs +5 -5
- package/dist/components/dev-console/index.js +51 -233
- package/dist/components/dev-console/index.js.map +1 -1
- package/dist/components/dev-console/index.mjs +5 -5
- package/dist/components/help-modal/index.js +29 -147
- package/dist/components/help-modal/index.js.map +1 -1
- package/dist/components/help-modal/index.mjs +1 -1
- package/dist/components/help-modal/modal.js +29 -147
- package/dist/components/help-modal/modal.js.map +1 -1
- package/dist/components/help-modal/modal.mjs +1 -1
- package/dist/components/index.js +1685 -1725
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +30 -30
- package/dist/index.css +266 -98
- package/dist/index.css.map +1 -1
- package/dist/index.js +1694 -1734
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -30
- package/dist/types/css.d.ts +6 -5
- package/dist/types/css.js.map +1 -1
- package/package.json +4 -4
- package/src/components/chat/Chat.tsx +59 -22
- package/src/components/chat/ChatContext.tsx +29 -1
- package/src/components/chat/CodeBlock.tsx +2 -4
- package/src/components/chat/Header.tsx +8 -3
- package/src/components/chat/Icons.tsx +108 -108
- package/src/components/chat/Input.tsx +47 -38
- package/src/components/chat/Markdown.tsx +0 -3
- package/src/components/chat/Messages.tsx +68 -56
- package/src/components/chat/Suggestion.tsx +2 -3
- package/src/components/chat/messages/AssistantMessage.tsx +95 -3
- package/src/components/chat/messages/RenderTextMessage.tsx +17 -1
- package/src/components/chat/props.ts +66 -0
- package/src/components/dev-console/console.tsx +16 -54
- package/src/components/help-modal/modal.tsx +38 -101
- package/src/css/button.css +15 -4
- package/src/css/colors.css +56 -10
- package/src/css/console.css +46 -39
- package/src/css/header.css +23 -6
- package/src/css/input.css +35 -19
- package/src/css/markdown.css +2 -1
- package/src/css/messages.css +126 -16
- package/src/css/panel.css +1 -0
- package/src/css/suggestions.css +14 -6
- package/src/types/css.ts +6 -5
- package/dist/chunk-3VNMQWGT.mjs +0 -25
- package/dist/chunk-3VNMQWGT.mjs.map +0 -1
- package/dist/chunk-6FTRYYR5.mjs.map +0 -1
- package/dist/chunk-CBBFRI3Q.mjs.map +0 -1
- package/dist/chunk-FZC7X5PK.mjs +0 -262
- package/dist/chunk-FZC7X5PK.mjs.map +0 -1
- package/dist/chunk-OFYI4UU4.mjs.map +0 -1
- package/dist/chunk-QXQDIFOC.mjs.map +0 -1
- package/dist/chunk-QXTRFMPM.mjs.map +0 -1
- package/dist/chunk-TI7SY2RI.mjs +0 -164
- package/dist/chunk-TI7SY2RI.mjs.map +0 -1
- package/dist/chunk-UPTB2MVO.mjs.map +0 -1
- package/dist/chunk-VEC45H6Q.mjs +0 -18
- package/dist/chunk-VEC45H6Q.mjs.map +0 -1
- package/dist/chunk-WGAZXTUA.mjs.map +0 -1
- package/dist/chunk-YQ3D5IQV.mjs.map +0 -1
- package/dist/chunk-ZIF5JJCH.mjs.map +0 -1
- /package/dist/{chunk-AELKLZSG.mjs.map → chunk-AIR3MXUU.mjs.map} +0 -0
- /package/dist/{chunk-YAGE7RCE.mjs.map → chunk-CGVOCLHN.mjs.map} +0 -0
- /package/dist/{chunk-DLG7BZTA.mjs.map → chunk-CZUP2N4J.mjs.map} +0 -0
- /package/dist/{chunk-R2O33F44.mjs.map → chunk-TFIQA2P5.mjs.map} +0 -0
- /package/dist/{chunk-3XAXY2Z3.mjs.map → chunk-UZTZXMYS.mjs.map} +0 -0
- /package/dist/{chunk-RQNJNK2W.mjs.map → chunk-VC4NO5QZ.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "./chunk-EFZPSZWO.mjs";
|
|
3
3
|
import "./chunk-MWC5OV7Z.mjs";
|
|
4
|
-
import "./chunk-UCVCAGU7.mjs";
|
|
5
|
-
import "./chunk-N7LTE54T.mjs";
|
|
6
4
|
import "./chunk-SQMEPWVT.mjs";
|
|
7
5
|
import {
|
|
8
6
|
CopilotSidebar
|
|
9
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CZUP2N4J.mjs";
|
|
10
8
|
import "./chunk-WB3YULQ4.mjs";
|
|
9
|
+
import {
|
|
10
|
+
CopilotPopup
|
|
11
|
+
} from "./chunk-TFIQA2P5.mjs";
|
|
12
|
+
import "./chunk-AIR3MXUU.mjs";
|
|
13
|
+
import "./chunk-CGVOCLHN.mjs";
|
|
14
|
+
import "./chunk-GIPO7UB2.mjs";
|
|
15
|
+
import "./chunk-UCVCAGU7.mjs";
|
|
11
16
|
import {
|
|
12
17
|
DefaultResponseRenderer,
|
|
13
18
|
createResponseCache
|
|
@@ -15,50 +20,45 @@ import {
|
|
|
15
20
|
import {
|
|
16
21
|
DefaultStateRenderer
|
|
17
22
|
} from "./chunk-MCO235PS.mjs";
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
} from "./chunk-R2O33F44.mjs";
|
|
21
|
-
import "./chunk-AELKLZSG.mjs";
|
|
22
|
-
import "./chunk-YAGE7RCE.mjs";
|
|
23
|
-
import "./chunk-VEC45H6Q.mjs";
|
|
24
|
-
import "./chunk-RQNJNK2W.mjs";
|
|
23
|
+
import "./chunk-N7LTE54T.mjs";
|
|
24
|
+
import "./chunk-VC4NO5QZ.mjs";
|
|
25
25
|
import {
|
|
26
26
|
CopilotChat
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-H24B7QWO.mjs";
|
|
28
28
|
import {
|
|
29
29
|
AssistantMessage
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-FBYETUFL.mjs";
|
|
31
31
|
import "./chunk-XB6QCUPB.mjs";
|
|
32
32
|
import "./chunk-UWWMAJ7R.mjs";
|
|
33
33
|
import "./chunk-WEYDZBT7.mjs";
|
|
34
|
-
import "./chunk-
|
|
34
|
+
import "./chunk-7RIBDD4K.mjs";
|
|
35
35
|
import {
|
|
36
36
|
UserMessage
|
|
37
37
|
} from "./chunk-HEIDCT7I.mjs";
|
|
38
|
+
import "./chunk-UZTZXMYS.mjs";
|
|
39
|
+
import "./chunk-TOQ7P4DO.mjs";
|
|
40
|
+
import "./chunk-LYHZXHTJ.mjs";
|
|
41
|
+
import "./chunk-YQFVRDNC.mjs";
|
|
42
|
+
import {
|
|
43
|
+
Markdown
|
|
44
|
+
} from "./chunk-XNQO5AZZ.mjs";
|
|
45
|
+
import "./chunk-PCTCOQK2.mjs";
|
|
46
|
+
import "./chunk-GJME6MK4.mjs";
|
|
47
|
+
import {
|
|
48
|
+
useChatContext
|
|
49
|
+
} from "./chunk-5JY5QJ2W.mjs";
|
|
38
50
|
import "./chunk-V7W6IM2V.mjs";
|
|
39
51
|
import {
|
|
40
52
|
CopilotDevConsole
|
|
41
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-QQ4FBIGN.mjs";
|
|
42
54
|
import "./chunk-KXE2JCUH.mjs";
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
55
|
+
import "./chunk-YC4NBUGE.mjs";
|
|
56
|
+
import "./chunk-BH6PCAAL.mjs";
|
|
45
57
|
import {
|
|
46
58
|
shouldShowDevConsole
|
|
47
59
|
} from "./chunk-6TCUJ3B7.mjs";
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-QXTRFMPM.mjs";
|
|
51
|
-
import "./chunk-YQFVRDNC.mjs";
|
|
52
|
-
import {
|
|
53
|
-
Markdown
|
|
54
|
-
} from "./chunk-YQ3D5IQV.mjs";
|
|
55
|
-
import "./chunk-6FTRYYR5.mjs";
|
|
56
|
-
import "./chunk-3XAXY2Z3.mjs";
|
|
57
|
-
import {
|
|
58
|
-
useChatContext
|
|
59
|
-
} from "./chunk-CBBFRI3Q.mjs";
|
|
60
|
-
import "./chunk-UPTB2MVO.mjs";
|
|
61
|
-
import "./chunk-FZC7X5PK.mjs";
|
|
60
|
+
import "./chunk-ORSMX3SE.mjs";
|
|
61
|
+
import "./chunk-OTPAZXVR.mjs";
|
|
62
62
|
import "./chunk-IU3WTXLQ.mjs";
|
|
63
63
|
import "./chunk-T26KLXLH.mjs";
|
|
64
64
|
import {
|
package/dist/types/css.d.ts
CHANGED
|
@@ -3,14 +3,15 @@ import { CSSProperties } from 'react';
|
|
|
3
3
|
interface CopilotKitCSSProperties extends CSSProperties {
|
|
4
4
|
"--copilot-kit-primary-color"?: string;
|
|
5
5
|
"--copilot-kit-contrast-color"?: string;
|
|
6
|
+
"--copilot-kit-background-color"?: string;
|
|
7
|
+
"--copilot-kit-input-background-color"?: string;
|
|
6
8
|
"--copilot-kit-secondary-color"?: string;
|
|
7
9
|
"--copilot-kit-secondary-contrast-color"?: string;
|
|
8
|
-
"--copilot-kit-background-color"?: string;
|
|
9
|
-
"--copilot-kit-muted-color"?: string;
|
|
10
10
|
"--copilot-kit-separator-color"?: string;
|
|
11
|
-
"--copilot-kit-
|
|
12
|
-
"--copilot-kit-
|
|
13
|
-
"--copilot-kit-
|
|
11
|
+
"--copilot-kit-muted-color"?: string;
|
|
12
|
+
"--copilot-kit-shadow-sm"?: string;
|
|
13
|
+
"--copilot-kit-shadow-md"?: string;
|
|
14
|
+
"--copilot-kit-shadow-lg"?: string;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export { CopilotKitCSSProperties };
|
package/dist/types/css.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/css.ts"],"sourcesContent":["// autogenerated (see postcss.config.js) - do not edit\nimport { CSSProperties } from \"react\";\n\nexport interface CopilotKitCSSProperties extends CSSProperties {\n \"--copilot-kit-primary-color\"?: string;\n \"--copilot-kit-contrast-color\"?: string;\n \"--copilot-kit-secondary-color\"?: string;\n \"--copilot-kit-
|
|
1
|
+
{"version":3,"sources":["../../src/types/css.ts"],"sourcesContent":["// autogenerated (see postcss.config.js) - do not edit\nimport { CSSProperties } from \"react\";\n\nexport interface CopilotKitCSSProperties extends CSSProperties {\n \"--copilot-kit-primary-color\"?: string;\n \"--copilot-kit-contrast-color\"?: string;\n \"--copilot-kit-secondary-color\"?: string;\n \"--copilot-kit-background-color\"?: string;\n \"--copilot-kit-muted-color\"?: string;\n \"--copilot-kit-text-light-color\"?: string;\n \"--copilot-kit-text-dark-color\"?: string;\n \"--copilot-kit-separator-color\"?: string;\n \"--copilot-kit-scrollbar-color\"?: string;\n \"--copilot-kit-header-color\"?: string;\n \"--copilot-kit-response-button-color\"?: string;\n \"--copilot-kit-response-button-background-color\"?: string;\n \"--copilot-kit-shadow-sm\"?: string;\n \"--copilot-kit-shadow-md\"?: string;\n \"--copilot-kit-shadow-lg\"?: string;\n \"--copilot-kit-text-color\"?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.
|
|
12
|
+
"version": "1.8.0-next.4",
|
|
13
13
|
"sideEffects": [
|
|
14
14
|
"**/*.css"
|
|
15
15
|
],
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"react-syntax-highlighter": "^15.5.0",
|
|
51
51
|
"remark-gfm": "^3.0.1",
|
|
52
52
|
"remark-math": "^5.1.1",
|
|
53
|
-
"@copilotkit/react-core": "1.
|
|
54
|
-
"@copilotkit/runtime-client-gql": "1.
|
|
55
|
-
"@copilotkit/shared": "1.
|
|
53
|
+
"@copilotkit/react-core": "1.8.0-next.4",
|
|
54
|
+
"@copilotkit/runtime-client-gql": "1.8.0-next.4",
|
|
55
|
+
"@copilotkit/shared": "1.8.0-next.4"
|
|
56
56
|
},
|
|
57
57
|
"keywords": [
|
|
58
58
|
"copilotkit",
|
|
@@ -118,6 +118,26 @@ export interface CopilotChatProps {
|
|
|
118
118
|
*/
|
|
119
119
|
onReloadMessages?: OnReloadMessages;
|
|
120
120
|
|
|
121
|
+
/**
|
|
122
|
+
* A callback function to regenerate the assistant's response
|
|
123
|
+
*/
|
|
124
|
+
onRegenerate?: () => void;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* A callback function when the message is copied
|
|
128
|
+
*/
|
|
129
|
+
onCopy?: (message: string) => void;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* A callback function for thumbs up feedback
|
|
133
|
+
*/
|
|
134
|
+
onThumbsUp?: (message: string) => void;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* A callback function for thumbs down feedback
|
|
138
|
+
*/
|
|
139
|
+
onThumbsDown?: (message: string) => void;
|
|
140
|
+
|
|
121
141
|
/**
|
|
122
142
|
* Icons can be used to set custom icons for the chat window.
|
|
123
143
|
*/
|
|
@@ -254,6 +274,10 @@ export function CopilotChat({
|
|
|
254
274
|
onInProgress,
|
|
255
275
|
onStopGeneration,
|
|
256
276
|
onReloadMessages,
|
|
277
|
+
onRegenerate,
|
|
278
|
+
onCopy,
|
|
279
|
+
onThumbsUp,
|
|
280
|
+
onThumbsDown,
|
|
257
281
|
Messages = DefaultMessages,
|
|
258
282
|
RenderTextMessage = DefaultRenderTextMessage,
|
|
259
283
|
RenderActionExecutionMessage = DefaultRenderActionExecutionMessage,
|
|
@@ -312,9 +336,22 @@ export function CopilotChat({
|
|
|
312
336
|
const chatContext = React.useContext(ChatContext);
|
|
313
337
|
const isVisible = chatContext ? chatContext.open : true;
|
|
314
338
|
|
|
339
|
+
const handleRegenerate = () => {
|
|
340
|
+
if (onRegenerate) {
|
|
341
|
+
onRegenerate();
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
reloadMessages();
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
const handleCopy = (message: string) => {
|
|
348
|
+
if (onCopy) {
|
|
349
|
+
onCopy(message);
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
|
|
315
353
|
return (
|
|
316
354
|
<WrappedCopilotChat icons={icons} labels={labels} className={className}>
|
|
317
|
-
<CopilotDevConsole />
|
|
318
355
|
<Messages
|
|
319
356
|
AssistantMessage={AssistantMessage}
|
|
320
357
|
UserMessage={UserMessage}
|
|
@@ -324,32 +361,32 @@ export function CopilotChat({
|
|
|
324
361
|
RenderResultMessage={RenderResultMessage}
|
|
325
362
|
messages={visibleMessages}
|
|
326
363
|
inProgress={isLoading}
|
|
364
|
+
onRegenerate={handleRegenerate}
|
|
365
|
+
onCopy={handleCopy}
|
|
366
|
+
onThumbsUp={onThumbsUp}
|
|
367
|
+
onThumbsDown={onThumbsDown}
|
|
327
368
|
>
|
|
328
369
|
{currentSuggestions.length > 0 && (
|
|
329
|
-
<div>
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
/>
|
|
341
|
-
))}
|
|
342
|
-
</div>
|
|
370
|
+
<div className="suggestions">
|
|
371
|
+
{currentSuggestions.map((suggestion, index) => (
|
|
372
|
+
<Suggestion
|
|
373
|
+
key={index}
|
|
374
|
+
title={suggestion.title}
|
|
375
|
+
message={suggestion.message}
|
|
376
|
+
partial={suggestion.partial}
|
|
377
|
+
className={suggestion.className}
|
|
378
|
+
onClick={(message) => sendMessage(message)}
|
|
379
|
+
/>
|
|
380
|
+
))}
|
|
343
381
|
</div>
|
|
344
382
|
)}
|
|
345
|
-
{showResponseButton && visibleMessages.length > 0 && (
|
|
346
|
-
<ResponseButton
|
|
347
|
-
onClick={isLoading ? stopGeneration : reloadMessages}
|
|
348
|
-
inProgress={isLoading}
|
|
349
|
-
/>
|
|
350
|
-
)}
|
|
351
383
|
</Messages>
|
|
352
|
-
<Input
|
|
384
|
+
<Input
|
|
385
|
+
inProgress={isLoading}
|
|
386
|
+
onSend={sendMessage}
|
|
387
|
+
isVisible={isVisible}
|
|
388
|
+
onStop={stopGeneration}
|
|
389
|
+
/>
|
|
353
390
|
</WrappedCopilotChat>
|
|
354
391
|
);
|
|
355
392
|
}
|
|
@@ -99,6 +99,30 @@ export interface CopilotChatLabels {
|
|
|
99
99
|
* @default "Regenerate response"
|
|
100
100
|
*/
|
|
101
101
|
regenerateResponse?: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The label for the copy button.
|
|
105
|
+
* @default "Copy to clipboard"
|
|
106
|
+
*/
|
|
107
|
+
copyToClipboard?: string;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The label for the thumbs up button.
|
|
111
|
+
* @default "Thumbs up"
|
|
112
|
+
*/
|
|
113
|
+
thumbsUp?: string;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The label for the thumbs down button.
|
|
117
|
+
* @default "Thumbs down"
|
|
118
|
+
*/
|
|
119
|
+
thumbsDown?: string;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* The text to display when content is copied.
|
|
123
|
+
* @default "Copied!"
|
|
124
|
+
*/
|
|
125
|
+
copied?: string;
|
|
102
126
|
}
|
|
103
127
|
|
|
104
128
|
interface ChatContext {
|
|
@@ -150,6 +174,10 @@ export const ChatContextProvider = ({
|
|
|
150
174
|
error: "❌ An error occurred. Please try again.",
|
|
151
175
|
stopGenerating: "Stop generating",
|
|
152
176
|
regenerateResponse: "Regenerate response",
|
|
177
|
+
copyToClipboard: "Copy to clipboard",
|
|
178
|
+
thumbsUp: "Thumbs up",
|
|
179
|
+
thumbsDown: "Thumbs down",
|
|
180
|
+
copied: "Copied!",
|
|
153
181
|
},
|
|
154
182
|
...labels,
|
|
155
183
|
}),
|
|
@@ -167,7 +195,7 @@ export const ChatContextProvider = ({
|
|
|
167
195
|
spinnerIcon: DefaultIcons.SpinnerIcon,
|
|
168
196
|
stopIcon: DefaultIcons.StopIcon,
|
|
169
197
|
regenerateIcon: DefaultIcons.RegenerateIcon,
|
|
170
|
-
pushToTalkIcon: DefaultIcons.
|
|
198
|
+
pushToTalkIcon: DefaultIcons.MicrophoneIcon,
|
|
171
199
|
},
|
|
172
200
|
...icons,
|
|
173
201
|
}),
|
|
@@ -92,12 +92,10 @@ const CodeBlock: FC<Props> = memo(({ language, value }) => {
|
|
|
92
92
|
<span className="copilotKitCodeBlockToolbarLanguage">{language}</span>
|
|
93
93
|
<div className="copilotKitCodeBlockToolbarButtons">
|
|
94
94
|
<button className="copilotKitCodeBlockToolbarButton" onClick={downloadAsFile}>
|
|
95
|
-
|
|
96
|
-
<span className="sr-only">Download</span>
|
|
95
|
+
{DownloadIcon}
|
|
97
96
|
</button>
|
|
98
97
|
<button className="copilotKitCodeBlockToolbarButton" onClick={onCopy}>
|
|
99
|
-
{isCopied ?
|
|
100
|
-
<span className="sr-only">Copy code</span>
|
|
98
|
+
{isCopied ? CheckIcon : CopyIcon}
|
|
101
99
|
</button>
|
|
102
100
|
</div>
|
|
103
101
|
</div>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { HeaderProps } from "./props";
|
|
2
2
|
import { useChatContext } from "./ChatContext";
|
|
3
|
+
import { CopilotDevConsole } from "../dev-console";
|
|
4
|
+
import React from "react";
|
|
3
5
|
|
|
4
6
|
export const Header = ({}: HeaderProps) => {
|
|
5
7
|
const { setOpen, icons, labels } = useChatContext();
|
|
@@ -7,9 +9,12 @@ export const Header = ({}: HeaderProps) => {
|
|
|
7
9
|
return (
|
|
8
10
|
<div className="copilotKitHeader">
|
|
9
11
|
<div>{labels.title}</div>
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
<div className="copilotKitHeaderControls">
|
|
13
|
+
<CopilotDevConsole />
|
|
14
|
+
<button onClick={() => setOpen(false)} aria-label="Close">
|
|
15
|
+
{icons.headerCloseIcon}
|
|
16
|
+
</button>
|
|
17
|
+
</div>
|
|
13
18
|
</div>
|
|
14
19
|
);
|
|
15
20
|
};
|
|
@@ -51,7 +51,21 @@ export const SendIcon = (
|
|
|
51
51
|
xmlns="http://www.w3.org/2000/svg"
|
|
52
52
|
fill="none"
|
|
53
53
|
viewBox="0 0 24 24"
|
|
54
|
-
strokeWidth=
|
|
54
|
+
strokeWidth="1.5"
|
|
55
|
+
stroke="currentColor"
|
|
56
|
+
width="24"
|
|
57
|
+
height="24"
|
|
58
|
+
>
|
|
59
|
+
<path strokeLinecap="round" strokeLinejoin="round" d="M12 19V5m0 0l-7 7m7-7l7 7" />
|
|
60
|
+
</svg>
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
export const MicrophoneIcon = (
|
|
64
|
+
<svg
|
|
65
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
66
|
+
fill="none"
|
|
67
|
+
viewBox="0 0 24 24"
|
|
68
|
+
strokeWidth="1.5"
|
|
55
69
|
stroke="currentColor"
|
|
56
70
|
width="24"
|
|
57
71
|
height="24"
|
|
@@ -59,165 +73,151 @@ export const SendIcon = (
|
|
|
59
73
|
<path
|
|
60
74
|
strokeLinecap="round"
|
|
61
75
|
strokeLinejoin="round"
|
|
62
|
-
d="
|
|
76
|
+
d="M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"
|
|
63
77
|
/>
|
|
64
78
|
</svg>
|
|
65
79
|
);
|
|
66
80
|
|
|
67
|
-
export const
|
|
81
|
+
export const StopIcon = (
|
|
68
82
|
<svg
|
|
69
|
-
style={{
|
|
70
|
-
animation: "copilotKitSpinAnimation 1s linear infinite",
|
|
71
|
-
color: "rgb(107 114 128)",
|
|
72
|
-
}}
|
|
73
|
-
width="24"
|
|
74
|
-
height="24"
|
|
75
83
|
xmlns="http://www.w3.org/2000/svg"
|
|
76
84
|
fill="none"
|
|
77
85
|
viewBox="0 0 24 24"
|
|
86
|
+
strokeWidth="1.5"
|
|
87
|
+
stroke="currentColor"
|
|
88
|
+
width="24"
|
|
89
|
+
height="24"
|
|
78
90
|
>
|
|
79
|
-
<circle
|
|
80
|
-
style={{ opacity: 0.25 }}
|
|
81
|
-
cx="12"
|
|
82
|
-
cy="12"
|
|
83
|
-
r="10"
|
|
84
|
-
stroke="currentColor"
|
|
85
|
-
strokeWidth="4"
|
|
86
|
-
></circle>
|
|
87
91
|
<path
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
d="
|
|
91
|
-
|
|
92
|
+
strokeLinecap="round"
|
|
93
|
+
strokeLinejoin="round"
|
|
94
|
+
d="M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"
|
|
95
|
+
/>
|
|
92
96
|
</svg>
|
|
93
97
|
);
|
|
94
98
|
|
|
95
|
-
export const
|
|
99
|
+
export const RegenerateIcon = (
|
|
96
100
|
<svg
|
|
97
|
-
style={{
|
|
98
|
-
animation: "copilotKitSpinAnimation 1s linear infinite",
|
|
99
|
-
}}
|
|
100
|
-
width="13"
|
|
101
|
-
height="13"
|
|
102
101
|
xmlns="http://www.w3.org/2000/svg"
|
|
103
102
|
fill="none"
|
|
104
103
|
viewBox="0 0 24 24"
|
|
104
|
+
strokeWidth="2"
|
|
105
|
+
stroke="currentColor"
|
|
106
|
+
width="16"
|
|
107
|
+
height="16"
|
|
108
|
+
style={{ minWidth: "16px", minHeight: "16px" }}
|
|
105
109
|
>
|
|
106
|
-
<circle
|
|
107
|
-
style={{ opacity: 0.25 }}
|
|
108
|
-
cx="12"
|
|
109
|
-
cy="12"
|
|
110
|
-
r="10"
|
|
111
|
-
stroke="currentColor"
|
|
112
|
-
strokeWidth="4"
|
|
113
|
-
></circle>
|
|
114
110
|
<path
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
d="
|
|
118
|
-
|
|
111
|
+
strokeLinecap="round"
|
|
112
|
+
strokeLinejoin="round"
|
|
113
|
+
d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"
|
|
114
|
+
/>
|
|
119
115
|
</svg>
|
|
120
116
|
);
|
|
121
117
|
|
|
122
|
-
export const
|
|
118
|
+
export const CopyIcon = (
|
|
123
119
|
<svg
|
|
124
|
-
style={{
|
|
125
|
-
display: "inline-block",
|
|
126
|
-
marginLeft: "0.25rem",
|
|
127
|
-
marginRight: "0.25rem",
|
|
128
|
-
}}
|
|
129
|
-
height="24"
|
|
130
|
-
width="24"
|
|
131
|
-
viewBox="0 0 27 27"
|
|
132
120
|
xmlns="http://www.w3.org/2000/svg"
|
|
133
|
-
fill="
|
|
121
|
+
fill="none"
|
|
122
|
+
viewBox="0 0 24 24"
|
|
123
|
+
strokeWidth="2"
|
|
124
|
+
stroke="currentColor"
|
|
125
|
+
width="16"
|
|
126
|
+
height="16"
|
|
127
|
+
style={{ minWidth: "16px", minHeight: "16px" }}
|
|
134
128
|
>
|
|
135
|
-
<
|
|
136
|
-
|
|
137
|
-
|
|
129
|
+
<path
|
|
130
|
+
strokeLinecap="round"
|
|
131
|
+
strokeLinejoin="round"
|
|
132
|
+
d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75"
|
|
133
|
+
/>
|
|
138
134
|
</svg>
|
|
139
135
|
);
|
|
140
136
|
|
|
141
|
-
export
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
145
|
-
viewBox="0 0 256 256"
|
|
146
|
-
fill="currentColor"
|
|
147
|
-
style={{ height: "1rem", width: "1rem" }}
|
|
148
|
-
className={className}
|
|
149
|
-
{...props}
|
|
150
|
-
>
|
|
151
|
-
<path d="m229.66 77.66-128 128a8 8 0 0 1-11.32 0l-56-56a8 8 0 0 1 11.32-11.32L96 188.69 218.34 66.34a8 8 0 0 1 11.32 11.32Z" />
|
|
152
|
-
</svg>
|
|
153
|
-
);
|
|
154
|
-
}
|
|
137
|
+
export const SmallSpinnerIcon = (
|
|
138
|
+
<span className="copilotKitSpinner" style={{ width: "13px", height: "13px" }}></span>
|
|
139
|
+
);
|
|
155
140
|
|
|
156
|
-
export
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
160
|
-
viewBox="0 0 256 256"
|
|
161
|
-
fill="currentColor"
|
|
162
|
-
style={{ height: "1rem", width: "1rem" }}
|
|
163
|
-
className={className}
|
|
164
|
-
{...props}
|
|
165
|
-
>
|
|
166
|
-
<path d="M224 152v56a16 16 0 0 1-16 16H48a16 16 0 0 1-16-16v-56a8 8 0 0 1 16 0v56h160v-56a8 8 0 0 1 16 0Zm-101.66 5.66a8 8 0 0 0 11.32 0l40-40a8 8 0 0 0-11.32-11.32L136 132.69V40a8 8 0 0 0-16 0v92.69l-26.34-26.35a8 8 0 0 0-11.32 11.32Z" />
|
|
167
|
-
</svg>
|
|
168
|
-
);
|
|
169
|
-
}
|
|
141
|
+
export const SpinnerIcon = (
|
|
142
|
+
<span className="copilotKitSpinner" style={{ width: "24px", height: "24px" }}></span>
|
|
143
|
+
);
|
|
170
144
|
|
|
171
|
-
export
|
|
172
|
-
|
|
173
|
-
<
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
className={className}
|
|
179
|
-
{...props}
|
|
180
|
-
>
|
|
181
|
-
<path d="M216 32H88a8 8 0 0 0-8 8v40H40a8 8 0 0 0-8 8v128a8 8 0 0 0 8 8h128a8 8 0 0 0 8-8v-40h40a8 8 0 0 0 8-8V40a8 8 0 0 0-8-8Zm-56 176H48V96h112Zm48-48h-32V88a8 8 0 0 0-8-8H96V48h112Z" />
|
|
182
|
-
</svg>
|
|
183
|
-
);
|
|
184
|
-
}
|
|
145
|
+
export const ActivityIcon = (
|
|
146
|
+
<div style={{ display: "flex", alignItems: "center", gap: "4px" }}>
|
|
147
|
+
<span className="copilotKitActivityDot" style={{ animationDelay: "0s" }}></span>
|
|
148
|
+
<span className="copilotKitActivityDot" style={{ animationDelay: "0.2s" }}></span>
|
|
149
|
+
<span className="copilotKitActivityDot" style={{ animationDelay: "0.4s" }}></span>
|
|
150
|
+
</div>
|
|
151
|
+
);
|
|
185
152
|
|
|
186
|
-
export const
|
|
153
|
+
export const ThumbsUpIcon = (
|
|
187
154
|
<svg
|
|
188
155
|
xmlns="http://www.w3.org/2000/svg"
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
156
|
+
fill="none"
|
|
157
|
+
viewBox="0 0 24 24"
|
|
158
|
+
strokeWidth="2"
|
|
159
|
+
stroke="currentColor"
|
|
160
|
+
width="16"
|
|
161
|
+
height="16"
|
|
162
|
+
style={{ minWidth: "16px", minHeight: "16px" }}
|
|
192
163
|
>
|
|
193
|
-
<path
|
|
164
|
+
<path
|
|
165
|
+
strokeLinecap="round"
|
|
166
|
+
strokeLinejoin="round"
|
|
167
|
+
d="M6.633 10.5c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 012.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 00.322-1.672V3a.75.75 0 01.75-.75A2.25 2.25 0 0116.5 4.5c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 01-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 00-1.423-.23H5.904M14.25 9h2.25M5.904 18.75c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 01-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 10.203 4.167 9.75 5 9.75h1.053c.472 0 .745.556.5.96a8.958 8.958 0 00-1.302 4.665c0 1.194.232 2.333.654 3.375z"
|
|
168
|
+
/>
|
|
194
169
|
</svg>
|
|
195
170
|
);
|
|
196
171
|
|
|
197
|
-
export const
|
|
172
|
+
export const ThumbsDownIcon = (
|
|
198
173
|
<svg
|
|
199
174
|
xmlns="http://www.w3.org/2000/svg"
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
175
|
+
fill="none"
|
|
176
|
+
viewBox="0 0 24 24"
|
|
177
|
+
strokeWidth="2"
|
|
178
|
+
stroke="currentColor"
|
|
179
|
+
width="16"
|
|
180
|
+
height="16"
|
|
181
|
+
style={{ minWidth: "16px", minHeight: "16px" }}
|
|
203
182
|
>
|
|
204
|
-
<path
|
|
183
|
+
<path
|
|
184
|
+
strokeLinecap="round"
|
|
185
|
+
strokeLinejoin="round"
|
|
186
|
+
d="M7.5 15h2.25m8.024-9.75c.011.05.028.1.052.148.591 1.2.924 2.55.924 3.977a8.96 8.96 0 01-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398C20.613 14.547 19.833 15 19 15h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 00.303-.54m.023-8.25H16.48a4.5 4.5 0 01-1.423-.23l-3.114-1.04a4.5 4.5 0 00-1.423-.23H6.504c-.618 0-1.217.247-1.605.729A11.95 11.95 0 002.25 12c0 .434.023.863.068 1.285C2.427 14.306 3.346 15 4.372 15h3.126c.618 0 .991.724.725 1.282A7.471 7.471 0 007.5 19.5a2.25 2.25 0 002.25 2.25.75.75 0 00.75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 002.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384"
|
|
187
|
+
/>
|
|
205
188
|
</svg>
|
|
206
189
|
);
|
|
207
190
|
|
|
208
|
-
export const
|
|
191
|
+
export const DownloadIcon = (
|
|
209
192
|
<svg
|
|
210
193
|
xmlns="http://www.w3.org/2000/svg"
|
|
211
194
|
fill="none"
|
|
212
195
|
viewBox="0 0 24 24"
|
|
213
|
-
strokeWidth=
|
|
196
|
+
strokeWidth="2"
|
|
214
197
|
stroke="currentColor"
|
|
215
|
-
|
|
198
|
+
width="16"
|
|
199
|
+
height="16"
|
|
200
|
+
style={{ minWidth: "16px", minHeight: "16px" }}
|
|
216
201
|
>
|
|
217
202
|
<path
|
|
218
203
|
strokeLinecap="round"
|
|
219
204
|
strokeLinejoin="round"
|
|
220
|
-
d="
|
|
205
|
+
d="M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"
|
|
221
206
|
/>
|
|
222
207
|
</svg>
|
|
223
208
|
);
|
|
209
|
+
|
|
210
|
+
export const CheckIcon = (
|
|
211
|
+
<svg
|
|
212
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
213
|
+
fill="none"
|
|
214
|
+
viewBox="0 0 24 24"
|
|
215
|
+
strokeWidth="2"
|
|
216
|
+
stroke="currentColor"
|
|
217
|
+
width="16"
|
|
218
|
+
height="16"
|
|
219
|
+
style={{ minWidth: "16px", minHeight: "16px" }}
|
|
220
|
+
>
|
|
221
|
+
<path strokeLinecap="round" strokeLinejoin="round" d="M4.5 12.75l6 6 9-13.5" />
|
|
222
|
+
</svg>
|
|
223
|
+
);
|