@hef2024/llmasaservice-ui 0.19.1 → 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 +237 -54
- package/dist/index.mjs +237 -54
- 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 +274 -38
- package/src/ChatPanel.css +111 -0
- package/src/ChatPanel.tsx +100 -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,7 @@ var ChatPanel = ({
|
|
|
1670
1714
|
const continueChat = (suggestion) => {
|
|
1671
1715
|
setThinkingBlocks([]);
|
|
1672
1716
|
setCurrentThinkingIndex(0);
|
|
1717
|
+
setError(null);
|
|
1673
1718
|
setResponse("");
|
|
1674
1719
|
if (emailInput && isEmailAddress(emailInput) && !emailInputSet) {
|
|
1675
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;
|
|
@@ -1765,7 +1810,11 @@ var ChatPanel = ({
|
|
|
1765
1810
|
true,
|
|
1766
1811
|
service,
|
|
1767
1812
|
convId,
|
|
1768
|
-
controller
|
|
1813
|
+
controller,
|
|
1814
|
+
void 0,
|
|
1815
|
+
// onComplete
|
|
1816
|
+
(errorMsg) => handleError(errorMsg)
|
|
1817
|
+
// onError
|
|
1769
1818
|
);
|
|
1770
1819
|
setLastPrompt(nextPromptToSend);
|
|
1771
1820
|
setLastMessages(messagesAndHistory);
|
|
@@ -2084,6 +2133,15 @@ var ChatPanel = ({
|
|
|
2084
2133
|
className: "llm-panel" + (theme === "light" ? "" : " dark-theme")
|
|
2085
2134
|
},
|
|
2086
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
|
+
)),
|
|
2087
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(
|
|
2088
2146
|
import_react_markdown.default,
|
|
2089
2147
|
{
|
|
@@ -2393,6 +2451,7 @@ var ChatPanel = ({
|
|
|
2393
2451
|
setIsToolInfoModalOpen(false);
|
|
2394
2452
|
setToolInfoData(null);
|
|
2395
2453
|
setJustReset(true);
|
|
2454
|
+
setError(null);
|
|
2396
2455
|
setLastController(new AbortController());
|
|
2397
2456
|
buttonActionRegistry.current.clear();
|
|
2398
2457
|
setTimeout(() => {
|
|
@@ -3348,9 +3407,6 @@ var DialogFooter = ({
|
|
|
3348
3407
|
// src/AIChatPanel.tsx
|
|
3349
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" }));
|
|
3350
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" }));
|
|
3351
|
-
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" }));
|
|
3352
|
-
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" }));
|
|
3353
|
-
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" }));
|
|
3354
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" }));
|
|
3355
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" }));
|
|
3356
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" }));
|
|
@@ -3358,6 +3414,8 @@ var CheckIcon = () => /* @__PURE__ */ import_react11.default.createElement("svg"
|
|
|
3358
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" }));
|
|
3359
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" }));
|
|
3360
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" }));
|
|
3361
3419
|
var ChatInput = import_react11.default.memo(({
|
|
3362
3420
|
placeholder,
|
|
3363
3421
|
idle,
|
|
@@ -3661,6 +3719,8 @@ var AIChatPanel = ({
|
|
|
3661
3719
|
const [newConversationConfirm, setNewConversationConfirm] = (0, import_react11.useState)(false);
|
|
3662
3720
|
const [justReset, setJustReset] = (0, import_react11.useState)(false);
|
|
3663
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);
|
|
3664
3724
|
const bottomRef = (0, import_react11.useRef)(null);
|
|
3665
3725
|
const responseAreaRef = (0, import_react11.useRef)(null);
|
|
3666
3726
|
const [userHasScrolled, setUserHasScrolled] = (0, import_react11.useState)(false);
|
|
@@ -3699,7 +3759,8 @@ var AIChatPanel = ({
|
|
|
3699
3759
|
idle,
|
|
3700
3760
|
lastCallId,
|
|
3701
3761
|
stop,
|
|
3702
|
-
setResponse
|
|
3762
|
+
setResponse,
|
|
3763
|
+
error: llmError
|
|
3703
3764
|
} = llmResult;
|
|
3704
3765
|
const toolList = llmResult.toolList || [];
|
|
3705
3766
|
const toolsLoading = llmResult.toolsLoading || false;
|
|
@@ -3774,8 +3835,8 @@ var AIChatPanel = ({
|
|
|
3774
3835
|
}
|
|
3775
3836
|
console.warn("ensureConversation - No ID in response");
|
|
3776
3837
|
return "";
|
|
3777
|
-
}).catch((
|
|
3778
|
-
console.error("Error creating new conversation",
|
|
3838
|
+
}).catch((error2) => {
|
|
3839
|
+
console.error("Error creating new conversation", error2);
|
|
3779
3840
|
return "";
|
|
3780
3841
|
});
|
|
3781
3842
|
}
|
|
@@ -3867,16 +3928,59 @@ var AIChatPanel = ({
|
|
|
3867
3928
|
}
|
|
3868
3929
|
return displayPrompt;
|
|
3869
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]);
|
|
3870
3955
|
const copyToClipboard = (0, import_react11.useCallback)((text, callId) => __async(void 0, null, function* () {
|
|
3871
3956
|
try {
|
|
3872
3957
|
const cleanText = text.replace(/<[^>]*>/g, "").replace(/\*\*(.*?)\*\*/g, "$1").replace(/\*(.*?)\*/g, "$1").replace(/#{1,6}\s/g, "").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1");
|
|
3873
3958
|
yield navigator.clipboard.writeText(cleanText);
|
|
3874
3959
|
setCopiedCallId(callId);
|
|
3875
3960
|
setTimeout(() => setCopiedCallId(null), 2e3);
|
|
3961
|
+
yield interactionClicked(callId, "copy");
|
|
3876
3962
|
} catch (err) {
|
|
3877
3963
|
console.error("Failed to copy:", err);
|
|
3878
3964
|
}
|
|
3879
|
-
}), []);
|
|
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]);
|
|
3880
3984
|
const scrollToBottom = (0, import_react11.useCallback)(() => {
|
|
3881
3985
|
var _a;
|
|
3882
3986
|
if (scrollRAFRef.current) {
|
|
@@ -3898,6 +4002,7 @@ var AIChatPanel = ({
|
|
|
3898
4002
|
console.log("AIChatPanel.continueChat called with:", promptText);
|
|
3899
4003
|
setThinkingBlocks([]);
|
|
3900
4004
|
setCurrentThinkingIndex(0);
|
|
4005
|
+
setError(null);
|
|
3901
4006
|
setUserHasScrolled(false);
|
|
3902
4007
|
setResponse("");
|
|
3903
4008
|
if (!idle) {
|
|
@@ -3970,7 +4075,37 @@ ${followOnPrompt}`;
|
|
|
3970
4075
|
// group_id from agent config
|
|
3971
4076
|
convId,
|
|
3972
4077
|
// Use the conversation ID from ensureConversation
|
|
3973
|
-
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
|
+
}
|
|
3974
4109
|
);
|
|
3975
4110
|
setLastMessages(messagesAndHistory);
|
|
3976
4111
|
if (convId && onConversationCreated) {
|
|
@@ -4030,6 +4165,7 @@ ${followOnPrompt}`;
|
|
|
4030
4165
|
setJustReset(true);
|
|
4031
4166
|
setLastController(new AbortController());
|
|
4032
4167
|
setUserHasScrolled(false);
|
|
4168
|
+
setError(null);
|
|
4033
4169
|
setTimeout(() => {
|
|
4034
4170
|
var _a;
|
|
4035
4171
|
setJustReset(false);
|
|
@@ -4057,6 +4193,7 @@ ${followOnPrompt}`;
|
|
|
4057
4193
|
prevIdleRef.current = idle;
|
|
4058
4194
|
if (wasStreaming && isNowIdle && !hasNotifiedCompletionRef.current) {
|
|
4059
4195
|
hasNotifiedCompletionRef.current = true;
|
|
4196
|
+
setIsLoading(false);
|
|
4060
4197
|
const currentHistory = latestHistoryRef.current;
|
|
4061
4198
|
const currentLastKey = lastKeyRef.current;
|
|
4062
4199
|
const currentLastCallId = lastCallIdRef.current;
|
|
@@ -4138,6 +4275,37 @@ ${followOnPrompt}`;
|
|
|
4138
4275
|
continueChat(initialPrompt);
|
|
4139
4276
|
}
|
|
4140
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]);
|
|
4141
4309
|
const CodeBlock = (0, import_react11.useCallback)((_a) => {
|
|
4142
4310
|
var _b = _a, { node, inline, className, children } = _b, props = __objRest(_b, ["node", "inline", "className", "children"]);
|
|
4143
4311
|
const match = /language-(\w+)/.exec(className || "");
|
|
@@ -4151,7 +4319,13 @@ ${followOnPrompt}`;
|
|
|
4151
4319
|
String(children).replace(/\n$/, "")
|
|
4152
4320
|
) : /* @__PURE__ */ import_react11.default.createElement("code", __spreadValues({ className }, props), children);
|
|
4153
4321
|
}, [prismStyle]);
|
|
4154
|
-
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
|
+
}, []);
|
|
4155
4329
|
if (!agentId || !onAgentChange) return null;
|
|
4156
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);
|
|
4157
4331
|
const agentOption = agentOptions.find((opt) => opt.value === agentId);
|
|
@@ -4195,14 +4369,13 @@ ${followOnPrompt}`;
|
|
|
4195
4369
|
onClick: () => {
|
|
4196
4370
|
onAgentChange(agentId);
|
|
4197
4371
|
setTimeout(() => {
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
}, 50);
|
|
4372
|
+
scrollToBottom();
|
|
4373
|
+
}, 100);
|
|
4201
4374
|
}
|
|
4202
4375
|
},
|
|
4203
4376
|
"Switch"
|
|
4204
4377
|
));
|
|
4205
|
-
}
|
|
4378
|
+
});
|
|
4206
4379
|
const markdownComponents = (0, import_react11.useMemo)(() => ({
|
|
4207
4380
|
code: CodeBlock,
|
|
4208
4381
|
"agent-suggestion": (_a) => {
|
|
@@ -4245,7 +4418,15 @@ ${followOnPrompt}`;
|
|
|
4245
4418
|
))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ai-chat-thinking__content" }, cleanContentForDisplay(currentBlock.content)));
|
|
4246
4419
|
}, [thinkingBlocks, currentThinkingIndex, cleanContentForDisplay]);
|
|
4247
4420
|
const panelClasses = ["ai-chat-panel", theme === "dark" ? "dark-theme" : ""].filter(Boolean).join(" ");
|
|
4248
|
-
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(
|
|
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) => {
|
|
4249
4430
|
const isLastEntry = index === entries.length - 1;
|
|
4250
4431
|
const isSystemMessage = prompt.startsWith("__system__:");
|
|
4251
4432
|
const { cleanedText } = processThinkingTags(entry.content);
|
|
@@ -4266,31 +4447,33 @@ ${followOnPrompt}`;
|
|
|
4266
4447
|
components: markdownComponents
|
|
4267
4448
|
},
|
|
4268
4449
|
processedContent
|
|
4269
|
-
))),
|
|
4270
|
-
|
|
4450
|
+
))), (!isLastEntry || !isLoading) && /* @__PURE__ */ import_react11.default.createElement("div", { className: "ai-chat-message__actions" }, /* @__PURE__ */ import_react11.default.createElement(
|
|
4451
|
+
"button",
|
|
4271
4452
|
{
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4453
|
+
className: "ai-chat-action-button",
|
|
4454
|
+
onClick: () => copyToClipboard(entry.content, entry.callId),
|
|
4455
|
+
title: copiedCallId === entry.callId ? "Copied!" : "Copy"
|
|
4275
4456
|
},
|
|
4276
|
-
/* @__PURE__ */ import_react11.default.createElement(
|
|
4277
|
-
)
|
|
4278
|
-
|
|
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",
|
|
4279
4460
|
{
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
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
|
|
4283
4465
|
},
|
|
4284
|
-
/* @__PURE__ */ import_react11.default.createElement(
|
|
4285
|
-
)
|
|
4286
|
-
|
|
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",
|
|
4287
4469
|
{
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
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
|
|
4291
4474
|
},
|
|
4292
|
-
/* @__PURE__ */ import_react11.default.createElement(
|
|
4293
|
-
))))
|
|
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
|
+
))));
|
|
4294
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(
|
|
4295
4478
|
Button,
|
|
4296
4479
|
{
|
|
@@ -4542,7 +4725,7 @@ var PlusIcon = () => /* @__PURE__ */ import_react13.default.createElement("svg",
|
|
|
4542
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" }));
|
|
4543
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" }));
|
|
4544
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" }));
|
|
4545
|
-
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" }));
|
|
4546
4729
|
var LoadingDotIcon = () => /* @__PURE__ */ import_react13.default.createElement("span", { className: "ai-agent-panel__loading-dot" });
|
|
4547
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" }));
|
|
4548
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" }));
|
|
@@ -5826,7 +6009,7 @@ var AIAgentPanel = import_react13.default.forwardRef(({
|
|
|
5826
6009
|
onClick: (e) => handleCloseConversation(activeConv.conversationId, e),
|
|
5827
6010
|
title: "Close conversation"
|
|
5828
6011
|
},
|
|
5829
|
-
/* @__PURE__ */ import_react13.default.createElement(
|
|
6012
|
+
/* @__PURE__ */ import_react13.default.createElement(CloseIcon2, null)
|
|
5830
6013
|
)
|
|
5831
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(
|
|
5832
6015
|
"div",
|