@axiom-lattice/react-sdk 2.1.21 → 2.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +837 -413
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +804 -355
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -49,6 +49,7 @@ __export(index_exports, {
|
|
|
49
49
|
LatticeChatShellContextProvider: () => LatticeChatShellContextProvider,
|
|
50
50
|
MDResponse: () => MDResponse,
|
|
51
51
|
MDViewFormItem: () => MDViewFormItem,
|
|
52
|
+
ScheduleButton: () => ScheduleButton,
|
|
52
53
|
SideAppViewBrowser: () => SideAppViewBrowser,
|
|
53
54
|
getElement: () => getElement,
|
|
54
55
|
regsiterElement: () => regsiterElement,
|
|
@@ -197,7 +198,7 @@ function useChat(threadId, options = {}) {
|
|
|
197
198
|
stopStreamingRef.current = null;
|
|
198
199
|
}
|
|
199
200
|
const { input, command, streaming = true } = data;
|
|
200
|
-
const { message:
|
|
201
|
+
const { message: message6, files, ...rest } = input || {};
|
|
201
202
|
setState((prev) => ({
|
|
202
203
|
...prev,
|
|
203
204
|
isLoading: true,
|
|
@@ -206,7 +207,7 @@ function useChat(threadId, options = {}) {
|
|
|
206
207
|
}));
|
|
207
208
|
const userMessage = {
|
|
208
209
|
id: Date.now().toString(),
|
|
209
|
-
content:
|
|
210
|
+
content: message6 || command?.resume?.message || "",
|
|
210
211
|
files,
|
|
211
212
|
role: "human"
|
|
212
213
|
};
|
|
@@ -535,7 +536,7 @@ function AgentThreadProvider({
|
|
|
535
536
|
stopStreamingRef.current = null;
|
|
536
537
|
}
|
|
537
538
|
const { input, command, streaming = true } = data;
|
|
538
|
-
const { message:
|
|
539
|
+
const { message: message6, files, ...rest } = input || {};
|
|
539
540
|
setState((prev) => ({
|
|
540
541
|
...prev,
|
|
541
542
|
isLoading: true,
|
|
@@ -543,7 +544,7 @@ function AgentThreadProvider({
|
|
|
543
544
|
}));
|
|
544
545
|
const userMessage = {
|
|
545
546
|
id: Date.now().toString(),
|
|
546
|
-
content:
|
|
547
|
+
content: message6 || command?.resume?.message || "",
|
|
547
548
|
files,
|
|
548
549
|
role: "human"
|
|
549
550
|
};
|
|
@@ -1330,7 +1331,7 @@ var ColumnLayout = ({
|
|
|
1330
1331
|
};
|
|
1331
1332
|
|
|
1332
1333
|
// src/components/Chat/SideAppViewBrowser.tsx
|
|
1333
|
-
var
|
|
1334
|
+
var import_icons15 = require("@ant-design/icons");
|
|
1334
1335
|
|
|
1335
1336
|
// src/components/GenUI/elements/confirm_feedback.tsx
|
|
1336
1337
|
var import_antd2 = require("antd");
|
|
@@ -1417,7 +1418,7 @@ var import_icons = require("@ant-design/icons");
|
|
|
1417
1418
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1418
1419
|
var { Text } = import_antd.Typography;
|
|
1419
1420
|
var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = true }) => {
|
|
1420
|
-
const { dataSource, message:
|
|
1421
|
+
const { dataSource, message: message6 } = data ?? {};
|
|
1421
1422
|
const [expandedRowKeys, setExpandedRowKeys] = (0, import_react8.useState)([]);
|
|
1422
1423
|
const { openSideApp } = useChatUIContext();
|
|
1423
1424
|
const processedData = dataSource?.map((item, index) => ({
|
|
@@ -1501,7 +1502,7 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
|
|
|
1501
1502
|
{
|
|
1502
1503
|
size: "small",
|
|
1503
1504
|
title: () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_antd.Flex, { justify: "space-between", align: "center", children: [
|
|
1504
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { strong: true, style: { fontSize: 16 }, children:
|
|
1505
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { strong: true, style: { fontSize: 16 }, children: message6 || "" }) }),
|
|
1505
1506
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_antd.Space, { children: [
|
|
1506
1507
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1507
1508
|
import_antd.Button,
|
|
@@ -1522,8 +1523,8 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
|
|
|
1522
1523
|
onClick: () => {
|
|
1523
1524
|
openSideApp({
|
|
1524
1525
|
component_key: "generic_data_table",
|
|
1525
|
-
message:
|
|
1526
|
-
data: { dataSource, message:
|
|
1526
|
+
message: message6 || "",
|
|
1527
|
+
data: { dataSource, message: message6 }
|
|
1527
1528
|
});
|
|
1528
1529
|
},
|
|
1529
1530
|
children: [
|
|
@@ -1679,11 +1680,11 @@ var ConfirmFeedback = ({
|
|
|
1679
1680
|
data,
|
|
1680
1681
|
interactive = true
|
|
1681
1682
|
}) => {
|
|
1682
|
-
const { message:
|
|
1683
|
+
const { message: message6, type, config, feedback, options } = data ?? {};
|
|
1683
1684
|
const { sendMessage } = useAgentChat();
|
|
1684
1685
|
const [clicked, setClicked] = (0, import_react10.useState)(false);
|
|
1685
1686
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_antd2.Space, { direction: "vertical", style: { width: "100%" }, children: [
|
|
1686
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MDResponse, { content:
|
|
1687
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MDResponse, { content: message6 }),
|
|
1687
1688
|
options ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd2.Space, { style: { justifyContent: "flex-end", width: "100%" }, children: options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1688
1689
|
import_antd2.Button,
|
|
1689
1690
|
{
|
|
@@ -2081,7 +2082,7 @@ var Todo = ({
|
|
|
2081
2082
|
}) => {
|
|
2082
2083
|
const { styles } = useStyle3();
|
|
2083
2084
|
const [isExpanded, setIsExpanded] = (0, import_react11.useState)(false);
|
|
2084
|
-
const
|
|
2085
|
+
const getStatusIcon3 = (status) => {
|
|
2085
2086
|
switch (status) {
|
|
2086
2087
|
case "completed":
|
|
2087
2088
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons4.CheckCircleOutlined, { style: { color: "#52c41a" } });
|
|
@@ -2093,7 +2094,7 @@ var Todo = ({
|
|
|
2093
2094
|
return null;
|
|
2094
2095
|
}
|
|
2095
2096
|
};
|
|
2096
|
-
const
|
|
2097
|
+
const getStatusColor2 = (status) => {
|
|
2097
2098
|
switch (status) {
|
|
2098
2099
|
case "completed":
|
|
2099
2100
|
return "success";
|
|
@@ -2173,7 +2174,7 @@ var Todo = ({
|
|
|
2173
2174
|
{
|
|
2174
2175
|
className: `${styles.todoItem} ${getItemClassName(item.status)}`,
|
|
2175
2176
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_antd5.Space, { align: "center", style: { width: "100%" }, children: [
|
|
2176
|
-
|
|
2177
|
+
getStatusIcon3(item.status),
|
|
2177
2178
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text4, { style: { flex: 1 }, children: item.content })
|
|
2178
2179
|
] })
|
|
2179
2180
|
}
|
|
@@ -2668,7 +2669,7 @@ var AttachmentsCard = ({
|
|
|
2668
2669
|
columns = 1,
|
|
2669
2670
|
showDownloadButton = false
|
|
2670
2671
|
}) => {
|
|
2671
|
-
const { Text:
|
|
2672
|
+
const { Text: Text15 } = import_antd8.Typography;
|
|
2672
2673
|
const [showAll, setShowAll] = (0, import_react13.useState)(false);
|
|
2673
2674
|
const { openSideApp } = useChatUIContext();
|
|
2674
2675
|
const getStyles = () => {
|
|
@@ -2743,7 +2744,7 @@ var AttachmentsCard = ({
|
|
|
2743
2744
|
);
|
|
2744
2745
|
};
|
|
2745
2746
|
const renderFileDescription = (item) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_antd8.Space, { direction: "vertical", size: size === "small" ? 2 : 4, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_antd8.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2746
|
-
|
|
2747
|
+
Text15,
|
|
2747
2748
|
{
|
|
2748
2749
|
type: "secondary",
|
|
2749
2750
|
style: {
|
|
@@ -2815,7 +2816,7 @@ var AttachmentsCard = ({
|
|
|
2815
2816
|
}
|
|
2816
2817
|
),
|
|
2817
2818
|
item.files && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { paddingLeft: "12px" }, children: [
|
|
2818
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2819
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Text15, { type: "secondary", style: { fontSize: "12px" }, children: [
|
|
2819
2820
|
"\u5305\u542B\u6587\u4EF6(",
|
|
2820
2821
|
item.files.length,
|
|
2821
2822
|
")"
|
|
@@ -3452,10 +3453,10 @@ var TaskCard = ({
|
|
|
3452
3453
|
};
|
|
3453
3454
|
|
|
3454
3455
|
// src/components/GenUI/elements/task_detail.tsx
|
|
3455
|
-
var
|
|
3456
|
+
var import_antd21 = require("antd");
|
|
3456
3457
|
|
|
3457
3458
|
// src/components/Chat/Chating.tsx
|
|
3458
|
-
var
|
|
3459
|
+
var import_icons12 = require("@ant-design/icons");
|
|
3459
3460
|
var import_x5 = require("@ant-design/x");
|
|
3460
3461
|
|
|
3461
3462
|
// src/components/Chat/MessageList.tsx
|
|
@@ -3465,7 +3466,7 @@ var import_ErrorBoundary = __toESM(require("antd/es/alert/ErrorBoundary"));
|
|
|
3465
3466
|
var import_react16 = require("react");
|
|
3466
3467
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3467
3468
|
var LazyBubble = ({
|
|
3468
|
-
message:
|
|
3469
|
+
message: message6,
|
|
3469
3470
|
renderContent,
|
|
3470
3471
|
autoLoadRightPanel
|
|
3471
3472
|
}) => {
|
|
@@ -3496,10 +3497,10 @@ var LazyBubble = ({
|
|
|
3496
3497
|
autoLoadRightPanel?.();
|
|
3497
3498
|
}, []);
|
|
3498
3499
|
const getPlaceholder = () => {
|
|
3499
|
-
const estimatedHeight =
|
|
3500
|
+
const estimatedHeight = message6.content ? Math.min(100, message6.content.length / 5) : 100;
|
|
3500
3501
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { height: `${estimatedHeight}px`, minHeight: "50px" } });
|
|
3501
3502
|
};
|
|
3502
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ErrorBoundary.default, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(
|
|
3503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ErrorBoundary.default, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message6) : getPlaceholder() }) });
|
|
3503
3504
|
};
|
|
3504
3505
|
var MemoizedBubbleList = (0, import_react16.memo)(
|
|
3505
3506
|
({
|
|
@@ -3530,8 +3531,8 @@ var MessageList = ({
|
|
|
3530
3531
|
messageLengthRef.current = messages?.length;
|
|
3531
3532
|
}
|
|
3532
3533
|
}, [messages?.length]);
|
|
3533
|
-
const renderContent = (0, import_react16.useCallback)((
|
|
3534
|
-
const { content } =
|
|
3534
|
+
const renderContent = (0, import_react16.useCallback)((message6) => {
|
|
3535
|
+
const { content } = message6;
|
|
3535
3536
|
try {
|
|
3536
3537
|
const json = JSON.parse(content);
|
|
3537
3538
|
if (json.action && json.message) {
|
|
@@ -3539,7 +3540,7 @@ var MessageList = ({
|
|
|
3539
3540
|
}
|
|
3540
3541
|
} catch (error) {
|
|
3541
3542
|
}
|
|
3542
|
-
const tool_calls_md =
|
|
3543
|
+
const tool_calls_md = message6.tool_calls?.map((tool_call) => {
|
|
3543
3544
|
return `\`\`\`tool_call
|
|
3544
3545
|
${JSON.stringify(tool_call)}
|
|
3545
3546
|
\`\`\``;
|
|
@@ -3548,17 +3549,17 @@ ${JSON.stringify(tool_call)}
|
|
|
3548
3549
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_antd14.Space, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MDResponse, { content: content_md }) });
|
|
3549
3550
|
}, []);
|
|
3550
3551
|
const items = (0, import_react16.useMemo)(
|
|
3551
|
-
() => messages.map((
|
|
3552
|
-
key:
|
|
3553
|
-
role:
|
|
3552
|
+
() => messages.map((message6, index) => ({
|
|
3553
|
+
key: message6.id,
|
|
3554
|
+
role: message6.role,
|
|
3554
3555
|
typing: false,
|
|
3555
3556
|
content: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3556
3557
|
LazyBubble,
|
|
3557
3558
|
{
|
|
3558
|
-
message:
|
|
3559
|
+
message: message6,
|
|
3559
3560
|
renderContent,
|
|
3560
3561
|
autoLoadRightPanel: () => {
|
|
3561
|
-
const { content, role: role2 } =
|
|
3562
|
+
const { content, role: role2 } = message6;
|
|
3562
3563
|
const isNewAddedMessage = messageLengthRef.current > 1 && messageLengthRef.current + 1 === messages.length;
|
|
3563
3564
|
if (index === messages.length - 1 && isNewAddedMessage && role2 === "ai") {
|
|
3564
3565
|
try {
|
|
@@ -3625,8 +3626,8 @@ ${JSON.stringify(tool_call)}
|
|
|
3625
3626
|
};
|
|
3626
3627
|
|
|
3627
3628
|
// src/components/Chat/Chating.tsx
|
|
3628
|
-
var
|
|
3629
|
-
var
|
|
3629
|
+
var import_antd20 = require("antd");
|
|
3630
|
+
var import_react19 = __toESM(require("react"));
|
|
3630
3631
|
|
|
3631
3632
|
// src/components/GenUI/HITLContainer.tsx
|
|
3632
3633
|
var import_antd15 = require("antd");
|
|
@@ -3683,7 +3684,7 @@ var HITLContainer = () => {
|
|
|
3683
3684
|
};
|
|
3684
3685
|
|
|
3685
3686
|
// src/components/Chat/AgentHeader.tsx
|
|
3686
|
-
var
|
|
3687
|
+
var import_antd19 = require("antd");
|
|
3687
3688
|
|
|
3688
3689
|
// src/components/Chat/TodoProgress.tsx
|
|
3689
3690
|
var import_antd16 = require("antd");
|
|
@@ -3766,14 +3767,76 @@ var FileExplorerButton = ({}) => {
|
|
|
3766
3767
|
) }) });
|
|
3767
3768
|
};
|
|
3768
3769
|
|
|
3769
|
-
// src/components/Chat/
|
|
3770
|
-
var import_x4 = require("@ant-design/x");
|
|
3770
|
+
// src/components/Chat/ScheduleButton.tsx
|
|
3771
3771
|
var import_react17 = require("react");
|
|
3772
|
+
var import_antd18 = require("antd");
|
|
3773
|
+
var import_icons11 = require("@ant-design/icons");
|
|
3774
|
+
var import_client_sdk4 = require("@axiom-lattice/client-sdk");
|
|
3772
3775
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3773
|
-
var
|
|
3776
|
+
var ScheduleButton = ({
|
|
3777
|
+
tooltipText = "Scheduled Tasks"
|
|
3778
|
+
}) => {
|
|
3779
|
+
const { threadId, assistantId } = useAgentChat();
|
|
3780
|
+
const { openSideApp } = useChatUIContext();
|
|
3781
|
+
const client = useAxiomLattice({ assistantId });
|
|
3782
|
+
const [scheduledTasks, setScheduledTasks] = (0, import_react17.useState)([]);
|
|
3783
|
+
const [loading, setLoading] = (0, import_react17.useState)(false);
|
|
3784
|
+
const [taskCount, setTaskCount] = (0, import_react17.useState)(0);
|
|
3785
|
+
const fetchScheduledTasks = (0, import_react17.useCallback)(async () => {
|
|
3786
|
+
if (!threadId) return;
|
|
3787
|
+
setLoading(true);
|
|
3788
|
+
try {
|
|
3789
|
+
const tasks = await client.schedules.getByThread({ threadId });
|
|
3790
|
+
setScheduledTasks(tasks);
|
|
3791
|
+
const activeCount = tasks.filter(
|
|
3792
|
+
(task) => task.status === import_client_sdk4.ScheduledTaskStatus.PENDING || task.status === import_client_sdk4.ScheduledTaskStatus.PAUSED
|
|
3793
|
+
).length;
|
|
3794
|
+
setTaskCount(activeCount);
|
|
3795
|
+
} catch (error) {
|
|
3796
|
+
console.error("Failed to fetch scheduled tasks:", error);
|
|
3797
|
+
setScheduledTasks([]);
|
|
3798
|
+
setTaskCount(0);
|
|
3799
|
+
} finally {
|
|
3800
|
+
setLoading(false);
|
|
3801
|
+
}
|
|
3802
|
+
}, [client, threadId]);
|
|
3803
|
+
(0, import_react17.useEffect)(() => {
|
|
3804
|
+
fetchScheduledTasks();
|
|
3805
|
+
}, [fetchScheduledTasks]);
|
|
3806
|
+
if (!threadId) {
|
|
3807
|
+
return null;
|
|
3808
|
+
}
|
|
3809
|
+
const handleClick = () => {
|
|
3810
|
+
openSideApp({
|
|
3811
|
+
component_key: "schedule_viewer",
|
|
3812
|
+
message: "Scheduled Tasks",
|
|
3813
|
+
data: {
|
|
3814
|
+
threadId,
|
|
3815
|
+
assistantId,
|
|
3816
|
+
tasks: scheduledTasks,
|
|
3817
|
+
onRefresh: fetchScheduledTasks
|
|
3818
|
+
}
|
|
3819
|
+
});
|
|
3820
|
+
};
|
|
3821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_antd18.Tooltip, { title: tooltipText, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_antd18.Badge, { count: taskCount, size: "small", color: "blue", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3822
|
+
import_antd18.Button,
|
|
3823
|
+
{
|
|
3824
|
+
type: "text",
|
|
3825
|
+
icon: loading ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_antd18.Spin, { size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_icons11.CalendarOutlined, {}),
|
|
3826
|
+
onClick: handleClick,
|
|
3827
|
+
disabled: loading
|
|
3828
|
+
}
|
|
3829
|
+
) }) });
|
|
3830
|
+
};
|
|
3831
|
+
|
|
3832
|
+
// src/components/Chat/AgentHeader.tsx
|
|
3833
|
+
var import_x4 = require("@ant-design/x");
|
|
3834
|
+
var import_react18 = require("react");
|
|
3835
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3836
|
+
var { Text: Text10 } = import_antd19.Typography;
|
|
3774
3837
|
var AgentHeader = (props) => {
|
|
3775
3838
|
const { description, avatar, name, extra, extraMeta } = props;
|
|
3776
|
-
const extraMetaComponents = (0,
|
|
3839
|
+
const extraMetaComponents = (0, import_react18.useMemo)(() => {
|
|
3777
3840
|
if (extraMeta && extraMeta.length > 0) {
|
|
3778
3841
|
return extraMeta.map((meta) => {
|
|
3779
3842
|
const Element = getElement(meta.id)?.card_view;
|
|
@@ -3782,7 +3845,7 @@ var AgentHeader = (props) => {
|
|
|
3782
3845
|
try {
|
|
3783
3846
|
} catch (error) {
|
|
3784
3847
|
}
|
|
3785
|
-
return /* @__PURE__ */ (0,
|
|
3848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3786
3849
|
Element,
|
|
3787
3850
|
{
|
|
3788
3851
|
component_key: meta.id,
|
|
@@ -3795,14 +3858,14 @@ var AgentHeader = (props) => {
|
|
|
3795
3858
|
}
|
|
3796
3859
|
return void 0;
|
|
3797
3860
|
}, [extraMeta]);
|
|
3798
|
-
return /* @__PURE__ */ (0,
|
|
3799
|
-
/* @__PURE__ */ (0,
|
|
3861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
3862
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3800
3863
|
import_x4.Welcome,
|
|
3801
3864
|
{
|
|
3802
3865
|
style: { padding: 8 },
|
|
3803
3866
|
variant: "borderless",
|
|
3804
|
-
description: description ? /* @__PURE__ */ (0,
|
|
3805
|
-
icon: /* @__PURE__ */ (0,
|
|
3867
|
+
description: description ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Text10, { ellipsis: { tooltip: description }, children: description }) : void 0,
|
|
3868
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3806
3869
|
"div",
|
|
3807
3870
|
{
|
|
3808
3871
|
style: {
|
|
@@ -3810,19 +3873,20 @@ var AgentHeader = (props) => {
|
|
|
3810
3873
|
alignItems: "center",
|
|
3811
3874
|
justifyContent: "center"
|
|
3812
3875
|
},
|
|
3813
|
-
children: avatar ? /* @__PURE__ */ (0,
|
|
3876
|
+
children: avatar ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_antd19.Avatar, { src: avatar, size: 48 }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_antd19.Avatar, { size: 48, children: name?.charAt(0).toUpperCase() })
|
|
3814
3877
|
}
|
|
3815
3878
|
),
|
|
3816
3879
|
title: name ? name : void 0,
|
|
3817
|
-
extra: /* @__PURE__ */ (0,
|
|
3880
|
+
extra: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_antd19.Space, { children: [
|
|
3818
3881
|
extra,
|
|
3819
|
-
/* @__PURE__ */ (0,
|
|
3820
|
-
/* @__PURE__ */ (0,
|
|
3821
|
-
|
|
3882
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TodoProgress, {}),
|
|
3883
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FileExplorerButton, {}),
|
|
3884
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ScheduleButton, {}),
|
|
3885
|
+
extraMetaComponents && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_antd19.Space, { align: "center", style: { marginRight: 16 }, children: extraMetaComponents })
|
|
3822
3886
|
] })
|
|
3823
3887
|
}
|
|
3824
3888
|
),
|
|
3825
|
-
/* @__PURE__ */ (0,
|
|
3889
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3826
3890
|
"div",
|
|
3827
3891
|
{
|
|
3828
3892
|
style: {
|
|
@@ -3834,7 +3898,7 @@ var AgentHeader = (props) => {
|
|
|
3834
3898
|
};
|
|
3835
3899
|
|
|
3836
3900
|
// src/components/Chat/Chating.tsx
|
|
3837
|
-
var
|
|
3901
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3838
3902
|
var Chating = ({
|
|
3839
3903
|
avatar,
|
|
3840
3904
|
name,
|
|
@@ -3850,12 +3914,12 @@ var Chating = ({
|
|
|
3850
3914
|
showHITL = true,
|
|
3851
3915
|
showRefreshButton = false
|
|
3852
3916
|
}) => {
|
|
3853
|
-
const [content, setContent] = (0,
|
|
3854
|
-
const [attachedFiles, setAttachedFiles] = (0,
|
|
3917
|
+
const [content, setContent] = (0, import_react19.useState)("");
|
|
3918
|
+
const [attachedFiles, setAttachedFiles] = (0, import_react19.useState)([]);
|
|
3855
3919
|
const { styles } = useStyle();
|
|
3856
|
-
const [headerOpen, setHeaderOpen] = (0,
|
|
3857
|
-
const attachmentsRef = (0,
|
|
3858
|
-
const senderRef =
|
|
3920
|
+
const [headerOpen, setHeaderOpen] = (0, import_react19.useState)(false);
|
|
3921
|
+
const attachmentsRef = (0, import_react19.useRef)(null);
|
|
3922
|
+
const senderRef = import_react19.default.useRef(null);
|
|
3859
3923
|
const {
|
|
3860
3924
|
messages,
|
|
3861
3925
|
sendMessage,
|
|
@@ -3867,7 +3931,7 @@ var Chating = ({
|
|
|
3867
3931
|
tenantId,
|
|
3868
3932
|
clearError
|
|
3869
3933
|
} = useAgentChat();
|
|
3870
|
-
(0,
|
|
3934
|
+
(0, import_react19.useEffect)(() => {
|
|
3871
3935
|
regsiterElement("action_show_attachments_uploader", {
|
|
3872
3936
|
card_view: () => null,
|
|
3873
3937
|
action: (data) => {
|
|
@@ -3889,7 +3953,7 @@ var Chating = ({
|
|
|
3889
3953
|
const onSubmit = (nextContent) => {
|
|
3890
3954
|
if (!nextContent && attachedFiles.length === 0) return;
|
|
3891
3955
|
if (attachedFiles.filter((f) => f.status !== "done").length > 0) {
|
|
3892
|
-
|
|
3956
|
+
import_antd20.message.warning("\u6587\u4EF6\u8FD8\u5728\u4E0A\u4F20\u4E2D...");
|
|
3893
3957
|
return;
|
|
3894
3958
|
}
|
|
3895
3959
|
if (!nextContent && attachedFiles.length > 0) {
|
|
@@ -3933,7 +3997,7 @@ var Chating = ({
|
|
|
3933
3997
|
setHeaderOpen(true);
|
|
3934
3998
|
}
|
|
3935
3999
|
if (info.file?.response?.error || info.file.status === "error") {
|
|
3936
|
-
|
|
4000
|
+
import_antd20.message.error(
|
|
3937
4001
|
`${info.file.name} file upload failed.${info.file?.response?.message}`
|
|
3938
4002
|
);
|
|
3939
4003
|
}
|
|
@@ -3945,22 +4009,22 @@ var Chating = ({
|
|
|
3945
4009
|
const beforeUpload = (file) => {
|
|
3946
4010
|
const isLessThan20MB = file.size / 1024 / 1024 < 20;
|
|
3947
4011
|
if (!isLessThan20MB) {
|
|
3948
|
-
|
|
4012
|
+
import_antd20.message.error(
|
|
3949
4013
|
`File must be smaller than 20MB! ${file.name} is too large.`
|
|
3950
4014
|
);
|
|
3951
4015
|
return false;
|
|
3952
4016
|
}
|
|
3953
4017
|
return true;
|
|
3954
4018
|
};
|
|
3955
|
-
const attachmentsNode = /* @__PURE__ */ (0,
|
|
3956
|
-
|
|
4019
|
+
const attachmentsNode = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_antd20.Badge, { dot: attachedFiles.length > 0 && !headerOpen, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4020
|
+
import_antd20.Button,
|
|
3957
4021
|
{
|
|
3958
4022
|
type: "text",
|
|
3959
|
-
icon: /* @__PURE__ */ (0,
|
|
4023
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_icons12.PaperClipOutlined, {}),
|
|
3960
4024
|
onClick: () => setHeaderOpen(!headerOpen)
|
|
3961
4025
|
}
|
|
3962
4026
|
) });
|
|
3963
|
-
const senderHeader = /* @__PURE__ */ (0,
|
|
4027
|
+
const senderHeader = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3964
4028
|
import_x5.Sender.Header,
|
|
3965
4029
|
{
|
|
3966
4030
|
title: "Attachments",
|
|
@@ -3972,7 +4036,7 @@ var Chating = ({
|
|
|
3972
4036
|
}
|
|
3973
4037
|
},
|
|
3974
4038
|
forceRender: true,
|
|
3975
|
-
children: /* @__PURE__ */ (0,
|
|
4039
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3976
4040
|
import_x5.Attachments,
|
|
3977
4041
|
{
|
|
3978
4042
|
ref: attachmentsRef,
|
|
@@ -3994,7 +4058,7 @@ var Chating = ({
|
|
|
3994
4058
|
multiple: true,
|
|
3995
4059
|
maxCount: 10,
|
|
3996
4060
|
placeholder: (type) => ({
|
|
3997
|
-
icon: /* @__PURE__ */ (0,
|
|
4061
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_icons12.CloudUploadOutlined, {}),
|
|
3998
4062
|
title: "\u4E0A\u4F20\u6587\u4EF6",
|
|
3999
4063
|
description: attachment_placeholder
|
|
4000
4064
|
})
|
|
@@ -4002,19 +4066,19 @@ var Chating = ({
|
|
|
4002
4066
|
)
|
|
4003
4067
|
}
|
|
4004
4068
|
);
|
|
4005
|
-
const refreshButton = /* @__PURE__ */ (0,
|
|
4006
|
-
|
|
4069
|
+
const refreshButton = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4070
|
+
import_antd20.Button,
|
|
4007
4071
|
{
|
|
4008
4072
|
type: "text",
|
|
4009
|
-
icon: /* @__PURE__ */ (0,
|
|
4073
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_icons12.ReloadOutlined, {}),
|
|
4010
4074
|
onClick: () => {
|
|
4011
4075
|
loadMessages();
|
|
4012
4076
|
}
|
|
4013
4077
|
}
|
|
4014
4078
|
);
|
|
4015
4079
|
const headerExtra = showRefreshButton ? [refreshButton] : [];
|
|
4016
|
-
return /* @__PURE__ */ (0,
|
|
4017
|
-
/* @__PURE__ */ (0,
|
|
4080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
4081
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: showHeader && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4018
4082
|
AgentHeader,
|
|
4019
4083
|
{
|
|
4020
4084
|
description,
|
|
@@ -4024,10 +4088,10 @@ var Chating = ({
|
|
|
4024
4088
|
extraMeta
|
|
4025
4089
|
}
|
|
4026
4090
|
) }),
|
|
4027
|
-
/* @__PURE__ */ (0,
|
|
4028
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
4029
|
-
error && /* @__PURE__ */ (0,
|
|
4030
|
-
|
|
4091
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(MessageList, { messages, className: styles.messages }),
|
|
4092
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", {}) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_x5.Prompts, { items: senderPromptsItems, onItemClick: onPromptsItemClick }),
|
|
4093
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { style: { padding: "0 16px 8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4094
|
+
import_antd20.Alert,
|
|
4031
4095
|
{
|
|
4032
4096
|
type: "error",
|
|
4033
4097
|
banner: true,
|
|
@@ -4036,8 +4100,8 @@ var Chating = ({
|
|
|
4036
4100
|
message: `${error.message}`
|
|
4037
4101
|
}
|
|
4038
4102
|
) }),
|
|
4039
|
-
showHITL && /* @__PURE__ */ (0,
|
|
4040
|
-
showSender && /* @__PURE__ */ (0,
|
|
4103
|
+
showHITL && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(HITLContainer, {}),
|
|
4104
|
+
showSender && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4041
4105
|
import_x5.Sender,
|
|
4042
4106
|
{
|
|
4043
4107
|
disabled: interrupts && interrupts.length > 0,
|
|
@@ -4063,11 +4127,11 @@ var Chating = ({
|
|
|
4063
4127
|
};
|
|
4064
4128
|
|
|
4065
4129
|
// src/components/GenUI/elements/task_detail.tsx
|
|
4066
|
-
var
|
|
4067
|
-
var { Text: Text11 } =
|
|
4130
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4131
|
+
var { Text: Text11 } = import_antd21.Typography;
|
|
4068
4132
|
var TaskDetail = ({ data, component_key, interactive = true }) => {
|
|
4069
4133
|
const { description, subagent_type, thread_id } = data || {};
|
|
4070
|
-
return /* @__PURE__ */ (0,
|
|
4134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4071
4135
|
AgentThreadProvider,
|
|
4072
4136
|
{
|
|
4073
4137
|
threadId: thread_id,
|
|
@@ -4077,7 +4141,7 @@ var TaskDetail = ({ data, component_key, interactive = true }) => {
|
|
|
4077
4141
|
enableReturnStateWhenStreamCompleted: true,
|
|
4078
4142
|
enableResumeStream: true
|
|
4079
4143
|
},
|
|
4080
|
-
children: /* @__PURE__ */ (0,
|
|
4144
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { style: { overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4081
4145
|
Chating,
|
|
4082
4146
|
{
|
|
4083
4147
|
showRefreshButton: true,
|
|
@@ -4092,11 +4156,11 @@ var TaskDetail = ({ data, component_key, interactive = true }) => {
|
|
|
4092
4156
|
};
|
|
4093
4157
|
|
|
4094
4158
|
// src/components/GenUI/elements/internet_search_card.tsx
|
|
4095
|
-
var
|
|
4096
|
-
var
|
|
4159
|
+
var import_antd22 = require("antd");
|
|
4160
|
+
var import_icons13 = require("@ant-design/icons");
|
|
4097
4161
|
var import_antd_style9 = require("antd-style");
|
|
4098
|
-
var
|
|
4099
|
-
var { Text: Text12 } =
|
|
4162
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4163
|
+
var { Text: Text12 } = import_antd22.Typography;
|
|
4100
4164
|
var useStyle7 = (0, import_antd_style9.createStyles)(({ token, css }) => ({
|
|
4101
4165
|
listContainer: css`
|
|
4102
4166
|
background: ${token.colorBgContainer};
|
|
@@ -4210,18 +4274,18 @@ var InternetSearchCard = ({
|
|
|
4210
4274
|
if (!toolCallData) {
|
|
4211
4275
|
return null;
|
|
4212
4276
|
}
|
|
4213
|
-
const header = /* @__PURE__ */ (0,
|
|
4214
|
-
/* @__PURE__ */ (0,
|
|
4215
|
-
/* @__PURE__ */ (0,
|
|
4277
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_antd22.Space, { children: [
|
|
4278
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text12, { strong: true, children: "Internet Search" }),
|
|
4279
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text12, { title: query, children: query })
|
|
4216
4280
|
] });
|
|
4217
|
-
return /* @__PURE__ */ (0,
|
|
4281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4218
4282
|
ContentPreviewCollapse,
|
|
4219
4283
|
{
|
|
4220
4284
|
panelKey: toolCallData.id,
|
|
4221
4285
|
header,
|
|
4222
|
-
expandIcon: () => /* @__PURE__ */ (0,
|
|
4223
|
-
children: /* @__PURE__ */ (0,
|
|
4224
|
-
|
|
4286
|
+
expandIcon: () => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons13.SearchOutlined, {}),
|
|
4287
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4288
|
+
import_antd22.List,
|
|
4225
4289
|
{
|
|
4226
4290
|
size: "small",
|
|
4227
4291
|
dataSource,
|
|
@@ -4230,11 +4294,11 @@ var InternetSearchCard = ({
|
|
|
4230
4294
|
const domain = getDomainFromUrl(url);
|
|
4231
4295
|
const iconText = getIconText(domain);
|
|
4232
4296
|
const iconColor = getIconColor(domain);
|
|
4233
|
-
return /* @__PURE__ */ (0,
|
|
4234
|
-
/* @__PURE__ */ (0,
|
|
4297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_antd22.List.Item, { extra: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text12, { className: styles.source, children: domain }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_antd22.Space, { style: { width: "100%" }, children: [
|
|
4298
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_antd22.Avatar, { style: { background: iconColor }, children: iconText }),
|
|
4235
4299
|
" ",
|
|
4236
|
-
/* @__PURE__ */ (0,
|
|
4237
|
-
|
|
4300
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4301
|
+
import_antd22.Button,
|
|
4238
4302
|
{
|
|
4239
4303
|
type: "text",
|
|
4240
4304
|
onClick: () => {
|
|
@@ -4255,6 +4319,361 @@ var InternetSearchCard = ({
|
|
|
4255
4319
|
);
|
|
4256
4320
|
};
|
|
4257
4321
|
|
|
4322
|
+
// src/components/GenUI/elements/schedule_viewer.tsx
|
|
4323
|
+
var import_react20 = require("react");
|
|
4324
|
+
var import_antd23 = require("antd");
|
|
4325
|
+
var import_icons14 = require("@ant-design/icons");
|
|
4326
|
+
var import_antd_style10 = require("antd-style");
|
|
4327
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
4328
|
+
var import_relativeTime = __toESM(require("dayjs/plugin/relativeTime"));
|
|
4329
|
+
var import_client_sdk5 = require("@axiom-lattice/client-sdk");
|
|
4330
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4331
|
+
import_dayjs2.default.extend(import_relativeTime.default);
|
|
4332
|
+
var { Text: Text13, Title: Title2 } = import_antd23.Typography;
|
|
4333
|
+
var useStyles3 = (0, import_antd_style10.createStyles)(({ token, css }) => ({
|
|
4334
|
+
container: css`
|
|
4335
|
+
height: 100%;
|
|
4336
|
+
padding: 16px;
|
|
4337
|
+
overflow: auto;
|
|
4338
|
+
background: ${token.colorBgContainer};
|
|
4339
|
+
`,
|
|
4340
|
+
header: css`
|
|
4341
|
+
display: flex;
|
|
4342
|
+
justify-content: space-between;
|
|
4343
|
+
align-items: center;
|
|
4344
|
+
margin-bottom: 16px;
|
|
4345
|
+
padding-bottom: 12px;
|
|
4346
|
+
border-bottom: 1px solid ${token.colorBorderSecondary};
|
|
4347
|
+
`,
|
|
4348
|
+
taskCard: css`
|
|
4349
|
+
margin-bottom: 12px;
|
|
4350
|
+
border-radius: ${token.borderRadiusLG}px;
|
|
4351
|
+
transition: box-shadow 0.2s;
|
|
4352
|
+
|
|
4353
|
+
&:hover {
|
|
4354
|
+
box-shadow: ${token.boxShadowSecondary};
|
|
4355
|
+
}
|
|
4356
|
+
`,
|
|
4357
|
+
taskHeader: css`
|
|
4358
|
+
display: flex;
|
|
4359
|
+
justify-content: space-between;
|
|
4360
|
+
align-items: flex-start;
|
|
4361
|
+
margin-bottom: 8px;
|
|
4362
|
+
`,
|
|
4363
|
+
taskType: css`
|
|
4364
|
+
font-weight: 600;
|
|
4365
|
+
font-size: 14px;
|
|
4366
|
+
color: ${token.colorText};
|
|
4367
|
+
`,
|
|
4368
|
+
taskId: css`
|
|
4369
|
+
font-family: monospace;
|
|
4370
|
+
font-size: 11px;
|
|
4371
|
+
color: ${token.colorTextSecondary};
|
|
4372
|
+
word-break: break-all;
|
|
4373
|
+
`,
|
|
4374
|
+
metaRow: css`
|
|
4375
|
+
display: flex;
|
|
4376
|
+
flex-wrap: wrap;
|
|
4377
|
+
gap: 16px;
|
|
4378
|
+
margin-top: 8px;
|
|
4379
|
+
`,
|
|
4380
|
+
metaItem: css`
|
|
4381
|
+
display: flex;
|
|
4382
|
+
align-items: center;
|
|
4383
|
+
gap: 6px;
|
|
4384
|
+
font-size: 12px;
|
|
4385
|
+
color: ${token.colorTextSecondary};
|
|
4386
|
+
`,
|
|
4387
|
+
actions: css`
|
|
4388
|
+
display: flex;
|
|
4389
|
+
gap: 4px;
|
|
4390
|
+
margin-top: 12px;
|
|
4391
|
+
padding-top: 12px;
|
|
4392
|
+
border-top: 1px solid ${token.colorBorderSecondary};
|
|
4393
|
+
`,
|
|
4394
|
+
emptyContainer: css`
|
|
4395
|
+
display: flex;
|
|
4396
|
+
flex-direction: column;
|
|
4397
|
+
align-items: center;
|
|
4398
|
+
justify-content: center;
|
|
4399
|
+
height: 300px;
|
|
4400
|
+
`,
|
|
4401
|
+
cronExpression: css`
|
|
4402
|
+
font-family: monospace;
|
|
4403
|
+
background: ${token.colorFillSecondary};
|
|
4404
|
+
padding: 2px 6px;
|
|
4405
|
+
border-radius: 4px;
|
|
4406
|
+
font-size: 12px;
|
|
4407
|
+
`
|
|
4408
|
+
}));
|
|
4409
|
+
var getStatusColor = (status) => {
|
|
4410
|
+
switch (status) {
|
|
4411
|
+
case import_client_sdk5.ScheduledTaskStatus.PENDING:
|
|
4412
|
+
return "processing";
|
|
4413
|
+
case import_client_sdk5.ScheduledTaskStatus.RUNNING:
|
|
4414
|
+
return "blue";
|
|
4415
|
+
case import_client_sdk5.ScheduledTaskStatus.COMPLETED:
|
|
4416
|
+
return "success";
|
|
4417
|
+
case import_client_sdk5.ScheduledTaskStatus.FAILED:
|
|
4418
|
+
return "error";
|
|
4419
|
+
case import_client_sdk5.ScheduledTaskStatus.CANCELLED:
|
|
4420
|
+
return "default";
|
|
4421
|
+
case import_client_sdk5.ScheduledTaskStatus.PAUSED:
|
|
4422
|
+
return "warning";
|
|
4423
|
+
default:
|
|
4424
|
+
return "default";
|
|
4425
|
+
}
|
|
4426
|
+
};
|
|
4427
|
+
var getStatusIcon2 = (status) => {
|
|
4428
|
+
switch (status) {
|
|
4429
|
+
case import_client_sdk5.ScheduledTaskStatus.PENDING:
|
|
4430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.ClockCircleOutlined, {});
|
|
4431
|
+
case import_client_sdk5.ScheduledTaskStatus.RUNNING:
|
|
4432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.SyncOutlined, { spin: true });
|
|
4433
|
+
case import_client_sdk5.ScheduledTaskStatus.COMPLETED:
|
|
4434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.CheckCircleOutlined, {});
|
|
4435
|
+
case import_client_sdk5.ScheduledTaskStatus.FAILED:
|
|
4436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.CloseCircleOutlined, {});
|
|
4437
|
+
case import_client_sdk5.ScheduledTaskStatus.CANCELLED:
|
|
4438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.StopOutlined, {});
|
|
4439
|
+
case import_client_sdk5.ScheduledTaskStatus.PAUSED:
|
|
4440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.PauseCircleOutlined, {});
|
|
4441
|
+
default:
|
|
4442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.ClockCircleOutlined, {});
|
|
4443
|
+
}
|
|
4444
|
+
};
|
|
4445
|
+
var formatTime = (timestamp) => {
|
|
4446
|
+
if (!timestamp) return "-";
|
|
4447
|
+
return (0, import_dayjs2.default)(timestamp).format("YYYY-MM-DD HH:mm:ss");
|
|
4448
|
+
};
|
|
4449
|
+
var getRelativeTime = (timestamp) => {
|
|
4450
|
+
if (!timestamp) return "";
|
|
4451
|
+
return (0, import_dayjs2.default)(timestamp).fromNow();
|
|
4452
|
+
};
|
|
4453
|
+
var ScheduleViewer = ({ data }) => {
|
|
4454
|
+
const { styles } = useStyles3();
|
|
4455
|
+
const { threadId, assistantId, tasks: initialTasks, onRefresh } = data ?? {};
|
|
4456
|
+
const client = useAxiomLattice({ assistantId });
|
|
4457
|
+
const [tasks, setTasks] = (0, import_react20.useState)(initialTasks || []);
|
|
4458
|
+
const [loading, setLoading] = (0, import_react20.useState)(false);
|
|
4459
|
+
const [actionLoading, setActionLoading] = (0, import_react20.useState)(null);
|
|
4460
|
+
const handleRefresh = (0, import_react20.useCallback)(async () => {
|
|
4461
|
+
if (!threadId) return;
|
|
4462
|
+
setLoading(true);
|
|
4463
|
+
try {
|
|
4464
|
+
const fetchedTasks = await client.schedules.getByThread({ threadId });
|
|
4465
|
+
setTasks(fetchedTasks);
|
|
4466
|
+
onRefresh?.();
|
|
4467
|
+
} catch (error) {
|
|
4468
|
+
console.error("Failed to refresh tasks:", error);
|
|
4469
|
+
import_antd23.message.error("Failed to refresh scheduled tasks");
|
|
4470
|
+
} finally {
|
|
4471
|
+
setLoading(false);
|
|
4472
|
+
}
|
|
4473
|
+
}, [client, threadId, onRefresh]);
|
|
4474
|
+
const handleCancel = (0, import_react20.useCallback)(
|
|
4475
|
+
async (taskId) => {
|
|
4476
|
+
setActionLoading(taskId);
|
|
4477
|
+
try {
|
|
4478
|
+
await client.schedules.cancel(taskId);
|
|
4479
|
+
import_antd23.message.success("Task cancelled successfully");
|
|
4480
|
+
await handleRefresh();
|
|
4481
|
+
} catch (error) {
|
|
4482
|
+
console.error("Failed to cancel task:", error);
|
|
4483
|
+
import_antd23.message.error("Failed to cancel task");
|
|
4484
|
+
} finally {
|
|
4485
|
+
setActionLoading(null);
|
|
4486
|
+
}
|
|
4487
|
+
},
|
|
4488
|
+
[client, handleRefresh]
|
|
4489
|
+
);
|
|
4490
|
+
const handlePause = (0, import_react20.useCallback)(
|
|
4491
|
+
async (taskId) => {
|
|
4492
|
+
setActionLoading(taskId);
|
|
4493
|
+
try {
|
|
4494
|
+
await client.schedules.pause(taskId);
|
|
4495
|
+
import_antd23.message.success("Task paused successfully");
|
|
4496
|
+
await handleRefresh();
|
|
4497
|
+
} catch (error) {
|
|
4498
|
+
console.error("Failed to pause task:", error);
|
|
4499
|
+
import_antd23.message.error("Failed to pause task");
|
|
4500
|
+
} finally {
|
|
4501
|
+
setActionLoading(null);
|
|
4502
|
+
}
|
|
4503
|
+
},
|
|
4504
|
+
[client, handleRefresh]
|
|
4505
|
+
);
|
|
4506
|
+
const handleResume = (0, import_react20.useCallback)(
|
|
4507
|
+
async (taskId) => {
|
|
4508
|
+
setActionLoading(taskId);
|
|
4509
|
+
try {
|
|
4510
|
+
await client.schedules.resume(taskId);
|
|
4511
|
+
import_antd23.message.success("Task resumed successfully");
|
|
4512
|
+
await handleRefresh();
|
|
4513
|
+
} catch (error) {
|
|
4514
|
+
console.error("Failed to resume task:", error);
|
|
4515
|
+
import_antd23.message.error("Failed to resume task");
|
|
4516
|
+
} finally {
|
|
4517
|
+
setActionLoading(null);
|
|
4518
|
+
}
|
|
4519
|
+
},
|
|
4520
|
+
[client, handleRefresh]
|
|
4521
|
+
);
|
|
4522
|
+
(0, import_react20.useEffect)(() => {
|
|
4523
|
+
if (threadId && (!initialTasks || initialTasks.length === 0)) {
|
|
4524
|
+
handleRefresh();
|
|
4525
|
+
}
|
|
4526
|
+
}, [threadId]);
|
|
4527
|
+
(0, import_react20.useEffect)(() => {
|
|
4528
|
+
if (initialTasks) {
|
|
4529
|
+
setTasks(initialTasks);
|
|
4530
|
+
}
|
|
4531
|
+
}, [initialTasks]);
|
|
4532
|
+
const renderActions = (task) => {
|
|
4533
|
+
const isLoading = actionLoading === task.taskId;
|
|
4534
|
+
const isPending = task.status === import_client_sdk5.ScheduledTaskStatus.PENDING;
|
|
4535
|
+
const isPaused = task.status === import_client_sdk5.ScheduledTaskStatus.PAUSED;
|
|
4536
|
+
const isCron = task.executionType === import_client_sdk5.ScheduleExecutionType.CRON;
|
|
4537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_antd23.Space, { className: styles.actions, children: [
|
|
4538
|
+
isPending && isCron && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_antd23.Tooltip, { title: "Pause", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4539
|
+
import_antd23.Button,
|
|
4540
|
+
{
|
|
4541
|
+
type: "text",
|
|
4542
|
+
size: "small",
|
|
4543
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.PauseCircleOutlined, {}),
|
|
4544
|
+
onClick: () => handlePause(task.taskId),
|
|
4545
|
+
loading: isLoading
|
|
4546
|
+
}
|
|
4547
|
+
) }),
|
|
4548
|
+
isPaused && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_antd23.Tooltip, { title: "Resume", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4549
|
+
import_antd23.Button,
|
|
4550
|
+
{
|
|
4551
|
+
type: "text",
|
|
4552
|
+
size: "small",
|
|
4553
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.PlayCircleOutlined, {}),
|
|
4554
|
+
onClick: () => handleResume(task.taskId),
|
|
4555
|
+
loading: isLoading
|
|
4556
|
+
}
|
|
4557
|
+
) }),
|
|
4558
|
+
(isPending || isPaused) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4559
|
+
import_antd23.Popconfirm,
|
|
4560
|
+
{
|
|
4561
|
+
title: "Cancel this scheduled task?",
|
|
4562
|
+
description: "This action cannot be undone.",
|
|
4563
|
+
onConfirm: () => handleCancel(task.taskId),
|
|
4564
|
+
okText: "Yes",
|
|
4565
|
+
cancelText: "No",
|
|
4566
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_antd23.Tooltip, { title: "Cancel", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4567
|
+
import_antd23.Button,
|
|
4568
|
+
{
|
|
4569
|
+
type: "text",
|
|
4570
|
+
size: "small",
|
|
4571
|
+
danger: true,
|
|
4572
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.StopOutlined, {}),
|
|
4573
|
+
loading: isLoading
|
|
4574
|
+
}
|
|
4575
|
+
) })
|
|
4576
|
+
}
|
|
4577
|
+
)
|
|
4578
|
+
] });
|
|
4579
|
+
};
|
|
4580
|
+
const renderTask = (task) => {
|
|
4581
|
+
const isActive = task.status === import_client_sdk5.ScheduledTaskStatus.PENDING || task.status === import_client_sdk5.ScheduledTaskStatus.PAUSED;
|
|
4582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4583
|
+
import_antd23.Card,
|
|
4584
|
+
{
|
|
4585
|
+
className: styles.taskCard,
|
|
4586
|
+
size: "small",
|
|
4587
|
+
bordered: true,
|
|
4588
|
+
children: [
|
|
4589
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: styles.taskHeader, children: [
|
|
4590
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
4591
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: styles.taskType, children: task.taskType }),
|
|
4592
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: styles.taskId, children: task.taskId })
|
|
4593
|
+
] }),
|
|
4594
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_antd23.Tag, { color: getStatusColor(task.status), icon: getStatusIcon2(task.status), children: task.status.toUpperCase() })
|
|
4595
|
+
] }),
|
|
4596
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: styles.metaRow, children: [
|
|
4597
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_antd23.Tooltip, { title: "Execution Type", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: styles.metaItem, children: [
|
|
4598
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.FieldTimeOutlined, {}),
|
|
4599
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { children: task.executionType === import_client_sdk5.ScheduleExecutionType.CRON ? "Recurring" : "One-time" })
|
|
4600
|
+
] }) }),
|
|
4601
|
+
task.cronExpression && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_antd23.Tooltip, { title: "Cron Expression", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: styles.metaItem, children: [
|
|
4602
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.ClockCircleOutlined, {}),
|
|
4603
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { className: styles.cronExpression, children: task.cronExpression })
|
|
4604
|
+
] }) }),
|
|
4605
|
+
task.nextRunAt && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_antd23.Tooltip, { title: `Next run: ${formatTime(task.nextRunAt)}`, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: styles.metaItem, children: [
|
|
4606
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.ClockCircleOutlined, {}),
|
|
4607
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { children: [
|
|
4608
|
+
"Next: ",
|
|
4609
|
+
getRelativeTime(task.nextRunAt)
|
|
4610
|
+
] })
|
|
4611
|
+
] }) }),
|
|
4612
|
+
task.executeAt && !task.cronExpression && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_antd23.Tooltip, { title: `Execute at: ${formatTime(task.executeAt)}`, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: styles.metaItem, children: [
|
|
4613
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.ClockCircleOutlined, {}),
|
|
4614
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { children: [
|
|
4615
|
+
"At: ",
|
|
4616
|
+
getRelativeTime(task.executeAt)
|
|
4617
|
+
] })
|
|
4618
|
+
] }) }),
|
|
4619
|
+
task.runCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_antd23.Tooltip, { title: "Run count", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: styles.metaItem, children: [
|
|
4620
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.SyncOutlined, {}),
|
|
4621
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { children: [
|
|
4622
|
+
"Runs: ",
|
|
4623
|
+
task.runCount,
|
|
4624
|
+
task.maxRuns ? ` / ${task.maxRuns}` : ""
|
|
4625
|
+
] })
|
|
4626
|
+
] }) })
|
|
4627
|
+
] }),
|
|
4628
|
+
task.lastError && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { style: { marginTop: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Text13, { type: "danger", style: { fontSize: 12 }, children: [
|
|
4629
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.ExclamationCircleOutlined, { style: { marginRight: 4 } }),
|
|
4630
|
+
task.lastError
|
|
4631
|
+
] }) }),
|
|
4632
|
+
task.metadata && Object.keys(task.metadata).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4633
|
+
import_antd23.Descriptions,
|
|
4634
|
+
{
|
|
4635
|
+
size: "small",
|
|
4636
|
+
column: 1,
|
|
4637
|
+
style: { marginTop: 12 },
|
|
4638
|
+
items: Object.entries(task.metadata).map(([key, value]) => ({
|
|
4639
|
+
key,
|
|
4640
|
+
label: key,
|
|
4641
|
+
children: typeof value === "object" ? JSON.stringify(value) : String(value)
|
|
4642
|
+
}))
|
|
4643
|
+
}
|
|
4644
|
+
),
|
|
4645
|
+
isActive && renderActions(task)
|
|
4646
|
+
]
|
|
4647
|
+
},
|
|
4648
|
+
task.taskId
|
|
4649
|
+
);
|
|
4650
|
+
};
|
|
4651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: styles.container, children: [
|
|
4652
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: styles.header, children: [
|
|
4653
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Title2, { level: 5, style: { margin: 0 }, children: "Scheduled Tasks" }),
|
|
4654
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_antd23.Tooltip, { title: "Refresh", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4655
|
+
import_antd23.Button,
|
|
4656
|
+
{
|
|
4657
|
+
type: "text",
|
|
4658
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons14.ReloadOutlined, { spin: loading }),
|
|
4659
|
+
onClick: handleRefresh,
|
|
4660
|
+
loading
|
|
4661
|
+
}
|
|
4662
|
+
) })
|
|
4663
|
+
] }),
|
|
4664
|
+
loading && tasks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: styles.emptyContainer, children: [
|
|
4665
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_antd23.Spin, { size: "large" }),
|
|
4666
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Text13, { type: "secondary", style: { marginTop: 16 }, children: "Loading scheduled tasks..." })
|
|
4667
|
+
] }) : tasks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: styles.emptyContainer, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4668
|
+
import_antd23.Empty,
|
|
4669
|
+
{
|
|
4670
|
+
image: import_antd23.Empty.PRESENTED_IMAGE_SIMPLE,
|
|
4671
|
+
description: "No scheduled tasks for this thread"
|
|
4672
|
+
}
|
|
4673
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: tasks.map(renderTask) })
|
|
4674
|
+
] });
|
|
4675
|
+
};
|
|
4676
|
+
|
|
4258
4677
|
// src/components/GenUI/elements/builtIns.tsx
|
|
4259
4678
|
var elements = {
|
|
4260
4679
|
action_show_attachments_uploader: {
|
|
@@ -4306,6 +4725,10 @@ var elements = {
|
|
|
4306
4725
|
task: {
|
|
4307
4726
|
card_view: TaskCard,
|
|
4308
4727
|
side_app_view: TaskDetail
|
|
4728
|
+
},
|
|
4729
|
+
schedule_viewer: {
|
|
4730
|
+
card_view: () => null,
|
|
4731
|
+
side_app_view: ScheduleViewer
|
|
4309
4732
|
}
|
|
4310
4733
|
};
|
|
4311
4734
|
|
|
@@ -4323,11 +4746,11 @@ var regsiterElement = (language, ElementMeta) => {
|
|
|
4323
4746
|
};
|
|
4324
4747
|
|
|
4325
4748
|
// src/components/Chat/SideAppViewBrowser.tsx
|
|
4326
|
-
var
|
|
4327
|
-
var
|
|
4328
|
-
var
|
|
4329
|
-
var
|
|
4330
|
-
var useStyle8 = (0,
|
|
4749
|
+
var import_antd24 = require("antd");
|
|
4750
|
+
var import_antd_style11 = require("antd-style");
|
|
4751
|
+
var import_react21 = require("react");
|
|
4752
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4753
|
+
var useStyle8 = (0, import_antd_style11.createStyles)(({ token, css }) => {
|
|
4331
4754
|
return {
|
|
4332
4755
|
tabContainer: css`
|
|
4333
4756
|
.ant-tabs-content-holder {
|
|
@@ -4346,9 +4769,9 @@ var useStyle8 = (0, import_antd_style10.createStyles)(({ token, css }) => {
|
|
|
4346
4769
|
};
|
|
4347
4770
|
});
|
|
4348
4771
|
var EmptySideAppView = ({ component_key, data }) => {
|
|
4349
|
-
return /* @__PURE__ */ (0,
|
|
4350
|
-
/* @__PURE__ */ (0,
|
|
4351
|
-
/* @__PURE__ */ (0,
|
|
4772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
|
|
4773
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { children: "\u672A\u627E\u5230\u5BF9\u5E94\u7684\u7EC4\u4EF6\u89C6\u56FE" }),
|
|
4774
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("pre", { children: JSON.stringify({ component_key, data }, null, 2) })
|
|
4352
4775
|
] });
|
|
4353
4776
|
};
|
|
4354
4777
|
var SideAppViewBrowser = () => {
|
|
@@ -4360,10 +4783,10 @@ var SideAppViewBrowser = () => {
|
|
|
4360
4783
|
openSideApp,
|
|
4361
4784
|
closeSideApp
|
|
4362
4785
|
} = useChatUIContext();
|
|
4363
|
-
const [activeKey, setActiveKey] = (0,
|
|
4786
|
+
const [activeKey, setActiveKey] = (0, import_react21.useState)(
|
|
4364
4787
|
JSON.stringify(sideAppSelectedCard)
|
|
4365
4788
|
);
|
|
4366
|
-
const [items, setItems] = (0,
|
|
4789
|
+
const [items, setItems] = (0, import_react21.useState)([]);
|
|
4367
4790
|
const add = (key, label, children) => {
|
|
4368
4791
|
const newActiveKey = key;
|
|
4369
4792
|
const newPanes = [...items];
|
|
@@ -4399,7 +4822,7 @@ var SideAppViewBrowser = () => {
|
|
|
4399
4822
|
remove(targetKey);
|
|
4400
4823
|
}
|
|
4401
4824
|
};
|
|
4402
|
-
(0,
|
|
4825
|
+
(0, import_react21.useEffect)(() => {
|
|
4403
4826
|
const SideAppView = getElement(sideAppSelectedCard?.component_key).side_app_view || EmptySideAppView;
|
|
4404
4827
|
const key = JSON.stringify(sideAppSelectedCard);
|
|
4405
4828
|
if (items.find((item) => item.key === key)) {
|
|
@@ -4409,7 +4832,7 @@ var SideAppViewBrowser = () => {
|
|
|
4409
4832
|
add(
|
|
4410
4833
|
key,
|
|
4411
4834
|
sideAppSelectedCard?.message || sideAppSelectedCard?.data.message || "\u672A\u547D\u540D",
|
|
4412
|
-
/* @__PURE__ */ (0,
|
|
4835
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4413
4836
|
SideAppView,
|
|
4414
4837
|
{
|
|
4415
4838
|
component_key: sideAppSelectedCard?.component_key || "",
|
|
@@ -4450,26 +4873,26 @@ var SideAppViewBrowser = () => {
|
|
|
4450
4873
|
const getSizeIcon = (size) => {
|
|
4451
4874
|
switch (size) {
|
|
4452
4875
|
case "middle":
|
|
4453
|
-
return /* @__PURE__ */ (0,
|
|
4876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_icons15.CompressOutlined, {});
|
|
4454
4877
|
case "large":
|
|
4455
|
-
return /* @__PURE__ */ (0,
|
|
4878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_icons15.ExpandOutlined, {});
|
|
4456
4879
|
case "full":
|
|
4457
|
-
return /* @__PURE__ */ (0,
|
|
4880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_icons15.FullscreenOutlined, {});
|
|
4458
4881
|
default:
|
|
4459
|
-
return /* @__PURE__ */ (0,
|
|
4882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_icons15.ExpandOutlined, {});
|
|
4460
4883
|
}
|
|
4461
4884
|
};
|
|
4462
|
-
return /* @__PURE__ */ (0,
|
|
4463
|
-
|
|
4885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4886
|
+
import_antd24.Tabs,
|
|
4464
4887
|
{
|
|
4465
4888
|
className: styles.tabContainer,
|
|
4466
4889
|
type: "editable-card",
|
|
4467
4890
|
style: { height: "100%" },
|
|
4468
4891
|
hideAdd: true,
|
|
4469
4892
|
tabBarExtraContent: {
|
|
4470
|
-
right: /* @__PURE__ */ (0,
|
|
4471
|
-
/* @__PURE__ */ (0,
|
|
4472
|
-
|
|
4893
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { style: { display: "flex", gap: "4px" }, children: [
|
|
4894
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4895
|
+
import_antd24.Button,
|
|
4473
4896
|
{
|
|
4474
4897
|
style: { margin: "8px 0" },
|
|
4475
4898
|
size: "large",
|
|
@@ -4479,13 +4902,13 @@ var SideAppViewBrowser = () => {
|
|
|
4479
4902
|
title: `\u5F53\u524D\u5C3A\u5BF8: ${getSizeLabel(sideAppSize)}, \u70B9\u51FB\u5207\u6362`
|
|
4480
4903
|
}
|
|
4481
4904
|
),
|
|
4482
|
-
/* @__PURE__ */ (0,
|
|
4483
|
-
|
|
4905
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4906
|
+
import_antd24.Button,
|
|
4484
4907
|
{
|
|
4485
4908
|
style: { margin: "8px 0" },
|
|
4486
4909
|
size: "large",
|
|
4487
4910
|
type: "text",
|
|
4488
|
-
icon: /* @__PURE__ */ (0,
|
|
4911
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_icons15.CloseOutlined, {}),
|
|
4489
4912
|
onClick: () => {
|
|
4490
4913
|
closeSideApp();
|
|
4491
4914
|
}
|
|
@@ -4502,10 +4925,10 @@ var SideAppViewBrowser = () => {
|
|
|
4502
4925
|
};
|
|
4503
4926
|
|
|
4504
4927
|
// src/components/Chat/LatticeChat.tsx
|
|
4505
|
-
var
|
|
4928
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4506
4929
|
var LatticeChat = (props) => {
|
|
4507
4930
|
const { assistant_id, thread_id = "", menu, header, ...chatingProps } = props;
|
|
4508
|
-
return /* @__PURE__ */ (0,
|
|
4931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4509
4932
|
AgentThreadProvider,
|
|
4510
4933
|
{
|
|
4511
4934
|
assistantId: assistant_id,
|
|
@@ -4515,7 +4938,7 @@ var LatticeChat = (props) => {
|
|
|
4515
4938
|
enableReturnStateWhenStreamCompleted: true,
|
|
4516
4939
|
enableResumeStream: true
|
|
4517
4940
|
},
|
|
4518
|
-
children: /* @__PURE__ */ (0,
|
|
4941
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ChatUIContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
4519
4942
|
"div",
|
|
4520
4943
|
{
|
|
4521
4944
|
style: {
|
|
@@ -4526,12 +4949,12 @@ var LatticeChat = (props) => {
|
|
|
4526
4949
|
},
|
|
4527
4950
|
children: [
|
|
4528
4951
|
header,
|
|
4529
|
-
/* @__PURE__ */ (0,
|
|
4952
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4530
4953
|
ColumnLayout,
|
|
4531
4954
|
{
|
|
4532
4955
|
menu,
|
|
4533
|
-
left: thread_id ? /* @__PURE__ */ (0,
|
|
4534
|
-
right: /* @__PURE__ */ (0,
|
|
4956
|
+
left: thread_id ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Chating, { ...chatingProps }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: "\u9700\u8981\u5148\u521B\u5EFA\u4F1A\u8BDD" }),
|
|
4957
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SideAppViewBrowser, {})
|
|
4535
4958
|
}
|
|
4536
4959
|
)
|
|
4537
4960
|
]
|
|
@@ -4542,15 +4965,15 @@ var LatticeChat = (props) => {
|
|
|
4542
4965
|
};
|
|
4543
4966
|
|
|
4544
4967
|
// src/components/Chat/ConversationContext.tsx
|
|
4545
|
-
var
|
|
4968
|
+
var import_react24 = require("react");
|
|
4546
4969
|
|
|
4547
4970
|
// src/components/Chat/AssistantContext.tsx
|
|
4548
|
-
var
|
|
4549
|
-
var
|
|
4971
|
+
var import_react23 = require("react");
|
|
4972
|
+
var import_client_sdk6 = require("@axiom-lattice/client-sdk");
|
|
4550
4973
|
|
|
4551
4974
|
// src/components/Chat/LatticeChatShellContext.tsx
|
|
4552
|
-
var
|
|
4553
|
-
var
|
|
4975
|
+
var import_react22 = require("react");
|
|
4976
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4554
4977
|
var DEFAULT_CONFIG = {
|
|
4555
4978
|
baseURL: "http://localhost:4001",
|
|
4556
4979
|
apiKey: "",
|
|
@@ -4558,7 +4981,7 @@ var DEFAULT_CONFIG = {
|
|
|
4558
4981
|
timeout: 3e5,
|
|
4559
4982
|
headers: {}
|
|
4560
4983
|
};
|
|
4561
|
-
var LatticeChatShellContext = (0,
|
|
4984
|
+
var LatticeChatShellContext = (0, import_react22.createContext)({
|
|
4562
4985
|
config: DEFAULT_CONFIG,
|
|
4563
4986
|
updateConfig: () => {
|
|
4564
4987
|
},
|
|
@@ -4576,7 +4999,7 @@ var LatticeChatShellContextProvider = ({
|
|
|
4576
4999
|
persistToLocalStorage = false,
|
|
4577
5000
|
localStorageKey = "lattice_chat_shell_config"
|
|
4578
5001
|
}) => {
|
|
4579
|
-
const loadInitialConfig = (0,
|
|
5002
|
+
const loadInitialConfig = (0, import_react22.useCallback)(() => {
|
|
4580
5003
|
if (persistToLocalStorage && typeof window !== "undefined") {
|
|
4581
5004
|
try {
|
|
4582
5005
|
const stored = localStorage.getItem(localStorageKey);
|
|
@@ -4590,9 +5013,9 @@ var LatticeChatShellContextProvider = ({
|
|
|
4590
5013
|
}
|
|
4591
5014
|
return { ...DEFAULT_CONFIG, ...initialConfig };
|
|
4592
5015
|
}, [persistToLocalStorage, localStorageKey, initialConfig]);
|
|
4593
|
-
const [config, setConfig] = (0,
|
|
4594
|
-
const [settingsModalOpen, setSettingsModalOpen] = (0,
|
|
4595
|
-
const saveToLocalStorage = (0,
|
|
5016
|
+
const [config, setConfig] = (0, import_react22.useState)(loadInitialConfig);
|
|
5017
|
+
const [settingsModalOpen, setSettingsModalOpen] = (0, import_react22.useState)(false);
|
|
5018
|
+
const saveToLocalStorage = (0, import_react22.useCallback)(
|
|
4596
5019
|
(newConfig) => {
|
|
4597
5020
|
if (persistToLocalStorage && typeof window !== "undefined") {
|
|
4598
5021
|
try {
|
|
@@ -4604,7 +5027,7 @@ var LatticeChatShellContextProvider = ({
|
|
|
4604
5027
|
},
|
|
4605
5028
|
[persistToLocalStorage, localStorageKey]
|
|
4606
5029
|
);
|
|
4607
|
-
const updateConfig = (0,
|
|
5030
|
+
const updateConfig = (0, import_react22.useCallback)(
|
|
4608
5031
|
(updates) => {
|
|
4609
5032
|
setConfig((prev) => {
|
|
4610
5033
|
const newConfig = { ...prev, ...updates };
|
|
@@ -4614,7 +5037,7 @@ var LatticeChatShellContextProvider = ({
|
|
|
4614
5037
|
},
|
|
4615
5038
|
[saveToLocalStorage]
|
|
4616
5039
|
);
|
|
4617
|
-
const updateConfigValue = (0,
|
|
5040
|
+
const updateConfigValue = (0, import_react22.useCallback)(
|
|
4618
5041
|
(key, value) => {
|
|
4619
5042
|
setConfig((prev) => {
|
|
4620
5043
|
const newConfig = { ...prev, [key]: value };
|
|
@@ -4624,12 +5047,12 @@ var LatticeChatShellContextProvider = ({
|
|
|
4624
5047
|
},
|
|
4625
5048
|
[saveToLocalStorage]
|
|
4626
5049
|
);
|
|
4627
|
-
const resetConfig = (0,
|
|
5050
|
+
const resetConfig = (0, import_react22.useCallback)(() => {
|
|
4628
5051
|
const defaultConfig = { ...DEFAULT_CONFIG, ...initialConfig };
|
|
4629
5052
|
setConfig(defaultConfig);
|
|
4630
5053
|
saveToLocalStorage(defaultConfig);
|
|
4631
5054
|
}, [initialConfig, saveToLocalStorage]);
|
|
4632
|
-
return /* @__PURE__ */ (0,
|
|
5055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4633
5056
|
LatticeChatShellContext.Provider,
|
|
4634
5057
|
{
|
|
4635
5058
|
value: {
|
|
@@ -4645,7 +5068,7 @@ var LatticeChatShellContextProvider = ({
|
|
|
4645
5068
|
);
|
|
4646
5069
|
};
|
|
4647
5070
|
var useLatticeChatShellContext = () => {
|
|
4648
|
-
const context = (0,
|
|
5071
|
+
const context = (0, import_react22.useContext)(LatticeChatShellContext);
|
|
4649
5072
|
if (!context) {
|
|
4650
5073
|
throw new Error(
|
|
4651
5074
|
"useLatticeChatShellContext must be used within a LatticeChatShellContextProvider"
|
|
@@ -4655,8 +5078,8 @@ var useLatticeChatShellContext = () => {
|
|
|
4655
5078
|
};
|
|
4656
5079
|
|
|
4657
5080
|
// src/components/Chat/AssistantContext.tsx
|
|
4658
|
-
var
|
|
4659
|
-
var AssistantContext = (0,
|
|
5081
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
5082
|
+
var AssistantContext = (0, import_react23.createContext)({
|
|
4660
5083
|
assistants: [],
|
|
4661
5084
|
currentAssistant: null,
|
|
4662
5085
|
isLoading: false,
|
|
@@ -4689,8 +5112,8 @@ var AssistantContextProvider = ({
|
|
|
4689
5112
|
const {
|
|
4690
5113
|
config: { baseURL, apiKey = "", transport = "sse" }
|
|
4691
5114
|
} = useLatticeChatShellContext();
|
|
4692
|
-
const client = (0,
|
|
4693
|
-
() => new
|
|
5115
|
+
const client = (0, import_react23.useMemo)(
|
|
5116
|
+
() => new import_client_sdk6.Client({
|
|
4694
5117
|
baseURL,
|
|
4695
5118
|
apiKey,
|
|
4696
5119
|
assistantId: "",
|
|
@@ -4698,17 +5121,17 @@ var AssistantContextProvider = ({
|
|
|
4698
5121
|
}),
|
|
4699
5122
|
[baseURL, apiKey, transport]
|
|
4700
5123
|
);
|
|
4701
|
-
const [state, setState] = (0,
|
|
5124
|
+
const [state, setState] = (0, import_react23.useState)({
|
|
4702
5125
|
assistants: [],
|
|
4703
5126
|
currentAssistant: null,
|
|
4704
5127
|
isLoading: false,
|
|
4705
5128
|
error: null
|
|
4706
5129
|
});
|
|
4707
|
-
const assistantsRef = (0,
|
|
4708
|
-
(0,
|
|
5130
|
+
const assistantsRef = (0, import_react23.useRef)([]);
|
|
5131
|
+
(0, import_react23.useEffect)(() => {
|
|
4709
5132
|
assistantsRef.current = state.assistants;
|
|
4710
5133
|
}, [state.assistants]);
|
|
4711
|
-
const listAssistants = (0,
|
|
5134
|
+
const listAssistants = (0, import_react23.useCallback)(async () => {
|
|
4712
5135
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4713
5136
|
try {
|
|
4714
5137
|
const assistants = await client.assistants.list();
|
|
@@ -4725,7 +5148,7 @@ var AssistantContextProvider = ({
|
|
|
4725
5148
|
}));
|
|
4726
5149
|
}
|
|
4727
5150
|
}, [client]);
|
|
4728
|
-
const getAssistant = (0,
|
|
5151
|
+
const getAssistant = (0, import_react23.useCallback)(
|
|
4729
5152
|
async (id) => {
|
|
4730
5153
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4731
5154
|
try {
|
|
@@ -4748,7 +5171,7 @@ var AssistantContextProvider = ({
|
|
|
4748
5171
|
},
|
|
4749
5172
|
[client]
|
|
4750
5173
|
);
|
|
4751
|
-
const createAssistant = (0,
|
|
5174
|
+
const createAssistant = (0, import_react23.useCallback)(
|
|
4752
5175
|
async (options) => {
|
|
4753
5176
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4754
5177
|
try {
|
|
@@ -4770,7 +5193,7 @@ var AssistantContextProvider = ({
|
|
|
4770
5193
|
},
|
|
4771
5194
|
[client]
|
|
4772
5195
|
);
|
|
4773
|
-
const updateAssistant = (0,
|
|
5196
|
+
const updateAssistant = (0, import_react23.useCallback)(
|
|
4774
5197
|
async (id, options) => {
|
|
4775
5198
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4776
5199
|
try {
|
|
@@ -4795,7 +5218,7 @@ var AssistantContextProvider = ({
|
|
|
4795
5218
|
},
|
|
4796
5219
|
[client]
|
|
4797
5220
|
);
|
|
4798
|
-
const deleteAssistant = (0,
|
|
5221
|
+
const deleteAssistant = (0, import_react23.useCallback)(
|
|
4799
5222
|
async (id) => {
|
|
4800
5223
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4801
5224
|
try {
|
|
@@ -4817,7 +5240,7 @@ var AssistantContextProvider = ({
|
|
|
4817
5240
|
},
|
|
4818
5241
|
[client]
|
|
4819
5242
|
);
|
|
4820
|
-
const selectAssistant = (0,
|
|
5243
|
+
const selectAssistant = (0, import_react23.useCallback)(
|
|
4821
5244
|
async (id) => {
|
|
4822
5245
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
4823
5246
|
try {
|
|
@@ -4848,21 +5271,21 @@ var AssistantContextProvider = ({
|
|
|
4848
5271
|
},
|
|
4849
5272
|
[client]
|
|
4850
5273
|
);
|
|
4851
|
-
const clearCurrentAssistant = (0,
|
|
5274
|
+
const clearCurrentAssistant = (0, import_react23.useCallback)(() => {
|
|
4852
5275
|
setState((prev) => ({
|
|
4853
5276
|
...prev,
|
|
4854
5277
|
currentAssistant: null
|
|
4855
5278
|
}));
|
|
4856
5279
|
}, []);
|
|
4857
|
-
const refresh = (0,
|
|
5280
|
+
const refresh = (0, import_react23.useCallback)(async () => {
|
|
4858
5281
|
await listAssistants();
|
|
4859
5282
|
}, [listAssistants]);
|
|
4860
|
-
(0,
|
|
5283
|
+
(0, import_react23.useEffect)(() => {
|
|
4861
5284
|
if (autoLoad) {
|
|
4862
5285
|
listAssistants();
|
|
4863
5286
|
}
|
|
4864
5287
|
}, [autoLoad, listAssistants]);
|
|
4865
|
-
(0,
|
|
5288
|
+
(0, import_react23.useEffect)(() => {
|
|
4866
5289
|
if (state.assistants.length > 0) {
|
|
4867
5290
|
const isCurrentAssistantValid = state.currentAssistant && state.assistants.some((a) => a.id === state.currentAssistant?.id);
|
|
4868
5291
|
if (!isCurrentAssistantValid) {
|
|
@@ -4890,7 +5313,7 @@ var AssistantContextProvider = ({
|
|
|
4890
5313
|
}
|
|
4891
5314
|
}
|
|
4892
5315
|
}, [initialAssistantId, state.assistants, state.currentAssistant]);
|
|
4893
|
-
return /* @__PURE__ */ (0,
|
|
5316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4894
5317
|
AssistantContext.Provider,
|
|
4895
5318
|
{
|
|
4896
5319
|
value: {
|
|
@@ -4909,7 +5332,7 @@ var AssistantContextProvider = ({
|
|
|
4909
5332
|
);
|
|
4910
5333
|
};
|
|
4911
5334
|
var useAssistantContext = () => {
|
|
4912
|
-
const context = (0,
|
|
5335
|
+
const context = (0, import_react23.useContext)(AssistantContext);
|
|
4913
5336
|
if (!context) {
|
|
4914
5337
|
throw new Error(
|
|
4915
5338
|
"useAssistantContext must be used within an AssistantContextProvider"
|
|
@@ -4919,9 +5342,9 @@ var useAssistantContext = () => {
|
|
|
4919
5342
|
};
|
|
4920
5343
|
|
|
4921
5344
|
// src/components/Chat/ConversationContext.tsx
|
|
4922
|
-
var
|
|
4923
|
-
var
|
|
4924
|
-
var ConversationContext = (0,
|
|
5345
|
+
var import_client_sdk7 = require("@axiom-lattice/client-sdk");
|
|
5346
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
5347
|
+
var ConversationContext = (0, import_react24.createContext)({
|
|
4925
5348
|
assistantId: null,
|
|
4926
5349
|
thread: null,
|
|
4927
5350
|
threadId: null,
|
|
@@ -4963,8 +5386,8 @@ var ConversationContextProvider = ({
|
|
|
4963
5386
|
const {
|
|
4964
5387
|
config: { baseURL, apiKey = "", transport = "sse" }
|
|
4965
5388
|
} = useLatticeChatShellContext();
|
|
4966
|
-
const client = (0,
|
|
4967
|
-
() => new
|
|
5389
|
+
const client = (0, import_react24.useMemo)(
|
|
5390
|
+
() => new import_client_sdk7.Client({
|
|
4968
5391
|
baseURL,
|
|
4969
5392
|
apiKey,
|
|
4970
5393
|
assistantId: assistantId || "",
|
|
@@ -4972,18 +5395,18 @@ var ConversationContextProvider = ({
|
|
|
4972
5395
|
}),
|
|
4973
5396
|
[baseURL, apiKey, assistantId, transport]
|
|
4974
5397
|
);
|
|
4975
|
-
const [threads, setThreads] = (0,
|
|
4976
|
-
const [threadId, setThreadId] = (0,
|
|
4977
|
-
const [isLoading, setIsLoading] = (0,
|
|
4978
|
-
const [error, setError] = (0,
|
|
4979
|
-
const loadedAssistantIdRef = (0,
|
|
4980
|
-
const prevAssistantIdRef = (0,
|
|
4981
|
-
const isLoadingRef = (0,
|
|
4982
|
-
const clientRef = (0,
|
|
4983
|
-
(0,
|
|
5398
|
+
const [threads, setThreads] = (0, import_react24.useState)([]);
|
|
5399
|
+
const [threadId, setThreadId] = (0, import_react24.useState)(null);
|
|
5400
|
+
const [isLoading, setIsLoading] = (0, import_react24.useState)(false);
|
|
5401
|
+
const [error, setError] = (0, import_react24.useState)(null);
|
|
5402
|
+
const loadedAssistantIdRef = (0, import_react24.useRef)(null);
|
|
5403
|
+
const prevAssistantIdRef = (0, import_react24.useRef)(null);
|
|
5404
|
+
const isLoadingRef = (0, import_react24.useRef)(false);
|
|
5405
|
+
const clientRef = (0, import_react24.useRef)(client);
|
|
5406
|
+
(0, import_react24.useEffect)(() => {
|
|
4984
5407
|
clientRef.current = client;
|
|
4985
5408
|
}, [client]);
|
|
4986
|
-
const loadThreads = (0,
|
|
5409
|
+
const loadThreads = (0, import_react24.useCallback)(async () => {
|
|
4987
5410
|
const currentClient = clientRef.current;
|
|
4988
5411
|
if (!assistantId || !currentClient.assistantId) {
|
|
4989
5412
|
setThreads([]);
|
|
@@ -5042,7 +5465,7 @@ var ConversationContextProvider = ({
|
|
|
5042
5465
|
isLoadingRef.current = false;
|
|
5043
5466
|
}
|
|
5044
5467
|
}, [assistantId]);
|
|
5045
|
-
(0,
|
|
5468
|
+
(0, import_react24.useEffect)(() => {
|
|
5046
5469
|
const currentClient = clientRef.current;
|
|
5047
5470
|
const prevAssistantId = prevAssistantIdRef.current;
|
|
5048
5471
|
const assistantChanged = prevAssistantId !== assistantId;
|
|
@@ -5061,20 +5484,20 @@ var ConversationContextProvider = ({
|
|
|
5061
5484
|
prevAssistantIdRef.current = null;
|
|
5062
5485
|
}
|
|
5063
5486
|
}, [assistantId, loadThreads]);
|
|
5064
|
-
const thread = (0,
|
|
5487
|
+
const thread = (0, import_react24.useMemo)(() => {
|
|
5065
5488
|
if (!assistantId || !threadId) {
|
|
5066
5489
|
return null;
|
|
5067
5490
|
}
|
|
5068
5491
|
return threads.find((t) => t.id === threadId) || null;
|
|
5069
5492
|
}, [assistantId, threadId, threads]);
|
|
5070
|
-
const setThread = (0,
|
|
5493
|
+
const setThread = (0, import_react24.useCallback)((newThread) => {
|
|
5071
5494
|
if (newThread) {
|
|
5072
5495
|
setThreadId(newThread.id);
|
|
5073
5496
|
} else {
|
|
5074
5497
|
setThreadId(null);
|
|
5075
5498
|
}
|
|
5076
5499
|
}, []);
|
|
5077
|
-
const selectThread = (0,
|
|
5500
|
+
const selectThread = (0, import_react24.useCallback)(
|
|
5078
5501
|
(targetThreadId) => {
|
|
5079
5502
|
const foundThread = threads.find((t) => t.id === targetThreadId);
|
|
5080
5503
|
if (foundThread) {
|
|
@@ -5083,7 +5506,7 @@ var ConversationContextProvider = ({
|
|
|
5083
5506
|
},
|
|
5084
5507
|
[threads]
|
|
5085
5508
|
);
|
|
5086
|
-
const createThread = (0,
|
|
5509
|
+
const createThread = (0, import_react24.useCallback)(
|
|
5087
5510
|
async (label) => {
|
|
5088
5511
|
if (!assistantId || !client.assistantId) {
|
|
5089
5512
|
throw new Error("No assistant selected");
|
|
@@ -5108,7 +5531,7 @@ var ConversationContextProvider = ({
|
|
|
5108
5531
|
},
|
|
5109
5532
|
[assistantId, client, loadThreads]
|
|
5110
5533
|
);
|
|
5111
|
-
const listThreads = (0,
|
|
5534
|
+
const listThreads = (0, import_react24.useCallback)(async () => {
|
|
5112
5535
|
if (!assistantId || !client.assistantId) {
|
|
5113
5536
|
return [];
|
|
5114
5537
|
}
|
|
@@ -5129,7 +5552,7 @@ var ConversationContextProvider = ({
|
|
|
5129
5552
|
setIsLoading(false);
|
|
5130
5553
|
}
|
|
5131
5554
|
}, [assistantId, client, threads]);
|
|
5132
|
-
const updateThread = (0,
|
|
5555
|
+
const updateThread = (0, import_react24.useCallback)(
|
|
5133
5556
|
async (newThread) => {
|
|
5134
5557
|
if (!assistantId || !client.assistantId) {
|
|
5135
5558
|
throw new Error("No assistant selected");
|
|
@@ -5151,13 +5574,13 @@ var ConversationContextProvider = ({
|
|
|
5151
5574
|
},
|
|
5152
5575
|
[assistantId, client, loadThreads]
|
|
5153
5576
|
);
|
|
5154
|
-
const getThreadById = (0,
|
|
5577
|
+
const getThreadById = (0, import_react24.useCallback)(
|
|
5155
5578
|
(targetThreadId) => {
|
|
5156
5579
|
return threads.find((t) => t.id === targetThreadId) || null;
|
|
5157
5580
|
},
|
|
5158
5581
|
[threads]
|
|
5159
5582
|
);
|
|
5160
|
-
const deleteThread = (0,
|
|
5583
|
+
const deleteThread = (0, import_react24.useCallback)(
|
|
5161
5584
|
async (targetThreadId) => {
|
|
5162
5585
|
if (!assistantId || !client.assistantId) {
|
|
5163
5586
|
throw new Error("No assistant selected");
|
|
@@ -5180,10 +5603,10 @@ var ConversationContextProvider = ({
|
|
|
5180
5603
|
},
|
|
5181
5604
|
[threadId, assistantId, client, loadThreads]
|
|
5182
5605
|
);
|
|
5183
|
-
const clearThread = (0,
|
|
5606
|
+
const clearThread = (0, import_react24.useCallback)(() => {
|
|
5184
5607
|
setThreadId(null);
|
|
5185
5608
|
}, []);
|
|
5186
|
-
return /* @__PURE__ */ (0,
|
|
5609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5187
5610
|
ConversationContext.Provider,
|
|
5188
5611
|
{
|
|
5189
5612
|
value: {
|
|
@@ -5208,7 +5631,7 @@ var ConversationContextProvider = ({
|
|
|
5208
5631
|
);
|
|
5209
5632
|
};
|
|
5210
5633
|
var useConversationContext = () => {
|
|
5211
|
-
const context = (0,
|
|
5634
|
+
const context = (0, import_react24.useContext)(ConversationContext);
|
|
5212
5635
|
if (!context) {
|
|
5213
5636
|
throw new Error(
|
|
5214
5637
|
"useConversationContext must be used within a ConversationContextProvider"
|
|
@@ -5219,11 +5642,11 @@ var useConversationContext = () => {
|
|
|
5219
5642
|
|
|
5220
5643
|
// src/components/Chat/AgentConversations.tsx
|
|
5221
5644
|
var import_x6 = require("@ant-design/x");
|
|
5222
|
-
var
|
|
5223
|
-
var
|
|
5224
|
-
var
|
|
5645
|
+
var import_antd25 = require("antd");
|
|
5646
|
+
var import_react25 = require("react");
|
|
5647
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
5225
5648
|
var AgentConversations = () => {
|
|
5226
|
-
const { token } =
|
|
5649
|
+
const { token } = import_antd25.theme.useToken();
|
|
5227
5650
|
const { currentAssistant } = useAssistantContext();
|
|
5228
5651
|
const {
|
|
5229
5652
|
assistantId,
|
|
@@ -5238,7 +5661,7 @@ var AgentConversations = () => {
|
|
|
5238
5661
|
background: "transparent",
|
|
5239
5662
|
borderRadius: token.borderRadius
|
|
5240
5663
|
};
|
|
5241
|
-
const threadItems = (0,
|
|
5664
|
+
const threadItems = (0, import_react25.useMemo)(() => {
|
|
5242
5665
|
return threads || [];
|
|
5243
5666
|
}, [threads]);
|
|
5244
5667
|
const items = threadItems.map((thread2) => ({
|
|
@@ -5251,7 +5674,7 @@ var AgentConversations = () => {
|
|
|
5251
5674
|
}
|
|
5252
5675
|
await createThread();
|
|
5253
5676
|
};
|
|
5254
|
-
return /* @__PURE__ */ (0,
|
|
5677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5255
5678
|
import_x6.Conversations,
|
|
5256
5679
|
{
|
|
5257
5680
|
creation: {
|
|
@@ -5269,16 +5692,16 @@ var AgentConversations = () => {
|
|
|
5269
5692
|
};
|
|
5270
5693
|
|
|
5271
5694
|
// src/components/Chat/ChatSidebar.tsx
|
|
5272
|
-
var
|
|
5273
|
-
var
|
|
5274
|
-
var
|
|
5695
|
+
var import_react26 = require("react");
|
|
5696
|
+
var import_antd27 = require("antd");
|
|
5697
|
+
var import_icons16 = require("@ant-design/icons");
|
|
5275
5698
|
|
|
5276
5699
|
// src/components/Chat/AssistantList.tsx
|
|
5277
5700
|
var import_x7 = require("@ant-design/x");
|
|
5278
|
-
var
|
|
5279
|
-
var
|
|
5701
|
+
var import_antd26 = require("antd");
|
|
5702
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
5280
5703
|
var AssistantList = () => {
|
|
5281
|
-
const { token } =
|
|
5704
|
+
const { token } = import_antd26.theme.useToken();
|
|
5282
5705
|
const { assistants, selectAssistant, currentAssistant } = useAssistantContext();
|
|
5283
5706
|
const style = {
|
|
5284
5707
|
width: "100%",
|
|
@@ -5288,8 +5711,8 @@ var AssistantList = () => {
|
|
|
5288
5711
|
const items = assistants.map((assistant) => ({
|
|
5289
5712
|
key: assistant.id,
|
|
5290
5713
|
label: assistant.name,
|
|
5291
|
-
icon: /* @__PURE__ */ (0,
|
|
5292
|
-
|
|
5714
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5715
|
+
import_antd26.Avatar,
|
|
5293
5716
|
{
|
|
5294
5717
|
size: "small",
|
|
5295
5718
|
style: {
|
|
@@ -5300,7 +5723,7 @@ var AssistantList = () => {
|
|
|
5300
5723
|
}
|
|
5301
5724
|
)
|
|
5302
5725
|
}));
|
|
5303
|
-
return /* @__PURE__ */ (0,
|
|
5726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5304
5727
|
import_x7.Conversations,
|
|
5305
5728
|
{
|
|
5306
5729
|
items,
|
|
@@ -5314,9 +5737,9 @@ var AssistantList = () => {
|
|
|
5314
5737
|
};
|
|
5315
5738
|
|
|
5316
5739
|
// src/components/Chat/ChatSidebar.tsx
|
|
5317
|
-
var
|
|
5318
|
-
var
|
|
5319
|
-
var
|
|
5740
|
+
var import_antd_style12 = require("antd-style");
|
|
5741
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
5742
|
+
var useStyles4 = (0, import_antd_style12.createStyles)(({ token, css }) => ({
|
|
5320
5743
|
sidebar: css`
|
|
5321
5744
|
display: flex;
|
|
5322
5745
|
flex-direction: column;
|
|
@@ -5521,12 +5944,12 @@ var ChatSidebar = ({
|
|
|
5521
5944
|
onSettingsClick,
|
|
5522
5945
|
defaultCollapsed = false
|
|
5523
5946
|
}) => {
|
|
5524
|
-
const { styles } =
|
|
5947
|
+
const { styles } = useStyles4();
|
|
5525
5948
|
const { setMenuCollapsed, menuCollapsed, sideAppVisible } = useChatUIContext();
|
|
5526
5949
|
const { setSettingsModalOpen } = useLatticeChatShellContext();
|
|
5527
|
-
const [isHovered, setIsHovered] = (0,
|
|
5528
|
-
const [isFirstCollapse, setIsFirstCollapse] = (0,
|
|
5529
|
-
const prevIsCollapsedRef = (0,
|
|
5950
|
+
const [isHovered, setIsHovered] = (0, import_react26.useState)(false);
|
|
5951
|
+
const [isFirstCollapse, setIsFirstCollapse] = (0, import_react26.useState)(false);
|
|
5952
|
+
const prevIsCollapsedRef = (0, import_react26.useRef)(false);
|
|
5530
5953
|
const handleToggleCollapse = () => {
|
|
5531
5954
|
setMenuCollapsed(!menuCollapsed);
|
|
5532
5955
|
};
|
|
@@ -5535,7 +5958,7 @@ var ChatSidebar = ({
|
|
|
5535
5958
|
onSettingsClick?.();
|
|
5536
5959
|
};
|
|
5537
5960
|
const isCollapsed = menuCollapsed || sideAppVisible;
|
|
5538
|
-
(0,
|
|
5961
|
+
(0, import_react26.useEffect)(() => {
|
|
5539
5962
|
const prevIsCollapsed = prevIsCollapsedRef.current;
|
|
5540
5963
|
if (isCollapsed) {
|
|
5541
5964
|
const hasSeenFirstCollapse = localStorage.getItem(FIRST_COLLAPSE_KEY);
|
|
@@ -5564,54 +5987,54 @@ var ChatSidebar = ({
|
|
|
5564
5987
|
const handleMouseLeave = () => {
|
|
5565
5988
|
setIsHovered(false);
|
|
5566
5989
|
};
|
|
5567
|
-
return /* @__PURE__ */ (0,
|
|
5568
|
-
/* @__PURE__ */ (0,
|
|
5990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
5991
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
5569
5992
|
"div",
|
|
5570
5993
|
{
|
|
5571
5994
|
className: `${styles.sidebar} ${isFirstCollapse ? "firstTimeHighlight" : ""}`,
|
|
5572
5995
|
onMouseEnter: handleMouseEnter,
|
|
5573
5996
|
onMouseLeave: handleMouseLeave,
|
|
5574
5997
|
children: [
|
|
5575
|
-
/* @__PURE__ */ (0,
|
|
5576
|
-
|
|
5998
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5999
|
+
import_antd27.Tooltip,
|
|
5577
6000
|
{
|
|
5578
6001
|
title: "Move the mouse over the collapsed sidebar to see the assistants and threads",
|
|
5579
6002
|
open: isFirstCollapse,
|
|
5580
6003
|
placement: "right",
|
|
5581
|
-
children: isFirstCollapse && /* @__PURE__ */ (0,
|
|
6004
|
+
children: isFirstCollapse && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { style: { marginTop: "400px" } })
|
|
5582
6005
|
}
|
|
5583
6006
|
),
|
|
5584
|
-
!isCollapsed && /* @__PURE__ */ (0,
|
|
5585
|
-
/* @__PURE__ */ (0,
|
|
5586
|
-
/* @__PURE__ */ (0,
|
|
5587
|
-
/* @__PURE__ */ (0,
|
|
5588
|
-
/* @__PURE__ */ (0,
|
|
6007
|
+
!isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
6008
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.content, children: [
|
|
6009
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.section, children: [
|
|
6010
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: styles.sectionTitle, children: "Assistants" }),
|
|
6011
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantList, {})
|
|
5589
6012
|
] }),
|
|
5590
|
-
/* @__PURE__ */ (0,
|
|
5591
|
-
/* @__PURE__ */ (0,
|
|
5592
|
-
/* @__PURE__ */ (0,
|
|
5593
|
-
/* @__PURE__ */ (0,
|
|
6013
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_antd27.Divider, { className: styles.divider }),
|
|
6014
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.section, children: [
|
|
6015
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: styles.sectionTitle, children: "Threads" }),
|
|
6016
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AgentConversations, {})
|
|
5594
6017
|
] })
|
|
5595
6018
|
] }),
|
|
5596
|
-
/* @__PURE__ */ (0,
|
|
5597
|
-
/* @__PURE__ */ (0,
|
|
6019
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.footer, children: [
|
|
6020
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5598
6021
|
"button",
|
|
5599
6022
|
{
|
|
5600
6023
|
className: styles.actionButton,
|
|
5601
6024
|
onClick: handleToggleCollapse,
|
|
5602
6025
|
title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5603
6026
|
"aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5604
|
-
children: isCollapsed ? /* @__PURE__ */ (0,
|
|
6027
|
+
children: isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons16.MenuUnfoldOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons16.MenuFoldOutlined, {})
|
|
5605
6028
|
}
|
|
5606
6029
|
),
|
|
5607
|
-
/* @__PURE__ */ (0,
|
|
6030
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5608
6031
|
"button",
|
|
5609
6032
|
{
|
|
5610
6033
|
className: styles.actionButton,
|
|
5611
6034
|
onClick: handleSettingsClick,
|
|
5612
6035
|
title: "Settings",
|
|
5613
6036
|
"aria-label": "Settings",
|
|
5614
|
-
children: /* @__PURE__ */ (0,
|
|
6037
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons16.SettingOutlined, {})
|
|
5615
6038
|
}
|
|
5616
6039
|
)
|
|
5617
6040
|
] })
|
|
@@ -5619,43 +6042,43 @@ var ChatSidebar = ({
|
|
|
5619
6042
|
]
|
|
5620
6043
|
}
|
|
5621
6044
|
),
|
|
5622
|
-
isCollapsed && /* @__PURE__ */ (0,
|
|
6045
|
+
isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
5623
6046
|
"div",
|
|
5624
6047
|
{
|
|
5625
6048
|
className: `${styles.hoverOverlay} ${isHovered ? "visible" : ""}`,
|
|
5626
6049
|
onMouseEnter: handleMouseEnter,
|
|
5627
6050
|
onMouseLeave: handleMouseLeave,
|
|
5628
6051
|
children: [
|
|
5629
|
-
/* @__PURE__ */ (0,
|
|
5630
|
-
/* @__PURE__ */ (0,
|
|
5631
|
-
/* @__PURE__ */ (0,
|
|
5632
|
-
/* @__PURE__ */ (0,
|
|
6052
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.hoverContent, children: [
|
|
6053
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.section, children: [
|
|
6054
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: styles.sectionTitle, children: "Assistants" }),
|
|
6055
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssistantList, {})
|
|
5633
6056
|
] }),
|
|
5634
|
-
/* @__PURE__ */ (0,
|
|
5635
|
-
/* @__PURE__ */ (0,
|
|
5636
|
-
/* @__PURE__ */ (0,
|
|
5637
|
-
/* @__PURE__ */ (0,
|
|
6057
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_antd27.Divider, { className: styles.divider }),
|
|
6058
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.section, children: [
|
|
6059
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: styles.sectionTitle, children: "Threads" }),
|
|
6060
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AgentConversations, {})
|
|
5638
6061
|
] })
|
|
5639
6062
|
] }),
|
|
5640
|
-
/* @__PURE__ */ (0,
|
|
5641
|
-
/* @__PURE__ */ (0,
|
|
6063
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.footer, children: [
|
|
6064
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5642
6065
|
"button",
|
|
5643
6066
|
{
|
|
5644
6067
|
className: styles.actionButton,
|
|
5645
6068
|
onClick: handleToggleCollapse,
|
|
5646
6069
|
title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5647
6070
|
"aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5648
|
-
children: isCollapsed ? /* @__PURE__ */ (0,
|
|
6071
|
+
children: isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons16.MenuUnfoldOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons16.MenuFoldOutlined, {})
|
|
5649
6072
|
}
|
|
5650
6073
|
),
|
|
5651
|
-
/* @__PURE__ */ (0,
|
|
6074
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5652
6075
|
"button",
|
|
5653
6076
|
{
|
|
5654
6077
|
className: styles.actionButton,
|
|
5655
6078
|
onClick: handleSettingsClick,
|
|
5656
6079
|
title: "Settings",
|
|
5657
6080
|
"aria-label": "Settings",
|
|
5658
|
-
children: /* @__PURE__ */ (0,
|
|
6081
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_icons16.SettingOutlined, {})
|
|
5659
6082
|
}
|
|
5660
6083
|
)
|
|
5661
6084
|
] })
|
|
@@ -5666,14 +6089,14 @@ var ChatSidebar = ({
|
|
|
5666
6089
|
};
|
|
5667
6090
|
|
|
5668
6091
|
// src/components/Chat/LatticeChatView.tsx
|
|
5669
|
-
var
|
|
6092
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
5670
6093
|
var LatticeChatView = (props) => {
|
|
5671
6094
|
const { assistantId, thread } = useConversationContext();
|
|
5672
6095
|
const { currentAssistant } = useAssistantContext();
|
|
5673
6096
|
const {
|
|
5674
6097
|
config: { baseURL }
|
|
5675
6098
|
} = useLatticeChatShellContext();
|
|
5676
|
-
return assistantId && thread ? /* @__PURE__ */ (0,
|
|
6099
|
+
return assistantId && thread ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5677
6100
|
AxiomLatticeProvider,
|
|
5678
6101
|
{
|
|
5679
6102
|
config: {
|
|
@@ -5682,14 +6105,14 @@ var LatticeChatView = (props) => {
|
|
|
5682
6105
|
assistantId,
|
|
5683
6106
|
transport: "sse"
|
|
5684
6107
|
},
|
|
5685
|
-
children: /* @__PURE__ */ (0,
|
|
6108
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5686
6109
|
LatticeChat,
|
|
5687
6110
|
{
|
|
5688
6111
|
thread_id: thread?.id,
|
|
5689
6112
|
assistant_id: assistantId,
|
|
5690
6113
|
name: currentAssistant?.name,
|
|
5691
6114
|
description: currentAssistant?.description,
|
|
5692
|
-
menu: /* @__PURE__ */ (0,
|
|
6115
|
+
menu: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ChatSidebar, {})
|
|
5693
6116
|
}
|
|
5694
6117
|
)
|
|
5695
6118
|
}
|
|
@@ -5697,14 +6120,14 @@ var LatticeChatView = (props) => {
|
|
|
5697
6120
|
};
|
|
5698
6121
|
|
|
5699
6122
|
// src/components/Chat/SettingsModal.tsx
|
|
5700
|
-
var
|
|
5701
|
-
var
|
|
5702
|
-
var
|
|
5703
|
-
var
|
|
5704
|
-
var
|
|
5705
|
-
var { Text:
|
|
5706
|
-
var { TextArea } =
|
|
5707
|
-
var
|
|
6123
|
+
var import_react27 = require("react");
|
|
6124
|
+
var import_antd28 = require("antd");
|
|
6125
|
+
var import_icons17 = require("@ant-design/icons");
|
|
6126
|
+
var import_antd_style13 = require("antd-style");
|
|
6127
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
6128
|
+
var { Text: Text14, Title: Title3 } = import_antd28.Typography;
|
|
6129
|
+
var { TextArea } = import_antd28.Input;
|
|
6130
|
+
var useStyles5 = (0, import_antd_style13.createStyles)(({ token, css }) => ({
|
|
5708
6131
|
// settingsModal: css`
|
|
5709
6132
|
// .ant-modal {
|
|
5710
6133
|
// max-width: 100vw !important;
|
|
@@ -6050,21 +6473,21 @@ var SETTINGS_MENU_ITEMS = [
|
|
|
6050
6473
|
{
|
|
6051
6474
|
key: "environment",
|
|
6052
6475
|
label: "Environment Variables",
|
|
6053
|
-
icon: /* @__PURE__ */ (0,
|
|
6476
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_icons17.EnvironmentOutlined, {})
|
|
6054
6477
|
},
|
|
6055
6478
|
{
|
|
6056
6479
|
key: "models",
|
|
6057
6480
|
label: "Model Configuration",
|
|
6058
|
-
icon: /* @__PURE__ */ (0,
|
|
6481
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_icons17.ApiOutlined, {})
|
|
6059
6482
|
}
|
|
6060
6483
|
];
|
|
6061
6484
|
var SettingsModal = ({
|
|
6062
6485
|
open,
|
|
6063
6486
|
onClose
|
|
6064
6487
|
}) => {
|
|
6065
|
-
const { styles } =
|
|
6488
|
+
const { styles } = useStyles5();
|
|
6066
6489
|
const { config: shellConfig, updateConfigValue } = useLatticeChatShellContext();
|
|
6067
|
-
const [connections, setConnections] = (0,
|
|
6490
|
+
const [connections, setConnections] = (0, import_react27.useState)(() => {
|
|
6068
6491
|
if (typeof window !== "undefined") {
|
|
6069
6492
|
try {
|
|
6070
6493
|
const stored = localStorage.getItem("lattice_server_connections");
|
|
@@ -6087,21 +6510,21 @@ var SettingsModal = ({
|
|
|
6087
6510
|
}
|
|
6088
6511
|
return [];
|
|
6089
6512
|
});
|
|
6090
|
-
const [serverConfigs, setServerConfigs] = (0,
|
|
6091
|
-
const connectionsRef = (0,
|
|
6092
|
-
(0,
|
|
6513
|
+
const [serverConfigs, setServerConfigs] = (0, import_react27.useState)({});
|
|
6514
|
+
const connectionsRef = (0, import_react27.useRef)(connections);
|
|
6515
|
+
(0, import_react27.useEffect)(() => {
|
|
6093
6516
|
connectionsRef.current = connections;
|
|
6094
6517
|
}, [connections]);
|
|
6095
|
-
const [activeTabKey, setActiveTabKey] = (0,
|
|
6518
|
+
const [activeTabKey, setActiveTabKey] = (0, import_react27.useState)(
|
|
6096
6519
|
connections.length > 0 ? connections[0].id : ""
|
|
6097
6520
|
);
|
|
6098
|
-
const [activeMenu, setActiveMenu] = (0,
|
|
6099
|
-
const [loading, setLoading] = (0,
|
|
6100
|
-
const [showAddServerModal, setShowAddServerModal] = (0,
|
|
6101
|
-
const [newServerUrl, setNewServerUrl] = (0,
|
|
6102
|
-
const [newServerName, setNewServerName] = (0,
|
|
6103
|
-
const [newServerApiKey, setNewServerApiKey] = (0,
|
|
6104
|
-
const [addingServer, setAddingServer] = (0,
|
|
6521
|
+
const [activeMenu, setActiveMenu] = (0, import_react27.useState)("environment");
|
|
6522
|
+
const [loading, setLoading] = (0, import_react27.useState)(false);
|
|
6523
|
+
const [showAddServerModal, setShowAddServerModal] = (0, import_react27.useState)(false);
|
|
6524
|
+
const [newServerUrl, setNewServerUrl] = (0, import_react27.useState)("");
|
|
6525
|
+
const [newServerName, setNewServerName] = (0, import_react27.useState)("");
|
|
6526
|
+
const [newServerApiKey, setNewServerApiKey] = (0, import_react27.useState)("");
|
|
6527
|
+
const [addingServer, setAddingServer] = (0, import_react27.useState)(false);
|
|
6105
6528
|
const saveConnections = (newConnections) => {
|
|
6106
6529
|
setConnections(newConnections);
|
|
6107
6530
|
if (typeof window !== "undefined") {
|
|
@@ -6240,7 +6663,7 @@ var SettingsModal = ({
|
|
|
6240
6663
|
}
|
|
6241
6664
|
} catch (error) {
|
|
6242
6665
|
console.error("Failed to load configuration:", error);
|
|
6243
|
-
|
|
6666
|
+
import_antd28.message.error("Failed to load current configuration");
|
|
6244
6667
|
}
|
|
6245
6668
|
};
|
|
6246
6669
|
const loadModelsConfig = async (serverId) => {
|
|
@@ -6291,7 +6714,7 @@ var SettingsModal = ({
|
|
|
6291
6714
|
console.error("Failed to load models configuration:", error);
|
|
6292
6715
|
}
|
|
6293
6716
|
};
|
|
6294
|
-
(0,
|
|
6717
|
+
(0, import_react27.useEffect)(() => {
|
|
6295
6718
|
if (open && activeTabKey) {
|
|
6296
6719
|
initializeServerConfig(activeTabKey);
|
|
6297
6720
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
@@ -6300,7 +6723,7 @@ var SettingsModal = ({
|
|
|
6300
6723
|
}
|
|
6301
6724
|
}
|
|
6302
6725
|
}, [open, activeTabKey]);
|
|
6303
|
-
(0,
|
|
6726
|
+
(0, import_react27.useEffect)(() => {
|
|
6304
6727
|
if (open && activeTabKey) {
|
|
6305
6728
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
6306
6729
|
if (connection?.connected) {
|
|
@@ -6314,7 +6737,7 @@ var SettingsModal = ({
|
|
|
6314
6737
|
}, [open, activeTabKey, activeMenu]);
|
|
6315
6738
|
const handleAddServer = async () => {
|
|
6316
6739
|
if (!newServerUrl.trim()) {
|
|
6317
|
-
|
|
6740
|
+
import_antd28.message.error("Please enter a server URL");
|
|
6318
6741
|
return;
|
|
6319
6742
|
}
|
|
6320
6743
|
let normalizedUrl = newServerUrl.trim();
|
|
@@ -6340,7 +6763,7 @@ var SettingsModal = ({
|
|
|
6340
6763
|
setNewServerUrl("");
|
|
6341
6764
|
setNewServerName("");
|
|
6342
6765
|
setNewServerApiKey("");
|
|
6343
|
-
|
|
6766
|
+
import_antd28.message.success("Server added successfully");
|
|
6344
6767
|
};
|
|
6345
6768
|
const handleDeleteServer = (serverId) => {
|
|
6346
6769
|
const newConnections = connections.filter((c) => c.id !== serverId);
|
|
@@ -6357,7 +6780,7 @@ var SettingsModal = ({
|
|
|
6357
6780
|
setActiveTabKey("");
|
|
6358
6781
|
}
|
|
6359
6782
|
}
|
|
6360
|
-
|
|
6783
|
+
import_antd28.message.success("Server deleted");
|
|
6361
6784
|
};
|
|
6362
6785
|
const handleTabChange = (newTabKey) => {
|
|
6363
6786
|
setConnections(
|
|
@@ -6371,12 +6794,12 @@ var SettingsModal = ({
|
|
|
6371
6794
|
const handleSave = async () => {
|
|
6372
6795
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
6373
6796
|
if (!connection || !connection.connected) {
|
|
6374
|
-
|
|
6797
|
+
import_antd28.message.error("Please connect to a server first");
|
|
6375
6798
|
return;
|
|
6376
6799
|
}
|
|
6377
6800
|
const url = connection.url;
|
|
6378
6801
|
if (!url) {
|
|
6379
|
-
|
|
6802
|
+
import_antd28.message.error("Please connect to a server first");
|
|
6380
6803
|
return;
|
|
6381
6804
|
}
|
|
6382
6805
|
try {
|
|
@@ -6440,23 +6863,23 @@ var SettingsModal = ({
|
|
|
6440
6863
|
const data = await response.json();
|
|
6441
6864
|
if (response.ok && data.success) {
|
|
6442
6865
|
if (data.requiresRestart && data.requiresRestart.length > 0) {
|
|
6443
|
-
|
|
6866
|
+
import_antd28.message.warning(
|
|
6444
6867
|
`Configuration saved. Please restart the server for ${data.requiresRestart.join(
|
|
6445
6868
|
", "
|
|
6446
6869
|
)} to take effect.`,
|
|
6447
6870
|
5
|
|
6448
6871
|
);
|
|
6449
6872
|
} else {
|
|
6450
|
-
|
|
6873
|
+
import_antd28.message.success("Configuration saved and applied successfully");
|
|
6451
6874
|
}
|
|
6452
6875
|
if (data.warnings && data.warnings.length > 0) {
|
|
6453
6876
|
data.warnings.forEach((warning) => {
|
|
6454
|
-
|
|
6877
|
+
import_antd28.message.warning(warning, 5);
|
|
6455
6878
|
});
|
|
6456
6879
|
}
|
|
6457
6880
|
onClose();
|
|
6458
6881
|
} else {
|
|
6459
|
-
|
|
6882
|
+
import_antd28.message.error(data.error || "Failed to save configuration");
|
|
6460
6883
|
}
|
|
6461
6884
|
} else if (activeMenu === "models") {
|
|
6462
6885
|
const validModels = config.models.filter(
|
|
@@ -6475,17 +6898,17 @@ var SettingsModal = ({
|
|
|
6475
6898
|
});
|
|
6476
6899
|
const data = await response.json();
|
|
6477
6900
|
if (response.ok && data.success) {
|
|
6478
|
-
|
|
6901
|
+
import_antd28.message.success(
|
|
6479
6902
|
"Model configuration saved and registered successfully"
|
|
6480
6903
|
);
|
|
6481
6904
|
onClose();
|
|
6482
6905
|
} else {
|
|
6483
|
-
|
|
6906
|
+
import_antd28.message.error(data.error || "Failed to save model configuration");
|
|
6484
6907
|
}
|
|
6485
6908
|
}
|
|
6486
6909
|
} catch (error) {
|
|
6487
6910
|
console.error("Failed to save configuration:", error);
|
|
6488
|
-
|
|
6911
|
+
import_antd28.message.error(error.message || "Failed to save configuration");
|
|
6489
6912
|
} finally {
|
|
6490
6913
|
setLoading(false);
|
|
6491
6914
|
}
|
|
@@ -6501,25 +6924,25 @@ var SettingsModal = ({
|
|
|
6501
6924
|
}
|
|
6502
6925
|
}));
|
|
6503
6926
|
};
|
|
6504
|
-
return /* @__PURE__ */ (0,
|
|
6505
|
-
/* @__PURE__ */ (0,
|
|
6506
|
-
|
|
6927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: styles.formContainer, children: [
|
|
6928
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
6929
|
+
import_antd28.Alert,
|
|
6507
6930
|
{
|
|
6508
6931
|
message: "Configuration Effect",
|
|
6509
|
-
description: /* @__PURE__ */ (0,
|
|
6510
|
-
/* @__PURE__ */ (0,
|
|
6511
|
-
/* @__PURE__ */ (0,
|
|
6512
|
-
|
|
6932
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
|
|
6933
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { style: { marginBottom: 8 }, children: [
|
|
6934
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
6935
|
+
import_icons17.CheckCircleOutlined,
|
|
6513
6936
|
{
|
|
6514
6937
|
style: { color: "#52c41a", marginRight: 8 }
|
|
6515
6938
|
}
|
|
6516
6939
|
),
|
|
6517
|
-
/* @__PURE__ */ (0,
|
|
6940
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("strong", { children: "Immediately effective:" }),
|
|
6518
6941
|
" QUEUE_SERVICE_TYPE, REDIS_URL, REDIS_PASSWORD, QUEUE_NAME"
|
|
6519
6942
|
] }),
|
|
6520
|
-
/* @__PURE__ */ (0,
|
|
6521
|
-
/* @__PURE__ */ (0,
|
|
6522
|
-
/* @__PURE__ */ (0,
|
|
6943
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
|
|
6944
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_icons17.ReloadOutlined, { style: { color: "#faad14", marginRight: 8 } }),
|
|
6945
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("strong", { children: "Requires restart:" }),
|
|
6523
6946
|
" PORT (server must be restarted to change port)"
|
|
6524
6947
|
] })
|
|
6525
6948
|
] }),
|
|
@@ -6528,8 +6951,8 @@ var SettingsModal = ({
|
|
|
6528
6951
|
className: styles.alertCard
|
|
6529
6952
|
}
|
|
6530
6953
|
),
|
|
6531
|
-
/* @__PURE__ */ (0,
|
|
6532
|
-
/* @__PURE__ */ (0,
|
|
6954
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { style: { marginBottom: 24 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { type: "secondary", style: { fontSize: 14, lineHeight: 1.6 }, children: "Configure environment variables in .env format (key=value). One variable per line. Leave password fields empty to keep current values." }) }),
|
|
6955
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
6533
6956
|
TextArea,
|
|
6534
6957
|
{
|
|
6535
6958
|
value: config.envText,
|
|
@@ -6606,10 +7029,10 @@ QUEUE_NAME=tasks`,
|
|
|
6606
7029
|
}));
|
|
6607
7030
|
}
|
|
6608
7031
|
};
|
|
6609
|
-
return /* @__PURE__ */ (0,
|
|
6610
|
-
/* @__PURE__ */ (0,
|
|
6611
|
-
config.models.map((model, index) => /* @__PURE__ */ (0,
|
|
6612
|
-
/* @__PURE__ */ (0,
|
|
7032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: styles.formContainer, children: [
|
|
7033
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { style: { marginBottom: 32 }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { type: "secondary", style: { fontSize: 14, lineHeight: 1.6 }, children: "Configure model lattices. Each model will be registered with the provided key and can be used by agents." }) }),
|
|
7034
|
+
config.models.map((model, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: styles.card, children: [
|
|
7035
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
6613
7036
|
"div",
|
|
6614
7037
|
{
|
|
6615
7038
|
style: {
|
|
@@ -6621,13 +7044,13 @@ QUEUE_NAME=tasks`,
|
|
|
6621
7044
|
borderBottom: "1px solid rgba(0, 0, 0, 0.06)"
|
|
6622
7045
|
},
|
|
6623
7046
|
children: [
|
|
6624
|
-
/* @__PURE__ */ (0,
|
|
6625
|
-
/* @__PURE__ */ (0,
|
|
7047
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
|
|
7048
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Text14, { strong: true, style: { fontSize: 16 }, children: [
|
|
6626
7049
|
"Model ",
|
|
6627
7050
|
index + 1
|
|
6628
7051
|
] }),
|
|
6629
|
-
model.key && /* @__PURE__ */ (0,
|
|
6630
|
-
|
|
7052
|
+
model.key && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
7053
|
+
Text14,
|
|
6631
7054
|
{
|
|
6632
7055
|
type: "secondary",
|
|
6633
7056
|
style: { marginLeft: 8, fontSize: 12 },
|
|
@@ -6639,8 +7062,8 @@ QUEUE_NAME=tasks`,
|
|
|
6639
7062
|
}
|
|
6640
7063
|
)
|
|
6641
7064
|
] }),
|
|
6642
|
-
config.models.length > 1 && /* @__PURE__ */ (0,
|
|
6643
|
-
|
|
7065
|
+
config.models.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7066
|
+
import_antd28.Button,
|
|
6644
7067
|
{
|
|
6645
7068
|
type: "text",
|
|
6646
7069
|
danger: true,
|
|
@@ -6656,11 +7079,11 @@ QUEUE_NAME=tasks`,
|
|
|
6656
7079
|
]
|
|
6657
7080
|
}
|
|
6658
7081
|
),
|
|
6659
|
-
/* @__PURE__ */ (0,
|
|
6660
|
-
/* @__PURE__ */ (0,
|
|
6661
|
-
/* @__PURE__ */ (0,
|
|
6662
|
-
/* @__PURE__ */ (0,
|
|
6663
|
-
|
|
7082
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd28.Space, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
7083
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
|
|
7084
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { className: styles.formLabel, children: "Key *" }),
|
|
7085
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7086
|
+
import_antd28.Input,
|
|
6664
7087
|
{
|
|
6665
7088
|
placeholder: "e.g., default, gpt-4, claude",
|
|
6666
7089
|
value: model.key,
|
|
@@ -6668,12 +7091,12 @@ QUEUE_NAME=tasks`,
|
|
|
6668
7091
|
style: { height: 40 }
|
|
6669
7092
|
}
|
|
6670
7093
|
),
|
|
6671
|
-
/* @__PURE__ */ (0,
|
|
7094
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { className: styles.formDescription, children: "Unique identifier for this model" })
|
|
6672
7095
|
] }),
|
|
6673
|
-
/* @__PURE__ */ (0,
|
|
6674
|
-
/* @__PURE__ */ (0,
|
|
6675
|
-
/* @__PURE__ */ (0,
|
|
6676
|
-
|
|
7096
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
|
|
7097
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { className: styles.formLabel, children: "Provider *" }),
|
|
7098
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7099
|
+
import_antd28.Select,
|
|
6677
7100
|
{
|
|
6678
7101
|
style: { width: "100%", height: 40 },
|
|
6679
7102
|
value: model.provider,
|
|
@@ -6688,10 +7111,10 @@ QUEUE_NAME=tasks`,
|
|
|
6688
7111
|
}
|
|
6689
7112
|
)
|
|
6690
7113
|
] }),
|
|
6691
|
-
/* @__PURE__ */ (0,
|
|
6692
|
-
/* @__PURE__ */ (0,
|
|
6693
|
-
/* @__PURE__ */ (0,
|
|
6694
|
-
|
|
7114
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
|
|
7115
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { className: styles.formLabel, children: "Model Name *" }),
|
|
7116
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7117
|
+
import_antd28.Input,
|
|
6695
7118
|
{
|
|
6696
7119
|
placeholder: "e.g., gpt-4, claude-3-opus, kimi-k2-250905",
|
|
6697
7120
|
value: model.model,
|
|
@@ -6700,10 +7123,10 @@ QUEUE_NAME=tasks`,
|
|
|
6700
7123
|
}
|
|
6701
7124
|
)
|
|
6702
7125
|
] }),
|
|
6703
|
-
/* @__PURE__ */ (0,
|
|
6704
|
-
/* @__PURE__ */ (0,
|
|
6705
|
-
/* @__PURE__ */ (0,
|
|
6706
|
-
|
|
7126
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
|
|
7127
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { className: styles.formLabel, children: "API Key" }),
|
|
7128
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7129
|
+
import_antd28.Input.Password,
|
|
6707
7130
|
{
|
|
6708
7131
|
placeholder: "Enter your API key",
|
|
6709
7132
|
value: model.apiKey,
|
|
@@ -6711,12 +7134,12 @@ QUEUE_NAME=tasks`,
|
|
|
6711
7134
|
style: { height: 40 }
|
|
6712
7135
|
}
|
|
6713
7136
|
),
|
|
6714
|
-
/* @__PURE__ */ (0,
|
|
7137
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { className: styles.formDescription, children: "API key for the model provider. Leave empty to use environment variable." })
|
|
6715
7138
|
] }),
|
|
6716
|
-
/* @__PURE__ */ (0,
|
|
6717
|
-
/* @__PURE__ */ (0,
|
|
6718
|
-
/* @__PURE__ */ (0,
|
|
6719
|
-
|
|
7139
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
|
|
7140
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { className: styles.formLabel, children: "Base URL" }),
|
|
7141
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7142
|
+
import_antd28.Input,
|
|
6720
7143
|
{
|
|
6721
7144
|
placeholder: "e.g., https://api.openai.com/v1",
|
|
6722
7145
|
value: model.baseURL,
|
|
@@ -6724,23 +7147,23 @@ QUEUE_NAME=tasks`,
|
|
|
6724
7147
|
style: { height: 40 }
|
|
6725
7148
|
}
|
|
6726
7149
|
),
|
|
6727
|
-
/* @__PURE__ */ (0,
|
|
7150
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { className: styles.formDescription, children: "Optional custom base URL for the API" })
|
|
6728
7151
|
] }),
|
|
6729
|
-
/* @__PURE__ */ (0,
|
|
6730
|
-
/* @__PURE__ */ (0,
|
|
6731
|
-
|
|
7152
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd28.Space, { children: [
|
|
7153
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7154
|
+
import_antd28.Switch,
|
|
6732
7155
|
{
|
|
6733
7156
|
checked: model.streaming,
|
|
6734
7157
|
onChange: (checked) => handleModelChange(index, "streaming", checked)
|
|
6735
7158
|
}
|
|
6736
7159
|
),
|
|
6737
|
-
/* @__PURE__ */ (0,
|
|
7160
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { children: "Enable Streaming" })
|
|
6738
7161
|
] }) }),
|
|
6739
|
-
/* @__PURE__ */ (0,
|
|
6740
|
-
/* @__PURE__ */ (0,
|
|
6741
|
-
/* @__PURE__ */ (0,
|
|
6742
|
-
/* @__PURE__ */ (0,
|
|
6743
|
-
|
|
7162
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { style: { display: "flex", gap: 20 }, children: [
|
|
7163
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { style: { flex: 1 }, children: [
|
|
7164
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { className: styles.formLabel, children: "Max Tokens" }),
|
|
7165
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7166
|
+
import_antd28.Input,
|
|
6744
7167
|
{
|
|
6745
7168
|
type: "number",
|
|
6746
7169
|
placeholder: "e.g., 4096",
|
|
@@ -6754,10 +7177,10 @@ QUEUE_NAME=tasks`,
|
|
|
6754
7177
|
}
|
|
6755
7178
|
)
|
|
6756
7179
|
] }),
|
|
6757
|
-
/* @__PURE__ */ (0,
|
|
6758
|
-
/* @__PURE__ */ (0,
|
|
6759
|
-
/* @__PURE__ */ (0,
|
|
6760
|
-
|
|
7180
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { style: { flex: 1 }, children: [
|
|
7181
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { className: styles.formLabel, children: "Temperature" }),
|
|
7182
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7183
|
+
import_antd28.Input,
|
|
6761
7184
|
{
|
|
6762
7185
|
type: "number",
|
|
6763
7186
|
step: "0.1",
|
|
@@ -6775,8 +7198,8 @@ QUEUE_NAME=tasks`,
|
|
|
6775
7198
|
] })
|
|
6776
7199
|
] })
|
|
6777
7200
|
] }, index)),
|
|
6778
|
-
/* @__PURE__ */ (0,
|
|
6779
|
-
|
|
7201
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7202
|
+
import_antd28.Button,
|
|
6780
7203
|
{
|
|
6781
7204
|
type: "dashed",
|
|
6782
7205
|
onClick: handleAddModel,
|
|
@@ -6803,9 +7226,9 @@ QUEUE_NAME=tasks`,
|
|
|
6803
7226
|
);
|
|
6804
7227
|
const currentConnection = connections.find((c) => c.id === activeTabKey);
|
|
6805
7228
|
const renderTabLabel = (connection) => {
|
|
6806
|
-
return /* @__PURE__ */ (0,
|
|
6807
|
-
/* @__PURE__ */ (0,
|
|
6808
|
-
|
|
7229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
7230
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7231
|
+
import_icons17.CloudServerOutlined,
|
|
6809
7232
|
{
|
|
6810
7233
|
style: {
|
|
6811
7234
|
marginRight: 8,
|
|
@@ -6813,15 +7236,15 @@ QUEUE_NAME=tasks`,
|
|
|
6813
7236
|
}
|
|
6814
7237
|
}
|
|
6815
7238
|
),
|
|
6816
|
-
/* @__PURE__ */ (0,
|
|
6817
|
-
connection.connected && /* @__PURE__ */ (0,
|
|
6818
|
-
|
|
7239
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: connection.name }),
|
|
7240
|
+
connection.connected && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7241
|
+
import_icons17.CheckCircleFilled,
|
|
6819
7242
|
{
|
|
6820
7243
|
style: { color: "#52c41a", fontSize: 12, marginLeft: 8 }
|
|
6821
7244
|
}
|
|
6822
7245
|
),
|
|
6823
|
-
connection.error && !connection.connecting && /* @__PURE__ */ (0,
|
|
6824
|
-
|
|
7246
|
+
connection.error && !connection.connecting && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7247
|
+
import_icons17.CloseCircleFilled,
|
|
6825
7248
|
{
|
|
6826
7249
|
style: { color: "#ff4d4f", fontSize: 12, marginLeft: 8 }
|
|
6827
7250
|
}
|
|
@@ -6831,35 +7254,35 @@ QUEUE_NAME=tasks`,
|
|
|
6831
7254
|
const tabItems = connections.map((connection) => ({
|
|
6832
7255
|
key: connection.id,
|
|
6833
7256
|
label: renderTabLabel(connection),
|
|
6834
|
-
children: /* @__PURE__ */ (0,
|
|
6835
|
-
/* @__PURE__ */ (0,
|
|
7257
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: styles.tabContent, children: connection.connected ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_jsx_runtime44.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { style: { display: "flex", height: "100%" }, children: [
|
|
7258
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: styles.sidebar, children: SETTINGS_MENU_ITEMS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
6836
7259
|
"div",
|
|
6837
7260
|
{
|
|
6838
7261
|
className: `${styles.menuItem} ${activeMenu === item.key ? "active" : ""}`,
|
|
6839
7262
|
onClick: () => setActiveMenu(item.key),
|
|
6840
7263
|
children: [
|
|
6841
|
-
/* @__PURE__ */ (0,
|
|
6842
|
-
/* @__PURE__ */ (0,
|
|
7264
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: styles.menuItemIcon, children: item.icon }),
|
|
7265
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: styles.menuItemText, children: item.label })
|
|
6843
7266
|
]
|
|
6844
7267
|
},
|
|
6845
7268
|
item.key
|
|
6846
7269
|
)) }),
|
|
6847
|
-
/* @__PURE__ */ (0,
|
|
6848
|
-
/* @__PURE__ */ (0,
|
|
6849
|
-
/* @__PURE__ */ (0,
|
|
6850
|
-
/* @__PURE__ */ (0,
|
|
6851
|
-
/* @__PURE__ */ (0,
|
|
7270
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: styles.content, children: [
|
|
7271
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: styles.contentHeader, children: [
|
|
7272
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: styles.contentHeaderLeft, children: [
|
|
7273
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Title3, { level: 3, className: styles.contentTitle, children: activeMenuItem?.label }),
|
|
7274
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Text14, { className: styles.contentDescription, children: [
|
|
6852
7275
|
activeMenu === "environment" && "Manage environment variables for the gateway server",
|
|
6853
7276
|
activeMenu === "models" && "Configure and register model lattices for use by agents"
|
|
6854
7277
|
] })
|
|
6855
7278
|
] }),
|
|
6856
|
-
/* @__PURE__ */ (0,
|
|
6857
|
-
/* @__PURE__ */ (0,
|
|
6858
|
-
/* @__PURE__ */ (0,
|
|
6859
|
-
|
|
7279
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: styles.contentHeaderRight, children: [
|
|
7280
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_antd28.Button, { onClick: onClose, children: "Cancel" }),
|
|
7281
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7282
|
+
import_antd28.Button,
|
|
6860
7283
|
{
|
|
6861
7284
|
type: "primary",
|
|
6862
|
-
icon: /* @__PURE__ */ (0,
|
|
7285
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_icons17.SaveOutlined, {}),
|
|
6863
7286
|
onClick: handleSave,
|
|
6864
7287
|
loading,
|
|
6865
7288
|
children: "Save Configuration"
|
|
@@ -6867,9 +7290,9 @@ QUEUE_NAME=tasks`,
|
|
|
6867
7290
|
)
|
|
6868
7291
|
] })
|
|
6869
7292
|
] }),
|
|
6870
|
-
/* @__PURE__ */ (0,
|
|
7293
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: styles.contentBody, children: renderContent(connection.id) })
|
|
6871
7294
|
] })
|
|
6872
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
7295
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
6873
7296
|
"div",
|
|
6874
7297
|
{
|
|
6875
7298
|
style: {
|
|
@@ -6881,29 +7304,29 @@ QUEUE_NAME=tasks`,
|
|
|
6881
7304
|
gap: 16,
|
|
6882
7305
|
padding: 48
|
|
6883
7306
|
},
|
|
6884
|
-
children: connection.connecting ? /* @__PURE__ */ (0,
|
|
6885
|
-
/* @__PURE__ */ (0,
|
|
6886
|
-
/* @__PURE__ */ (0,
|
|
6887
|
-
/* @__PURE__ */ (0,
|
|
7307
|
+
children: connection.connecting ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
7308
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_icons17.LinkOutlined, { style: { fontSize: 64, color: "#1890ff" }, spin: true }),
|
|
7309
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Title3, { level: 4, children: "Connecting..." }),
|
|
7310
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Text14, { type: "secondary", style: { textAlign: "center" }, children: [
|
|
6888
7311
|
"Connecting to ",
|
|
6889
7312
|
connection.url
|
|
6890
7313
|
] })
|
|
6891
|
-
] }) : /* @__PURE__ */ (0,
|
|
6892
|
-
/* @__PURE__ */ (0,
|
|
6893
|
-
/* @__PURE__ */ (0,
|
|
6894
|
-
/* @__PURE__ */ (0,
|
|
6895
|
-
|
|
7314
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
7315
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_icons17.LinkOutlined, { style: { fontSize: 64, color: "#d9d9d9" } }),
|
|
7316
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Title3, { level: 4, type: "secondary", children: connection.error || "Not Connected" }),
|
|
7317
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7318
|
+
Text14,
|
|
6896
7319
|
{
|
|
6897
7320
|
type: "secondary",
|
|
6898
7321
|
style: { textAlign: "center", maxWidth: 400 },
|
|
6899
7322
|
children: connection.error ? `Failed to connect to ${connection.url}. Please check the server URL and try again.` : `Click "Reconnect" to connect to ${connection.url}`
|
|
6900
7323
|
}
|
|
6901
7324
|
),
|
|
6902
|
-
/* @__PURE__ */ (0,
|
|
6903
|
-
|
|
7325
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7326
|
+
import_antd28.Button,
|
|
6904
7327
|
{
|
|
6905
7328
|
type: "primary",
|
|
6906
|
-
icon: /* @__PURE__ */ (0,
|
|
7329
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_icons17.LinkOutlined, {}),
|
|
6907
7330
|
onClick: () => checkConnection(connection.id),
|
|
6908
7331
|
loading: connection.connecting,
|
|
6909
7332
|
style: { marginTop: 16 },
|
|
@@ -6915,9 +7338,9 @@ QUEUE_NAME=tasks`,
|
|
|
6915
7338
|
) }),
|
|
6916
7339
|
closable: connections.length > 1
|
|
6917
7340
|
}));
|
|
6918
|
-
return /* @__PURE__ */ (0,
|
|
6919
|
-
/* @__PURE__ */ (0,
|
|
6920
|
-
|
|
7341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
7342
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7343
|
+
import_antd28.Modal,
|
|
6921
7344
|
{
|
|
6922
7345
|
open,
|
|
6923
7346
|
onCancel: onClose,
|
|
@@ -6925,8 +7348,8 @@ QUEUE_NAME=tasks`,
|
|
|
6925
7348
|
width: "80%",
|
|
6926
7349
|
footer: null,
|
|
6927
7350
|
title: "Settings",
|
|
6928
|
-
children: /* @__PURE__ */ (0,
|
|
6929
|
-
|
|
7351
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7352
|
+
import_antd28.Tabs,
|
|
6930
7353
|
{
|
|
6931
7354
|
activeKey: activeTabKey,
|
|
6932
7355
|
onChange: handleTabChange,
|
|
@@ -6939,7 +7362,7 @@ QUEUE_NAME=tasks`,
|
|
|
6939
7362
|
}
|
|
6940
7363
|
},
|
|
6941
7364
|
items: tabItems,
|
|
6942
|
-
addIcon: /* @__PURE__ */ (0,
|
|
7365
|
+
addIcon: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
6943
7366
|
"div",
|
|
6944
7367
|
{
|
|
6945
7368
|
style: {
|
|
@@ -6949,8 +7372,8 @@ QUEUE_NAME=tasks`,
|
|
|
6949
7372
|
padding: "4px 8px"
|
|
6950
7373
|
},
|
|
6951
7374
|
children: [
|
|
6952
|
-
/* @__PURE__ */ (0,
|
|
6953
|
-
/* @__PURE__ */ (0,
|
|
7375
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_icons17.PlusOutlined, {}),
|
|
7376
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: "Add Server" })
|
|
6954
7377
|
]
|
|
6955
7378
|
}
|
|
6956
7379
|
)
|
|
@@ -6958,8 +7381,8 @@ QUEUE_NAME=tasks`,
|
|
|
6958
7381
|
) })
|
|
6959
7382
|
}
|
|
6960
7383
|
),
|
|
6961
|
-
/* @__PURE__ */ (0,
|
|
6962
|
-
|
|
7384
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7385
|
+
import_antd28.Modal,
|
|
6963
7386
|
{
|
|
6964
7387
|
title: "Add New Server",
|
|
6965
7388
|
open: showAddServerModal,
|
|
@@ -6972,11 +7395,11 @@ QUEUE_NAME=tasks`,
|
|
|
6972
7395
|
},
|
|
6973
7396
|
confirmLoading: addingServer,
|
|
6974
7397
|
className: styles.addServerModal,
|
|
6975
|
-
children: /* @__PURE__ */ (0,
|
|
6976
|
-
/* @__PURE__ */ (0,
|
|
6977
|
-
/* @__PURE__ */ (0,
|
|
6978
|
-
/* @__PURE__ */ (0,
|
|
6979
|
-
|
|
7398
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd28.Space, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
7399
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
|
|
7400
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server Name" }),
|
|
7401
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7402
|
+
import_antd28.Input,
|
|
6980
7403
|
{
|
|
6981
7404
|
placeholder: "e.g., Production Server",
|
|
6982
7405
|
value: newServerName,
|
|
@@ -6984,12 +7407,12 @@ QUEUE_NAME=tasks`,
|
|
|
6984
7407
|
onPressEnter: handleAddServer
|
|
6985
7408
|
}
|
|
6986
7409
|
),
|
|
6987
|
-
/* @__PURE__ */ (0,
|
|
7410
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: Leave empty to use URL as name" })
|
|
6988
7411
|
] }),
|
|
6989
|
-
/* @__PURE__ */ (0,
|
|
6990
|
-
/* @__PURE__ */ (0,
|
|
6991
|
-
/* @__PURE__ */ (0,
|
|
6992
|
-
|
|
7412
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
|
|
7413
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server URL *" }),
|
|
7414
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7415
|
+
import_antd28.Input,
|
|
6993
7416
|
{
|
|
6994
7417
|
placeholder: "e.g., http://localhost:4001",
|
|
6995
7418
|
value: newServerUrl,
|
|
@@ -6997,12 +7420,12 @@ QUEUE_NAME=tasks`,
|
|
|
6997
7420
|
onPressEnter: handleAddServer
|
|
6998
7421
|
}
|
|
6999
7422
|
),
|
|
7000
|
-
/* @__PURE__ */ (0,
|
|
7423
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Enter the full URL of the gateway server" })
|
|
7001
7424
|
] }),
|
|
7002
|
-
/* @__PURE__ */ (0,
|
|
7003
|
-
/* @__PURE__ */ (0,
|
|
7004
|
-
/* @__PURE__ */ (0,
|
|
7005
|
-
|
|
7425
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
|
|
7426
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { strong: true, style: { display: "block", marginBottom: 8 }, children: "API Key" }),
|
|
7427
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7428
|
+
import_antd28.Input.Password,
|
|
7006
7429
|
{
|
|
7007
7430
|
placeholder: "Optional: Enter API key for authentication",
|
|
7008
7431
|
value: newServerApiKey,
|
|
@@ -7010,7 +7433,7 @@ QUEUE_NAME=tasks`,
|
|
|
7010
7433
|
onPressEnter: handleAddServer
|
|
7011
7434
|
}
|
|
7012
7435
|
),
|
|
7013
|
-
/* @__PURE__ */ (0,
|
|
7436
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text14, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: API key for server authentication" })
|
|
7014
7437
|
] })
|
|
7015
7438
|
] })
|
|
7016
7439
|
}
|
|
@@ -7019,10 +7442,10 @@ QUEUE_NAME=tasks`,
|
|
|
7019
7442
|
};
|
|
7020
7443
|
|
|
7021
7444
|
// src/components/Chat/AgentServerSetting.tsx
|
|
7022
|
-
var
|
|
7445
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
7023
7446
|
var AgentServerSetting = () => {
|
|
7024
7447
|
const { settingsModalOpen, setSettingsModalOpen } = useLatticeChatShellContext();
|
|
7025
|
-
return /* @__PURE__ */ (0,
|
|
7448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
7026
7449
|
SettingsModal,
|
|
7027
7450
|
{
|
|
7028
7451
|
open: settingsModalOpen,
|
|
@@ -7032,11 +7455,11 @@ var AgentServerSetting = () => {
|
|
|
7032
7455
|
};
|
|
7033
7456
|
|
|
7034
7457
|
// src/components/Chat/LatticeChatShell.tsx
|
|
7035
|
-
var
|
|
7458
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
7036
7459
|
var LatticeChatShell = (props) => {
|
|
7037
|
-
return /* @__PURE__ */ (0,
|
|
7038
|
-
/* @__PURE__ */ (0,
|
|
7039
|
-
/* @__PURE__ */ (0,
|
|
7460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(LatticeChatShellContextProvider, { ...props, children: [
|
|
7461
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AssistantContextProvider, { autoLoad: true, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ConversationContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(LatticeChatView, {}) }) }),
|
|
7462
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AgentServerSetting, {})
|
|
7040
7463
|
] });
|
|
7041
7464
|
};
|
|
7042
7465
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -7059,6 +7482,7 @@ var LatticeChatShell = (props) => {
|
|
|
7059
7482
|
LatticeChatShellContextProvider,
|
|
7060
7483
|
MDResponse,
|
|
7061
7484
|
MDViewFormItem,
|
|
7485
|
+
ScheduleButton,
|
|
7062
7486
|
SideAppViewBrowser,
|
|
7063
7487
|
getElement,
|
|
7064
7488
|
regsiterElement,
|