@copilotkit/react-ui 1.8.0-next.6 → 1.8.0-next.7
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 +10 -0
- package/dist/{chunk-FBYETUFL.mjs → chunk-5M7ODWKH.mjs} +6 -12
- package/dist/chunk-5M7ODWKH.mjs.map +1 -0
- package/dist/{chunk-DFHFPZQD.mjs → chunk-EMWOZVCW.mjs} +9 -16
- package/dist/chunk-EMWOZVCW.mjs.map +1 -0
- package/dist/{chunk-Z6YOBQUJ.mjs → chunk-HGA4N4ME.mjs} +8 -13
- package/dist/chunk-HGA4N4ME.mjs.map +1 -0
- package/dist/{chunk-CGVOCLHN.mjs → chunk-P7S3E5UW.mjs} +2 -2
- package/dist/{chunk-6H7IQRIU.mjs → chunk-QTN7AYVL.mjs} +2 -2
- package/dist/{chunk-LYHZXHTJ.mjs → chunk-SNLHKLW3.mjs} +2 -2
- package/dist/{chunk-5JY5QJ2W.mjs → chunk-UN2E3HCK.mjs} +9 -3
- package/dist/chunk-UN2E3HCK.mjs.map +1 -0
- package/dist/{chunk-FFNESJSG.mjs → chunk-Y6OESC5U.mjs} +2 -2
- package/dist/{chunk-QS7UFQFD.mjs → chunk-YGD4IB27.mjs} +2 -2
- package/dist/{chunk-VC4NO5QZ.mjs → chunk-YOEL33HG.mjs} +2 -2
- package/dist/{chunk-GJME6MK4.mjs → chunk-ZY25LVYR.mjs} +2 -2
- package/dist/components/chat/Button.js.map +1 -1
- package/dist/components/chat/Button.mjs +2 -2
- package/dist/components/chat/Chat.d.ts +2 -11
- package/dist/components/chat/Chat.js +67 -76
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +6 -7
- package/dist/components/chat/ChatContext.d.ts +15 -0
- package/dist/components/chat/ChatContext.js +67 -1
- package/dist/components/chat/ChatContext.js.map +1 -1
- package/dist/components/chat/ChatContext.mjs +1 -1
- package/dist/components/chat/Header.js.map +1 -1
- package/dist/components/chat/Header.mjs +2 -2
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +2 -2
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +2 -2
- package/dist/components/chat/Modal.d.ts +1 -1
- package/dist/components/chat/Modal.js +74 -87
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +10 -11
- package/dist/components/chat/Popup.js +76 -89
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +11 -12
- package/dist/components/chat/Sidebar.js +76 -89
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +11 -12
- package/dist/components/chat/Window.js.map +1 -1
- package/dist/components/chat/Window.mjs +2 -2
- package/dist/components/chat/index.d.ts +1 -1
- package/dist/components/chat/index.js +78 -91
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +14 -15
- package/dist/components/chat/messages/AssistantMessage.js +4 -67
- package/dist/components/chat/messages/AssistantMessage.js.map +1 -1
- package/dist/components/chat/messages/AssistantMessage.mjs +2 -2
- package/dist/components/chat/props.d.ts +1 -5
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +78 -91
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +14 -15
- package/dist/index.css +0 -26
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +78 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -16
- package/package.json +4 -4
- package/src/components/chat/Chat.tsx +0 -16
- package/src/components/chat/ChatContext.tsx +25 -0
- package/src/components/chat/Modal.tsx +0 -6
- package/src/components/chat/messages/AssistantMessage.tsx +4 -5
- package/src/components/chat/props.ts +0 -5
- package/src/styles.css +0 -1
- package/dist/chunk-5JY5QJ2W.mjs.map +0 -1
- package/dist/chunk-DFHFPZQD.mjs.map +0 -1
- package/dist/chunk-FBYETUFL.mjs.map +0 -1
- package/dist/chunk-UZTZXMYS.mjs +0 -18
- package/dist/chunk-UZTZXMYS.mjs.map +0 -1
- package/dist/chunk-Z6YOBQUJ.mjs.map +0 -1
- package/dist/components/chat/Response.d.ts +0 -7
- package/dist/components/chat/Response.js +0 -64
- package/dist/components/chat/Response.js.map +0 -1
- package/dist/components/chat/Response.mjs +0 -10
- package/dist/components/chat/Response.mjs.map +0 -1
- package/src/components/chat/Response.tsx +0 -12
- package/src/css/response.css +0 -26
- /package/dist/{chunk-CGVOCLHN.mjs.map → chunk-P7S3E5UW.mjs.map} +0 -0
- /package/dist/{chunk-6H7IQRIU.mjs.map → chunk-QTN7AYVL.mjs.map} +0 -0
- /package/dist/{chunk-LYHZXHTJ.mjs.map → chunk-SNLHKLW3.mjs.map} +0 -0
- /package/dist/{chunk-FFNESJSG.mjs.map → chunk-Y6OESC5U.mjs.map} +0 -0
- /package/dist/{chunk-QS7UFQFD.mjs.map → chunk-YGD4IB27.mjs.map} +0 -0
- /package/dist/{chunk-VC4NO5QZ.mjs.map → chunk-YOEL33HG.mjs.map} +0 -0
- /package/dist/{chunk-GJME6MK4.mjs.map → chunk-ZY25LVYR.mjs.map} +0 -0
|
@@ -361,7 +361,10 @@ var ChatContextProvider = ({
|
|
|
361
361
|
spinnerIcon: SpinnerIcon,
|
|
362
362
|
stopIcon: StopIcon,
|
|
363
363
|
regenerateIcon: RegenerateIcon,
|
|
364
|
-
pushToTalkIcon: MicrophoneIcon
|
|
364
|
+
pushToTalkIcon: MicrophoneIcon,
|
|
365
|
+
copyIcon: CopyIcon,
|
|
366
|
+
thumbsUpIcon: ThumbsUpIcon,
|
|
367
|
+
thumbsDownIcon: ThumbsDownIcon
|
|
365
368
|
}), icons),
|
|
366
369
|
[icons]
|
|
367
370
|
);
|
|
@@ -805,18 +808,8 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop }) => {
|
|
|
805
808
|
] }) });
|
|
806
809
|
};
|
|
807
810
|
|
|
808
|
-
// src/components/chat/Response.tsx
|
|
809
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
810
|
-
var ResponseButton = ({ onClick, inProgress }) => {
|
|
811
|
-
const context = useChatContext();
|
|
812
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { onClick, className: "copilotKitResponseButton", children: [
|
|
813
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: inProgress ? context.icons.stopIcon : context.icons.regenerateIcon }),
|
|
814
|
-
inProgress ? context.labels.stopGenerating : context.labels.regenerateResponse
|
|
815
|
-
] });
|
|
816
|
-
};
|
|
817
|
-
|
|
818
811
|
// src/components/chat/messages/RenderTextMessage.tsx
|
|
819
|
-
var
|
|
812
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
820
813
|
function RenderTextMessage(props) {
|
|
821
814
|
const {
|
|
822
815
|
message,
|
|
@@ -832,7 +825,7 @@ function RenderTextMessage(props) {
|
|
|
832
825
|
} = props;
|
|
833
826
|
if (message.isTextMessage()) {
|
|
834
827
|
if (message.role === "user") {
|
|
835
|
-
return /* @__PURE__ */ (0,
|
|
828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
836
829
|
UserMessage2,
|
|
837
830
|
{
|
|
838
831
|
"data-message-role": "user",
|
|
@@ -842,7 +835,7 @@ function RenderTextMessage(props) {
|
|
|
842
835
|
index
|
|
843
836
|
);
|
|
844
837
|
} else if (message.role == "assistant") {
|
|
845
|
-
return /* @__PURE__ */ (0,
|
|
838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
846
839
|
AssistantMessage2,
|
|
847
840
|
{
|
|
848
841
|
"data-message-role": "assistant",
|
|
@@ -865,7 +858,7 @@ function RenderTextMessage(props) {
|
|
|
865
858
|
// src/components/chat/messages/RenderActionExecutionMessage.tsx
|
|
866
859
|
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
867
860
|
var import_react_core4 = require("@copilotkit/react-core");
|
|
868
|
-
var
|
|
861
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
869
862
|
function RenderActionExecutionMessage(props) {
|
|
870
863
|
const { chatComponentsCache } = (0, import_react_core4.useCopilotContext)();
|
|
871
864
|
const { message, inProgress, index, isCurrentMessage, actionResult, AssistantMessage: AssistantMessage2 } = props;
|
|
@@ -874,7 +867,7 @@ function RenderActionExecutionMessage(props) {
|
|
|
874
867
|
const render = chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"];
|
|
875
868
|
if (typeof render === "string") {
|
|
876
869
|
if (isCurrentMessage && inProgress) {
|
|
877
|
-
return /* @__PURE__ */ (0,
|
|
870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
878
871
|
AssistantMessage2,
|
|
879
872
|
{
|
|
880
873
|
rawData: message,
|
|
@@ -907,7 +900,7 @@ function RenderActionExecutionMessage(props) {
|
|
|
907
900
|
return null;
|
|
908
901
|
}
|
|
909
902
|
if (typeof toRender === "string") {
|
|
910
|
-
return /* @__PURE__ */ (0,
|
|
903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
911
904
|
AssistantMessage2,
|
|
912
905
|
{
|
|
913
906
|
rawData: message,
|
|
@@ -919,7 +912,7 @@ function RenderActionExecutionMessage(props) {
|
|
|
919
912
|
index
|
|
920
913
|
);
|
|
921
914
|
} else {
|
|
922
|
-
return /* @__PURE__ */ (0,
|
|
915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
923
916
|
AssistantMessage2,
|
|
924
917
|
{
|
|
925
918
|
rawData: message,
|
|
@@ -933,20 +926,20 @@ function RenderActionExecutionMessage(props) {
|
|
|
933
926
|
}
|
|
934
927
|
} catch (e) {
|
|
935
928
|
console.error(`Error executing render function for action ${message.name}: ${e}`);
|
|
936
|
-
return /* @__PURE__ */ (0,
|
|
929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
937
930
|
AssistantMessage2,
|
|
938
931
|
{
|
|
939
932
|
rawData: message,
|
|
940
933
|
"data-message-role": "assistant",
|
|
941
934
|
isLoading: false,
|
|
942
935
|
isGenerating: false,
|
|
943
|
-
subComponent: /* @__PURE__ */ (0,
|
|
944
|
-
/* @__PURE__ */ (0,
|
|
936
|
+
subComponent: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("b", { children: [
|
|
945
938
|
"\u274C Error executing render function for action ",
|
|
946
939
|
message.name,
|
|
947
940
|
":"
|
|
948
941
|
] }),
|
|
949
|
-
/* @__PURE__ */ (0,
|
|
942
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("pre", { children: e instanceof Error ? e.message : String(e) })
|
|
950
943
|
] })
|
|
951
944
|
},
|
|
952
945
|
index
|
|
@@ -956,7 +949,7 @@ function RenderActionExecutionMessage(props) {
|
|
|
956
949
|
} else if (!inProgress || !isCurrentMessage) {
|
|
957
950
|
return null;
|
|
958
951
|
} else {
|
|
959
|
-
return /* @__PURE__ */ (0,
|
|
952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
960
953
|
AssistantMessage2,
|
|
961
954
|
{
|
|
962
955
|
rawData: message,
|
|
@@ -971,11 +964,11 @@ function RenderActionExecutionMessage(props) {
|
|
|
971
964
|
}
|
|
972
965
|
|
|
973
966
|
// src/components/chat/messages/RenderResultMessage.tsx
|
|
974
|
-
var
|
|
967
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
975
968
|
function RenderResultMessage(props) {
|
|
976
969
|
const { message, inProgress, index, isCurrentMessage, AssistantMessage: AssistantMessage2 } = props;
|
|
977
970
|
if (message.isResultMessage() && inProgress && isCurrentMessage) {
|
|
978
|
-
return /* @__PURE__ */ (0,
|
|
971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
979
972
|
AssistantMessage2,
|
|
980
973
|
{
|
|
981
974
|
"data-message-role": "assistant",
|
|
@@ -992,7 +985,7 @@ function RenderResultMessage(props) {
|
|
|
992
985
|
|
|
993
986
|
// src/components/chat/messages/RenderAgentStateMessage.tsx
|
|
994
987
|
var import_react_core5 = require("@copilotkit/react-core");
|
|
995
|
-
var
|
|
988
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
996
989
|
function RenderAgentStateMessage(props) {
|
|
997
990
|
const { chatComponentsCache } = (0, import_react_core5.useCopilotContext)();
|
|
998
991
|
const { message, inProgress, index, isCurrentMessage, AssistantMessage: AssistantMessage2 } = props;
|
|
@@ -1004,7 +997,7 @@ function RenderAgentStateMessage(props) {
|
|
|
1004
997
|
if (render) {
|
|
1005
998
|
if (typeof render === "string") {
|
|
1006
999
|
if (isCurrentMessage && inProgress) {
|
|
1007
|
-
return /* @__PURE__ */ (0,
|
|
1000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1008
1001
|
AssistantMessage2,
|
|
1009
1002
|
{
|
|
1010
1003
|
rawData: message,
|
|
@@ -1030,7 +1023,7 @@ function RenderAgentStateMessage(props) {
|
|
|
1030
1023
|
return null;
|
|
1031
1024
|
}
|
|
1032
1025
|
if (!toRender && isCurrentMessage && inProgress) {
|
|
1033
|
-
return /* @__PURE__ */ (0,
|
|
1026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1034
1027
|
AssistantMessage2,
|
|
1035
1028
|
{
|
|
1036
1029
|
"data-message-role": "assistant",
|
|
@@ -1044,7 +1037,7 @@ function RenderAgentStateMessage(props) {
|
|
|
1044
1037
|
return null;
|
|
1045
1038
|
}
|
|
1046
1039
|
if (typeof toRender === "string") {
|
|
1047
|
-
return /* @__PURE__ */ (0,
|
|
1040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1048
1041
|
AssistantMessage2,
|
|
1049
1042
|
{
|
|
1050
1043
|
rawData: message,
|
|
@@ -1056,7 +1049,7 @@ function RenderAgentStateMessage(props) {
|
|
|
1056
1049
|
index
|
|
1057
1050
|
);
|
|
1058
1051
|
} else {
|
|
1059
|
-
return /* @__PURE__ */ (0,
|
|
1052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1060
1053
|
AssistantMessage2,
|
|
1061
1054
|
{
|
|
1062
1055
|
rawData: message,
|
|
@@ -1072,7 +1065,7 @@ function RenderAgentStateMessage(props) {
|
|
|
1072
1065
|
} else if (!inProgress || !isCurrentMessage) {
|
|
1073
1066
|
return null;
|
|
1074
1067
|
} else {
|
|
1075
|
-
return /* @__PURE__ */ (0,
|
|
1068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1076
1069
|
AssistantMessage2,
|
|
1077
1070
|
{
|
|
1078
1071
|
rawData: message,
|
|
@@ -1117,7 +1110,7 @@ function useCopyToClipboard({ timeout = 2e3 }) {
|
|
|
1117
1110
|
}
|
|
1118
1111
|
|
|
1119
1112
|
// src/components/chat/CodeBlock.tsx
|
|
1120
|
-
var
|
|
1113
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1121
1114
|
var programmingLanguages = {
|
|
1122
1115
|
javascript: ".js",
|
|
1123
1116
|
python: ".py",
|
|
@@ -1180,15 +1173,15 @@ var CodeBlock = (0, import_react6.memo)(({ language, value }) => {
|
|
|
1180
1173
|
return;
|
|
1181
1174
|
copyToClipboard(value);
|
|
1182
1175
|
};
|
|
1183
|
-
return /* @__PURE__ */ (0,
|
|
1184
|
-
/* @__PURE__ */ (0,
|
|
1185
|
-
/* @__PURE__ */ (0,
|
|
1186
|
-
/* @__PURE__ */ (0,
|
|
1187
|
-
/* @__PURE__ */ (0,
|
|
1188
|
-
/* @__PURE__ */ (0,
|
|
1176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "copilotKitCodeBlock", children: [
|
|
1177
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "copilotKitCodeBlockToolbar", children: [
|
|
1178
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "copilotKitCodeBlockToolbarLanguage", children: language }),
|
|
1179
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "copilotKitCodeBlockToolbarButtons", children: [
|
|
1180
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: downloadAsFile, children: DownloadIcon }),
|
|
1181
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { className: "copilotKitCodeBlockToolbarButton", onClick: onCopy, children: isCopied ? CheckIcon : CopyIcon })
|
|
1189
1182
|
] })
|
|
1190
1183
|
] }),
|
|
1191
|
-
/* @__PURE__ */ (0,
|
|
1184
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1192
1185
|
import_react_syntax_highlighter.Prism,
|
|
1193
1186
|
{
|
|
1194
1187
|
language,
|
|
@@ -1491,18 +1484,18 @@ var highlightStyle = {
|
|
|
1491
1484
|
// src/components/chat/Markdown.tsx
|
|
1492
1485
|
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
1493
1486
|
var import_remark_math = __toESM(require("remark-math"));
|
|
1494
|
-
var
|
|
1487
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1495
1488
|
var MemoizedReactMarkdown = (0, import_react7.memo)(
|
|
1496
1489
|
import_react_markdown.default,
|
|
1497
1490
|
(prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
|
|
1498
1491
|
);
|
|
1499
1492
|
var Markdown = ({ content }) => {
|
|
1500
|
-
return /* @__PURE__ */ (0,
|
|
1493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "copilotKitMarkdown", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MemoizedReactMarkdown, { components, remarkPlugins: [import_remark_gfm.default, import_remark_math.default], children: content }) });
|
|
1501
1494
|
};
|
|
1502
1495
|
var components = {
|
|
1503
1496
|
a(_a) {
|
|
1504
1497
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
1505
|
-
return /* @__PURE__ */ (0,
|
|
1498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1506
1499
|
"a",
|
|
1507
1500
|
__spreadProps(__spreadValues({
|
|
1508
1501
|
style: { color: "blue", textDecoration: "underline" }
|
|
@@ -1517,7 +1510,7 @@ var components = {
|
|
|
1517
1510
|
var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
|
|
1518
1511
|
if (children.length) {
|
|
1519
1512
|
if (children[0] == "\u258D") {
|
|
1520
|
-
return /* @__PURE__ */ (0,
|
|
1513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1521
1514
|
"span",
|
|
1522
1515
|
{
|
|
1523
1516
|
style: {
|
|
@@ -1532,9 +1525,9 @@ var components = {
|
|
|
1532
1525
|
}
|
|
1533
1526
|
const match = /language-(\w+)/.exec(className || "");
|
|
1534
1527
|
if (inline) {
|
|
1535
|
-
return /* @__PURE__ */ (0,
|
|
1528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("code", __spreadProps(__spreadValues({ className }, props), { children }));
|
|
1536
1529
|
}
|
|
1537
|
-
return /* @__PURE__ */ (0,
|
|
1530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1538
1531
|
CodeBlock,
|
|
1539
1532
|
__spreadValues({
|
|
1540
1533
|
language: match && match[1] || "",
|
|
@@ -1547,7 +1540,7 @@ var components = {
|
|
|
1547
1540
|
|
|
1548
1541
|
// src/components/chat/messages/AssistantMessage.tsx
|
|
1549
1542
|
var import_react8 = require("react");
|
|
1550
|
-
var
|
|
1543
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1551
1544
|
var AssistantMessage = (props) => {
|
|
1552
1545
|
const { icons, labels } = useChatContext();
|
|
1553
1546
|
const {
|
|
@@ -1588,77 +1581,77 @@ var AssistantMessage = (props) => {
|
|
|
1588
1581
|
onThumbsDown(message);
|
|
1589
1582
|
}
|
|
1590
1583
|
};
|
|
1591
|
-
const LoadingIcon = () => /* @__PURE__ */ (0,
|
|
1592
|
-
return /* @__PURE__ */ (0,
|
|
1593
|
-
(message || isLoading) && /* @__PURE__ */ (0,
|
|
1594
|
-
message && /* @__PURE__ */ (0,
|
|
1595
|
-
isLoading && /* @__PURE__ */ (0,
|
|
1596
|
-
message && !isLoading && /* @__PURE__ */ (0,
|
|
1584
|
+
const LoadingIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: icons.activityIcon });
|
|
1585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1586
|
+
(message || isLoading) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "copilotKitMessage copilotKitAssistantMessage", children: [
|
|
1587
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Markdown, { content: message || "" }),
|
|
1588
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LoadingIcon, {}),
|
|
1589
|
+
message && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1597
1590
|
"div",
|
|
1598
1591
|
{
|
|
1599
1592
|
className: `copilotKitMessageControls ${isCurrentMessage ? "currentMessage" : ""}`,
|
|
1600
1593
|
children: [
|
|
1601
|
-
/* @__PURE__ */ (0,
|
|
1594
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1602
1595
|
"button",
|
|
1603
1596
|
{
|
|
1604
1597
|
className: "copilotKitMessageControlButton",
|
|
1605
1598
|
onClick: handleRegenerate,
|
|
1606
1599
|
"aria-label": labels.regenerateResponse,
|
|
1607
1600
|
title: labels.regenerateResponse,
|
|
1608
|
-
children:
|
|
1601
|
+
children: icons.regenerateIcon
|
|
1609
1602
|
}
|
|
1610
1603
|
),
|
|
1611
|
-
/* @__PURE__ */ (0,
|
|
1604
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1612
1605
|
"button",
|
|
1613
1606
|
{
|
|
1614
1607
|
className: "copilotKitMessageControlButton",
|
|
1615
1608
|
onClick: handleCopy,
|
|
1616
1609
|
"aria-label": labels.copyToClipboard,
|
|
1617
1610
|
title: labels.copyToClipboard,
|
|
1618
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
1611
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: "10px", fontWeight: "bold" }, children: "\u2713" }) : icons.copyIcon
|
|
1619
1612
|
}
|
|
1620
1613
|
),
|
|
1621
|
-
onThumbsUp && /* @__PURE__ */ (0,
|
|
1614
|
+
onThumbsUp && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1622
1615
|
"button",
|
|
1623
1616
|
{
|
|
1624
1617
|
className: "copilotKitMessageControlButton",
|
|
1625
1618
|
onClick: handleThumbsUp,
|
|
1626
1619
|
"aria-label": labels.thumbsUp,
|
|
1627
1620
|
title: labels.thumbsUp,
|
|
1628
|
-
children:
|
|
1621
|
+
children: icons.thumbsUpIcon
|
|
1629
1622
|
}
|
|
1630
1623
|
),
|
|
1631
|
-
onThumbsDown && /* @__PURE__ */ (0,
|
|
1624
|
+
onThumbsDown && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1632
1625
|
"button",
|
|
1633
1626
|
{
|
|
1634
1627
|
className: "copilotKitMessageControlButton",
|
|
1635
1628
|
onClick: handleThumbsDown,
|
|
1636
1629
|
"aria-label": labels.thumbsDown,
|
|
1637
1630
|
title: labels.thumbsDown,
|
|
1638
|
-
children:
|
|
1631
|
+
children: icons.thumbsDownIcon
|
|
1639
1632
|
}
|
|
1640
1633
|
)
|
|
1641
1634
|
]
|
|
1642
1635
|
}
|
|
1643
1636
|
)
|
|
1644
1637
|
] }),
|
|
1645
|
-
/* @__PURE__ */ (0,
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { marginBottom: "0.5rem" }, children: subComponent })
|
|
1646
1639
|
] });
|
|
1647
1640
|
};
|
|
1648
1641
|
|
|
1649
1642
|
// src/components/chat/messages/UserMessage.tsx
|
|
1650
|
-
var
|
|
1643
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1651
1644
|
var UserMessage = (props) => {
|
|
1652
|
-
return /* @__PURE__ */ (0,
|
|
1645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: props.message });
|
|
1653
1646
|
};
|
|
1654
1647
|
|
|
1655
1648
|
// src/components/chat/Suggestion.tsx
|
|
1656
1649
|
var import_react_core6 = require("@copilotkit/react-core");
|
|
1657
1650
|
var import_shared = require("@copilotkit/shared");
|
|
1658
1651
|
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
1659
|
-
var
|
|
1652
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1660
1653
|
function Suggestion({ title, message, onClick, partial, className }) {
|
|
1661
|
-
return /* @__PURE__ */ (0,
|
|
1654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1662
1655
|
"button",
|
|
1663
1656
|
{
|
|
1664
1657
|
disabled: partial,
|
|
@@ -1668,7 +1661,7 @@ function Suggestion({ title, message, onClick, partial, className }) {
|
|
|
1668
1661
|
},
|
|
1669
1662
|
className: className || (partial ? "suggestion loading" : "suggestion"),
|
|
1670
1663
|
"data-test-id": "suggestion",
|
|
1671
|
-
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0,
|
|
1664
|
+
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: title })
|
|
1672
1665
|
}
|
|
1673
1666
|
);
|
|
1674
1667
|
}
|
|
@@ -1748,12 +1741,11 @@ var import_react_core7 = require("@copilotkit/react-core");
|
|
|
1748
1741
|
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
1749
1742
|
var import_shared2 = require("@copilotkit/shared");
|
|
1750
1743
|
var import_react_core8 = require("@copilotkit/react-core");
|
|
1751
|
-
var
|
|
1744
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1752
1745
|
function CopilotChat({
|
|
1753
1746
|
instructions,
|
|
1754
1747
|
onSubmitMessage,
|
|
1755
1748
|
makeSystemMessage,
|
|
1756
|
-
showResponseButton = true,
|
|
1757
1749
|
onInProgress,
|
|
1758
1750
|
onStopGeneration,
|
|
1759
1751
|
onReloadMessages,
|
|
@@ -1767,7 +1759,6 @@ function CopilotChat({
|
|
|
1767
1759
|
RenderAgentStateMessage: RenderAgentStateMessage2 = RenderAgentStateMessage,
|
|
1768
1760
|
RenderResultMessage: RenderResultMessage2 = RenderResultMessage,
|
|
1769
1761
|
Input: Input2 = Input,
|
|
1770
|
-
ResponseButton: ResponseButton2 = ResponseButton,
|
|
1771
1762
|
className,
|
|
1772
1763
|
icons,
|
|
1773
1764
|
labels,
|
|
@@ -1815,8 +1806,8 @@ function CopilotChat({
|
|
|
1815
1806
|
onCopy(message);
|
|
1816
1807
|
}
|
|
1817
1808
|
};
|
|
1818
|
-
return /* @__PURE__ */ (0,
|
|
1819
|
-
/* @__PURE__ */ (0,
|
|
1809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
1810
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1820
1811
|
Messages2,
|
|
1821
1812
|
{
|
|
1822
1813
|
AssistantMessage: AssistantMessage2,
|
|
@@ -1831,7 +1822,7 @@ function CopilotChat({
|
|
|
1831
1822
|
onCopy: handleCopy,
|
|
1832
1823
|
onThumbsUp,
|
|
1833
1824
|
onThumbsDown,
|
|
1834
|
-
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0,
|
|
1825
|
+
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "suggestions", children: currentSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1835
1826
|
Suggestion,
|
|
1836
1827
|
{
|
|
1837
1828
|
title: suggestion.title,
|
|
@@ -1844,7 +1835,7 @@ function CopilotChat({
|
|
|
1844
1835
|
)) })
|
|
1845
1836
|
}
|
|
1846
1837
|
),
|
|
1847
|
-
/* @__PURE__ */ (0,
|
|
1838
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1848
1839
|
Input2,
|
|
1849
1840
|
{
|
|
1850
1841
|
inProgress: isLoading,
|
|
@@ -1863,10 +1854,10 @@ function WrappedCopilotChat({
|
|
|
1863
1854
|
}) {
|
|
1864
1855
|
const chatContext = import_react9.default.useContext(ChatContext);
|
|
1865
1856
|
if (!chatContext) {
|
|
1866
|
-
return /* @__PURE__ */ (0,
|
|
1867
|
-
}, children: /* @__PURE__ */ (0,
|
|
1857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
1858
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `copilotKitChat ${className}`, children }) });
|
|
1868
1859
|
}
|
|
1869
|
-
return /* @__PURE__ */ (0,
|
|
1860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children });
|
|
1870
1861
|
}
|
|
1871
1862
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
1872
1863
|
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
|