@copilotkit/react-ui 1.9.2-next.4 → 1.9.2-next.5
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-KGKVOUC3.mjs → chunk-2TJK4TTF.mjs} +2 -2
- package/dist/{chunk-GBGU4ZR6.mjs → chunk-AHVYHPVQ.mjs} +2 -2
- package/dist/{chunk-RT4HE74K.mjs → chunk-KQEMBE47.mjs} +6 -4
- package/dist/chunk-KQEMBE47.mjs.map +1 -0
- package/dist/{chunk-XZI6DUGE.mjs → chunk-OMIVNOML.mjs} +3 -3
- package/dist/{chunk-EMIYIMQ6.mjs → chunk-X3LV7OXQ.mjs} +21 -11
- package/dist/chunk-X3LV7OXQ.mjs.map +1 -0
- package/dist/components/chat/Chat.d.ts +2 -1
- package/dist/components/chat/Chat.js +23 -11
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +2 -2
- package/dist/components/chat/Input.d.ts +1 -1
- package/dist/components/chat/Input.js +19 -9
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +1 -1
- package/dist/components/chat/Modal.js +23 -11
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +3 -3
- package/dist/components/chat/Popup.js +23 -11
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +4 -4
- package/dist/components/chat/Sidebar.js +23 -11
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +4 -4
- package/dist/components/chat/index.js +23 -11
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +5 -5
- package/dist/components/chat/props.d.ts +1 -0
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/index.js +23 -11
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +5 -5
- package/dist/index.js +23 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/package.json +4 -4
- package/src/components/chat/Chat.tsx +4 -0
- package/src/components/chat/Input.tsx +21 -11
- package/src/components/chat/props.ts +1 -0
- package/dist/chunk-EMIYIMQ6.mjs.map +0 -1
- package/dist/chunk-RT4HE74K.mjs.map +0 -1
- /package/dist/{chunk-KGKVOUC3.mjs.map → chunk-2TJK4TTF.mjs.map} +0 -0
- /package/dist/{chunk-GBGU4ZR6.mjs.map → chunk-AHVYHPVQ.mjs.map} +0 -0
- /package/dist/{chunk-XZI6DUGE.mjs.map → chunk-OMIVNOML.mjs.map} +0 -0
|
@@ -2,11 +2,11 @@ import "../../chunk-SC6JRFAJ.mjs";
|
|
|
2
2
|
import "../../chunk-WB3YULQ4.mjs";
|
|
3
3
|
import {
|
|
4
4
|
CopilotPopup
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-AHVYHPVQ.mjs";
|
|
6
6
|
import {
|
|
7
7
|
CopilotSidebar
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-2TJK4TTF.mjs";
|
|
9
|
+
import "../../chunk-OMIVNOML.mjs";
|
|
10
10
|
import "../../chunk-C3GSYRC3.mjs";
|
|
11
11
|
import "../../chunk-GVKA7RQQ.mjs";
|
|
12
12
|
import "../../chunk-V7W6IM2V.mjs";
|
|
@@ -19,7 +19,7 @@ import "../../chunk-BH6PCAAL.mjs";
|
|
|
19
19
|
import "../../chunk-UFN2VWSR.mjs";
|
|
20
20
|
import {
|
|
21
21
|
CopilotChat
|
|
22
|
-
} from "../../chunk-
|
|
22
|
+
} from "../../chunk-KQEMBE47.mjs";
|
|
23
23
|
import "../../chunk-UKCPOBQM.mjs";
|
|
24
24
|
import "../../chunk-2II3Q27P.mjs";
|
|
25
25
|
import {
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
Suggestion
|
|
41
41
|
} from "../../chunk-IMBPSLL4.mjs";
|
|
42
42
|
import "../../chunk-PLHTVHUW.mjs";
|
|
43
|
-
import "../../chunk-
|
|
43
|
+
import "../../chunk-X3LV7OXQ.mjs";
|
|
44
44
|
import "../../chunk-CGEAG65D.mjs";
|
|
45
45
|
import "../../chunk-YQFVRDNC.mjs";
|
|
46
46
|
import {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/chat/props.ts"],"sourcesContent":["import { Message, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { CopilotChatSuggestion } from \"../../types/suggestions\";\nimport { ReactNode } from \"react\";\n\nexport interface ButtonProps {}\n\nexport interface WindowProps {\n clickOutsideToClose: boolean;\n hitEscapeToClose: boolean;\n shortcut: string;\n children?: React.ReactNode;\n}\n\nexport interface HeaderProps {}\n\nexport interface SuggestionsProps {\n title: string;\n message: string;\n partial?: boolean;\n className?: string;\n onClick: (message: string) => void;\n}\n\nexport type ComponentsMap<T extends Record<string, object> = Record<string, object>> = {\n [K in keyof T]: React.FC<{ children?: ReactNode } & T[K]>;\n};\n\nexport interface MessagesProps {\n messages: Message[];\n inProgress: boolean;\n children?: React.ReactNode;\n AssistantMessage: React.ComponentType<AssistantMessageProps>;\n UserMessage: React.ComponentType<UserMessageProps>;\n RenderTextMessage: React.ComponentType<RenderMessageProps>;\n RenderActionExecutionMessage: React.ComponentType<RenderMessageProps>;\n RenderAgentStateMessage: React.ComponentType<RenderMessageProps>;\n RenderResultMessage: React.ComponentType<RenderMessageProps>;\n RenderImageMessage: React.ComponentType<RenderMessageProps>;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: (messageId: string) => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: TextMessage) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: TextMessage) => void;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n}\n\nexport interface Renderer {\n content: string;\n}\n\nexport interface UserMessageProps {\n message?: string;\n rawData: any;\n subComponent?: React.JSX.Element;\n}\n\nexport interface AssistantMessageProps {\n /**\n * The message content from the assistant\n */\n\n message?: string;\n\n /**\n * Indicates if this is the last message\n */\n isCurrentMessage?: boolean;\n\n /**\n * The raw data from the assistant's response\n */\n rawData: any;\n\n /**\n * A component that was decided to render by the LLM.\n * When working with useCopilotActions and useCoAgentStateRender, this will be\n * the render component that was specified.\n */\n subComponent?: React.JSX.Element;\n\n /**\n * Whether a response is loading, this is when the LLM is thinking of a response but hasn't finished yet.\n */\n isLoading: boolean;\n\n /**\n * Whether a response is generating, this is when the LLM is actively generating and streaming content.\n */\n isGenerating: boolean;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: () => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: TextMessage) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: TextMessage) => void;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n}\n\nexport interface RenderMessageProps {\n message: Message;\n inProgress: boolean;\n index: number;\n isCurrentMessage: boolean;\n actionResult?: string;\n AssistantMessage?: React.ComponentType<AssistantMessageProps>;\n UserMessage?: React.ComponentType<UserMessageProps>;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: (messageId: string) => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: TextMessage) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: TextMessage) => void;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n}\n\nexport interface InputProps {\n inProgress: boolean;\n onSend: (text: string) => Promise<Message>;\n isVisible?: boolean;\n onStop?: () => void;\n onUpload?: () => void;\n}\n\nexport interface RenderSuggestionsListProps {\n suggestions: CopilotChatSuggestion[];\n onSuggestionClick: (message: string) => void;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/chat/props.ts"],"sourcesContent":["import { Message, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { CopilotChatSuggestion } from \"../../types/suggestions\";\nimport { ReactNode } from \"react\";\n\nexport interface ButtonProps {}\n\nexport interface WindowProps {\n clickOutsideToClose: boolean;\n hitEscapeToClose: boolean;\n shortcut: string;\n children?: React.ReactNode;\n}\n\nexport interface HeaderProps {}\n\nexport interface SuggestionsProps {\n title: string;\n message: string;\n partial?: boolean;\n className?: string;\n onClick: (message: string) => void;\n}\n\nexport type ComponentsMap<T extends Record<string, object> = Record<string, object>> = {\n [K in keyof T]: React.FC<{ children?: ReactNode } & T[K]>;\n};\n\nexport interface MessagesProps {\n messages: Message[];\n inProgress: boolean;\n children?: React.ReactNode;\n AssistantMessage: React.ComponentType<AssistantMessageProps>;\n UserMessage: React.ComponentType<UserMessageProps>;\n RenderTextMessage: React.ComponentType<RenderMessageProps>;\n RenderActionExecutionMessage: React.ComponentType<RenderMessageProps>;\n RenderAgentStateMessage: React.ComponentType<RenderMessageProps>;\n RenderResultMessage: React.ComponentType<RenderMessageProps>;\n RenderImageMessage: React.ComponentType<RenderMessageProps>;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: (messageId: string) => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: TextMessage) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: TextMessage) => void;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n}\n\nexport interface Renderer {\n content: string;\n}\n\nexport interface UserMessageProps {\n message?: string;\n rawData: any;\n subComponent?: React.JSX.Element;\n}\n\nexport interface AssistantMessageProps {\n /**\n * The message content from the assistant\n */\n\n message?: string;\n\n /**\n * Indicates if this is the last message\n */\n isCurrentMessage?: boolean;\n\n /**\n * The raw data from the assistant's response\n */\n rawData: any;\n\n /**\n * A component that was decided to render by the LLM.\n * When working with useCopilotActions and useCoAgentStateRender, this will be\n * the render component that was specified.\n */\n subComponent?: React.JSX.Element;\n\n /**\n * Whether a response is loading, this is when the LLM is thinking of a response but hasn't finished yet.\n */\n isLoading: boolean;\n\n /**\n * Whether a response is generating, this is when the LLM is actively generating and streaming content.\n */\n isGenerating: boolean;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: () => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: TextMessage) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: TextMessage) => void;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n}\n\nexport interface RenderMessageProps {\n message: Message;\n inProgress: boolean;\n index: number;\n isCurrentMessage: boolean;\n actionResult?: string;\n AssistantMessage?: React.ComponentType<AssistantMessageProps>;\n UserMessage?: React.ComponentType<UserMessageProps>;\n\n /**\n * Callback function to regenerate the assistant's response\n */\n onRegenerate?: (messageId: string) => void;\n\n /**\n * Callback function when the message is copied\n */\n onCopy?: (message: string) => void;\n\n /**\n * Callback function for thumbs up feedback\n */\n onThumbsUp?: (message: TextMessage) => void;\n\n /**\n * Callback function for thumbs down feedback\n */\n onThumbsDown?: (message: TextMessage) => void;\n\n /**\n * A list of markdown components to render in assistant message.\n * Useful when you want to render custom elements in the message (e.g a reference tag element)\n */\n markdownTagRenderers?: ComponentsMap;\n}\n\nexport interface InputProps {\n inProgress: boolean;\n onSend: (text: string) => Promise<Message>;\n isVisible?: boolean;\n onStop?: () => void;\n onUpload?: () => void;\n hideStopButton?: boolean;\n}\n\nexport interface RenderSuggestionsListProps {\n suggestions: CopilotChatSuggestion[];\n onSuggestionClick: (message: string) => void;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/components/index.js
CHANGED
|
@@ -1427,8 +1427,15 @@ function PoweredByTag({ showPoweredBy = true }) {
|
|
|
1427
1427
|
// src/components/chat/Input.tsx
|
|
1428
1428
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1429
1429
|
var MAX_NEWLINES = 6;
|
|
1430
|
-
var Input = ({
|
|
1431
|
-
|
|
1430
|
+
var Input = ({
|
|
1431
|
+
inProgress,
|
|
1432
|
+
onSend,
|
|
1433
|
+
isVisible = false,
|
|
1434
|
+
onStop,
|
|
1435
|
+
onUpload,
|
|
1436
|
+
hideStopButton = false
|
|
1437
|
+
}) => {
|
|
1438
|
+
var _a, _b;
|
|
1432
1439
|
const context = useChatContext();
|
|
1433
1440
|
const copilotContext = (0, import_react_core6.useCopilotContext)();
|
|
1434
1441
|
const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
@@ -1457,15 +1464,18 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1457
1464
|
inProgress
|
|
1458
1465
|
});
|
|
1459
1466
|
const isInProgress = inProgress || pushToTalkState === "transcribing";
|
|
1460
|
-
const buttonIcon = isInProgress ? context.icons.stopIcon : context.icons.sendIcon;
|
|
1467
|
+
const buttonIcon = isInProgress && !hideStopButton ? context.icons.stopIcon : context.icons.sendIcon;
|
|
1461
1468
|
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
1462
|
-
const canSend = () => {
|
|
1469
|
+
const canSend = (0, import_react9.useMemo)(() => {
|
|
1463
1470
|
var _a2;
|
|
1464
1471
|
const interruptEvent = (_a2 = copilotContext.langGraphInterruptAction) == null ? void 0 : _a2.event;
|
|
1465
1472
|
const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
|
|
1466
|
-
return
|
|
1467
|
-
};
|
|
1468
|
-
const
|
|
1473
|
+
return !isInProgress && text.trim().length > 0 && pushToTalkState === "idle" && !interruptInProgress;
|
|
1474
|
+
}, [(_b = copilotContext.langGraphInterruptAction) == null ? void 0 : _b.event, isInProgress, text, pushToTalkState]);
|
|
1475
|
+
const canStop = (0, import_react9.useMemo)(() => {
|
|
1476
|
+
return isInProgress && !hideStopButton;
|
|
1477
|
+
}, [isInProgress, hideStopButton]);
|
|
1478
|
+
const sendDisabled = !canSend && !canStop;
|
|
1469
1479
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`, children: [
|
|
1470
1480
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
|
|
1471
1481
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
@@ -1480,7 +1490,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1480
1490
|
onKeyDown: (event) => {
|
|
1481
1491
|
if (event.key === "Enter" && !event.shiftKey) {
|
|
1482
1492
|
event.preventDefault();
|
|
1483
|
-
if (canSend
|
|
1493
|
+
if (canSend) {
|
|
1484
1494
|
send();
|
|
1485
1495
|
}
|
|
1486
1496
|
}
|
|
@@ -1502,7 +1512,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
|
|
|
1502
1512
|
"button",
|
|
1503
1513
|
{
|
|
1504
1514
|
disabled: sendDisabled,
|
|
1505
|
-
onClick: isInProgress ? onStop : send,
|
|
1515
|
+
onClick: isInProgress && !hideStopButton ? onStop : send,
|
|
1506
1516
|
"data-copilotkit-in-progress": inProgress,
|
|
1507
1517
|
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
1508
1518
|
className: "copilotKitInputControlButton",
|
|
@@ -2708,7 +2718,8 @@ function CopilotChat({
|
|
|
2708
2718
|
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
2709
2719
|
UserMessage: UserMessage2 = UserMessage,
|
|
2710
2720
|
imageUploadsEnabled,
|
|
2711
|
-
inputFileAccept = "image/*"
|
|
2721
|
+
inputFileAccept = "image/*",
|
|
2722
|
+
hideStopButton
|
|
2712
2723
|
}) {
|
|
2713
2724
|
const { additionalInstructions, setChatInstructions } = (0, import_react_core10.useCopilotContext)();
|
|
2714
2725
|
const [selectedImages, setSelectedImages] = (0, import_react13.useState)([]);
|
|
@@ -2891,7 +2902,8 @@ function CopilotChat({
|
|
|
2891
2902
|
onUpload: imageUploadsEnabled ? () => {
|
|
2892
2903
|
var _a;
|
|
2893
2904
|
return (_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
2894
|
-
} : void 0
|
|
2905
|
+
} : void 0,
|
|
2906
|
+
hideStopButton
|
|
2895
2907
|
}
|
|
2896
2908
|
)
|
|
2897
2909
|
] });
|