@copilotkit/react-ui 1.8.13-next.2 → 1.8.13-next.3
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 +9 -0
- package/dist/{chunk-3R6CEFJE.mjs → chunk-FWKHST6I.mjs} +67 -33
- package/dist/chunk-FWKHST6I.mjs.map +1 -0
- package/dist/{chunk-ZRW27A32.mjs → chunk-IAHSHPRJ.mjs} +12 -13
- package/dist/chunk-IAHSHPRJ.mjs.map +1 -0
- package/dist/{chunk-XZNY26GH.mjs → chunk-IMBPSLL4.mjs} +3 -3
- package/dist/chunk-IMBPSLL4.mjs.map +1 -0
- package/dist/{chunk-756IINQI.mjs → chunk-JU3HNL5N.mjs} +2 -2
- package/dist/{chunk-IQ7DDXDA.mjs → chunk-QEZ3YYLO.mjs} +2 -2
- package/dist/chunk-QGSPTXOV.mjs +24 -0
- package/dist/chunk-QGSPTXOV.mjs.map +1 -0
- package/dist/chunk-SC6JRFAJ.mjs +1 -0
- package/dist/components/chat/Button.d.ts +1 -0
- package/dist/components/chat/Chat.d.ts +6 -2
- package/dist/components/chat/Chat.js +39 -24
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +3 -2
- package/dist/components/chat/Header.d.ts +1 -0
- package/dist/components/chat/Input.d.ts +1 -0
- package/dist/components/chat/Messages.d.ts +1 -0
- package/dist/components/chat/Modal.d.ts +2 -2
- package/dist/components/chat/Modal.js +106 -62
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +4 -3
- package/dist/components/chat/Popup.d.ts +1 -1
- package/dist/components/chat/Popup.js +108 -64
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +5 -4
- package/dist/components/chat/Sidebar.d.ts +1 -1
- package/dist/components/chat/Sidebar.js +108 -64
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +5 -4
- package/dist/components/chat/Suggestion.d.ts +8 -4
- package/dist/components/chat/Suggestion.js +2 -2
- package/dist/components/chat/Suggestion.js.map +1 -1
- package/dist/components/chat/Suggestion.mjs +1 -1
- package/dist/components/chat/Suggestions.d.ts +9 -0
- package/dist/components/chat/Suggestions.js +73 -0
- package/dist/components/chat/Suggestions.js.map +1 -0
- package/dist/components/chat/Suggestions.mjs +10 -0
- package/dist/components/chat/Suggestions.mjs.map +1 -0
- package/dist/components/chat/Window.d.ts +1 -0
- package/dist/components/chat/index.d.ts +4 -2
- package/dist/components/chat/index.js +114 -66
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +14 -7
- package/dist/components/chat/messages/AssistantMessage.d.ts +1 -0
- package/dist/components/chat/messages/RenderActionExecutionMessage.d.ts +1 -0
- package/dist/components/chat/messages/RenderAgentStateMessage.d.ts +1 -0
- package/dist/components/chat/messages/RenderImageMessage.d.ts +1 -0
- package/dist/components/chat/messages/RenderResultMessage.d.ts +1 -0
- package/dist/components/chat/messages/RenderTextMessage.d.ts +1 -0
- package/dist/components/chat/messages/UserMessage.d.ts +1 -0
- package/dist/components/chat/props.d.ts +6 -1
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/index.d.ts +4 -2
- package/dist/components/index.js +114 -66
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +14 -7
- package/dist/index.d.ts +4 -2
- package/dist/index.js +114 -66
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -7
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +6 -6
- package/src/components/chat/Chat.tsx +12 -14
- package/src/components/chat/Modal.tsx +2 -0
- package/src/components/chat/Suggestion.tsx +10 -3
- package/src/components/chat/Suggestions.tsx +20 -0
- package/src/components/chat/index.tsx +2 -0
- package/src/components/chat/props.ts +6 -0
- package/src/types/index.ts +1 -0
- package/dist/chunk-3R6CEFJE.mjs.map +0 -1
- package/dist/chunk-PXEVB7IK.mjs +0 -1
- package/dist/chunk-XZNY26GH.mjs.map +0 -1
- package/dist/chunk-ZRW27A32.mjs.map +0 -1
- /package/dist/{chunk-756IINQI.mjs.map → chunk-JU3HNL5N.mjs.map} +0 -0
- /package/dist/{chunk-IQ7DDXDA.mjs.map → chunk-QEZ3YYLO.mjs.map} +0 -0
- /package/dist/{chunk-PXEVB7IK.mjs.map → chunk-SC6JRFAJ.mjs.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-FWKHST6I.mjs";
|
|
4
4
|
import "../../chunk-TIDV74OE.mjs";
|
|
5
5
|
import "../../chunk-UH2UFL5W.mjs";
|
|
6
6
|
import "../../chunk-V7W6IM2V.mjs";
|
|
@@ -11,7 +11,7 @@ import "../../chunk-KXE2JCUH.mjs";
|
|
|
11
11
|
import "../../chunk-NRA3CFEE.mjs";
|
|
12
12
|
import "../../chunk-BH6PCAAL.mjs";
|
|
13
13
|
import "../../chunk-UFN2VWSR.mjs";
|
|
14
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-IAHSHPRJ.mjs";
|
|
15
15
|
import "../../chunk-MPZAMNCN.mjs";
|
|
16
16
|
import "../../chunk-ALWZ35SI.mjs";
|
|
17
17
|
import "../../chunk-UKWBNVMQ.mjs";
|
|
@@ -19,7 +19,8 @@ import "../../chunk-6VUDBDUN.mjs";
|
|
|
19
19
|
import "../../chunk-5INP2EWU.mjs";
|
|
20
20
|
import "../../chunk-XMNTLIK5.mjs";
|
|
21
21
|
import "../../chunk-HWMFMBJC.mjs";
|
|
22
|
-
import "../../chunk-
|
|
22
|
+
import "../../chunk-QGSPTXOV.mjs";
|
|
23
|
+
import "../../chunk-IMBPSLL4.mjs";
|
|
23
24
|
import "../../chunk-PLHTVHUW.mjs";
|
|
24
25
|
import "../../chunk-EMIYIMQ6.mjs";
|
|
25
26
|
import "../../chunk-CGEAG65D.mjs";
|
|
@@ -3,10 +3,10 @@ import { CopilotModalProps } from './Modal.js';
|
|
|
3
3
|
import 'react';
|
|
4
4
|
import './props.js';
|
|
5
5
|
import '@copilotkit/runtime-client-gql';
|
|
6
|
+
import '../../types/suggestions.js';
|
|
6
7
|
import './Chat.js';
|
|
7
8
|
import './ChatContext.js';
|
|
8
9
|
import '@copilotkit/react-core';
|
|
9
|
-
import '../../types/suggestions.js';
|
|
10
10
|
|
|
11
11
|
declare function CopilotPopup(props: CopilotModalProps): react_jsx_runtime.JSX.Element;
|
|
12
12
|
|
|
@@ -2486,19 +2486,23 @@ function RenderImageMessage(_a) {
|
|
|
2486
2486
|
return null;
|
|
2487
2487
|
}
|
|
2488
2488
|
|
|
2489
|
+
// src/components/chat/Chat.tsx
|
|
2490
|
+
var import_react13 = __toESM(require("react"));
|
|
2491
|
+
var import_react_core10 = require("@copilotkit/react-core");
|
|
2492
|
+
|
|
2489
2493
|
// src/components/chat/Suggestion.tsx
|
|
2490
2494
|
var import_react_core9 = require("@copilotkit/react-core");
|
|
2491
2495
|
var import_shared2 = require("@copilotkit/shared");
|
|
2492
2496
|
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
2493
2497
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2494
|
-
function Suggestion({ title,
|
|
2498
|
+
function Suggestion({ title, onClick, partial, className }) {
|
|
2495
2499
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2496
2500
|
"button",
|
|
2497
2501
|
{
|
|
2498
2502
|
disabled: partial,
|
|
2499
2503
|
onClick: (e) => {
|
|
2500
2504
|
e.preventDefault();
|
|
2501
|
-
onClick(
|
|
2505
|
+
onClick();
|
|
2502
2506
|
},
|
|
2503
2507
|
className: className || (partial ? "suggestion loading" : "suggestion"),
|
|
2504
2508
|
"data-test-id": "suggestion",
|
|
@@ -2577,8 +2581,6 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
2577
2581
|
});
|
|
2578
2582
|
|
|
2579
2583
|
// src/components/chat/Chat.tsx
|
|
2580
|
-
var import_react13 = __toESM(require("react"));
|
|
2581
|
-
var import_react_core10 = require("@copilotkit/react-core");
|
|
2582
2584
|
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
2583
2585
|
var import_shared3 = require("@copilotkit/shared");
|
|
2584
2586
|
var import_react_core11 = require("@copilotkit/react-core");
|
|
@@ -2661,8 +2663,24 @@ var ImageUploadQueue = ({
|
|
|
2661
2663
|
);
|
|
2662
2664
|
};
|
|
2663
2665
|
|
|
2664
|
-
// src/components/chat/
|
|
2666
|
+
// src/components/chat/Suggestions.tsx
|
|
2665
2667
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2668
|
+
function Suggestions({ suggestions, onSuggestionClick }) {
|
|
2669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "suggestions", children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2670
|
+
Suggestion,
|
|
2671
|
+
{
|
|
2672
|
+
title: suggestion.title,
|
|
2673
|
+
message: suggestion.message,
|
|
2674
|
+
partial: suggestion.partial,
|
|
2675
|
+
className: suggestion.className,
|
|
2676
|
+
onClick: () => onSuggestionClick(suggestion.message)
|
|
2677
|
+
},
|
|
2678
|
+
index
|
|
2679
|
+
)) });
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
// src/components/chat/Chat.tsx
|
|
2683
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2666
2684
|
function CopilotChat({
|
|
2667
2685
|
instructions,
|
|
2668
2686
|
onSubmitMessage,
|
|
@@ -2681,6 +2699,7 @@ function CopilotChat({
|
|
|
2681
2699
|
RenderAgentStateMessage: RenderAgentStateMessage2 = RenderAgentStateMessage,
|
|
2682
2700
|
RenderResultMessage: RenderResultMessage2 = RenderResultMessage,
|
|
2683
2701
|
RenderImageMessage: RenderImageMessage2 = RenderImageMessage,
|
|
2702
|
+
RenderSuggestionsList = Suggestions,
|
|
2684
2703
|
Input: Input2 = Input,
|
|
2685
2704
|
className,
|
|
2686
2705
|
icons,
|
|
@@ -2820,8 +2839,8 @@ function CopilotChat({
|
|
|
2820
2839
|
const removeSelectedImage = (index) => {
|
|
2821
2840
|
setSelectedImages((prev) => prev.filter((_, i) => i !== index));
|
|
2822
2841
|
};
|
|
2823
|
-
return /* @__PURE__ */ (0,
|
|
2824
|
-
/* @__PURE__ */ (0,
|
|
2842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(WrappedCopilotChat, { icons, labels, className, children: [
|
|
2843
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2825
2844
|
Messages2,
|
|
2826
2845
|
{
|
|
2827
2846
|
AssistantMessage: AssistantMessage2,
|
|
@@ -2838,22 +2857,18 @@ function CopilotChat({
|
|
|
2838
2857
|
onThumbsUp,
|
|
2839
2858
|
onThumbsDown,
|
|
2840
2859
|
markdownTagRenderers,
|
|
2841
|
-
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0,
|
|
2842
|
-
|
|
2860
|
+
children: currentSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2861
|
+
RenderSuggestionsList,
|
|
2843
2862
|
{
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
onClick: (message) => handleSendMessage(message)
|
|
2849
|
-
},
|
|
2850
|
-
index
|
|
2851
|
-
)) })
|
|
2863
|
+
onSuggestionClick: handleSendMessage,
|
|
2864
|
+
suggestions: currentSuggestions
|
|
2865
|
+
}
|
|
2866
|
+
)
|
|
2852
2867
|
}
|
|
2853
2868
|
),
|
|
2854
|
-
imageUploadsEnabled && /* @__PURE__ */ (0,
|
|
2855
|
-
/* @__PURE__ */ (0,
|
|
2856
|
-
/* @__PURE__ */ (0,
|
|
2869
|
+
imageUploadsEnabled && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
2870
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageUploadQueue, { images: selectedImages, onRemoveImage: removeSelectedImage }),
|
|
2871
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2857
2872
|
"input",
|
|
2858
2873
|
{
|
|
2859
2874
|
type: "file",
|
|
@@ -2865,7 +2880,7 @@ function CopilotChat({
|
|
|
2865
2880
|
}
|
|
2866
2881
|
)
|
|
2867
2882
|
] }),
|
|
2868
|
-
/* @__PURE__ */ (0,
|
|
2883
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2869
2884
|
Input2,
|
|
2870
2885
|
{
|
|
2871
2886
|
inProgress: isLoading,
|
|
@@ -2888,10 +2903,10 @@ function WrappedCopilotChat({
|
|
|
2888
2903
|
}) {
|
|
2889
2904
|
const chatContext = import_react13.default.useContext(ChatContext);
|
|
2890
2905
|
if (!chatContext) {
|
|
2891
|
-
return /* @__PURE__ */ (0,
|
|
2892
|
-
}, children: /* @__PURE__ */ (0,
|
|
2906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
2907
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
|
|
2893
2908
|
}
|
|
2894
|
-
return /* @__PURE__ */ (0,
|
|
2909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children });
|
|
2895
2910
|
}
|
|
2896
2911
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
2897
2912
|
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
|
|
@@ -3076,56 +3091,85 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
3076
3091
|
};
|
|
3077
3092
|
|
|
3078
3093
|
// src/components/chat/Modal.tsx
|
|
3079
|
-
var
|
|
3080
|
-
var CopilotModal = ({
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3094
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3095
|
+
var CopilotModal = (_a) => {
|
|
3096
|
+
var _b = _a, {
|
|
3097
|
+
instructions,
|
|
3098
|
+
defaultOpen = false,
|
|
3099
|
+
clickOutsideToClose = true,
|
|
3100
|
+
hitEscapeToClose = true,
|
|
3101
|
+
onSetOpen,
|
|
3102
|
+
onSubmitMessage,
|
|
3103
|
+
onStopGeneration,
|
|
3104
|
+
onReloadMessages,
|
|
3105
|
+
shortcut = "/",
|
|
3106
|
+
icons,
|
|
3107
|
+
labels,
|
|
3108
|
+
makeSystemMessage,
|
|
3109
|
+
onInProgress,
|
|
3110
|
+
Window: Window2 = Window,
|
|
3111
|
+
Button: Button2 = Button,
|
|
3112
|
+
Header: Header2 = Header,
|
|
3113
|
+
Messages: Messages2 = Messages,
|
|
3114
|
+
Input: Input2 = Input,
|
|
3115
|
+
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
3116
|
+
UserMessage: UserMessage2 = UserMessage,
|
|
3117
|
+
onThumbsUp,
|
|
3118
|
+
onThumbsDown,
|
|
3119
|
+
onCopy,
|
|
3120
|
+
onRegenerate,
|
|
3121
|
+
markdownTagRenderers,
|
|
3122
|
+
className,
|
|
3123
|
+
children
|
|
3124
|
+
} = _b, props = __objRest(_b, [
|
|
3125
|
+
"instructions",
|
|
3126
|
+
"defaultOpen",
|
|
3127
|
+
"clickOutsideToClose",
|
|
3128
|
+
"hitEscapeToClose",
|
|
3129
|
+
"onSetOpen",
|
|
3130
|
+
"onSubmitMessage",
|
|
3131
|
+
"onStopGeneration",
|
|
3132
|
+
"onReloadMessages",
|
|
3133
|
+
"shortcut",
|
|
3134
|
+
"icons",
|
|
3135
|
+
"labels",
|
|
3136
|
+
"makeSystemMessage",
|
|
3137
|
+
"onInProgress",
|
|
3138
|
+
"Window",
|
|
3139
|
+
"Button",
|
|
3140
|
+
"Header",
|
|
3141
|
+
"Messages",
|
|
3142
|
+
"Input",
|
|
3143
|
+
"AssistantMessage",
|
|
3144
|
+
"UserMessage",
|
|
3145
|
+
"onThumbsUp",
|
|
3146
|
+
"onThumbsDown",
|
|
3147
|
+
"onCopy",
|
|
3148
|
+
"onRegenerate",
|
|
3149
|
+
"markdownTagRenderers",
|
|
3150
|
+
"className",
|
|
3151
|
+
"children"
|
|
3152
|
+
]);
|
|
3109
3153
|
const [openState, setOpenState] = import_react14.default.useState(defaultOpen);
|
|
3110
3154
|
const setOpen = (open) => {
|
|
3111
3155
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
3112
3156
|
setOpenState(open);
|
|
3113
3157
|
};
|
|
3114
|
-
return /* @__PURE__ */ (0,
|
|
3158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
3115
3159
|
children,
|
|
3116
|
-
/* @__PURE__ */ (0,
|
|
3117
|
-
/* @__PURE__ */ (0,
|
|
3118
|
-
/* @__PURE__ */ (0,
|
|
3160
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className, children: [
|
|
3161
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button2, {}),
|
|
3162
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3119
3163
|
Window2,
|
|
3120
3164
|
{
|
|
3121
3165
|
clickOutsideToClose,
|
|
3122
3166
|
shortcut,
|
|
3123
3167
|
hitEscapeToClose,
|
|
3124
3168
|
children: [
|
|
3125
|
-
/* @__PURE__ */ (0,
|
|
3126
|
-
/* @__PURE__ */ (0,
|
|
3169
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Header2, {}),
|
|
3170
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3127
3171
|
CopilotChat,
|
|
3128
|
-
{
|
|
3172
|
+
__spreadProps(__spreadValues({}, props), {
|
|
3129
3173
|
instructions,
|
|
3130
3174
|
onSubmitMessage,
|
|
3131
3175
|
onStopGeneration,
|
|
@@ -3141,7 +3185,7 @@ var CopilotModal = ({
|
|
|
3141
3185
|
onCopy,
|
|
3142
3186
|
onRegenerate,
|
|
3143
3187
|
markdownTagRenderers
|
|
3144
|
-
}
|
|
3188
|
+
})
|
|
3145
3189
|
)
|
|
3146
3190
|
]
|
|
3147
3191
|
}
|
|
@@ -3151,12 +3195,12 @@ var CopilotModal = ({
|
|
|
3151
3195
|
};
|
|
3152
3196
|
|
|
3153
3197
|
// src/components/chat/Popup.tsx
|
|
3154
|
-
var
|
|
3198
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3155
3199
|
function CopilotPopup(props) {
|
|
3156
3200
|
props = __spreadProps(__spreadValues({}, props), {
|
|
3157
3201
|
className: props.className ? props.className + " copilotKitPopup" : "copilotKitPopup"
|
|
3158
3202
|
});
|
|
3159
|
-
return /* @__PURE__ */ (0,
|
|
3203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CopilotModal, __spreadProps(__spreadValues({}, props), { children: props.children }));
|
|
3160
3204
|
}
|
|
3161
3205
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3162
3206
|
0 && (module.exports = {
|