@copilotkit/react-core 2.0.0-rc.14 → 2.0.0-rc.16
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/dist/{MarkdownSurfaces-EGmsCZWN.cjs → MarkdownSurfaces-ChOKawIN.cjs} +52 -43
- package/dist/MarkdownSurfaces-ChOKawIN.cjs.map +1 -0
- package/dist/{MarkdownSurfaces-DKC9Eg_a.mjs → MarkdownSurfaces-DAEqIF5v.mjs} +52 -43
- package/dist/MarkdownSurfaces-DAEqIF5v.mjs.map +1 -0
- package/dist/context.cjs +6 -6
- package/dist/context.cjs.map +1 -1
- package/dist/context.mjs +6 -6
- package/dist/context.mjs.map +1 -1
- package/dist/generative-ui.cjs +6 -4
- package/dist/generative-ui.cjs.map +1 -1
- package/dist/generative-ui.mjs +6 -4
- package/dist/generative-ui.mjs.map +1 -1
- package/dist/headless.cjs +2 -2
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.mjs +2 -2
- package/dist/headless.mjs.map +1 -1
- package/dist/index.cjs +98 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +23 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +98 -40
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +167 -65
- package/dist/index.umd.js.map +1 -1
- package/package.json +9 -9
- package/dist/MarkdownSurfaces-DKC9Eg_a.mjs.map +0 -1
- package/dist/MarkdownSurfaces-EGmsCZWN.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_MarkdownSurfaces = require('./MarkdownSurfaces-
|
|
4
|
+
const require_MarkdownSurfaces = require('./MarkdownSurfaces-ChOKawIN.cjs');
|
|
5
5
|
let _copilotkit_core = require("@copilotkit/core");
|
|
6
6
|
let _ag_ui_client = require("@ag-ui/client");
|
|
7
7
|
let react = require("react");
|
|
@@ -1242,7 +1242,7 @@ function useRenderToolCall() {
|
|
|
1242
1242
|
|
|
1243
1243
|
//#endregion
|
|
1244
1244
|
//#region package.json
|
|
1245
|
-
var version$1 = "2.0.0-rc.
|
|
1245
|
+
var version$1 = "2.0.0-rc.16";
|
|
1246
1246
|
|
|
1247
1247
|
//#endregion
|
|
1248
1248
|
//#region src/components/CopilotKitInspector.tsx
|
|
@@ -2807,7 +2807,7 @@ function buildGenerativeUIManifest(runtime, threadId) {
|
|
|
2807
2807
|
* includeCatalog: true,
|
|
2808
2808
|
* contextSent: false,
|
|
2809
2809
|
* });
|
|
2810
|
-
* envelope["
|
|
2810
|
+
* envelope["1.0"].supportedCatalogIds; // [runtime.ui.id]
|
|
2811
2811
|
* ```
|
|
2812
2812
|
*/
|
|
2813
2813
|
function buildGenerativeUIEnvelope(runtime, threadId, options) {
|
|
@@ -2816,7 +2816,7 @@ function buildGenerativeUIEnvelope(runtime, threadId, options) {
|
|
|
2816
2816
|
const instructions = options.instructions ?? (transport === "markdown" ? (0, _copilotkit_shared.buildGenerativeUIMarkdownGuidelines)((0, _copilotkit_shared.generativeUIGuideFeatures)(manifest)) : void 0);
|
|
2817
2817
|
const omitComponents = transport === "markdown" && !includeCatalog;
|
|
2818
2818
|
return {
|
|
2819
|
-
"
|
|
2819
|
+
"1.0": {
|
|
2820
2820
|
supportedCatalogIds: manifest.catalogIds ?? [manifest.catalogId],
|
|
2821
2821
|
inlineCatalogs: [{
|
|
2822
2822
|
catalogId: manifest.catalogId,
|
|
@@ -3090,13 +3090,16 @@ function createGenerativeUIDispatcher(options) {
|
|
|
3090
3090
|
* gesture runs only from an event binding.
|
|
3091
3091
|
*/
|
|
3092
3092
|
const invokeBasic = (name, args, origin) => {
|
|
3093
|
-
const
|
|
3093
|
+
const info = _copilotkit_shared.GENERATIVE_UI_FUNCTIONS[name];
|
|
3094
|
+
const run = require_MarkdownSurfaces.BASIC_FUNCTIONS[name];
|
|
3095
|
+
if (info === void 0 || run === void 0) throw new Error(`"${name}" is not a basic function`);
|
|
3096
|
+
const refused = callerError(name, info, origin);
|
|
3094
3097
|
if (refused) return failWith(name, origin, refused);
|
|
3095
3098
|
if (args !== void 0 && !(typeof args === "object" && args !== null && !Array.isArray(args))) return failWith(name, origin, new require_MarkdownSurfaces.GenerativeUIError("invalid_arguments", `Invalid arguments for "${name}": args must be an object`));
|
|
3096
3099
|
try {
|
|
3097
3100
|
return {
|
|
3098
3101
|
ok: true,
|
|
3099
|
-
result:
|
|
3102
|
+
result: run(args ?? {})
|
|
3100
3103
|
};
|
|
3101
3104
|
} catch (error) {
|
|
3102
3105
|
return failWith(name, origin, new require_MarkdownSurfaces.GenerativeUIError(error instanceof require_MarkdownSurfaces.ExpressionError ? "invalid_arguments" : "handler_failed", `"${name}" failed: ${messageOf(error)}`));
|
|
@@ -3270,31 +3273,47 @@ function summarizeRejections(rejections) {
|
|
|
3270
3273
|
* with `getState()`.
|
|
3271
3274
|
*/
|
|
3272
3275
|
var GenerativeUISurfaceManager = class {
|
|
3276
|
+
surfaces = /* @__PURE__ */ new Map();
|
|
3277
|
+
bookkeeping = /* @__PURE__ */ new Map();
|
|
3278
|
+
listeners = /* @__PURE__ */ new Set();
|
|
3279
|
+
/** Mounts of each target id, in mount order. */
|
|
3280
|
+
targets = /* @__PURE__ */ new Map();
|
|
3281
|
+
state = {};
|
|
3282
|
+
/**
|
|
3283
|
+
* User-owned data model values, by surface key, then by path. Kept when a
|
|
3284
|
+
* surface is rebuilt. Cleared when the surface is deleted.
|
|
3285
|
+
*/
|
|
3286
|
+
owned = /* @__PURE__ */ new Map();
|
|
3287
|
+
/**
|
|
3288
|
+
* Keys of the surfaces that a `deleteSurface` removed. A surface id is
|
|
3289
|
+
* unique for the life of the page, so a key stays here when its surface is
|
|
3290
|
+
* built again.
|
|
3291
|
+
*/
|
|
3292
|
+
deletedKeys = /* @__PURE__ */ new Set();
|
|
3293
|
+
/**
|
|
3294
|
+
* Surfaces that share their data model, by surface key: the parts of a
|
|
3295
|
+
* chat surface that the prose lift split. A user write to one part goes
|
|
3296
|
+
* to every part, so an input in one part drives a binding in another.
|
|
3297
|
+
*/
|
|
3298
|
+
linked = /* @__PURE__ */ new Map();
|
|
3299
|
+
webCoreCatalog;
|
|
3300
|
+
activeThreadId;
|
|
3301
|
+
version = 0;
|
|
3273
3302
|
constructor(ui, options = {}) {
|
|
3274
3303
|
this.ui = ui;
|
|
3275
3304
|
this.options = options;
|
|
3276
|
-
this.surfaces = /* @__PURE__ */ new Map();
|
|
3277
|
-
this.bookkeeping = /* @__PURE__ */ new Map();
|
|
3278
|
-
this.listeners = /* @__PURE__ */ new Set();
|
|
3279
|
-
this.targets = /* @__PURE__ */ new Map();
|
|
3280
|
-
this.state = {};
|
|
3281
|
-
this.owned = /* @__PURE__ */ new Map();
|
|
3282
|
-
this.deletedKeys = /* @__PURE__ */ new Set();
|
|
3283
|
-
this.linked = /* @__PURE__ */ new Map();
|
|
3284
|
-
this.version = 0;
|
|
3285
|
-
this.subscribe = (listener) => {
|
|
3286
|
-
this.listeners.add(listener);
|
|
3287
|
-
return () => {
|
|
3288
|
-
this.listeners.delete(listener);
|
|
3289
|
-
};
|
|
3290
|
-
};
|
|
3291
|
-
this.getVersion = () => this.version;
|
|
3292
|
-
this.getState = () => this.state;
|
|
3293
3305
|
this.webCoreCatalog = new _a2ui_web_core_v0_9.Catalog(ui.id, [...ui.components.keys()].map((name) => ({
|
|
3294
3306
|
name,
|
|
3295
3307
|
schema: zod.any()
|
|
3296
3308
|
})), []);
|
|
3297
3309
|
}
|
|
3310
|
+
subscribe = (listener) => {
|
|
3311
|
+
this.listeners.add(listener);
|
|
3312
|
+
return () => {
|
|
3313
|
+
this.listeners.delete(listener);
|
|
3314
|
+
};
|
|
3315
|
+
};
|
|
3316
|
+
getVersion = () => this.version;
|
|
3298
3317
|
notify() {
|
|
3299
3318
|
this.version++;
|
|
3300
3319
|
for (const listener of [...this.listeners]) listener();
|
|
@@ -3480,6 +3499,11 @@ var GenerativeUISurfaceManager = class {
|
|
|
3480
3499
|
names: new Set(components)
|
|
3481
3500
|
};
|
|
3482
3501
|
}
|
|
3502
|
+
/**
|
|
3503
|
+
* The app state object. It is the same object until a key changes, so it
|
|
3504
|
+
* can be a `useSyncExternalStore` snapshot.
|
|
3505
|
+
*/
|
|
3506
|
+
getState = () => this.state;
|
|
3483
3507
|
/** Sets one state key. Notifies only when the value changed. */
|
|
3484
3508
|
setState(key, value) {
|
|
3485
3509
|
if (Object.hasOwn(this.state, key) && Object.is(this.state[key], value)) return;
|
|
@@ -4300,17 +4324,17 @@ function waitForReactCommit() {
|
|
|
4300
4324
|
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
4301
4325
|
}
|
|
4302
4326
|
var CopilotKitCoreReact = class extends _copilotkit_core.CopilotKitCore {
|
|
4327
|
+
_renderToolCalls = [];
|
|
4328
|
+
_hookRenderToolCalls = /* @__PURE__ */ new Map();
|
|
4329
|
+
_cachedMergedRenderToolCalls = null;
|
|
4330
|
+
_renderCustomMessages = [];
|
|
4331
|
+
_renderActivityMessages = [];
|
|
4332
|
+
_interruptElement = null;
|
|
4303
4333
|
constructor(config) {
|
|
4304
4334
|
super({
|
|
4305
4335
|
...config,
|
|
4306
4336
|
ɵwaitForFrameworkUpdates: waitForReactCommit
|
|
4307
4337
|
});
|
|
4308
|
-
this._renderToolCalls = [];
|
|
4309
|
-
this._hookRenderToolCalls = /* @__PURE__ */ new Map();
|
|
4310
|
-
this._cachedMergedRenderToolCalls = null;
|
|
4311
|
-
this._renderCustomMessages = [];
|
|
4312
|
-
this._renderActivityMessages = [];
|
|
4313
|
-
this._interruptElement = null;
|
|
4314
4338
|
this._renderToolCalls = config.renderToolCalls ?? [];
|
|
4315
4339
|
this._renderCustomMessages = config.renderCustomMessages ?? [];
|
|
4316
4340
|
this._renderActivityMessages = config.renderActivityMessages ?? [];
|
|
@@ -6795,7 +6819,7 @@ function useInterrupt(config) {
|
|
|
6795
6819
|
try {
|
|
6796
6820
|
maybePromise = handler({
|
|
6797
6821
|
event: legacyEvent,
|
|
6798
|
-
interrupt: pending.kind === "standard" ? pending.interrupts[0] : null,
|
|
6822
|
+
interrupt: pending.kind === "standard" ? pending.interrupts[0] ?? null : null,
|
|
6799
6823
|
interrupts: pending.kind === "standard" ? [...pending.interrupts] : [],
|
|
6800
6824
|
resolve: resolveRef.current,
|
|
6801
6825
|
cancel: cancelRef.current
|
|
@@ -6824,7 +6848,7 @@ function useInterrupt(config) {
|
|
|
6824
6848
|
if (!isEnabled(legacyEvent)) return null;
|
|
6825
6849
|
return renderRef.current({
|
|
6826
6850
|
event: legacyEvent,
|
|
6827
|
-
interrupt: pending.kind === "standard" ? pending.interrupts[0] : null,
|
|
6851
|
+
interrupt: pending.kind === "standard" ? pending.interrupts[0] ?? null : null,
|
|
6828
6852
|
interrupts: pending.kind === "standard" ? [...pending.interrupts] : [],
|
|
6829
6853
|
result: handlerResult,
|
|
6830
6854
|
resolve,
|
|
@@ -10785,6 +10809,7 @@ function usePinToSend({ scrollRef, contentRef, spacerRef, topOffset = 16 }) {
|
|
|
10785
10809
|
const lastNonceRef = (0, react.useRef)(-1);
|
|
10786
10810
|
(0, react.useEffect)(() => {
|
|
10787
10811
|
if (sendNonce === lastNonceRef.current) return;
|
|
10812
|
+
const previousNonce = lastNonceRef.current;
|
|
10788
10813
|
lastNonceRef.current = sendNonce;
|
|
10789
10814
|
if (!id) return;
|
|
10790
10815
|
const scrollEl = scrollRef.current;
|
|
@@ -10800,7 +10825,9 @@ function usePinToSend({ scrollRef, contentRef, spacerRef, topOffset = 16 }) {
|
|
|
10800
10825
|
const bubbleHeight = Math.max(0, userMessageHeight - paddingTop);
|
|
10801
10826
|
const spacerHeight = Math.max(0, viewportHeight - bubbleHeight - topOffset);
|
|
10802
10827
|
spacerEl.style.height = `${spacerHeight}px`;
|
|
10828
|
+
let pinned = false;
|
|
10803
10829
|
const raf = requestAnimationFrame(() => {
|
|
10830
|
+
pinned = true;
|
|
10804
10831
|
const targetTop = computeOffsetTop(targetEl, scrollEl) + paddingTop - topOffset;
|
|
10805
10832
|
scrollEl.scrollTo({
|
|
10806
10833
|
top: Math.max(0, targetTop),
|
|
@@ -10817,6 +10844,7 @@ function usePinToSend({ scrollRef, contentRef, spacerRef, topOffset = 16 }) {
|
|
|
10817
10844
|
return () => {
|
|
10818
10845
|
cancelAnimationFrame(raf);
|
|
10819
10846
|
ro.disconnect();
|
|
10847
|
+
if (!pinned) lastNonceRef.current = previousNonce;
|
|
10820
10848
|
};
|
|
10821
10849
|
}, [
|
|
10822
10850
|
id,
|
|
@@ -10852,15 +10880,16 @@ function DropOverlay() {
|
|
|
10852
10880
|
})
|
|
10853
10881
|
});
|
|
10854
10882
|
}
|
|
10855
|
-
function CopilotChatView({ messageView, input, scrollView, suggestionView, welcomeScreen, messages = [], autoScroll = true, isRunning = false, suggestions, suggestionLoadingIndexes, onSelectSuggestion, onSubmitMessage, onStop, inputMode, inputValue, onInputChange, onStartTranscribe, onCancelTranscribe, onFinishTranscribe, onFinishTranscribeWithAudio, attachments, onRemoveAttachment, onAddFile, dragOver, onDragOver, onDragLeave, onDrop, isConnecting = false, hasExplicitThreadId = false, intelligenceIndicator, children, className, ...props }) {
|
|
10883
|
+
function CopilotChatView({ messageView, input, scrollView, suggestionView, welcomeScreen, messages = [], autoScroll = true, isRunning = false, suggestions, suggestionLoadingIndexes, onSelectSuggestion, onSubmitMessage, onStop, inputMode, inputValue, onInputChange, onStartTranscribe, onCancelTranscribe, onFinishTranscribe, onFinishTranscribeWithAudio, attachments, onRemoveAttachment, onAddFile, dragOver, onDragOver, onDragLeave, onDrop, isConnecting = false, connectingIndicator, hasExplicitThreadId = false, intelligenceIndicator, children, className, ...props }) {
|
|
10856
10884
|
const configuredThreadId = require_MarkdownSurfaces.useCopilotChatConfiguration()?.threadId;
|
|
10857
10885
|
const [fallbackThreadId, setFallbackThreadId] = (0, react.useState)(messages[0]?.id);
|
|
10858
10886
|
const previousMessageIds = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
10859
10887
|
(0, react.useEffect)(() => {
|
|
10860
|
-
|
|
10888
|
+
const firstMessage = messages[0];
|
|
10889
|
+
if (firstMessage === void 0) return;
|
|
10861
10890
|
const overlaps = messages.some((message) => previousMessageIds.current.has(message.id));
|
|
10862
10891
|
previousMessageIds.current = new Set(messages.map((message) => message.id));
|
|
10863
|
-
if (!overlaps) setFallbackThreadId(
|
|
10892
|
+
if (!overlaps) setFallbackThreadId(firstMessage.id);
|
|
10864
10893
|
}, [messages]);
|
|
10865
10894
|
const scrollThreadId = configuredThreadId ?? fallbackThreadId;
|
|
10866
10895
|
const [inputContainerEl, setInputContainerEl] = (0, react.useState)(null);
|
|
@@ -10926,6 +10955,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
10926
10955
|
onSelectSuggestion,
|
|
10927
10956
|
className: "cpk-chat-view-suggestion-view"
|
|
10928
10957
|
}) : null;
|
|
10958
|
+
const BoundConnectingIndicator = isConnecting && messages.length === 0 && connectingIndicator !== false ? require_MarkdownSurfaces.renderSlot(connectingIndicator === true ? void 0 : connectingIndicator, CopilotChatView.ConnectingIndicator, {}) : null;
|
|
10929
10959
|
const BoundScrollView = require_MarkdownSurfaces.renderSlot(scrollView, CopilotChatView.ScrollView, {
|
|
10930
10960
|
autoScroll,
|
|
10931
10961
|
scrollThreadId,
|
|
@@ -10936,10 +10966,14 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
10936
10966
|
style: { paddingBottom: `${inputContainerHeight + (hasSuggestions ? 4 : 32)}px` },
|
|
10937
10967
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
10938
10968
|
className: "cpk-chat-view-feed",
|
|
10939
|
-
children: [
|
|
10940
|
-
|
|
10941
|
-
|
|
10942
|
-
|
|
10969
|
+
children: [
|
|
10970
|
+
BoundConnectingIndicator,
|
|
10971
|
+
BoundMessageView,
|
|
10972
|
+
hasSuggestions ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10973
|
+
className: "cpk-chat-view-suggestions",
|
|
10974
|
+
children: BoundSuggestionView
|
|
10975
|
+
}) : null
|
|
10976
|
+
]
|
|
10943
10977
|
})
|
|
10944
10978
|
})
|
|
10945
10979
|
});
|
|
@@ -10976,6 +11010,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
10976
11010
|
"data-copilotkit": true,
|
|
10977
11011
|
"data-testid": "copilot-chat",
|
|
10978
11012
|
"data-copilot-running": isRunning ? "true" : "false",
|
|
11013
|
+
"data-copilot-connecting": isConnecting ? "true" : "false",
|
|
10979
11014
|
onDragOver,
|
|
10980
11015
|
onDragLeave,
|
|
10981
11016
|
onDrop,
|
|
@@ -10986,6 +11021,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
10986
11021
|
}
|
|
10987
11022
|
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10988
11023
|
"data-copilotkit": true,
|
|
11024
|
+
"data-copilot-connecting": isConnecting ? "true" : "false",
|
|
10989
11025
|
style: { display: "contents" },
|
|
10990
11026
|
children: children({
|
|
10991
11027
|
messageView: BoundMessageView,
|
|
@@ -10998,6 +11034,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
10998
11034
|
"data-copilotkit": true,
|
|
10999
11035
|
"data-testid": "copilot-chat",
|
|
11000
11036
|
"data-copilot-running": isRunning ? "true" : "false",
|
|
11037
|
+
"data-copilot-connecting": isConnecting ? "true" : "false",
|
|
11001
11038
|
onDragOver,
|
|
11002
11039
|
onDragLeave,
|
|
11003
11040
|
onDrop,
|
|
@@ -11213,13 +11250,15 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
11213
11250
|
if (mode === "pin-to-bottom") return;
|
|
11214
11251
|
const scrollElement = nonAutoScrollEl;
|
|
11215
11252
|
if (!scrollElement) return;
|
|
11253
|
+
const contentElement = contentRef.current;
|
|
11216
11254
|
const checkScroll = () => {
|
|
11217
|
-
setShowScrollButton(
|
|
11255
|
+
setShowScrollButton((contentElement ? contentElement.getBoundingClientRect().bottom - scrollElement.getBoundingClientRect().bottom : scrollElement.scrollHeight - scrollElement.scrollTop - scrollElement.clientHeight) >= 10);
|
|
11218
11256
|
};
|
|
11219
11257
|
checkScroll();
|
|
11220
11258
|
scrollElement.addEventListener("scroll", checkScroll);
|
|
11221
11259
|
const resizeObserver = new ResizeObserver(checkScroll);
|
|
11222
11260
|
resizeObserver.observe(scrollElement);
|
|
11261
|
+
if (contentElement) resizeObserver.observe(contentElement);
|
|
11223
11262
|
return () => {
|
|
11224
11263
|
scrollElement.removeEventListener("scroll", checkScroll);
|
|
11225
11264
|
resizeObserver.disconnect();
|
|
@@ -11305,6 +11344,22 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
11305
11344
|
className,
|
|
11306
11345
|
...props
|
|
11307
11346
|
});
|
|
11347
|
+
_CopilotChatView.ConnectingIndicator = ({ className, ...props }) => {
|
|
11348
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
11349
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11350
|
+
"data-testid": "copilot-connecting-indicator",
|
|
11351
|
+
role: "status",
|
|
11352
|
+
className: require_MarkdownSurfaces.cn("cpk-chat-view-connecting-indicator", className),
|
|
11353
|
+
...props,
|
|
11354
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
11355
|
+
name: "Loader2",
|
|
11356
|
+
className: "cpk-chat-view-connecting-spinner"
|
|
11357
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11358
|
+
className: "cpk-chat-view-connecting-label",
|
|
11359
|
+
children: labels.chatConnectingLabel
|
|
11360
|
+
})]
|
|
11361
|
+
});
|
|
11362
|
+
};
|
|
11308
11363
|
_CopilotChatView.WelcomeMessage = ({ className, ...props }) => {
|
|
11309
11364
|
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
11310
11365
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
@@ -12033,7 +12088,10 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
|
|
|
12033
12088
|
const effectiveMode = isTranscribing ? "processing" : transcribeMode;
|
|
12034
12089
|
const messages = (0, react.useMemo)(() => [...agent.messages], [(0, _copilotkit_core.ɵmessagesFingerprint)(agent.messages)]);
|
|
12035
12090
|
const lastUserMessageId = (0, react.useMemo)(() => {
|
|
12036
|
-
for (let i = messages.length - 1; i >= 0; i--)
|
|
12091
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
12092
|
+
const message = messages[i];
|
|
12093
|
+
if (message?.role === "user") return message.id;
|
|
12094
|
+
}
|
|
12037
12095
|
return null;
|
|
12038
12096
|
}, [messages]);
|
|
12039
12097
|
const [sendNonce, setSendNonce] = (0, react.useState)(0);
|