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