@hef2024/llmasaservice-ui 0.19.0 → 0.20.0
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/AICHATPANEL-PORT-INVENTORY.md +830 -0
- package/DEBUG-ERROR-HANDLING.md +130 -0
- package/FIX-APPLIED.md +234 -0
- package/IMPLEMENTATION-COMPLETE.md +246 -0
- package/README.md +1 -0
- package/dist/index.css +190 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +242 -56
- package/dist/index.mjs +242 -56
- package/docs/CHANGELOG-ERROR-HANDLING.md +247 -0
- package/docs/ERROR-HANDLING-413.md +253 -0
- package/docs/ERROR-HANDLING-SUMMARY.md +131 -0
- package/package.json +1 -1
- package/src/AIChatPanel.css +120 -1
- package/src/AIChatPanel.tsx +282 -40
- package/src/ChatPanel.css +111 -0
- package/src/ChatPanel.tsx +105 -4
package/dist/index.js
CHANGED
|
@@ -273,6 +273,7 @@ var ChatPanel = ({
|
|
|
273
273
|
const [alwaysApprovedTools, setAlwaysApprovedTools] = (0, import_react3.useState)([]);
|
|
274
274
|
const [thinkingBlocks, setThinkingBlocks] = (0, import_react3.useState)([]);
|
|
275
275
|
const [currentThinkingIndex, setCurrentThinkingIndex] = (0, import_react3.useState)(0);
|
|
276
|
+
const [error, setError] = (0, import_react3.useState)(null);
|
|
276
277
|
const [userResizedHeight, setUserResizedHeight] = (0, import_react3.useState)(null);
|
|
277
278
|
const [pendingButtonAttachments, setPendingButtonAttachments] = (0, import_react3.useState)([]);
|
|
278
279
|
const actionMatchRegistry = (0, import_react3.useRef)(/* @__PURE__ */ new Map());
|
|
@@ -574,10 +575,10 @@ var ChatPanel = ({
|
|
|
574
575
|
const allTools = results.flat();
|
|
575
576
|
setToolList(allTools);
|
|
576
577
|
setToolsFetchError(false);
|
|
577
|
-
} catch (
|
|
578
|
+
} catch (error2) {
|
|
578
579
|
console.error(
|
|
579
580
|
"An error occurred while processing tool fetches:",
|
|
580
|
-
|
|
581
|
+
error2
|
|
581
582
|
);
|
|
582
583
|
setToolList([]);
|
|
583
584
|
setToolsFetchError(true);
|
|
@@ -587,7 +588,7 @@ var ChatPanel = ({
|
|
|
587
588
|
});
|
|
588
589
|
fetchAndSetTools();
|
|
589
590
|
}, [mcpServers, publicAPIUrl]);
|
|
590
|
-
const
|
|
591
|
+
const llmResult = (0, import_llmasaservice_client.useLLM)({
|
|
591
592
|
project_id,
|
|
592
593
|
customer: currentCustomer,
|
|
593
594
|
url,
|
|
@@ -600,6 +601,41 @@ var ChatPanel = ({
|
|
|
600
601
|
};
|
|
601
602
|
})
|
|
602
603
|
});
|
|
604
|
+
const { send, response, idle, stop, lastCallId, setResponse, error: llmError } = llmResult;
|
|
605
|
+
const handleError = (0, import_react3.useCallback)((errorMessage, historyKey) => {
|
|
606
|
+
console.log("[ChatPanel] Error detected:", errorMessage);
|
|
607
|
+
if (errorMessage.includes("413") || errorMessage.toLowerCase().includes("content too large")) {
|
|
608
|
+
setError({
|
|
609
|
+
message: "The context is too large to process. Please start a new conversation or reduce the amount of context.",
|
|
610
|
+
code: "413"
|
|
611
|
+
});
|
|
612
|
+
} else if (errorMessage.toLowerCase().includes("network error") || errorMessage.toLowerCase().includes("fetch")) {
|
|
613
|
+
setError({
|
|
614
|
+
message: "Network error. Please check your connection and try again.",
|
|
615
|
+
code: "NETWORK_ERROR"
|
|
616
|
+
});
|
|
617
|
+
} else {
|
|
618
|
+
setError({
|
|
619
|
+
message: errorMessage,
|
|
620
|
+
code: "UNKNOWN_ERROR"
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
setIsLoading(false);
|
|
624
|
+
const keyToUse = historyKey || lastKey;
|
|
625
|
+
if (keyToUse) {
|
|
626
|
+
setHistory((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
627
|
+
[keyToUse]: {
|
|
628
|
+
content: `Error: ${errorMessage}`,
|
|
629
|
+
callId: lastCallId || ""
|
|
630
|
+
}
|
|
631
|
+
}));
|
|
632
|
+
}
|
|
633
|
+
}, [lastKey, lastCallId]);
|
|
634
|
+
(0, import_react3.useEffect)(() => {
|
|
635
|
+
if (llmError && llmError.trim()) {
|
|
636
|
+
handleError(llmError);
|
|
637
|
+
}
|
|
638
|
+
}, [llmError, handleError]);
|
|
603
639
|
const processActionsOnContent = (0, import_react3.useCallback)((content, context) => {
|
|
604
640
|
let workingContent = content;
|
|
605
641
|
const buttonAttachments = [];
|
|
@@ -936,8 +972,8 @@ var ChatPanel = ({
|
|
|
936
972
|
return action;
|
|
937
973
|
}
|
|
938
974
|
}).filter(Boolean);
|
|
939
|
-
} catch (
|
|
940
|
-
console.error("Error parsing actions string:",
|
|
975
|
+
} catch (error2) {
|
|
976
|
+
console.error("Error parsing actions string:", error2);
|
|
941
977
|
actions2 = [];
|
|
942
978
|
}
|
|
943
979
|
}
|
|
@@ -1125,8 +1161,8 @@ var ChatPanel = ({
|
|
|
1125
1161
|
console.error(`No content returned from tool ${req.toolName}`);
|
|
1126
1162
|
return null;
|
|
1127
1163
|
}
|
|
1128
|
-
} catch (
|
|
1129
|
-
console.error(`Error processing tool ${req.toolName}:`,
|
|
1164
|
+
} catch (error2) {
|
|
1165
|
+
console.error(`Error processing tool ${req.toolName}:`, error2);
|
|
1130
1166
|
return null;
|
|
1131
1167
|
}
|
|
1132
1168
|
}));
|
|
@@ -1168,10 +1204,14 @@ var ChatPanel = ({
|
|
|
1168
1204
|
true,
|
|
1169
1205
|
service,
|
|
1170
1206
|
currentConversation,
|
|
1171
|
-
lastController
|
|
1207
|
+
lastController,
|
|
1208
|
+
void 0,
|
|
1209
|
+
// onComplete
|
|
1210
|
+
(errorMsg) => handleError(errorMsg)
|
|
1211
|
+
// onError
|
|
1172
1212
|
);
|
|
1173
|
-
} catch (
|
|
1174
|
-
console.error("Error in processing all tools:",
|
|
1213
|
+
} catch (error2) {
|
|
1214
|
+
console.error("Error in processing all tools:", error2);
|
|
1175
1215
|
setIsLoading(false);
|
|
1176
1216
|
}
|
|
1177
1217
|
});
|
|
@@ -1303,8 +1343,8 @@ var ChatPanel = ({
|
|
|
1303
1343
|
if (typeof interactionClicked === "function") {
|
|
1304
1344
|
interactionClicked(lastCallId, "action");
|
|
1305
1345
|
}
|
|
1306
|
-
} catch (
|
|
1307
|
-
console.error("Error executing clickCode:",
|
|
1346
|
+
} catch (error2) {
|
|
1347
|
+
console.error("Error executing clickCode:", error2);
|
|
1308
1348
|
}
|
|
1309
1349
|
}
|
|
1310
1350
|
};
|
|
@@ -1399,10 +1439,10 @@ var ChatPanel = ({
|
|
|
1399
1439
|
if (typeof interactionClicked === "function") {
|
|
1400
1440
|
interactionClicked(lastCallId, "action");
|
|
1401
1441
|
}
|
|
1402
|
-
} catch (
|
|
1442
|
+
} catch (error2) {
|
|
1403
1443
|
console.error(
|
|
1404
1444
|
"Error executing clickCode via delegation:",
|
|
1405
|
-
|
|
1445
|
+
error2
|
|
1406
1446
|
);
|
|
1407
1447
|
}
|
|
1408
1448
|
}
|
|
@@ -1514,7 +1554,11 @@ var ChatPanel = ({
|
|
|
1514
1554
|
true,
|
|
1515
1555
|
service,
|
|
1516
1556
|
convId,
|
|
1517
|
-
controller
|
|
1557
|
+
controller,
|
|
1558
|
+
void 0,
|
|
1559
|
+
// onComplete
|
|
1560
|
+
(errorMsg) => handleError(errorMsg)
|
|
1561
|
+
// onError
|
|
1518
1562
|
);
|
|
1519
1563
|
setLastPrompt(initialPrompt);
|
|
1520
1564
|
setLastMessages(messages);
|
|
@@ -1610,8 +1654,8 @@ var ChatPanel = ({
|
|
|
1610
1654
|
return newConvo.id;
|
|
1611
1655
|
}
|
|
1612
1656
|
return "";
|
|
1613
|
-
}).catch((
|
|
1614
|
-
console.error("Error creating new conversation",
|
|
1657
|
+
}).catch((error2) => {
|
|
1658
|
+
console.error("Error creating new conversation", error2);
|
|
1615
1659
|
return "";
|
|
1616
1660
|
});
|
|
1617
1661
|
}
|
|
@@ -1660,7 +1704,7 @@ var ChatPanel = ({
|
|
|
1660
1704
|
customerEmail: updatedValues.customer_user_email
|
|
1661
1705
|
})
|
|
1662
1706
|
}).catch(
|
|
1663
|
-
(
|
|
1707
|
+
(error2) => console.error("Failed to update conversation:", error2)
|
|
1664
1708
|
);
|
|
1665
1709
|
}
|
|
1666
1710
|
});
|
|
@@ -1670,6 +1714,8 @@ var ChatPanel = ({
|
|
|
1670
1714
|
const continueChat = (suggestion) => {
|
|
1671
1715
|
setThinkingBlocks([]);
|
|
1672
1716
|
setCurrentThinkingIndex(0);
|
|
1717
|
+
setError(null);
|
|
1718
|
+
setResponse("");
|
|
1673
1719
|
if (emailInput && isEmailAddress(emailInput) && !emailInputSet) {
|
|
1674
1720
|
const newId = (currentCustomer == null ? void 0 : currentCustomer.customer_id) && currentCustomer.customer_id !== "" && currentCustomer.customer_id !== (currentCustomer == null ? void 0 : currentCustomer.customer_user_email) ? currentCustomer.customer_id : emailInput;
|
|
1675
1721
|
setEmailInputSet(true);
|
|
@@ -1764,7 +1810,11 @@ var ChatPanel = ({
|
|
|
1764
1810
|
true,
|
|
1765
1811
|
service,
|
|
1766
1812
|
convId,
|
|
1767
|
-
controller
|
|
1813
|
+
controller,
|
|
1814
|
+
void 0,
|
|
1815
|
+
// onComplete
|
|
1816
|
+
(errorMsg) => handleError(errorMsg)
|
|
1817
|
+
// onError
|
|
1768
1818
|
);
|
|
1769
1819
|
setLastPrompt(nextPromptToSend);
|
|
1770
1820
|
setLastMessages(messagesAndHistory);
|
|
@@ -2083,6 +2133,15 @@ var ChatPanel = ({
|
|
|
2083
2133
|
className: "llm-panel" + (theme === "light" ? "" : " dark-theme")
|
|
2084
2134
|
},
|
|
2085
2135
|
title && title !== "" ? /* @__PURE__ */ import_react3.default.createElement("div", { className: "title" }, title) : null,
|
|
2136
|
+
error && /* @__PURE__ */ import_react3.default.createElement("div", { className: "error-banner" }, /* @__PURE__ */ import_react3.default.createElement("div", { className: "error-banner__icon" }, /* @__PURE__ */ import_react3.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ import_react3.default.createElement("circle", { cx: "12", cy: "12", r: "10" }), /* @__PURE__ */ import_react3.default.createElement("line", { x1: "12", x2: "12", y1: "8", y2: "12" }), /* @__PURE__ */ import_react3.default.createElement("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" }))), /* @__PURE__ */ import_react3.default.createElement("div", { className: "error-banner__content" }, /* @__PURE__ */ import_react3.default.createElement("div", { className: "error-banner__message" }, error.message), error.code === "413" && /* @__PURE__ */ import_react3.default.createElement("div", { className: "error-banner__hint" }, "Try starting a new conversation or reducing the amount of information being sent.")), /* @__PURE__ */ import_react3.default.createElement(
|
|
2137
|
+
"button",
|
|
2138
|
+
{
|
|
2139
|
+
className: "error-banner__close",
|
|
2140
|
+
onClick: () => setError(null),
|
|
2141
|
+
"aria-label": "Dismiss error"
|
|
2142
|
+
},
|
|
2143
|
+
/* @__PURE__ */ import_react3.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ import_react3.default.createElement("line", { x1: "18", x2: "6", y1: "6", y2: "18" }), /* @__PURE__ */ import_react3.default.createElement("line", { x1: "6", x2: "18", y1: "6", y2: "18" }))
|
|
2144
|
+
)),
|
|
2086
2145
|
/* @__PURE__ */ import_react3.default.createElement("div", { className: "responseArea", ref: responseAreaRef }, initialMessage && initialMessage !== "" ? /* @__PURE__ */ import_react3.default.createElement("div", { className: "history-entry" }, /* @__PURE__ */ import_react3.default.createElement("div", { className: "response" }, /* @__PURE__ */ import_react3.default.createElement(
|
|
2087
2146
|
import_react_markdown.default,
|
|
2088
2147
|
{
|
|
@@ -2392,6 +2451,7 @@ var ChatPanel = ({
|
|
|
2392
2451
|
setIsToolInfoModalOpen(false);
|
|
2393
2452
|
setToolInfoData(null);
|
|
2394
2453
|
setJustReset(true);
|
|
2454
|
+
setError(null);
|
|
2395
2455
|
setLastController(new AbortController());
|
|
2396
2456
|
buttonActionRegistry.current.clear();
|
|
2397
2457
|
setTimeout(() => {
|
|
@@ -3347,9 +3407,6 @@ var DialogFooter = ({
|
|
|
3347
3407
|
// src/AIChatPanel.tsx
|
|
3348
3408
|
var ArrowUpIcon = () => /* @__PURE__ */ import_react11.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ import_react11.default.createElement("path", { d: "M12 19V5M5 12l7-7 7 7" }));
|
|
3349
3409
|
var StopIcon = () => /* @__PURE__ */ import_react11.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "ai-chat-icon" }, /* @__PURE__ */ import_react11.default.createElement("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" }));
|
|
3350
|
-
var CopyIcon = () => /* @__PURE__ */ import_react11.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ import_react11.default.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }), /* @__PURE__ */ import_react11.default.createElement("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }));
|
|
3351
|
-
var ThumbsUpIcon = () => /* @__PURE__ */ import_react11.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ import_react11.default.createElement("path", { d: "M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3" }));
|
|
3352
|
-
var ThumbsDownIcon = () => /* @__PURE__ */ import_react11.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ import_react11.default.createElement("path", { d: "M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17" }));
|
|
3353
3410
|
var ChevronDownIcon = () => /* @__PURE__ */ import_react11.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ import_react11.default.createElement("path", { d: "m6 9 6 6 6-6" }));
|
|
3354
3411
|
var ChevronUpIcon = () => /* @__PURE__ */ import_react11.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ import_react11.default.createElement("path", { d: "m18 15-6-6-6 6" }));
|
|
3355
3412
|
var AgentIcon = () => /* @__PURE__ */ import_react11.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ import_react11.default.createElement("path", { d: "M12 8V4H8" }), /* @__PURE__ */ import_react11.default.createElement("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }), /* @__PURE__ */ import_react11.default.createElement("path", { d: "M2 14h2" }), /* @__PURE__ */ import_react11.default.createElement("path", { d: "M20 14h2" }), /* @__PURE__ */ import_react11.default.createElement("path", { d: "M15 13v2" }), /* @__PURE__ */ import_react11.default.createElement("path", { d: "M9 13v2" }));
|
|
@@ -3357,6 +3414,8 @@ var CheckIcon = () => /* @__PURE__ */ import_react11.default.createElement("svg"
|
|
|
3357
3414
|
var BrainIcon = () => /* @__PURE__ */ import_react11.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ import_react11.default.createElement("path", { d: "M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 1.98-3A2.5 2.5 0 0 1 9.5 2Z" }), /* @__PURE__ */ import_react11.default.createElement("path", { d: "M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-1.98-3A2.5 2.5 0 0 0 14.5 2Z" }));
|
|
3358
3415
|
var SearchIcon = () => /* @__PURE__ */ import_react11.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ import_react11.default.createElement("circle", { cx: "11", cy: "11", r: "8" }), /* @__PURE__ */ import_react11.default.createElement("path", { d: "m21 21-4.3-4.3" }));
|
|
3359
3416
|
var LLMAsAServiceLogo = () => /* @__PURE__ */ import_react11.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 72 72", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react11.default.createElement("ellipse", { cx: "14.0868", cy: "59.2146", rx: "7.8261", ry: "7.7854", fill: "#2487D8" }), /* @__PURE__ */ import_react11.default.createElement("ellipse", { cx: "24.9013", cy: "43.0776", rx: "6.11858", ry: "6.08676", fill: "#2487D8" }), /* @__PURE__ */ import_react11.default.createElement("ellipse", { cx: "45.391", cy: "43.0776", rx: "6.11858", ry: "6.08676", fill: "#2487D8" }), /* @__PURE__ */ import_react11.default.createElement("ellipse", { cx: "65.8813", cy: "43.0776", rx: "6.11858", ry: "6.08676", fill: "#2487D8" }), /* @__PURE__ */ import_react11.default.createElement("ellipse", { cx: "35.1461", cy: "26.5327", rx: "4.41103", ry: "4.3878", fill: "#2487D8" }), /* @__PURE__ */ import_react11.default.createElement("ellipse", { cx: "55.6364", cy: "26.5327", rx: "4.41103", ry: "4.3878", fill: "#2487D8" }), /* @__PURE__ */ import_react11.default.createElement("ellipse", { cx: "45.391", cy: "10.3959", rx: "2.70351", ry: "2.68919", fill: "#2487D8" }));
|
|
3417
|
+
var AlertCircleIcon = () => /* @__PURE__ */ import_react11.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ import_react11.default.createElement("circle", { cx: "12", cy: "12", r: "10" }), /* @__PURE__ */ import_react11.default.createElement("line", { x1: "12", x2: "12", y1: "8", y2: "12" }), /* @__PURE__ */ import_react11.default.createElement("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" }));
|
|
3418
|
+
var CloseIcon = () => /* @__PURE__ */ import_react11.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ import_react11.default.createElement("line", { x1: "18", x2: "6", y1: "6", y2: "18" }), /* @__PURE__ */ import_react11.default.createElement("line", { x1: "6", x2: "18", y1: "6", y2: "18" }));
|
|
3360
3419
|
var ChatInput = import_react11.default.memo(({
|
|
3361
3420
|
placeholder,
|
|
3362
3421
|
idle,
|
|
@@ -3660,6 +3719,8 @@ var AIChatPanel = ({
|
|
|
3660
3719
|
const [newConversationConfirm, setNewConversationConfirm] = (0, import_react11.useState)(false);
|
|
3661
3720
|
const [justReset, setJustReset] = (0, import_react11.useState)(false);
|
|
3662
3721
|
const [copiedCallId, setCopiedCallId] = (0, import_react11.useState)(null);
|
|
3722
|
+
const [feedbackCallId, setFeedbackCallId] = (0, import_react11.useState)(null);
|
|
3723
|
+
const [error, setError] = (0, import_react11.useState)(null);
|
|
3663
3724
|
const bottomRef = (0, import_react11.useRef)(null);
|
|
3664
3725
|
const responseAreaRef = (0, import_react11.useRef)(null);
|
|
3665
3726
|
const [userHasScrolled, setUserHasScrolled] = (0, import_react11.useState)(false);
|
|
@@ -3698,7 +3759,8 @@ var AIChatPanel = ({
|
|
|
3698
3759
|
idle,
|
|
3699
3760
|
lastCallId,
|
|
3700
3761
|
stop,
|
|
3701
|
-
setResponse
|
|
3762
|
+
setResponse,
|
|
3763
|
+
error: llmError
|
|
3702
3764
|
} = llmResult;
|
|
3703
3765
|
const toolList = llmResult.toolList || [];
|
|
3704
3766
|
const toolsLoading = llmResult.toolsLoading || false;
|
|
@@ -3773,8 +3835,8 @@ var AIChatPanel = ({
|
|
|
3773
3835
|
}
|
|
3774
3836
|
console.warn("ensureConversation - No ID in response");
|
|
3775
3837
|
return "";
|
|
3776
|
-
}).catch((
|
|
3777
|
-
console.error("Error creating new conversation",
|
|
3838
|
+
}).catch((error2) => {
|
|
3839
|
+
console.error("Error creating new conversation", error2);
|
|
3778
3840
|
return "";
|
|
3779
3841
|
});
|
|
3780
3842
|
}
|
|
@@ -3866,16 +3928,59 @@ var AIChatPanel = ({
|
|
|
3866
3928
|
}
|
|
3867
3929
|
return displayPrompt;
|
|
3868
3930
|
}, [hideRagContextInPrompt]);
|
|
3931
|
+
const interactionClicked = (0, import_react11.useCallback)((callId, action, emailaddress = "", comment = "") => __async(void 0, null, function* () {
|
|
3932
|
+
var _a, _b;
|
|
3933
|
+
console.log(`[AIChatPanel] Interaction: ${action} for callId: ${callId}`);
|
|
3934
|
+
const convId = currentConversation || (yield ensureConversation());
|
|
3935
|
+
const finalCallId = callId || convId;
|
|
3936
|
+
const isEmailAddress = (str) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(str);
|
|
3937
|
+
const email = emailaddress && emailaddress !== "" ? emailaddress : isEmailAddress((_a = customer == null ? void 0 : customer.customer_user_email) != null ? _a : "") ? customer == null ? void 0 : customer.customer_user_email : isEmailAddress((_b = customer == null ? void 0 : customer.customer_id) != null ? _b : "") ? customer == null ? void 0 : customer.customer_id : "";
|
|
3938
|
+
try {
|
|
3939
|
+
yield fetch(`${publicAPIUrl}/feedback/${finalCallId}/${action}`, {
|
|
3940
|
+
method: "POST",
|
|
3941
|
+
headers: {
|
|
3942
|
+
"Content-Type": "application/json"
|
|
3943
|
+
},
|
|
3944
|
+
body: JSON.stringify({
|
|
3945
|
+
project_id: project_id != null ? project_id : "",
|
|
3946
|
+
conversation_id: convId != null ? convId : "",
|
|
3947
|
+
email,
|
|
3948
|
+
comment
|
|
3949
|
+
})
|
|
3950
|
+
});
|
|
3951
|
+
} catch (err) {
|
|
3952
|
+
console.error("[AIChatPanel] Failed to send feedback:", err);
|
|
3953
|
+
}
|
|
3954
|
+
}), [currentConversation, ensureConversation, customer, project_id, publicAPIUrl]);
|
|
3869
3955
|
const copyToClipboard = (0, import_react11.useCallback)((text, callId) => __async(void 0, null, function* () {
|
|
3870
3956
|
try {
|
|
3871
3957
|
const cleanText = text.replace(/<[^>]*>/g, "").replace(/\*\*(.*?)\*\*/g, "$1").replace(/\*(.*?)\*/g, "$1").replace(/#{1,6}\s/g, "").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1");
|
|
3872
3958
|
yield navigator.clipboard.writeText(cleanText);
|
|
3873
3959
|
setCopiedCallId(callId);
|
|
3874
3960
|
setTimeout(() => setCopiedCallId(null), 2e3);
|
|
3961
|
+
yield interactionClicked(callId, "copy");
|
|
3875
3962
|
} catch (err) {
|
|
3876
3963
|
console.error("Failed to copy:", err);
|
|
3877
3964
|
}
|
|
3878
|
-
}), []);
|
|
3965
|
+
}), [interactionClicked]);
|
|
3966
|
+
const handleThumbsUp = (0, import_react11.useCallback)((callId) => __async(void 0, null, function* () {
|
|
3967
|
+
console.log("[AIChatPanel] Thumbs up clicked:", callId);
|
|
3968
|
+
setFeedbackCallId({ callId, type: "up" });
|
|
3969
|
+
setTimeout(() => setFeedbackCallId(null), 2e3);
|
|
3970
|
+
yield interactionClicked(callId, "thumbsup");
|
|
3971
|
+
if (thumbsUpClick) {
|
|
3972
|
+
thumbsUpClick(callId);
|
|
3973
|
+
}
|
|
3974
|
+
}), [thumbsUpClick, interactionClicked]);
|
|
3975
|
+
const handleThumbsDown = (0, import_react11.useCallback)((callId) => __async(void 0, null, function* () {
|
|
3976
|
+
console.log("[AIChatPanel] Thumbs down clicked:", callId);
|
|
3977
|
+
setFeedbackCallId({ callId, type: "down" });
|
|
3978
|
+
setTimeout(() => setFeedbackCallId(null), 2e3);
|
|
3979
|
+
yield interactionClicked(callId, "thumbsdown");
|
|
3980
|
+
if (thumbsDownClick) {
|
|
3981
|
+
thumbsDownClick(callId);
|
|
3982
|
+
}
|
|
3983
|
+
}), [thumbsDownClick, interactionClicked]);
|
|
3879
3984
|
const scrollToBottom = (0, import_react11.useCallback)(() => {
|
|
3880
3985
|
var _a;
|
|
3881
3986
|
if (scrollRAFRef.current) {
|
|
@@ -3897,7 +4002,9 @@ var AIChatPanel = ({
|
|
|
3897
4002
|
console.log("AIChatPanel.continueChat called with:", promptText);
|
|
3898
4003
|
setThinkingBlocks([]);
|
|
3899
4004
|
setCurrentThinkingIndex(0);
|
|
4005
|
+
setError(null);
|
|
3900
4006
|
setUserHasScrolled(false);
|
|
4007
|
+
setResponse("");
|
|
3901
4008
|
if (!idle) {
|
|
3902
4009
|
stop(lastController);
|
|
3903
4010
|
setHistory((prevHistory) => __spreadProps(__spreadValues({}, prevHistory), {
|
|
@@ -3968,7 +4075,37 @@ ${followOnPrompt}`;
|
|
|
3968
4075
|
// group_id from agent config
|
|
3969
4076
|
convId,
|
|
3970
4077
|
// Use the conversation ID from ensureConversation
|
|
3971
|
-
newController
|
|
4078
|
+
newController,
|
|
4079
|
+
void 0,
|
|
4080
|
+
// onComplete
|
|
4081
|
+
(errorMsg) => {
|
|
4082
|
+
console.log("[AIChatPanel] Error callback triggered:", errorMsg);
|
|
4083
|
+
if (errorMsg.includes("413") || errorMsg.toLowerCase().includes("content too large")) {
|
|
4084
|
+
setError({
|
|
4085
|
+
message: "The context is too large to process. Please start a new conversation or reduce the amount of context.",
|
|
4086
|
+
code: "413"
|
|
4087
|
+
});
|
|
4088
|
+
} else if (errorMsg.toLowerCase().includes("network error") || errorMsg.toLowerCase().includes("fetch")) {
|
|
4089
|
+
setError({
|
|
4090
|
+
message: "Network error. Please check your connection and try again.",
|
|
4091
|
+
code: "NETWORK_ERROR"
|
|
4092
|
+
});
|
|
4093
|
+
} else {
|
|
4094
|
+
setError({
|
|
4095
|
+
message: errorMsg,
|
|
4096
|
+
code: "UNKNOWN_ERROR"
|
|
4097
|
+
});
|
|
4098
|
+
}
|
|
4099
|
+
setIsLoading(false);
|
|
4100
|
+
if (promptKey) {
|
|
4101
|
+
setHistory((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
4102
|
+
[promptKey]: {
|
|
4103
|
+
content: `Error: ${errorMsg}`,
|
|
4104
|
+
callId: lastCallId || ""
|
|
4105
|
+
}
|
|
4106
|
+
}));
|
|
4107
|
+
}
|
|
4108
|
+
}
|
|
3972
4109
|
);
|
|
3973
4110
|
setLastMessages(messagesAndHistory);
|
|
3974
4111
|
if (convId && onConversationCreated) {
|
|
@@ -3994,7 +4131,8 @@ ${followOnPrompt}`;
|
|
|
3994
4131
|
ensureConversation,
|
|
3995
4132
|
dataWithExtras,
|
|
3996
4133
|
scrollToBottom,
|
|
3997
|
-
onConversationCreated
|
|
4134
|
+
onConversationCreated,
|
|
4135
|
+
setResponse
|
|
3998
4136
|
]);
|
|
3999
4137
|
const handleSuggestionClick = (0, import_react11.useCallback)((question) => {
|
|
4000
4138
|
continueChat(question);
|
|
@@ -4027,6 +4165,7 @@ ${followOnPrompt}`;
|
|
|
4027
4165
|
setJustReset(true);
|
|
4028
4166
|
setLastController(new AbortController());
|
|
4029
4167
|
setUserHasScrolled(false);
|
|
4168
|
+
setError(null);
|
|
4030
4169
|
setTimeout(() => {
|
|
4031
4170
|
var _a;
|
|
4032
4171
|
setJustReset(false);
|
|
@@ -4054,6 +4193,7 @@ ${followOnPrompt}`;
|
|
|
4054
4193
|
prevIdleRef.current = idle;
|
|
4055
4194
|
if (wasStreaming && isNowIdle && !hasNotifiedCompletionRef.current) {
|
|
4056
4195
|
hasNotifiedCompletionRef.current = true;
|
|
4196
|
+
setIsLoading(false);
|
|
4057
4197
|
const currentHistory = latestHistoryRef.current;
|
|
4058
4198
|
const currentLastKey = lastKeyRef.current;
|
|
4059
4199
|
const currentLastCallId = lastCallIdRef.current;
|
|
@@ -4135,6 +4275,37 @@ ${followOnPrompt}`;
|
|
|
4135
4275
|
continueChat(initialPrompt);
|
|
4136
4276
|
}
|
|
4137
4277
|
}, [initialPrompt, continueChat]);
|
|
4278
|
+
(0, import_react11.useEffect)(() => {
|
|
4279
|
+
if (llmError && llmError.trim()) {
|
|
4280
|
+
console.log("[AIChatPanel] Error detected:", llmError);
|
|
4281
|
+
const errorMessage = llmError;
|
|
4282
|
+
if (errorMessage.includes("413") || errorMessage.toLowerCase().includes("content too large")) {
|
|
4283
|
+
setError({
|
|
4284
|
+
message: "The context is too large to process. Please start a new conversation or reduce the amount of context.",
|
|
4285
|
+
code: "413"
|
|
4286
|
+
});
|
|
4287
|
+
} else if (errorMessage.toLowerCase().includes("network error") || errorMessage.toLowerCase().includes("fetch")) {
|
|
4288
|
+
setError({
|
|
4289
|
+
message: "Network error. Please check your connection and try again.",
|
|
4290
|
+
code: "NETWORK_ERROR"
|
|
4291
|
+
});
|
|
4292
|
+
} else {
|
|
4293
|
+
setError({
|
|
4294
|
+
message: errorMessage,
|
|
4295
|
+
code: "UNKNOWN_ERROR"
|
|
4296
|
+
});
|
|
4297
|
+
}
|
|
4298
|
+
setIsLoading(false);
|
|
4299
|
+
if (lastKey) {
|
|
4300
|
+
setHistory((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
4301
|
+
[lastKey]: {
|
|
4302
|
+
content: `Error: ${errorMessage}`,
|
|
4303
|
+
callId: lastCallId || ""
|
|
4304
|
+
}
|
|
4305
|
+
}));
|
|
4306
|
+
}
|
|
4307
|
+
}
|
|
4308
|
+
}, [llmError, lastKey, lastCallId]);
|
|
4138
4309
|
const CodeBlock = (0, import_react11.useCallback)((_a) => {
|
|
4139
4310
|
var _b = _a, { node, inline, className, children } = _b, props = __objRest(_b, ["node", "inline", "className", "children"]);
|
|
4140
4311
|
const match = /language-(\w+)/.exec(className || "");
|
|
@@ -4148,7 +4319,13 @@ ${followOnPrompt}`;
|
|
|
4148
4319
|
String(children).replace(/\n$/, "")
|
|
4149
4320
|
) : /* @__PURE__ */ import_react11.default.createElement("code", __spreadValues({ className }, props), children);
|
|
4150
4321
|
}, [prismStyle]);
|
|
4151
|
-
const AgentSuggestionCard =
|
|
4322
|
+
const AgentSuggestionCard = import_react11.default.memo(({ agentId, agentName, reason }) => {
|
|
4323
|
+
(0, import_react11.useEffect)(() => {
|
|
4324
|
+
const timer = setTimeout(() => {
|
|
4325
|
+
scrollToBottom();
|
|
4326
|
+
}, 100);
|
|
4327
|
+
return () => clearTimeout(timer);
|
|
4328
|
+
}, []);
|
|
4152
4329
|
if (!agentId || !onAgentChange) return null;
|
|
4153
4330
|
const isValidUUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(agentId);
|
|
4154
4331
|
const agentOption = agentOptions.find((opt) => opt.value === agentId);
|
|
@@ -4192,14 +4369,13 @@ ${followOnPrompt}`;
|
|
|
4192
4369
|
onClick: () => {
|
|
4193
4370
|
onAgentChange(agentId);
|
|
4194
4371
|
setTimeout(() => {
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
}, 50);
|
|
4372
|
+
scrollToBottom();
|
|
4373
|
+
}, 100);
|
|
4198
4374
|
}
|
|
4199
4375
|
},
|
|
4200
4376
|
"Switch"
|
|
4201
4377
|
));
|
|
4202
|
-
}
|
|
4378
|
+
});
|
|
4203
4379
|
const markdownComponents = (0, import_react11.useMemo)(() => ({
|
|
4204
4380
|
code: CodeBlock,
|
|
4205
4381
|
"agent-suggestion": (_a) => {
|
|
@@ -4242,8 +4418,16 @@ ${followOnPrompt}`;
|
|
|
4242
4418
|
))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ai-chat-thinking__content" }, cleanContentForDisplay(currentBlock.content)));
|
|
4243
4419
|
}, [thinkingBlocks, currentThinkingIndex, cleanContentForDisplay]);
|
|
4244
4420
|
const panelClasses = ["ai-chat-panel", theme === "dark" ? "dark-theme" : ""].filter(Boolean).join(" ");
|
|
4245
|
-
return /* @__PURE__ */ import_react11.default.createElement("div", { className: panelClasses }, title && /* @__PURE__ */ import_react11.default.createElement("div", { className: "ai-chat-panel__title" }, title), /* @__PURE__ */ import_react11.default.createElement(
|
|
4246
|
-
|
|
4421
|
+
return /* @__PURE__ */ import_react11.default.createElement("div", { className: panelClasses }, title && /* @__PURE__ */ import_react11.default.createElement("div", { className: "ai-chat-panel__title" }, title), error && /* @__PURE__ */ import_react11.default.createElement("div", { className: "ai-chat-error-banner" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ai-chat-error-banner__icon" }, /* @__PURE__ */ import_react11.default.createElement(AlertCircleIcon, null)), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ai-chat-error-banner__content" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ai-chat-error-banner__message" }, error.message), error.code === "413" && /* @__PURE__ */ import_react11.default.createElement("div", { className: "ai-chat-error-banner__hint" }, "Try starting a new conversation or reducing the amount of information being sent.")), /* @__PURE__ */ import_react11.default.createElement(
|
|
4422
|
+
"button",
|
|
4423
|
+
{
|
|
4424
|
+
className: "ai-chat-error-banner__close",
|
|
4425
|
+
onClick: () => setError(null),
|
|
4426
|
+
"aria-label": "Dismiss error"
|
|
4427
|
+
},
|
|
4428
|
+
/* @__PURE__ */ import_react11.default.createElement(CloseIcon, null)
|
|
4429
|
+
)), /* @__PURE__ */ import_react11.default.createElement(ScrollArea, { className: "ai-chat-panel__messages", ref: responseAreaRef }, initialMessage && /* @__PURE__ */ import_react11.default.createElement("div", { className: "ai-chat-message ai-chat-message--assistant" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ai-chat-message__content" }, /* @__PURE__ */ import_react11.default.createElement(import_react_markdown2.default, { remarkPlugins: [import_remark_gfm2.default], rehypePlugins: [import_rehype_raw2.default] }, initialMessage))), Object.entries(history).map(([prompt, entry], index, entries) => {
|
|
4430
|
+
const isLastEntry = index === entries.length - 1;
|
|
4247
4431
|
const isSystemMessage = prompt.startsWith("__system__:");
|
|
4248
4432
|
const { cleanedText } = processThinkingTags(entry.content);
|
|
4249
4433
|
const processedContent = processActions(cleanedText);
|
|
@@ -4263,31 +4447,33 @@ ${followOnPrompt}`;
|
|
|
4263
4447
|
components: markdownComponents
|
|
4264
4448
|
},
|
|
4265
4449
|
processedContent
|
|
4266
|
-
))),
|
|
4267
|
-
|
|
4450
|
+
))), (!isLastEntry || !isLoading) && /* @__PURE__ */ import_react11.default.createElement("div", { className: "ai-chat-message__actions" }, /* @__PURE__ */ import_react11.default.createElement(
|
|
4451
|
+
"button",
|
|
4268
4452
|
{
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4453
|
+
className: "ai-chat-action-button",
|
|
4454
|
+
onClick: () => copyToClipboard(entry.content, entry.callId),
|
|
4455
|
+
title: copiedCallId === entry.callId ? "Copied!" : "Copy"
|
|
4272
4456
|
},
|
|
4273
|
-
/* @__PURE__ */ import_react11.default.createElement(
|
|
4274
|
-
)
|
|
4275
|
-
|
|
4457
|
+
copiedCallId === entry.callId ? /* @__PURE__ */ import_react11.default.createElement("span", { style: { fontSize: "11px", fontWeight: 500 } }, "Copied!") : /* @__PURE__ */ import_react11.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ import_react11.default.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }), /* @__PURE__ */ import_react11.default.createElement("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }))
|
|
4458
|
+
), /* @__PURE__ */ import_react11.default.createElement(
|
|
4459
|
+
"button",
|
|
4276
4460
|
{
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4461
|
+
className: "ai-chat-action-button",
|
|
4462
|
+
onClick: () => handleThumbsUp(entry.callId),
|
|
4463
|
+
title: (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "up" ? "Thanks!" : "Good response",
|
|
4464
|
+
style: (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "up" ? { color: "#22c55e" } : void 0
|
|
4280
4465
|
},
|
|
4281
|
-
/* @__PURE__ */ import_react11.default.createElement(
|
|
4282
|
-
)
|
|
4283
|
-
|
|
4466
|
+
(feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "up" ? /* @__PURE__ */ import_react11.default.createElement("span", { style: { fontSize: "11px", fontWeight: 500 } }, "Thanks!") : /* @__PURE__ */ import_react11.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ import_react11.default.createElement("path", { d: "M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3" }))
|
|
4467
|
+
), /* @__PURE__ */ import_react11.default.createElement(
|
|
4468
|
+
"button",
|
|
4284
4469
|
{
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4470
|
+
className: "ai-chat-action-button",
|
|
4471
|
+
onClick: () => handleThumbsDown(entry.callId),
|
|
4472
|
+
title: (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "down" ? "Thanks!" : "Poor response",
|
|
4473
|
+
style: (feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "down" ? { color: "#ef4444" } : void 0
|
|
4288
4474
|
},
|
|
4289
|
-
/* @__PURE__ */ import_react11.default.createElement(
|
|
4290
|
-
))))
|
|
4475
|
+
(feedbackCallId == null ? void 0 : feedbackCallId.callId) === entry.callId && (feedbackCallId == null ? void 0 : feedbackCallId.type) === "down" ? /* @__PURE__ */ import_react11.default.createElement("span", { style: { fontSize: "11px", fontWeight: 500 } }, "Thanks!") : /* @__PURE__ */ import_react11.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "ai-chat-icon-sm" }, /* @__PURE__ */ import_react11.default.createElement("path", { d: "M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17" }))
|
|
4476
|
+
))));
|
|
4291
4477
|
}), followOnQuestionsState.length > 0 && idle && !isLoading && /* @__PURE__ */ import_react11.default.createElement("div", { className: "ai-chat-suggestions" }, followOnQuestionsState.map((question, index) => /* @__PURE__ */ import_react11.default.createElement(
|
|
4292
4478
|
Button,
|
|
4293
4479
|
{
|
|
@@ -4539,7 +4725,7 @@ var PlusIcon = () => /* @__PURE__ */ import_react13.default.createElement("svg",
|
|
|
4539
4725
|
var ChevronLeftIcon = () => /* @__PURE__ */ import_react13.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react13.default.createElement("path", { d: "M10 12L6 8l4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
|
|
4540
4726
|
var ChevronRightIcon = () => /* @__PURE__ */ import_react13.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react13.default.createElement("path", { d: "M6 12l4-4-4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
|
|
4541
4727
|
var MessageIcon = () => /* @__PURE__ */ import_react13.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react13.default.createElement("path", { d: "M14 10a1.333 1.333 0 0 1-1.333 1.333H4L2 14V3.333A1.333 1.333 0 0 1 3.333 2h9.334A1.333 1.333 0 0 1 14 3.333V10Z", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
|
|
4542
|
-
var
|
|
4728
|
+
var CloseIcon2 = () => /* @__PURE__ */ import_react13.default.createElement("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react13.default.createElement("path", { d: "M9 3L3 9M3 3l6 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }));
|
|
4543
4729
|
var LoadingDotIcon = () => /* @__PURE__ */ import_react13.default.createElement("span", { className: "ai-agent-panel__loading-dot" });
|
|
4544
4730
|
var SidebarIcon = () => /* @__PURE__ */ import_react13.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react13.default.createElement("rect", { x: "2", y: "2", width: "12", height: "12", rx: "2", stroke: "currentColor", strokeWidth: "1.5" }), /* @__PURE__ */ import_react13.default.createElement("path", { d: "M6 2v12", stroke: "currentColor", strokeWidth: "1.5" }));
|
|
4545
4731
|
var SparkleIcon = () => /* @__PURE__ */ import_react13.default.createElement("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react13.default.createElement("path", { d: "M8 1v3M8 12v3M3 8H0M16 8h-3M12.95 3.05l-2.12 2.12M5.17 10.83l-2.12 2.12M12.95 12.95l-2.12-2.12M5.17 5.17L3.05 3.05", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }), /* @__PURE__ */ import_react13.default.createElement("circle", { cx: "8", cy: "8", r: "2", fill: "currentColor" }));
|
|
@@ -5823,7 +6009,7 @@ var AIAgentPanel = import_react13.default.forwardRef(({
|
|
|
5823
6009
|
onClick: (e) => handleCloseConversation(activeConv.conversationId, e),
|
|
5824
6010
|
title: "Close conversation"
|
|
5825
6011
|
},
|
|
5826
|
-
/* @__PURE__ */ import_react13.default.createElement(
|
|
6012
|
+
/* @__PURE__ */ import_react13.default.createElement(CloseIcon2, null)
|
|
5827
6013
|
)
|
|
5828
6014
|
))), conversationsLoading ? /* @__PURE__ */ import_react13.default.createElement("div", { className: "ai-agent-panel__loading" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "ai-agent-panel__loading-spinner" }), /* @__PURE__ */ import_react13.default.createElement("span", null, "Loading conversations...")) : conversationsError ? /* @__PURE__ */ import_react13.default.createElement("div", { className: "ai-agent-panel__empty" }, /* @__PURE__ */ import_react13.default.createElement("p", null, "Error: ", conversationsError), /* @__PURE__ */ import_react13.default.createElement(Button, { variant: "secondary", size: "sm", onClick: handleRefreshConversations }, "Retry")) : groupedConversations.length === 0 && activeConversationsList.length === 0 ? /* @__PURE__ */ import_react13.default.createElement("div", { className: "ai-agent-panel__empty" }, /* @__PURE__ */ import_react13.default.createElement(MessageIcon, null), /* @__PURE__ */ import_react13.default.createElement("p", null, "No conversations yet"), /* @__PURE__ */ import_react13.default.createElement("p", { className: "ai-agent-panel__empty-hint" }, "Start chatting to create your first conversation")) : /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, activeConversationsList.length > 0 && groupedConversations.some((g) => g.count > 0) && /* @__PURE__ */ import_react13.default.createElement("div", { className: "ai-agent-panel__group-divider" }), groupedConversations.map((group) => /* @__PURE__ */ import_react13.default.createElement("div", { key: group.label, className: "ai-agent-panel__group" }, /* @__PURE__ */ import_react13.default.createElement(
|
|
5829
6015
|
"div",
|