@agentiffai/design 1.3.12 → 1.3.14
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/copilotkit/index.cjs +46 -27
- package/dist/copilotkit/index.cjs.map +1 -1
- package/dist/copilotkit/index.js +46 -27
- package/dist/copilotkit/index.js.map +1 -1
- package/dist/index.cjs +12 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -832,6 +832,7 @@ function AssistantThinking({
|
|
|
832
832
|
AssistantThinking.displayName = "AssistantThinking";
|
|
833
833
|
function parseMarkdown(text) {
|
|
834
834
|
if (!text) return [];
|
|
835
|
+
text = text.replace(/<!--TOOL_CALL:[^>]*-->/g, "").replace(/__TOOL_CALL__:[^:]+:\{[^}]*(?:\{[^}]*\}[^}]*)*\}/g, "");
|
|
835
836
|
const elements = [];
|
|
836
837
|
let key = 0;
|
|
837
838
|
const paragraphs = text.split(/\n\n+/);
|
|
@@ -1401,20 +1402,30 @@ var AssistantMessageAdapterBase = ({
|
|
|
1401
1402
|
// markdownTagRenderers,
|
|
1402
1403
|
// ImageRenderer,
|
|
1403
1404
|
}) => {
|
|
1404
|
-
|
|
1405
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AssistantThinking, { message: "Thinking..." });
|
|
1406
|
-
}
|
|
1405
|
+
const lastGenerativeUIRef = react.useRef(null);
|
|
1407
1406
|
const rawContent = message?.content || "";
|
|
1408
1407
|
const content = stripToolCallMarkers(rawContent);
|
|
1409
1408
|
let generativeUIOutput = null;
|
|
1410
1409
|
const msgWithUI = message;
|
|
1411
1410
|
if (msgWithUI && typeof msgWithUI.generativeUI === "function") {
|
|
1412
1411
|
try {
|
|
1413
|
-
|
|
1412
|
+
const newOutput = msgWithUI.generativeUI();
|
|
1413
|
+
if (newOutput !== null && newOutput !== void 0) {
|
|
1414
|
+
generativeUIOutput = newOutput;
|
|
1415
|
+
lastGenerativeUIRef.current = newOutput;
|
|
1416
|
+
}
|
|
1414
1417
|
} catch (e) {
|
|
1415
1418
|
console.warn("[AssistantMessageAdapter] Error rendering generativeUI:", e);
|
|
1416
1419
|
}
|
|
1417
1420
|
}
|
|
1421
|
+
if (!generativeUIOutput && lastGenerativeUIRef.current) {
|
|
1422
|
+
generativeUIOutput = lastGenerativeUIRef.current;
|
|
1423
|
+
}
|
|
1424
|
+
const hasGenerativeUI = generativeUIOutput !== null;
|
|
1425
|
+
const showThinking = (isLoading || isGenerating && !content) && !hasGenerativeUI;
|
|
1426
|
+
if (showThinking) {
|
|
1427
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AssistantThinking, { message: "Thinking..." });
|
|
1428
|
+
}
|
|
1418
1429
|
const attachments = [];
|
|
1419
1430
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1420
1431
|
generativeUIOutput && /* @__PURE__ */ jsxRuntime.jsx(GenerativeUIContainer, { children: generativeUIOutput }),
|
|
@@ -1433,35 +1444,39 @@ var AssistantMessageAdapterBase = ({
|
|
|
1433
1444
|
};
|
|
1434
1445
|
var AssistantMessageAdapter = react.memo(AssistantMessageAdapterBase);
|
|
1435
1446
|
AssistantMessageAdapter.displayName = "AssistantMessageAdapter";
|
|
1436
|
-
function createAssistantMessageAdapter(ThinkingIndicator,
|
|
1447
|
+
function createAssistantMessageAdapter(ThinkingIndicator, _ToolCallsComponent) {
|
|
1437
1448
|
const CustomAssistantMessageAdapter = ({
|
|
1438
1449
|
message,
|
|
1439
1450
|
isLoading,
|
|
1440
|
-
isGenerating
|
|
1441
|
-
isCurrentMessage
|
|
1451
|
+
isGenerating
|
|
1452
|
+
// isCurrentMessage and ToolCallsComponent are no longer used but kept for backwards compat
|
|
1442
1453
|
}) => {
|
|
1443
|
-
const
|
|
1444
|
-
const shouldShowToolCalls = isCurrentMessage && ToolCallsComponent;
|
|
1454
|
+
const lastGenerativeUIRef = react.useRef(null);
|
|
1445
1455
|
const rawContent = message?.content || "";
|
|
1446
1456
|
const content = stripToolCallMarkers(rawContent);
|
|
1447
1457
|
let generativeUIOutput = null;
|
|
1448
1458
|
const msgWithUI = message;
|
|
1449
1459
|
if (msgWithUI && typeof msgWithUI.generativeUI === "function") {
|
|
1450
1460
|
try {
|
|
1451
|
-
|
|
1461
|
+
const newOutput = msgWithUI.generativeUI();
|
|
1462
|
+
if (newOutput !== null && newOutput !== void 0) {
|
|
1463
|
+
generativeUIOutput = newOutput;
|
|
1464
|
+
lastGenerativeUIRef.current = newOutput;
|
|
1465
|
+
}
|
|
1452
1466
|
} catch (e) {
|
|
1453
1467
|
console.warn("[AssistantMessageAdapter] Error rendering generativeUI:", e);
|
|
1454
1468
|
}
|
|
1455
1469
|
}
|
|
1470
|
+
if (!generativeUIOutput && lastGenerativeUIRef.current) {
|
|
1471
|
+
generativeUIOutput = lastGenerativeUIRef.current;
|
|
1472
|
+
}
|
|
1456
1473
|
const attachments = [];
|
|
1474
|
+
const hasGenerativeUI = generativeUIOutput !== null;
|
|
1475
|
+
const showThinking = (isLoading || isGenerating && !content) && !hasGenerativeUI;
|
|
1457
1476
|
if (showThinking) {
|
|
1458
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
1459
|
-
ThinkingIndicator ? /* @__PURE__ */ jsxRuntime.jsx(ThinkingIndicator, { isLoading, isGenerating }) : /* @__PURE__ */ jsxRuntime.jsx(AssistantThinking, { message: "Thinking..." }),
|
|
1460
|
-
shouldShowToolCalls && /* @__PURE__ */ jsxRuntime.jsx(ToolCallsComponent, {})
|
|
1461
|
-
] });
|
|
1477
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: ThinkingIndicator ? /* @__PURE__ */ jsxRuntime.jsx(ThinkingIndicator, { isLoading, isGenerating }) : /* @__PURE__ */ jsxRuntime.jsx(AssistantThinking, { message: "Thinking..." }) });
|
|
1462
1478
|
}
|
|
1463
1479
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1464
|
-
shouldShowToolCalls && /* @__PURE__ */ jsxRuntime.jsx(ToolCallsComponent, {}),
|
|
1465
1480
|
generativeUIOutput && /* @__PURE__ */ jsxRuntime.jsx(GenerativeUIContainer, { children: generativeUIOutput }),
|
|
1466
1481
|
content && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1467
1482
|
AssistantMessage,
|
|
@@ -1479,16 +1494,15 @@ function createAssistantMessageAdapter(ThinkingIndicator, ToolCallsComponent) {
|
|
|
1479
1494
|
CustomAssistantMessageAdapter.displayName = "CustomAssistantMessageAdapter";
|
|
1480
1495
|
return react.memo(CustomAssistantMessageAdapter);
|
|
1481
1496
|
}
|
|
1482
|
-
function createAssistantMessageAdapterWithErrorReporting(onReportIssue, ThinkingIndicator,
|
|
1497
|
+
function createAssistantMessageAdapterWithErrorReporting(onReportIssue, ThinkingIndicator, _ToolCallsComponent) {
|
|
1483
1498
|
const ErrorReportingAssistantMessageAdapter = ({
|
|
1484
1499
|
message,
|
|
1485
1500
|
isLoading,
|
|
1486
|
-
isGenerating
|
|
1487
|
-
isCurrentMessage
|
|
1501
|
+
isGenerating
|
|
1502
|
+
// isCurrentMessage and ToolCallsComponent are no longer used but kept for backwards compat
|
|
1488
1503
|
}) => {
|
|
1504
|
+
const lastGenerativeUIRef = react.useRef(null);
|
|
1489
1505
|
const { visibleMessages } = reactCore.useCopilotChat();
|
|
1490
|
-
const showThinking = isLoading || isGenerating && !message?.content;
|
|
1491
|
-
const shouldShowToolCalls = isCurrentMessage && ToolCallsComponent;
|
|
1492
1506
|
const rawContent = message?.content || "";
|
|
1493
1507
|
const content = stripToolCallMarkers(rawContent);
|
|
1494
1508
|
const errorContext = react.useMemo(() => detectErrorInMessage(content), [content]);
|
|
@@ -1536,20 +1550,25 @@ function createAssistantMessageAdapterWithErrorReporting(onReportIssue, Thinking
|
|
|
1536
1550
|
const msgWithUI = message;
|
|
1537
1551
|
if (msgWithUI && typeof msgWithUI.generativeUI === "function") {
|
|
1538
1552
|
try {
|
|
1539
|
-
|
|
1553
|
+
const newOutput = msgWithUI.generativeUI();
|
|
1554
|
+
if (newOutput !== null && newOutput !== void 0) {
|
|
1555
|
+
generativeUIOutput = newOutput;
|
|
1556
|
+
lastGenerativeUIRef.current = newOutput;
|
|
1557
|
+
}
|
|
1540
1558
|
} catch (e) {
|
|
1541
1559
|
console.warn("[AssistantMessageAdapter] Error rendering generativeUI:", e);
|
|
1542
1560
|
}
|
|
1543
1561
|
}
|
|
1562
|
+
if (!generativeUIOutput && lastGenerativeUIRef.current) {
|
|
1563
|
+
generativeUIOutput = lastGenerativeUIRef.current;
|
|
1564
|
+
}
|
|
1544
1565
|
const attachments = [];
|
|
1566
|
+
const hasGenerativeUI = generativeUIOutput !== null;
|
|
1567
|
+
const showThinking = (isLoading || isGenerating && !content) && !hasGenerativeUI;
|
|
1545
1568
|
if (showThinking) {
|
|
1546
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
1547
|
-
ThinkingIndicator ? /* @__PURE__ */ jsxRuntime.jsx(ThinkingIndicator, { isLoading, isGenerating }) : /* @__PURE__ */ jsxRuntime.jsx(AssistantThinking, { message: "Thinking..." }),
|
|
1548
|
-
shouldShowToolCalls && /* @__PURE__ */ jsxRuntime.jsx(ToolCallsComponent, {})
|
|
1549
|
-
] });
|
|
1569
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: ThinkingIndicator ? /* @__PURE__ */ jsxRuntime.jsx(ThinkingIndicator, { isLoading, isGenerating }) : /* @__PURE__ */ jsxRuntime.jsx(AssistantThinking, { message: "Thinking..." }) });
|
|
1550
1570
|
}
|
|
1551
1571
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1552
|
-
shouldShowToolCalls && /* @__PURE__ */ jsxRuntime.jsx(ToolCallsComponent, {}),
|
|
1553
1572
|
generativeUIOutput && /* @__PURE__ */ jsxRuntime.jsx(GenerativeUIContainer, { children: generativeUIOutput }),
|
|
1554
1573
|
content && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1555
1574
|
AssistantMessage,
|
|
@@ -3178,7 +3197,7 @@ function CustomCopilotSidebar2({
|
|
|
3178
3197
|
[disabled, disabledReason, onSetOpen]
|
|
3179
3198
|
);
|
|
3180
3199
|
const AssistantMessageAdapterMemo = react.useMemo(
|
|
3181
|
-
() => onReportIssue ? createAssistantMessageAdapterWithErrorReporting(onReportIssue, ThinkingIndicator
|
|
3200
|
+
() => onReportIssue ? createAssistantMessageAdapterWithErrorReporting(onReportIssue, ThinkingIndicator) : ThinkingIndicator || ToolCallsComponent ? createAssistantMessageAdapter(ThinkingIndicator) : AssistantMessageAdapter,
|
|
3182
3201
|
[ThinkingIndicator, ToolCallsComponent, onReportIssue]
|
|
3183
3202
|
);
|
|
3184
3203
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|