@axiom-lattice/react-sdk 2.1.80 → 2.1.82
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 +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +664 -637
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -70,6 +70,7 @@ __export(index_exports, {
|
|
|
70
70
|
ProtectedRoute: () => ProtectedRoute,
|
|
71
71
|
RegisterForm: () => RegisterForm,
|
|
72
72
|
ScheduleButton: () => ScheduleButton,
|
|
73
|
+
SideAppBrowserContext: () => SideAppBrowserContext,
|
|
73
74
|
SideAppViewBrowser: () => SideAppViewBrowser,
|
|
74
75
|
SkillCategoryPrompts: () => SkillCategoryPrompts_default,
|
|
75
76
|
SkillFlow: () => SkillFlow_default,
|
|
@@ -113,6 +114,8 @@ __export(index_exports, {
|
|
|
113
114
|
useEvalRuns: () => useEvalRuns,
|
|
114
115
|
useEvalSuites: () => useEvalSuites,
|
|
115
116
|
useLatticeChatShellContext: () => useLatticeChatShellContext,
|
|
117
|
+
useSideAppBrowser: () => useSideAppBrowser,
|
|
118
|
+
useSideAppOpener: () => useSideAppOpener,
|
|
116
119
|
useTenants: () => useTenants,
|
|
117
120
|
useUsers: () => useUsers
|
|
118
121
|
});
|
|
@@ -5031,11 +5034,11 @@ var import_icons43 = require("@ant-design/icons");
|
|
|
5031
5034
|
|
|
5032
5035
|
// src/components/GenUI/elements/confirm_feedback.tsx
|
|
5033
5036
|
var import_antd12 = require("antd");
|
|
5034
|
-
var
|
|
5037
|
+
var import_react31 = require("react");
|
|
5035
5038
|
|
|
5036
5039
|
// src/components/GenUI/MDResponse.tsx
|
|
5037
5040
|
var import_x_markdown = __toESM(require("@ant-design/x-markdown"));
|
|
5038
|
-
var
|
|
5041
|
+
var import_react30 = __toESM(require("react"));
|
|
5039
5042
|
var import_antd_style6 = require("antd-style");
|
|
5040
5043
|
|
|
5041
5044
|
// src/components/GenUI/Code.tsx
|
|
@@ -5080,21 +5083,35 @@ data
|
|
|
5080
5083
|
};
|
|
5081
5084
|
|
|
5082
5085
|
// src/components/GenUI/ReactChart.tsx
|
|
5083
|
-
var
|
|
5086
|
+
var import_react24 = require("react");
|
|
5084
5087
|
var echarts = __toESM(require("echarts"));
|
|
5085
5088
|
var import_antd6 = require("antd");
|
|
5086
5089
|
var import_best_effort_json_parser = require("best-effort-json-parser");
|
|
5087
5090
|
|
|
5088
5091
|
// src/components/GenUI/elements/generic_data_table.tsx
|
|
5089
5092
|
var import_antd5 = require("antd");
|
|
5090
|
-
var
|
|
5093
|
+
var import_react23 = require("react");
|
|
5091
5094
|
var import_icons3 = require("@ant-design/icons");
|
|
5095
|
+
|
|
5096
|
+
// src/components/Chat/SideAppBrowserContext.tsx
|
|
5097
|
+
var import_react22 = require("react");
|
|
5098
|
+
var SideAppBrowserContext = (0, import_react22.createContext)(null);
|
|
5099
|
+
var useSideAppBrowser = () => {
|
|
5100
|
+
return (0, import_react22.useContext)(SideAppBrowserContext);
|
|
5101
|
+
};
|
|
5102
|
+
var useSideAppOpener = () => {
|
|
5103
|
+
const { openSideApp } = useChatUIContext();
|
|
5104
|
+
const browserCtx = (0, import_react22.useContext)(SideAppBrowserContext);
|
|
5105
|
+
return browserCtx?.openApp ?? openSideApp;
|
|
5106
|
+
};
|
|
5107
|
+
|
|
5108
|
+
// src/components/GenUI/elements/generic_data_table.tsx
|
|
5092
5109
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
5093
5110
|
var { Text: Text3 } = import_antd5.Typography;
|
|
5094
5111
|
var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = true }) => {
|
|
5095
5112
|
const { dataSource, message: message23 } = data ?? {};
|
|
5096
|
-
const [expandedRowKeys, setExpandedRowKeys] = (0,
|
|
5097
|
-
const
|
|
5113
|
+
const [expandedRowKeys, setExpandedRowKeys] = (0, import_react23.useState)([]);
|
|
5114
|
+
const openSideApp = useSideAppOpener();
|
|
5098
5115
|
const processedData = dataSource?.map((item, index) => ({
|
|
5099
5116
|
...item,
|
|
5100
5117
|
key: `${index}_${JSON.stringify(item).slice(0, 20)}`
|
|
@@ -5570,11 +5587,11 @@ function parseAndValidateChartData(input) {
|
|
|
5570
5587
|
}
|
|
5571
5588
|
var ReactChart = (props) => {
|
|
5572
5589
|
const { children } = props;
|
|
5573
|
-
const chartRef = (0,
|
|
5574
|
-
const chartInstance = (0,
|
|
5575
|
-
const resizeObserverRef = (0,
|
|
5576
|
-
const [tableData, setTableData] = (0,
|
|
5577
|
-
(0,
|
|
5590
|
+
const chartRef = (0, import_react24.useRef)(null);
|
|
5591
|
+
const chartInstance = (0, import_react24.useRef)(null);
|
|
5592
|
+
const resizeObserverRef = (0, import_react24.useRef)(null);
|
|
5593
|
+
const [tableData, setTableData] = (0, import_react24.useState)(null);
|
|
5594
|
+
(0, import_react24.useEffect)(() => {
|
|
5578
5595
|
if (!chartRef.current) {
|
|
5579
5596
|
return;
|
|
5580
5597
|
}
|
|
@@ -5647,7 +5664,7 @@ var ReactChart = (props) => {
|
|
|
5647
5664
|
window.removeEventListener("resize", handleResize);
|
|
5648
5665
|
};
|
|
5649
5666
|
}, [children]);
|
|
5650
|
-
(0,
|
|
5667
|
+
(0, import_react24.useEffect)(() => {
|
|
5651
5668
|
return () => {
|
|
5652
5669
|
if (resizeObserverRef.current) {
|
|
5653
5670
|
resizeObserverRef.current.disconnect();
|
|
@@ -5702,17 +5719,17 @@ var ReactChart = (props) => {
|
|
|
5702
5719
|
};
|
|
5703
5720
|
|
|
5704
5721
|
// src/components/GenUI/Embed.tsx
|
|
5705
|
-
var
|
|
5722
|
+
var import_react27 = require("react");
|
|
5706
5723
|
var import_antd9 = require("antd");
|
|
5707
5724
|
var import_antd_style5 = require("antd-style");
|
|
5708
5725
|
|
|
5709
5726
|
// src/components/GenUI/FileRenderer.tsx
|
|
5710
|
-
var
|
|
5727
|
+
var import_react26 = require("react");
|
|
5711
5728
|
var import_antd8 = require("antd");
|
|
5712
5729
|
var import_antd_style4 = require("antd-style");
|
|
5713
5730
|
|
|
5714
5731
|
// src/components/GenUI/MarkdownViewer.tsx
|
|
5715
|
-
var
|
|
5732
|
+
var import_react25 = __toESM(require("react"));
|
|
5716
5733
|
var import_antd7 = require("antd");
|
|
5717
5734
|
var import_icons4 = require("@ant-design/icons");
|
|
5718
5735
|
var import_jspdf = require("jspdf");
|
|
@@ -5979,9 +5996,9 @@ var MarkdownViewer = ({
|
|
|
5979
5996
|
style
|
|
5980
5997
|
}) => {
|
|
5981
5998
|
const { styles, cx } = useStyles();
|
|
5982
|
-
const [copied, setCopied] = (0,
|
|
5983
|
-
const contentRef = (0,
|
|
5984
|
-
(0,
|
|
5999
|
+
const [copied, setCopied] = (0, import_react25.useState)(false);
|
|
6000
|
+
const contentRef = (0, import_react25.useRef)(null);
|
|
6001
|
+
(0, import_react25.useEffect)(() => {
|
|
5985
6002
|
if (copied) {
|
|
5986
6003
|
const timer = setTimeout(() => setCopied(false), 2e3);
|
|
5987
6004
|
return () => clearTimeout(timer);
|
|
@@ -6097,7 +6114,7 @@ var MarkdownViewer = ({
|
|
|
6097
6114
|
import_antd7.message.error({ content: "Failed to generate PDF", key: "pdf" });
|
|
6098
6115
|
}
|
|
6099
6116
|
};
|
|
6100
|
-
const displayContent =
|
|
6117
|
+
const displayContent = import_react25.default.useMemo(() => {
|
|
6101
6118
|
const lang = getLanguageFromFileName(fileName);
|
|
6102
6119
|
if (lang && lang !== "markdown" && lang !== "text") {
|
|
6103
6120
|
return `\`\`\`${lang}
|
|
@@ -6234,11 +6251,11 @@ var FileRenderer = ({
|
|
|
6234
6251
|
showHeader = true
|
|
6235
6252
|
}) => {
|
|
6236
6253
|
const { styles } = useStyles2();
|
|
6237
|
-
const [content, setContent] = (0,
|
|
6238
|
-
const [loading, setLoading] = (0,
|
|
6239
|
-
const [error, setError] = (0,
|
|
6240
|
-
const category = (0,
|
|
6241
|
-
(0,
|
|
6254
|
+
const [content, setContent] = (0, import_react26.useState)("");
|
|
6255
|
+
const [loading, setLoading] = (0, import_react26.useState)(true);
|
|
6256
|
+
const [error, setError] = (0, import_react26.useState)(null);
|
|
6257
|
+
const category = (0, import_react26.useMemo)(() => getFileCategory(fileName), [fileName]);
|
|
6258
|
+
(0, import_react26.useEffect)(() => {
|
|
6242
6259
|
if (category === "markdown" || category === "text") {
|
|
6243
6260
|
setLoading(true);
|
|
6244
6261
|
setError(null);
|
|
@@ -6385,13 +6402,13 @@ var Embed = ({ children }) => {
|
|
|
6385
6402
|
const { styles } = useStyles3();
|
|
6386
6403
|
const { config } = useLatticeChatShellContext();
|
|
6387
6404
|
const { threadId, assistantId } = useConversationContext();
|
|
6388
|
-
const embedConfig = (0,
|
|
6389
|
-
const fileUrl = (0,
|
|
6405
|
+
const embedConfig = (0, import_react27.useMemo)(() => parseEmbedContent(children), [children]);
|
|
6406
|
+
const fileUrl = (0, import_react27.useMemo)(() => {
|
|
6390
6407
|
if (embedConfig.url) return embedConfig.url;
|
|
6391
6408
|
if (!embedConfig.path || !config?.baseURL || !assistantId || !threadId) return null;
|
|
6392
6409
|
return `${config.baseURL}/api/assistants/${assistantId}/threads/${threadId}/sandbox/downloadfile?path=${encodeURIComponent(embedConfig.path)}`;
|
|
6393
6410
|
}, [embedConfig, config?.baseURL, assistantId, threadId]);
|
|
6394
|
-
const displayTitle = (0,
|
|
6411
|
+
const displayTitle = (0, import_react27.useMemo)(() => {
|
|
6395
6412
|
if (embedConfig.title) return embedConfig.title;
|
|
6396
6413
|
if (embedConfig.path) return embedConfig.path.split("/").pop() || embedConfig.path;
|
|
6397
6414
|
if (embedConfig.url) {
|
|
@@ -6403,7 +6420,7 @@ var Embed = ({ children }) => {
|
|
|
6403
6420
|
}
|
|
6404
6421
|
return "Embedded File";
|
|
6405
6422
|
}, [embedConfig]);
|
|
6406
|
-
const fileIcon = (0,
|
|
6423
|
+
const fileIcon = (0, import_react27.useMemo)(() => {
|
|
6407
6424
|
const fileName = embedConfig.path || embedConfig.url || "";
|
|
6408
6425
|
return getFileIcon(fileName);
|
|
6409
6426
|
}, [embedConfig]);
|
|
@@ -6514,7 +6531,7 @@ var MDComponentWrap = (Element) => {
|
|
|
6514
6531
|
|
|
6515
6532
|
// src/components/GenUI/elements/file_link.tsx
|
|
6516
6533
|
var import_antd11 = require("antd");
|
|
6517
|
-
var
|
|
6534
|
+
var import_react28 = require("react");
|
|
6518
6535
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
6519
6536
|
var FileLink = ({ data }) => {
|
|
6520
6537
|
if (!data) {
|
|
@@ -6523,16 +6540,16 @@ var FileLink = ({ data }) => {
|
|
|
6523
6540
|
if (!isFileName(data)) {
|
|
6524
6541
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: data });
|
|
6525
6542
|
}
|
|
6526
|
-
const
|
|
6543
|
+
const openSideApp = useSideAppOpener();
|
|
6527
6544
|
const { threadId, assistantId } = useConversationContext();
|
|
6528
6545
|
const { config } = useLatticeChatShellContext();
|
|
6529
|
-
const fileBaseURL = (0,
|
|
6546
|
+
const fileBaseURL = (0, import_react28.useMemo)(() => {
|
|
6530
6547
|
if (!config?.baseURL || !assistantId || !threadId) {
|
|
6531
6548
|
return null;
|
|
6532
6549
|
}
|
|
6533
6550
|
return `${config.baseURL}/api/assistants/${assistantId}/threads/${threadId}/sandbox/downloadfile?path=`;
|
|
6534
6551
|
}, [config?.baseURL, assistantId, threadId]);
|
|
6535
|
-
const handleItemClick = (0,
|
|
6552
|
+
const handleItemClick = (0, import_react28.useCallback)((path) => {
|
|
6536
6553
|
if (!fileBaseURL) return;
|
|
6537
6554
|
openSideApp({
|
|
6538
6555
|
component_key: "attachments",
|
|
@@ -6551,7 +6568,7 @@ var FileLink = ({ data }) => {
|
|
|
6551
6568
|
};
|
|
6552
6569
|
|
|
6553
6570
|
// src/components/GenUI/elements/MarkdownTable.tsx
|
|
6554
|
-
var
|
|
6571
|
+
var import_react29 = require("react");
|
|
6555
6572
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
6556
6573
|
var extractTableData = (domNode) => {
|
|
6557
6574
|
if (!domNode || !domNode.children) {
|
|
@@ -6618,7 +6635,7 @@ var extractTableData = (domNode) => {
|
|
|
6618
6635
|
};
|
|
6619
6636
|
var MarkdownTable = (props) => {
|
|
6620
6637
|
const { domNode } = props;
|
|
6621
|
-
const tableData = (0,
|
|
6638
|
+
const tableData = (0, import_react29.useMemo)(() => {
|
|
6622
6639
|
return extractTableData(domNode);
|
|
6623
6640
|
}, [domNode]);
|
|
6624
6641
|
if (!tableData || tableData.dataSource.length === 0) {
|
|
@@ -6716,7 +6733,7 @@ var useStyles4 = (0, import_antd_style6.createStyles)(({ token, css }) => ({
|
|
|
6716
6733
|
}
|
|
6717
6734
|
`
|
|
6718
6735
|
}));
|
|
6719
|
-
var MarkdownErrorBoundary = class extends
|
|
6736
|
+
var MarkdownErrorBoundary = class extends import_react30.default.Component {
|
|
6720
6737
|
constructor(props) {
|
|
6721
6738
|
super(props);
|
|
6722
6739
|
this.state = { hasError: false };
|
|
@@ -6734,8 +6751,8 @@ var MarkdownErrorBoundary = class extends import_react29.default.Component {
|
|
|
6734
6751
|
return this.props.children;
|
|
6735
6752
|
}
|
|
6736
6753
|
};
|
|
6737
|
-
var SafeXMarkdown =
|
|
6738
|
-
const deferredContent = (0,
|
|
6754
|
+
var SafeXMarkdown = import_react30.default.memo(({ content, components, className }) => {
|
|
6755
|
+
const deferredContent = (0, import_react30.useDeferredValue)(content);
|
|
6739
6756
|
if (typeof deferredContent !== "string") {
|
|
6740
6757
|
console.warn("[MDResponse] Content is not a string:", typeof deferredContent, deferredContent);
|
|
6741
6758
|
}
|
|
@@ -6759,7 +6776,7 @@ var MDResponseInner = ({
|
|
|
6759
6776
|
noGenUI
|
|
6760
6777
|
}) => {
|
|
6761
6778
|
const { styles } = useStyles4();
|
|
6762
|
-
const fallbackContent = (0,
|
|
6779
|
+
const fallbackContent = (0, import_react30.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: styles.markdownContainer, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("pre", { style: { whiteSpace: "pre-wrap", wordBreak: "break-word" }, children: content }) }), [content, styles.markdownContainer]);
|
|
6763
6780
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MarkdownErrorBoundary, { fallback: fallbackContent, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
6764
6781
|
SafeXMarkdown,
|
|
6765
6782
|
{
|
|
@@ -6769,7 +6786,7 @@ var MDResponseInner = ({
|
|
|
6769
6786
|
}
|
|
6770
6787
|
) });
|
|
6771
6788
|
};
|
|
6772
|
-
var MDResponse =
|
|
6789
|
+
var MDResponse = import_react30.default.memo(MDResponseInner);
|
|
6773
6790
|
MDResponse.displayName = "MDResponse";
|
|
6774
6791
|
var MDViewFormItem = ({ value }) => {
|
|
6775
6792
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MDResponse, { content: value || "" });
|
|
@@ -6784,7 +6801,7 @@ var ConfirmFeedback = ({
|
|
|
6784
6801
|
}) => {
|
|
6785
6802
|
const { message: message23, type, config, feedback, options } = data ?? {};
|
|
6786
6803
|
const { sendMessage } = useAgentChat();
|
|
6787
|
-
const [clicked, setClicked] = (0,
|
|
6804
|
+
const [clicked, setClicked] = (0, import_react31.useState)(false);
|
|
6788
6805
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_antd12.Space, { direction: "vertical", style: { width: "100%" }, children: [
|
|
6789
6806
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MDResponse, { content: message23 }),
|
|
6790
6807
|
options ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_antd12.Space, { style: { justifyContent: "flex-end", width: "100%" }, children: options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -6863,7 +6880,7 @@ var ConfirmFeedback = ({
|
|
|
6863
6880
|
|
|
6864
6881
|
// src/components/GenUI/elements/clarify_feedback.tsx
|
|
6865
6882
|
var import_antd13 = require("antd");
|
|
6866
|
-
var
|
|
6883
|
+
var import_react32 = require("react");
|
|
6867
6884
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
6868
6885
|
var { Text: Text5 } = import_antd13.Typography;
|
|
6869
6886
|
var ClarifyFeedback = ({
|
|
@@ -6872,9 +6889,9 @@ var ClarifyFeedback = ({
|
|
|
6872
6889
|
}) => {
|
|
6873
6890
|
const { questions } = data ?? {};
|
|
6874
6891
|
const { sendMessage } = useAgentChat();
|
|
6875
|
-
const [currentStep, setCurrentStep] = (0,
|
|
6876
|
-
const [answers, setAnswers] = (0,
|
|
6877
|
-
const [submitted, setSubmitted] = (0,
|
|
6892
|
+
const [currentStep, setCurrentStep] = (0, import_react32.useState)(0);
|
|
6893
|
+
const [answers, setAnswers] = (0, import_react32.useState)({});
|
|
6894
|
+
const [submitted, setSubmitted] = (0, import_react32.useState)(false);
|
|
6878
6895
|
const currentQuestion = questions?.[currentStep];
|
|
6879
6896
|
const totalQuestions = questions?.length || 0;
|
|
6880
6897
|
const handleOptionChange = (selected) => {
|
|
@@ -7381,7 +7398,7 @@ var ToolCall = ({ data }) => {
|
|
|
7381
7398
|
var import_antd16 = require("antd");
|
|
7382
7399
|
var import_antd_style8 = require("antd-style");
|
|
7383
7400
|
var import_icons9 = require("@ant-design/icons");
|
|
7384
|
-
var
|
|
7401
|
+
var import_react33 = require("react");
|
|
7385
7402
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
7386
7403
|
var { Text: Text7 } = import_antd16.Typography;
|
|
7387
7404
|
var useStyle3 = (0, import_antd_style8.createStyles)(({ token, css }) => ({
|
|
@@ -7426,10 +7443,10 @@ var Todo = ({
|
|
|
7426
7443
|
const allCompleted = data.every((item) => item.status === "completed");
|
|
7427
7444
|
return allPending || allCompleted;
|
|
7428
7445
|
};
|
|
7429
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
7446
|
+
const [isExpanded, setIsExpanded] = (0, import_react33.useState)(
|
|
7430
7447
|
() => smartCollapse ? getDefaultExpanded() : false
|
|
7431
7448
|
);
|
|
7432
|
-
(0,
|
|
7449
|
+
(0, import_react33.useEffect)(() => {
|
|
7433
7450
|
if (smartCollapse) {
|
|
7434
7451
|
setIsExpanded(getDefaultExpanded());
|
|
7435
7452
|
}
|
|
@@ -7620,7 +7637,7 @@ var WriteTodos = ({
|
|
|
7620
7637
|
};
|
|
7621
7638
|
|
|
7622
7639
|
// src/components/GenUI/FileExplorer.tsx
|
|
7623
|
-
var
|
|
7640
|
+
var import_react34 = require("react");
|
|
7624
7641
|
var import_antd18 = require("antd");
|
|
7625
7642
|
var import_icons12 = require("@ant-design/icons");
|
|
7626
7643
|
var import_antd_style9 = require("antd-style");
|
|
@@ -7888,10 +7905,10 @@ var FileExplorer = ({
|
|
|
7888
7905
|
}) => {
|
|
7889
7906
|
const { files } = data ?? {};
|
|
7890
7907
|
const { styles, cx } = useStyles5();
|
|
7891
|
-
const [fileList, setFileList] = (0,
|
|
7892
|
-
const [selectedKey, setSelectedKey] = (0,
|
|
7893
|
-
const [expandedKeys, setExpandedKeys] = (0,
|
|
7894
|
-
(0,
|
|
7908
|
+
const [fileList, setFileList] = (0, import_react34.useState)([]);
|
|
7909
|
+
const [selectedKey, setSelectedKey] = (0, import_react34.useState)("");
|
|
7910
|
+
const [expandedKeys, setExpandedKeys] = (0, import_react34.useState)([]);
|
|
7911
|
+
(0, import_react34.useEffect)(() => {
|
|
7895
7912
|
let list = [];
|
|
7896
7913
|
if (Array.isArray(files)) {
|
|
7897
7914
|
list = files;
|
|
@@ -7907,11 +7924,11 @@ var FileExplorer = ({
|
|
|
7907
7924
|
setSelectedKey(list[0].name);
|
|
7908
7925
|
}
|
|
7909
7926
|
}, [files]);
|
|
7910
|
-
const treeData = (0,
|
|
7927
|
+
const treeData = (0, import_react34.useMemo)(
|
|
7911
7928
|
() => buildTreeData(fileList, expandedKeys),
|
|
7912
7929
|
[fileList, expandedKeys]
|
|
7913
7930
|
);
|
|
7914
|
-
(0,
|
|
7931
|
+
(0, import_react34.useEffect)(() => {
|
|
7915
7932
|
if (treeData.length > 0 && expandedKeys.length === 0) {
|
|
7916
7933
|
const getAllKeys = (nodes) => {
|
|
7917
7934
|
let keys = [];
|
|
@@ -7928,7 +7945,7 @@ var FileExplorer = ({
|
|
|
7928
7945
|
setExpandedKeys(getAllKeys(treeData));
|
|
7929
7946
|
}
|
|
7930
7947
|
}, [treeData.length]);
|
|
7931
|
-
const selectedFile = (0,
|
|
7948
|
+
const selectedFile = (0, import_react34.useMemo)(() => {
|
|
7932
7949
|
return fileList.find((f) => f.name === selectedKey);
|
|
7933
7950
|
}, [fileList, selectedKey]);
|
|
7934
7951
|
const renderContent = () => {
|
|
@@ -7997,7 +8014,7 @@ var FileExplorer = ({
|
|
|
7997
8014
|
var import_x2 = require("@ant-design/x");
|
|
7998
8015
|
var import_antd19 = require("antd");
|
|
7999
8016
|
var import_dayjs = __toESM(require("dayjs"));
|
|
8000
|
-
var
|
|
8017
|
+
var import_react35 = require("react");
|
|
8001
8018
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
8002
8019
|
var AttachmentsCard = ({
|
|
8003
8020
|
data,
|
|
@@ -8011,8 +8028,8 @@ var AttachmentsCard = ({
|
|
|
8011
8028
|
const baseURL = config.baseURL;
|
|
8012
8029
|
const fileBaseURL = `${baseURL}/api/assistants/${assistantId}/threads/${threadId}/sandbox/downloadfile?path=`;
|
|
8013
8030
|
const { Text: Text48 } = import_antd19.Typography;
|
|
8014
|
-
const [showAll, setShowAll] = (0,
|
|
8015
|
-
const
|
|
8031
|
+
const [showAll, setShowAll] = (0, import_react35.useState)(false);
|
|
8032
|
+
const openSideApp = useSideAppOpener();
|
|
8016
8033
|
const getStyles = () => {
|
|
8017
8034
|
switch (size) {
|
|
8018
8035
|
case "small":
|
|
@@ -8193,7 +8210,7 @@ var AttachmentsCard = ({
|
|
|
8193
8210
|
|
|
8194
8211
|
// src/components/GenUI/elements/attachments_viewer_side_app.tsx
|
|
8195
8212
|
var import_antd20 = require("antd");
|
|
8196
|
-
var
|
|
8213
|
+
var import_react36 = require("react");
|
|
8197
8214
|
|
|
8198
8215
|
// src/components/GenUI/RenderMDFromURL.tsx
|
|
8199
8216
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
@@ -8214,13 +8231,13 @@ function AttachmentsViewerSideApp({
|
|
|
8214
8231
|
data,
|
|
8215
8232
|
component_key
|
|
8216
8233
|
}) {
|
|
8217
|
-
const [loading, setLoading] = (0,
|
|
8234
|
+
const [loading, setLoading] = (0, import_react36.useState)(false);
|
|
8218
8235
|
const { file_id, url, full_url } = data ?? {};
|
|
8219
|
-
const [fileUri, setFileUri] = (0,
|
|
8236
|
+
const [fileUri, setFileUri] = (0, import_react36.useState)({
|
|
8220
8237
|
url: full_url || "",
|
|
8221
8238
|
fileName: extractFileName(file_id || "")
|
|
8222
8239
|
});
|
|
8223
|
-
(0,
|
|
8240
|
+
(0, import_react36.useEffect)(() => {
|
|
8224
8241
|
setFileUri({
|
|
8225
8242
|
url: full_url || "",
|
|
8226
8243
|
fileName: extractFileName(file_id || "")
|
|
@@ -8264,7 +8281,7 @@ function AttachmentsViewerSideApp({
|
|
|
8264
8281
|
var import_antd22 = require("antd");
|
|
8265
8282
|
|
|
8266
8283
|
// src/components/GenUI/elements/ContentPreviewCollapse.tsx
|
|
8267
|
-
var
|
|
8284
|
+
var import_react37 = require("react");
|
|
8268
8285
|
var import_antd21 = require("antd");
|
|
8269
8286
|
var import_antd_style10 = require("antd-style");
|
|
8270
8287
|
var import_icons13 = require("@ant-design/icons");
|
|
@@ -8334,18 +8351,18 @@ var ContentPreviewCollapse = ({
|
|
|
8334
8351
|
showAllText = "Show all content",
|
|
8335
8352
|
showLessText = "Show less"
|
|
8336
8353
|
}) => {
|
|
8337
|
-
const [showFullContent, setShowFullContent] = (0,
|
|
8338
|
-
const [isOverflowing, setIsOverflowing] = (0,
|
|
8339
|
-
const contentRef = (0,
|
|
8354
|
+
const [showFullContent, setShowFullContent] = (0, import_react37.useState)(false);
|
|
8355
|
+
const [isOverflowing, setIsOverflowing] = (0, import_react37.useState)(false);
|
|
8356
|
+
const contentRef = (0, import_react37.useRef)(null);
|
|
8340
8357
|
const showShadow = isOverflowing && !showFullContent;
|
|
8341
8358
|
const { styles, cx } = useStyle4({ showShadow });
|
|
8342
|
-
const checkOverflow = (0,
|
|
8359
|
+
const checkOverflow = (0, import_react37.useCallback)(() => {
|
|
8343
8360
|
if (contentRef.current) {
|
|
8344
8361
|
const scrollHeight = contentRef.current.scrollHeight;
|
|
8345
8362
|
setIsOverflowing(scrollHeight > collapsedMaxHeight);
|
|
8346
8363
|
}
|
|
8347
8364
|
}, [collapsedMaxHeight]);
|
|
8348
|
-
(0,
|
|
8365
|
+
(0, import_react37.useEffect)(() => {
|
|
8349
8366
|
const element = contentRef.current;
|
|
8350
8367
|
if (!element) return;
|
|
8351
8368
|
checkOverflow();
|
|
@@ -8411,7 +8428,7 @@ var WriteFile = ({
|
|
|
8411
8428
|
}) => {
|
|
8412
8429
|
const toolCallData = data;
|
|
8413
8430
|
const { file_path, content } = toolCallData?.args || {};
|
|
8414
|
-
const
|
|
8431
|
+
const openSideApp = useSideAppOpener();
|
|
8415
8432
|
if (!toolCallData) {
|
|
8416
8433
|
return null;
|
|
8417
8434
|
}
|
|
@@ -8480,7 +8497,7 @@ var EditFile = ({
|
|
|
8480
8497
|
}) => {
|
|
8481
8498
|
const toolCallData = data;
|
|
8482
8499
|
const { file_path, new_string, old_string } = toolCallData?.args || {};
|
|
8483
|
-
const
|
|
8500
|
+
const openSideApp = useSideAppOpener();
|
|
8484
8501
|
if (!toolCallData) {
|
|
8485
8502
|
return null;
|
|
8486
8503
|
}
|
|
@@ -8681,7 +8698,7 @@ var TaskCard = ({
|
|
|
8681
8698
|
}) => {
|
|
8682
8699
|
const { styles } = useStyle5();
|
|
8683
8700
|
const toolCallData = data;
|
|
8684
|
-
const
|
|
8701
|
+
const openSideApp = useSideAppOpener();
|
|
8685
8702
|
if (!toolCallData) {
|
|
8686
8703
|
return null;
|
|
8687
8704
|
}
|
|
@@ -8810,17 +8827,17 @@ var import_x6 = require("@ant-design/x");
|
|
|
8810
8827
|
var import_x3 = require("@ant-design/x");
|
|
8811
8828
|
var import_antd25 = require("antd");
|
|
8812
8829
|
var import_ErrorBoundary = __toESM(require("antd/es/alert/ErrorBoundary"));
|
|
8813
|
-
var
|
|
8830
|
+
var import_react38 = require("react");
|
|
8814
8831
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
8815
8832
|
var LazyBubble = ({
|
|
8816
8833
|
message: message23,
|
|
8817
8834
|
renderContent,
|
|
8818
8835
|
autoLoadRightPanel
|
|
8819
8836
|
}) => {
|
|
8820
|
-
const ref = (0,
|
|
8821
|
-
const [isVisible, setIsVisible] = (0,
|
|
8822
|
-
const [wasEverVisible, setWasEverVisible] = (0,
|
|
8823
|
-
(0,
|
|
8837
|
+
const ref = (0, import_react38.useRef)(null);
|
|
8838
|
+
const [isVisible, setIsVisible] = (0, import_react38.useState)(false);
|
|
8839
|
+
const [wasEverVisible, setWasEverVisible] = (0, import_react38.useState)(false);
|
|
8840
|
+
(0, import_react38.useEffect)(() => {
|
|
8824
8841
|
const observer = new IntersectionObserver(
|
|
8825
8842
|
([entry]) => {
|
|
8826
8843
|
const visible = entry.isIntersecting;
|
|
@@ -8840,7 +8857,7 @@ var LazyBubble = ({
|
|
|
8840
8857
|
}
|
|
8841
8858
|
};
|
|
8842
8859
|
}, [wasEverVisible]);
|
|
8843
|
-
(0,
|
|
8860
|
+
(0, import_react38.useEffect)(() => {
|
|
8844
8861
|
autoLoadRightPanel?.();
|
|
8845
8862
|
}, []);
|
|
8846
8863
|
const getPlaceholder = () => {
|
|
@@ -8849,7 +8866,7 @@ var LazyBubble = ({
|
|
|
8849
8866
|
};
|
|
8850
8867
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_ErrorBoundary.default, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message23) : getPlaceholder() }) });
|
|
8851
8868
|
};
|
|
8852
|
-
var MemoizedBubbleList = (0,
|
|
8869
|
+
var MemoizedBubbleList = (0, import_react38.memo)(
|
|
8853
8870
|
({
|
|
8854
8871
|
items,
|
|
8855
8872
|
role,
|
|
@@ -8871,14 +8888,14 @@ var MessageList = ({
|
|
|
8871
8888
|
className
|
|
8872
8889
|
}) => {
|
|
8873
8890
|
const { styles } = useStyle();
|
|
8874
|
-
const
|
|
8875
|
-
const messageLengthRef = (0,
|
|
8876
|
-
(0,
|
|
8891
|
+
const openSideApp = useSideAppOpener();
|
|
8892
|
+
const messageLengthRef = (0, import_react38.useRef)(messages?.length ?? 0);
|
|
8893
|
+
(0, import_react38.useEffect)(() => {
|
|
8877
8894
|
if (messages?.length) {
|
|
8878
8895
|
messageLengthRef.current = messages?.length;
|
|
8879
8896
|
}
|
|
8880
8897
|
}, [messages?.length]);
|
|
8881
|
-
const renderContent = (0,
|
|
8898
|
+
const renderContent = (0, import_react38.useCallback)((message23) => {
|
|
8882
8899
|
const { content } = message23;
|
|
8883
8900
|
try {
|
|
8884
8901
|
const json = JSON.parse(content);
|
|
@@ -8895,7 +8912,7 @@ ${JSON.stringify(tool_call)}
|
|
|
8895
8912
|
const content_md = [content, ...tool_calls_md].join("\n");
|
|
8896
8913
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_antd25.Space, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MDResponse, { content: content_md }) });
|
|
8897
8914
|
}, []);
|
|
8898
|
-
const items = (0,
|
|
8915
|
+
const items = (0, import_react38.useMemo)(
|
|
8899
8916
|
() => messages.map((message23, index) => ({
|
|
8900
8917
|
key: message23.id,
|
|
8901
8918
|
role: message23.role,
|
|
@@ -8974,7 +8991,7 @@ ${JSON.stringify(tool_call)}
|
|
|
8974
8991
|
|
|
8975
8992
|
// src/components/Chat/Chating.tsx
|
|
8976
8993
|
var import_antd71 = require("antd");
|
|
8977
|
-
var
|
|
8994
|
+
var import_react81 = __toESM(require("react"));
|
|
8978
8995
|
var import_lucide_react20 = require("lucide-react");
|
|
8979
8996
|
|
|
8980
8997
|
// src/components/GenUI/HITLContainer.tsx
|
|
@@ -9043,7 +9060,7 @@ var HITLContainer = () => {
|
|
|
9043
9060
|
var import_antd27 = require("antd");
|
|
9044
9061
|
var import_antd_style13 = require("antd-style");
|
|
9045
9062
|
var import_icons15 = require("@ant-design/icons");
|
|
9046
|
-
var
|
|
9063
|
+
var import_react39 = require("react");
|
|
9047
9064
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
9048
9065
|
var useStyle7 = (0, import_antd_style13.createStyles)(({ css, token }) => ({
|
|
9049
9066
|
container: css`
|
|
@@ -9133,9 +9150,9 @@ var useStyle7 = (0, import_antd_style13.createStyles)(({ css, token }) => ({
|
|
|
9133
9150
|
var PendingMessagesContainer = () => {
|
|
9134
9151
|
const { styles } = useStyle7();
|
|
9135
9152
|
const { pendingMessages, sendMessage, removePendingMessage } = useAgentChat();
|
|
9136
|
-
const [expanded, setExpanded] = (0,
|
|
9137
|
-
const [sendingId, setSendingId] = (0,
|
|
9138
|
-
const [deletingId, setDeletingId] = (0,
|
|
9153
|
+
const [expanded, setExpanded] = (0, import_react39.useState)(true);
|
|
9154
|
+
const [sendingId, setSendingId] = (0, import_react39.useState)(null);
|
|
9155
|
+
const [deletingId, setDeletingId] = (0, import_react39.useState)(null);
|
|
9139
9156
|
if (!pendingMessages || pendingMessages.length === 0) return null;
|
|
9140
9157
|
const handleSendMessage = async (msg) => {
|
|
9141
9158
|
if (sendingId || deletingId) return;
|
|
@@ -9590,7 +9607,7 @@ var FileExplorerButton = ({}) => {
|
|
|
9590
9607
|
};
|
|
9591
9608
|
|
|
9592
9609
|
// src/components/Chat/ScheduleButton.tsx
|
|
9593
|
-
var
|
|
9610
|
+
var import_react40 = require("react");
|
|
9594
9611
|
var import_antd31 = require("antd");
|
|
9595
9612
|
var import_icons17 = require("@ant-design/icons");
|
|
9596
9613
|
var import_client_sdk5 = require("@axiom-lattice/client-sdk");
|
|
@@ -9601,10 +9618,10 @@ var ScheduleButton = ({
|
|
|
9601
9618
|
const { threadId, assistantId } = useAgentChat();
|
|
9602
9619
|
const { openSideApp } = useChatUIContext();
|
|
9603
9620
|
const client = useClient(assistantId || "");
|
|
9604
|
-
const [scheduledTasks, setScheduledTasks] = (0,
|
|
9605
|
-
const [loading, setLoading] = (0,
|
|
9606
|
-
const [taskCount, setTaskCount] = (0,
|
|
9607
|
-
const fetchScheduledTasks = (0,
|
|
9621
|
+
const [scheduledTasks, setScheduledTasks] = (0, import_react40.useState)([]);
|
|
9622
|
+
const [loading, setLoading] = (0, import_react40.useState)(false);
|
|
9623
|
+
const [taskCount, setTaskCount] = (0, import_react40.useState)(0);
|
|
9624
|
+
const fetchScheduledTasks = (0, import_react40.useCallback)(async () => {
|
|
9608
9625
|
if (!threadId) return;
|
|
9609
9626
|
setLoading(true);
|
|
9610
9627
|
try {
|
|
@@ -9622,7 +9639,7 @@ var ScheduleButton = ({
|
|
|
9622
9639
|
setLoading(false);
|
|
9623
9640
|
}
|
|
9624
9641
|
}, [client, threadId]);
|
|
9625
|
-
(0,
|
|
9642
|
+
(0, import_react40.useEffect)(() => {
|
|
9626
9643
|
fetchScheduledTasks();
|
|
9627
9644
|
}, [fetchScheduledTasks]);
|
|
9628
9645
|
if (!threadId) {
|
|
@@ -9916,7 +9933,7 @@ var AgentHeader = ({
|
|
|
9916
9933
|
};
|
|
9917
9934
|
|
|
9918
9935
|
// src/components/Chat/ThreadManagementButtons.tsx
|
|
9919
|
-
var
|
|
9936
|
+
var import_react41 = require("react");
|
|
9920
9937
|
var import_antd35 = require("antd");
|
|
9921
9938
|
var import_icons20 = require("@ant-design/icons");
|
|
9922
9939
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
@@ -9929,7 +9946,7 @@ var CreateThreadButton = () => {
|
|
|
9929
9946
|
if (!assistantId) {
|
|
9930
9947
|
return null;
|
|
9931
9948
|
}
|
|
9932
|
-
const handleCreateThread = (0,
|
|
9949
|
+
const handleCreateThread = (0, import_react41.useCallback)(async () => {
|
|
9933
9950
|
try {
|
|
9934
9951
|
await createThread();
|
|
9935
9952
|
} catch (error) {
|
|
@@ -9962,7 +9979,7 @@ var ThreadListButton = () => {
|
|
|
9962
9979
|
if (!assistantId) {
|
|
9963
9980
|
return null;
|
|
9964
9981
|
}
|
|
9965
|
-
const handleRefresh = (0,
|
|
9982
|
+
const handleRefresh = (0, import_react41.useCallback)(async () => {
|
|
9966
9983
|
try {
|
|
9967
9984
|
await listThreads();
|
|
9968
9985
|
} catch (error) {
|
|
@@ -10006,8 +10023,8 @@ var ThreadListButton = () => {
|
|
|
10006
10023
|
) });
|
|
10007
10024
|
};
|
|
10008
10025
|
var ThreadManagementButtons = () => {
|
|
10009
|
-
const shellContext = (0,
|
|
10010
|
-
const conversationContext = (0,
|
|
10026
|
+
const shellContext = (0, import_react41.useContext)(LatticeChatShellContext);
|
|
10027
|
+
const conversationContext = (0, import_react41.useContext)(ConversationContext);
|
|
10011
10028
|
if (!shellContext || !conversationContext) {
|
|
10012
10029
|
return null;
|
|
10013
10030
|
}
|
|
@@ -10027,16 +10044,16 @@ var ThreadManagementButtons = () => {
|
|
|
10027
10044
|
};
|
|
10028
10045
|
|
|
10029
10046
|
// src/context/WorkspaceContext.tsx
|
|
10030
|
-
var
|
|
10047
|
+
var import_react73 = __toESM(require("react"));
|
|
10031
10048
|
var import_client_sdk6 = require("@axiom-lattice/client-sdk");
|
|
10032
10049
|
|
|
10033
10050
|
// src/components/Chat/WorkspaceResourceManager.tsx
|
|
10034
|
-
var
|
|
10051
|
+
var import_react72 = require("react");
|
|
10035
10052
|
var import_lucide_react14 = require("lucide-react");
|
|
10036
10053
|
var import_antd63 = require("antd");
|
|
10037
10054
|
|
|
10038
10055
|
// src/components/Chat/Menu.tsx
|
|
10039
|
-
var
|
|
10056
|
+
var import_react42 = __toESM(require("react"));
|
|
10040
10057
|
var import_antd36 = require("antd");
|
|
10041
10058
|
var import_lucide_react4 = require("lucide-react");
|
|
10042
10059
|
var import_antd_style16 = require("antd-style");
|
|
@@ -10148,10 +10165,10 @@ var Menu = ({
|
|
|
10148
10165
|
const { styles: menuStyles } = useMenuStyles();
|
|
10149
10166
|
const { styles } = useStyle();
|
|
10150
10167
|
const isControlled = collapsed !== void 0;
|
|
10151
|
-
const [internalIsIconView, setInternalIsIconView] = (0,
|
|
10168
|
+
const [internalIsIconView, setInternalIsIconView] = (0, import_react42.useState)(!defaultExpanded);
|
|
10152
10169
|
const isIconView = isControlled ? collapsed : internalIsIconView;
|
|
10153
|
-
const [drawerStates, setDrawerStates] = (0,
|
|
10154
|
-
const [expandedInlineDrawers, setExpandedInlineDrawers] = (0,
|
|
10170
|
+
const [drawerStates, setDrawerStates] = (0, import_react42.useState)({});
|
|
10171
|
+
const [expandedInlineDrawers, setExpandedInlineDrawers] = (0, import_react42.useState)(
|
|
10155
10172
|
() => {
|
|
10156
10173
|
const defaultExpanded2 = /* @__PURE__ */ new Set();
|
|
10157
10174
|
items.forEach((item) => {
|
|
@@ -10165,8 +10182,8 @@ var Menu = ({
|
|
|
10165
10182
|
const shouldShowIconMode = isIconView || forceIconMode;
|
|
10166
10183
|
const isExpanded = !shouldShowIconMode;
|
|
10167
10184
|
const isCollapsed = !isExpanded;
|
|
10168
|
-
const groupedItems = (0,
|
|
10169
|
-
const handleItemClick = (0,
|
|
10185
|
+
const groupedItems = (0, import_react42.useMemo)(() => groupMenuItems(items), [items]);
|
|
10186
|
+
const handleItemClick = (0, import_react42.useCallback)(
|
|
10170
10187
|
(item) => {
|
|
10171
10188
|
onItemClick?.(item);
|
|
10172
10189
|
if (item.type === "drawer") {
|
|
@@ -10188,10 +10205,10 @@ var Menu = ({
|
|
|
10188
10205
|
},
|
|
10189
10206
|
[onItemClick, shouldShowIconMode]
|
|
10190
10207
|
);
|
|
10191
|
-
const handleCloseDrawer = (0,
|
|
10208
|
+
const handleCloseDrawer = (0, import_react42.useCallback)((itemId) => {
|
|
10192
10209
|
setDrawerStates((prev) => ({ ...prev, [itemId]: false }));
|
|
10193
10210
|
}, []);
|
|
10194
|
-
const handleToggleExpand = (0,
|
|
10211
|
+
const handleToggleExpand = (0, import_react42.useCallback)(() => {
|
|
10195
10212
|
if (!forceIconMode) {
|
|
10196
10213
|
const newValue = !isIconView;
|
|
10197
10214
|
if (isControlled) {
|
|
@@ -10203,7 +10220,7 @@ var Menu = ({
|
|
|
10203
10220
|
}, [forceIconMode, isIconView, isControlled, onCollapsedChange]);
|
|
10204
10221
|
const renderIconMode = () => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: `${menuStyles.sidebar} ${styles.iconMode} ${className || ""}`, style, children: [
|
|
10205
10222
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: styles.iconModeLogo, children: logo || logoIcon || /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react4.Cpu, { size: 28, color: "#1677ff" }) }),
|
|
10206
|
-
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: styles.iconModeContainer, children: groupedItems.map(({ group, items: items2 }, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
10223
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: styles.iconModeContainer, children: groupedItems.map(({ group, items: items2 }, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react42.default.Fragment, { children: [
|
|
10207
10224
|
groupIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: styles.iconModeDivider }),
|
|
10208
10225
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: styles.iconModeGroup, children: items2.map((item) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
10209
10226
|
"button",
|
|
@@ -10254,7 +10271,7 @@ var Menu = ({
|
|
|
10254
10271
|
items2.map((item) => {
|
|
10255
10272
|
const isInline = item.inline ?? false;
|
|
10256
10273
|
const isExpanded2 = expandedInlineDrawers.has(item.id);
|
|
10257
|
-
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
10274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react42.default.Fragment, { children: [
|
|
10258
10275
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
10259
10276
|
"button",
|
|
10260
10277
|
{
|
|
@@ -10351,13 +10368,13 @@ var Menu = ({
|
|
|
10351
10368
|
};
|
|
10352
10369
|
|
|
10353
10370
|
// src/components/Chat/ProjectCardList.tsx
|
|
10354
|
-
var
|
|
10371
|
+
var import_react44 = require("react");
|
|
10355
10372
|
var import_antd38 = require("antd");
|
|
10356
10373
|
var import_antd_style17 = require("antd-style");
|
|
10357
10374
|
var import_lucide_react5 = require("lucide-react");
|
|
10358
10375
|
|
|
10359
10376
|
// src/components/Chat/CreateProjectModal.tsx
|
|
10360
|
-
var
|
|
10377
|
+
var import_react43 = require("react");
|
|
10361
10378
|
var import_antd37 = require("antd");
|
|
10362
10379
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
10363
10380
|
var CreateProjectModal = ({
|
|
@@ -10366,7 +10383,7 @@ var CreateProjectModal = ({
|
|
|
10366
10383
|
onCreate
|
|
10367
10384
|
}) => {
|
|
10368
10385
|
const [form] = import_antd37.Form.useForm();
|
|
10369
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
10386
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react43.useState)(false);
|
|
10370
10387
|
const handleSubmit = async (values) => {
|
|
10371
10388
|
setIsSubmitting(true);
|
|
10372
10389
|
try {
|
|
@@ -10719,8 +10736,8 @@ var useStyle8 = (0, import_antd_style17.createStyles)(({ css, token }) => ({
|
|
|
10719
10736
|
var ProjectCardList = () => {
|
|
10720
10737
|
const { styles } = useStyle8();
|
|
10721
10738
|
const { token } = import_antd38.theme.useToken();
|
|
10722
|
-
const [viewMode, setViewMode] = (0,
|
|
10723
|
-
const [isCreateModalOpen, setIsCreateModalOpen] = (0,
|
|
10739
|
+
const [viewMode, setViewMode] = (0, import_react44.useState)("grid");
|
|
10740
|
+
const [isCreateModalOpen, setIsCreateModalOpen] = (0, import_react44.useState)(false);
|
|
10724
10741
|
const {
|
|
10725
10742
|
projects,
|
|
10726
10743
|
loading,
|
|
@@ -10863,7 +10880,7 @@ var ProjectCardList = () => {
|
|
|
10863
10880
|
};
|
|
10864
10881
|
|
|
10865
10882
|
// src/components/Chat/MetricsConfigDrawerContent.tsx
|
|
10866
|
-
var
|
|
10883
|
+
var import_react45 = require("react");
|
|
10867
10884
|
var import_lucide_react6 = require("lucide-react");
|
|
10868
10885
|
var import_antd39 = require("antd");
|
|
10869
10886
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
@@ -10874,13 +10891,13 @@ var MetricsConfigDrawerContent = () => {
|
|
|
10874
10891
|
const { config } = useLatticeChatShellContext();
|
|
10875
10892
|
const { token } = useToken2();
|
|
10876
10893
|
const { get, post, put, del } = useApi();
|
|
10877
|
-
const [configs, setConfigs] = (0,
|
|
10878
|
-
const [loading, setLoading] = (0,
|
|
10879
|
-
const [testingId, setTestingId] = (0,
|
|
10880
|
-
const [formModalOpen, setFormModalOpen] = (0,
|
|
10881
|
-
const [editingConfig, setEditingConfig] = (0,
|
|
10894
|
+
const [configs, setConfigs] = (0, import_react45.useState)([]);
|
|
10895
|
+
const [loading, setLoading] = (0, import_react45.useState)(false);
|
|
10896
|
+
const [testingId, setTestingId] = (0, import_react45.useState)(null);
|
|
10897
|
+
const [formModalOpen, setFormModalOpen] = (0, import_react45.useState)(false);
|
|
10898
|
+
const [editingConfig, setEditingConfig] = (0, import_react45.useState)(null);
|
|
10882
10899
|
const tenantId = config.headers?.["x-tenant-id"] || "default";
|
|
10883
|
-
(0,
|
|
10900
|
+
(0, import_react45.useEffect)(() => {
|
|
10884
10901
|
loadConfigs();
|
|
10885
10902
|
}, [tenantId]);
|
|
10886
10903
|
const loadConfigs = async () => {
|
|
@@ -11079,14 +11096,14 @@ var MetricsConfigFormModal = ({
|
|
|
11079
11096
|
const { token } = useToken2();
|
|
11080
11097
|
const { get, post, put } = useApi();
|
|
11081
11098
|
const tenantId = config.headers?.["x-tenant-id"] || "default";
|
|
11082
|
-
const [currentStep, setCurrentStep] = (0,
|
|
11083
|
-
const [saving, setSaving] = (0,
|
|
11084
|
-
const [fetchingDatasources, setFetchingDatasources] = (0,
|
|
11085
|
-
const [availableDatasources, setAvailableDatasources] = (0,
|
|
11086
|
-
const [selectedViewDatasource, setSelectedViewDatasource] = (0,
|
|
11087
|
-
const [availableMetrics, setAvailableMetrics] = (0,
|
|
11088
|
-
const [fetchingMetrics, setFetchingMetrics] = (0,
|
|
11089
|
-
const [formData, setFormData] = (0,
|
|
11099
|
+
const [currentStep, setCurrentStep] = (0, import_react45.useState)(0);
|
|
11100
|
+
const [saving, setSaving] = (0, import_react45.useState)(false);
|
|
11101
|
+
const [fetchingDatasources, setFetchingDatasources] = (0, import_react45.useState)(false);
|
|
11102
|
+
const [availableDatasources, setAvailableDatasources] = (0, import_react45.useState)([]);
|
|
11103
|
+
const [selectedViewDatasource, setSelectedViewDatasource] = (0, import_react45.useState)(null);
|
|
11104
|
+
const [availableMetrics, setAvailableMetrics] = (0, import_react45.useState)([]);
|
|
11105
|
+
const [fetchingMetrics, setFetchingMetrics] = (0, import_react45.useState)(false);
|
|
11106
|
+
const [formData, setFormData] = (0, import_react45.useState)({
|
|
11090
11107
|
key: editingConfig?.key || "",
|
|
11091
11108
|
name: editingConfig?.name || "",
|
|
11092
11109
|
description: editingConfig?.description || "",
|
|
@@ -11126,12 +11143,12 @@ var MetricsConfigFormModal = ({
|
|
|
11126
11143
|
selectedDataSources: editingConfig?.config?.selectedDataSources || []
|
|
11127
11144
|
});
|
|
11128
11145
|
};
|
|
11129
|
-
(0,
|
|
11146
|
+
(0, import_react45.useEffect)(() => {
|
|
11130
11147
|
if (open) {
|
|
11131
11148
|
resetForm();
|
|
11132
11149
|
}
|
|
11133
11150
|
}, [open, editingConfig]);
|
|
11134
|
-
(0,
|
|
11151
|
+
(0, import_react45.useEffect)(() => {
|
|
11135
11152
|
if (currentStep === 1 && availableDatasources.length === 0 && !fetchingDatasources) {
|
|
11136
11153
|
handleFetchDatasources();
|
|
11137
11154
|
}
|
|
@@ -11529,7 +11546,7 @@ var MetricsConfigFormModal = ({
|
|
|
11529
11546
|
};
|
|
11530
11547
|
|
|
11531
11548
|
// src/components/Chat/DatabaseConfigDrawerContent.tsx
|
|
11532
|
-
var
|
|
11549
|
+
var import_react46 = require("react");
|
|
11533
11550
|
var import_antd_style18 = require("antd-style");
|
|
11534
11551
|
var import_lucide_react7 = require("lucide-react");
|
|
11535
11552
|
var import_antd40 = require("antd");
|
|
@@ -11603,12 +11620,12 @@ var DatabaseConfigDrawerContent = ({
|
|
|
11603
11620
|
const { styles } = useStyles7();
|
|
11604
11621
|
const { config } = useLatticeChatShellContext();
|
|
11605
11622
|
const { get, post, put, del } = useApi();
|
|
11606
|
-
const [configs, setConfigs] = (0,
|
|
11607
|
-
const [loading, setLoading] = (0,
|
|
11608
|
-
const [testingId, setTestingId] = (0,
|
|
11609
|
-
const [formModalOpen, setFormModalOpen] = (0,
|
|
11610
|
-
const [editingConfig, setEditingConfig] = (0,
|
|
11611
|
-
(0,
|
|
11623
|
+
const [configs, setConfigs] = (0, import_react46.useState)([]);
|
|
11624
|
+
const [loading, setLoading] = (0, import_react46.useState)(false);
|
|
11625
|
+
const [testingId, setTestingId] = (0, import_react46.useState)(null);
|
|
11626
|
+
const [formModalOpen, setFormModalOpen] = (0, import_react46.useState)(false);
|
|
11627
|
+
const [editingConfig, setEditingConfig] = (0, import_react46.useState)(null);
|
|
11628
|
+
(0, import_react46.useEffect)(() => {
|
|
11612
11629
|
loadConfigs();
|
|
11613
11630
|
}, [tenantId]);
|
|
11614
11631
|
const loadConfigs = async () => {
|
|
@@ -11817,7 +11834,7 @@ var DatabaseConfigFormModal = ({
|
|
|
11817
11834
|
}) => {
|
|
11818
11835
|
const { config } = useLatticeChatShellContext();
|
|
11819
11836
|
const { post, put } = useApi();
|
|
11820
|
-
const [formData, setFormData] = (0,
|
|
11837
|
+
const [formData, setFormData] = (0, import_react46.useState)({
|
|
11821
11838
|
key: editingConfig?.key || "",
|
|
11822
11839
|
name: editingConfig?.name || "",
|
|
11823
11840
|
description: editingConfig?.description || "",
|
|
@@ -11829,7 +11846,7 @@ var DatabaseConfigFormModal = ({
|
|
|
11829
11846
|
password: editingConfig?.config.password || "",
|
|
11830
11847
|
connectionString: editingConfig?.config.connectionString || ""
|
|
11831
11848
|
});
|
|
11832
|
-
const [saving, setSaving] = (0,
|
|
11849
|
+
const [saving, setSaving] = (0, import_react46.useState)(false);
|
|
11833
11850
|
const handleSubmit = async () => {
|
|
11834
11851
|
setSaving(true);
|
|
11835
11852
|
try {
|
|
@@ -11948,7 +11965,7 @@ var DatabaseConfigFormModal = ({
|
|
|
11948
11965
|
{
|
|
11949
11966
|
value: formData.connectionString,
|
|
11950
11967
|
onChange: (e) => setFormData({ ...formData, connectionString: e.target.value }),
|
|
11951
|
-
placeholder: "e.g., postgresql://user:pass@host:5432/dbname or
|
|
11968
|
+
placeholder: "e.g., postgresql://user:pass@host:5432/dbname or mysql://user:pass@host:3306/dbname",
|
|
11952
11969
|
rows: 3,
|
|
11953
11970
|
style: { width: "100%" }
|
|
11954
11971
|
}
|
|
@@ -12041,7 +12058,7 @@ var DatabaseConfigFormModal = ({
|
|
|
12041
12058
|
};
|
|
12042
12059
|
|
|
12043
12060
|
// src/components/Chat/McpConfigDrawerContent.tsx
|
|
12044
|
-
var
|
|
12061
|
+
var import_react47 = require("react");
|
|
12045
12062
|
var import_lucide_react8 = require("lucide-react");
|
|
12046
12063
|
var import_antd41 = require("antd");
|
|
12047
12064
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
@@ -12055,12 +12072,12 @@ var McpConfigDrawerContent = ({
|
|
|
12055
12072
|
const { config } = useLatticeChatShellContext();
|
|
12056
12073
|
const { token } = useToken3();
|
|
12057
12074
|
const { get, post, put, del } = useApi();
|
|
12058
|
-
const [configs, setConfigs] = (0,
|
|
12059
|
-
const [loading, setLoading] = (0,
|
|
12060
|
-
const [testingId, setTestingId] = (0,
|
|
12061
|
-
const [formModalOpen, setFormModalOpen] = (0,
|
|
12062
|
-
const [editingConfig, setEditingConfig] = (0,
|
|
12063
|
-
(0,
|
|
12075
|
+
const [configs, setConfigs] = (0, import_react47.useState)([]);
|
|
12076
|
+
const [loading, setLoading] = (0, import_react47.useState)(false);
|
|
12077
|
+
const [testingId, setTestingId] = (0, import_react47.useState)(null);
|
|
12078
|
+
const [formModalOpen, setFormModalOpen] = (0, import_react47.useState)(false);
|
|
12079
|
+
const [editingConfig, setEditingConfig] = (0, import_react47.useState)(null);
|
|
12080
|
+
(0, import_react47.useEffect)(() => {
|
|
12064
12081
|
loadConfigs();
|
|
12065
12082
|
}, [tenantId]);
|
|
12066
12083
|
const loadConfigs = async () => {
|
|
@@ -12274,11 +12291,11 @@ var McpConfigFormModal = ({
|
|
|
12274
12291
|
const { config } = useLatticeChatShellContext();
|
|
12275
12292
|
const { token } = useToken3();
|
|
12276
12293
|
const { post, put } = useApi();
|
|
12277
|
-
const [currentStep, setCurrentStep] = (0,
|
|
12278
|
-
const [saving, setSaving] = (0,
|
|
12279
|
-
const [fetchingTools, setFetchingTools] = (0,
|
|
12280
|
-
const [availableTools, setAvailableTools] = (0,
|
|
12281
|
-
const [formData, setFormData] = (0,
|
|
12294
|
+
const [currentStep, setCurrentStep] = (0, import_react47.useState)(0);
|
|
12295
|
+
const [saving, setSaving] = (0, import_react47.useState)(false);
|
|
12296
|
+
const [fetchingTools, setFetchingTools] = (0, import_react47.useState)(false);
|
|
12297
|
+
const [availableTools, setAvailableTools] = (0, import_react47.useState)([]);
|
|
12298
|
+
const [formData, setFormData] = (0, import_react47.useState)({
|
|
12282
12299
|
key: editingConfig?.key || "",
|
|
12283
12300
|
name: editingConfig?.name || "",
|
|
12284
12301
|
description: editingConfig?.description || "",
|
|
@@ -12318,12 +12335,12 @@ var McpConfigFormModal = ({
|
|
|
12318
12335
|
selectedTools: editingConfig?.selectedTools || []
|
|
12319
12336
|
});
|
|
12320
12337
|
};
|
|
12321
|
-
(0,
|
|
12338
|
+
(0, import_react47.useEffect)(() => {
|
|
12322
12339
|
if (open) {
|
|
12323
12340
|
resetForm();
|
|
12324
12341
|
}
|
|
12325
12342
|
}, [open, editingConfig]);
|
|
12326
|
-
(0,
|
|
12343
|
+
(0, import_react47.useEffect)(() => {
|
|
12327
12344
|
if (currentStep === 1 && availableTools.length === 0 && !fetchingTools) {
|
|
12328
12345
|
handleFetchTools();
|
|
12329
12346
|
}
|
|
@@ -12674,13 +12691,13 @@ var McpConfigFormModal = ({
|
|
|
12674
12691
|
};
|
|
12675
12692
|
|
|
12676
12693
|
// src/components/Chat/AssistantFlow.tsx
|
|
12677
|
-
var
|
|
12678
|
-
var
|
|
12694
|
+
var import_react53 = require("react");
|
|
12695
|
+
var import_react54 = require("@xyflow/react");
|
|
12679
12696
|
var import_style = require("@xyflow/react/dist/style.css");
|
|
12680
12697
|
|
|
12681
12698
|
// src/components/Chat/AssistantNode.tsx
|
|
12682
|
-
var
|
|
12683
|
-
var
|
|
12699
|
+
var import_react48 = require("react");
|
|
12700
|
+
var import_react49 = require("@xyflow/react");
|
|
12684
12701
|
var import_antd42 = require("antd");
|
|
12685
12702
|
var import_icons21 = require("@ant-design/icons");
|
|
12686
12703
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
@@ -12724,7 +12741,7 @@ var AssistantNode = ({
|
|
|
12724
12741
|
}
|
|
12725
12742
|
const badgeColor = getBadgeColor(assistant.id);
|
|
12726
12743
|
const initials = assistant.name?.split(" ").map((n) => n.charAt(0)).join("").toUpperCase().slice(0, 2) || "A";
|
|
12727
|
-
const { modelKey, tools, agentType, prompt, subAgents } = (0,
|
|
12744
|
+
const { modelKey, tools, agentType, prompt, subAgents } = (0, import_react48.useMemo)(() => {
|
|
12728
12745
|
if (!assistant.graphDefinition) {
|
|
12729
12746
|
return {
|
|
12730
12747
|
modelKey: void 0,
|
|
@@ -13129,7 +13146,7 @@ var AssistantNode = ({
|
|
|
13129
13146
|
padding: 4
|
|
13130
13147
|
},
|
|
13131
13148
|
children: [
|
|
13132
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
13149
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react49.Handle, { type: "target", position: import_react49.Position.Top }),
|
|
13133
13150
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
13134
13151
|
"div",
|
|
13135
13152
|
{
|
|
@@ -13453,7 +13470,7 @@ var AssistantNode = ({
|
|
|
13453
13470
|
]
|
|
13454
13471
|
}
|
|
13455
13472
|
),
|
|
13456
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
13473
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react49.Handle, { type: "source", position: import_react49.Position.Bottom })
|
|
13457
13474
|
]
|
|
13458
13475
|
}
|
|
13459
13476
|
)
|
|
@@ -13464,7 +13481,7 @@ var AssistantNode = ({
|
|
|
13464
13481
|
var AssistantNode_default = AssistantNode;
|
|
13465
13482
|
|
|
13466
13483
|
// src/components/Chat/AgentConfigPanel.tsx
|
|
13467
|
-
var
|
|
13484
|
+
var import_react50 = require("react");
|
|
13468
13485
|
var import_antd43 = require("antd");
|
|
13469
13486
|
var import_icons22 = require("@ant-design/icons");
|
|
13470
13487
|
var import_lucide_react9 = require("lucide-react");
|
|
@@ -13473,7 +13490,7 @@ var { TextArea: TextArea4 } = import_antd43.Input;
|
|
|
13473
13490
|
var { Text: Text18, Title: Title4 } = import_antd43.Typography;
|
|
13474
13491
|
var SectionCard = ({ title, icon, badge, children, defaultExpanded = true }) => {
|
|
13475
13492
|
const { token } = import_antd43.theme.useToken();
|
|
13476
|
-
const [expanded, setExpanded] = (0,
|
|
13493
|
+
const [expanded, setExpanded] = (0, import_react50.useState)(defaultExpanded);
|
|
13477
13494
|
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
13478
13495
|
import_antd43.Card,
|
|
13479
13496
|
{
|
|
@@ -13687,11 +13704,11 @@ var getMiddlewareTypeDefinition = (middlewareType, availableTypes) => {
|
|
|
13687
13704
|
return availableTypes?.find((t) => t.type === middlewareType);
|
|
13688
13705
|
};
|
|
13689
13706
|
var SkillListField = ({ propertyKey, label, value, onChange, token }) => {
|
|
13690
|
-
const [skills, setSkills] = (0,
|
|
13691
|
-
const [loading, setLoading] = (0,
|
|
13707
|
+
const [skills, setSkills] = (0, import_react50.useState)([]);
|
|
13708
|
+
const [loading, setLoading] = (0, import_react50.useState)(false);
|
|
13692
13709
|
const { get } = useApi();
|
|
13693
|
-
const fetchedRef = (0,
|
|
13694
|
-
(0,
|
|
13710
|
+
const fetchedRef = (0, import_react50.useRef)(false);
|
|
13711
|
+
(0, import_react50.useEffect)(() => {
|
|
13695
13712
|
if (fetchedRef.current) return;
|
|
13696
13713
|
fetchedRef.current = true;
|
|
13697
13714
|
const fetchSkills = async () => {
|
|
@@ -13798,11 +13815,11 @@ var SkillListField = ({ propertyKey, label, value, onChange, token }) => {
|
|
|
13798
13815
|
] }, propertyKey) });
|
|
13799
13816
|
};
|
|
13800
13817
|
var DatabaseListField = ({ propertyKey, label, value, onChange, token }) => {
|
|
13801
|
-
const [databases, setDatabases] = (0,
|
|
13802
|
-
const [loading, setLoading] = (0,
|
|
13818
|
+
const [databases, setDatabases] = (0, import_react50.useState)([]);
|
|
13819
|
+
const [loading, setLoading] = (0, import_react50.useState)(false);
|
|
13803
13820
|
const { get } = useApi();
|
|
13804
|
-
const fetchedRef = (0,
|
|
13805
|
-
(0,
|
|
13821
|
+
const fetchedRef = (0, import_react50.useRef)(false);
|
|
13822
|
+
(0, import_react50.useEffect)(() => {
|
|
13806
13823
|
if (fetchedRef.current) return;
|
|
13807
13824
|
fetchedRef.current = true;
|
|
13808
13825
|
const fetchDatabases = async () => {
|
|
@@ -13913,11 +13930,11 @@ var DatabaseListField = ({ propertyKey, label, value, onChange, token }) => {
|
|
|
13913
13930
|
] }, propertyKey) });
|
|
13914
13931
|
};
|
|
13915
13932
|
var MetricsListField = ({ propertyKey, label, value, onChange, token }) => {
|
|
13916
|
-
const [servers, setServers] = (0,
|
|
13917
|
-
const [loading, setLoading] = (0,
|
|
13933
|
+
const [servers, setServers] = (0, import_react50.useState)([]);
|
|
13934
|
+
const [loading, setLoading] = (0, import_react50.useState)(false);
|
|
13918
13935
|
const { get } = useApi();
|
|
13919
|
-
const fetchedRef = (0,
|
|
13920
|
-
(0,
|
|
13936
|
+
const fetchedRef = (0, import_react50.useRef)(false);
|
|
13937
|
+
(0, import_react50.useEffect)(() => {
|
|
13921
13938
|
if (fetchedRef.current) return;
|
|
13922
13939
|
fetchedRef.current = true;
|
|
13923
13940
|
const fetchMetricsServers = async () => {
|
|
@@ -14029,7 +14046,7 @@ var MetricsListField = ({ propertyKey, label, value, onChange, token }) => {
|
|
|
14029
14046
|
};
|
|
14030
14047
|
var TopologyEdgeField = ({ propertyKey, label, value, onChange, token }) => {
|
|
14031
14048
|
const edges = Array.isArray(value) ? value : [];
|
|
14032
|
-
const [newEdge, setNewEdge] = (0,
|
|
14049
|
+
const [newEdge, setNewEdge] = (0, import_react50.useState)({ from: "", to: "", purpose: "" });
|
|
14033
14050
|
const handleAdd = () => {
|
|
14034
14051
|
if (!newEdge.from.trim() || !newEdge.to.trim() || !newEdge.purpose.trim()) return;
|
|
14035
14052
|
onChange([...edges, { ...newEdge }]);
|
|
@@ -14122,7 +14139,7 @@ var TopologyEdgeField = ({ propertyKey, label, value, onChange, token }) => {
|
|
|
14122
14139
|
] }, propertyKey) });
|
|
14123
14140
|
};
|
|
14124
14141
|
var MiddlewareSectionCard = ({ middleware, middlewareType, onToggle, onConfigChange, token }) => {
|
|
14125
|
-
const [expanded, setExpanded] = (0,
|
|
14142
|
+
const [expanded, setExpanded] = (0, import_react50.useState)(middleware.enabled);
|
|
14126
14143
|
const getIcon = () => {
|
|
14127
14144
|
switch (middleware.type) {
|
|
14128
14145
|
case "browser":
|
|
@@ -14288,18 +14305,18 @@ var AgentConfigPanel = ({
|
|
|
14288
14305
|
const { token } = import_antd43.theme.useToken();
|
|
14289
14306
|
const { config } = useLatticeChatShellContext();
|
|
14290
14307
|
const { get } = useApi();
|
|
14291
|
-
const [toolsLoading, setToolsLoading] = (0,
|
|
14292
|
-
const [saving, setSaving] = (0,
|
|
14293
|
-
const [deleting, setDeleting] = (0,
|
|
14294
|
-
const [isDeleteModalOpen, setIsDeleteModalOpen] = (0,
|
|
14295
|
-
const [tools, setTools] = (0,
|
|
14296
|
-
const [selectedTools, setSelectedTools] = (0,
|
|
14297
|
-
const [selectedSubAgents, setSelectedSubAgents] = (0,
|
|
14298
|
-
const [agentPrompt, setAgentPrompt] = (0,
|
|
14299
|
-
const [isPromptModalOpen, setIsPromptModalOpen] = (0,
|
|
14300
|
-
const [agentType, setAgentType] = (0,
|
|
14301
|
-
const [middleware, setMiddleware] = (0,
|
|
14302
|
-
const parsedConfig = (0,
|
|
14308
|
+
const [toolsLoading, setToolsLoading] = (0, import_react50.useState)(false);
|
|
14309
|
+
const [saving, setSaving] = (0, import_react50.useState)(false);
|
|
14310
|
+
const [deleting, setDeleting] = (0, import_react50.useState)(false);
|
|
14311
|
+
const [isDeleteModalOpen, setIsDeleteModalOpen] = (0, import_react50.useState)(false);
|
|
14312
|
+
const [tools, setTools] = (0, import_react50.useState)([]);
|
|
14313
|
+
const [selectedTools, setSelectedTools] = (0, import_react50.useState)([]);
|
|
14314
|
+
const [selectedSubAgents, setSelectedSubAgents] = (0, import_react50.useState)([]);
|
|
14315
|
+
const [agentPrompt, setAgentPrompt] = (0, import_react50.useState)("");
|
|
14316
|
+
const [isPromptModalOpen, setIsPromptModalOpen] = (0, import_react50.useState)(false);
|
|
14317
|
+
const [agentType, setAgentType] = (0, import_react50.useState)("react");
|
|
14318
|
+
const [middleware, setMiddleware] = (0, import_react50.useState)([]);
|
|
14319
|
+
const parsedConfig = (0, import_react50.useMemo)(() => {
|
|
14303
14320
|
if (!assistant?.graphDefinition) {
|
|
14304
14321
|
return null;
|
|
14305
14322
|
}
|
|
@@ -14316,7 +14333,7 @@ var AgentConfigPanel = ({
|
|
|
14316
14333
|
return null;
|
|
14317
14334
|
}
|
|
14318
14335
|
}, [assistant]);
|
|
14319
|
-
const initializeMiddleware = (0,
|
|
14336
|
+
const initializeMiddleware = (0, import_react50.useCallback)((types) => {
|
|
14320
14337
|
const middlewareTypes = types || [];
|
|
14321
14338
|
return middlewareTypes.map((type, index) => ({
|
|
14322
14339
|
id: `${type.type}-${index + 1}`,
|
|
@@ -14327,7 +14344,7 @@ var AgentConfigPanel = ({
|
|
|
14327
14344
|
config: {}
|
|
14328
14345
|
}));
|
|
14329
14346
|
}, []);
|
|
14330
|
-
const mergeMiddlewareConfig = (0,
|
|
14347
|
+
const mergeMiddlewareConfig = (0, import_react50.useCallback)((savedConfigs, availableTypes) => {
|
|
14331
14348
|
const types = availableTypes || [];
|
|
14332
14349
|
const savedMap = new Map(savedConfigs?.map((cfg) => [cfg.type, cfg]) || []);
|
|
14333
14350
|
return types.map((type, index) => {
|
|
@@ -14349,7 +14366,7 @@ var AgentConfigPanel = ({
|
|
|
14349
14366
|
};
|
|
14350
14367
|
});
|
|
14351
14368
|
}, []);
|
|
14352
|
-
const fetchTools = (0,
|
|
14369
|
+
const fetchTools = (0, import_react50.useCallback)(async () => {
|
|
14353
14370
|
if (!visible) return;
|
|
14354
14371
|
setToolsLoading(true);
|
|
14355
14372
|
try {
|
|
@@ -14363,7 +14380,7 @@ var AgentConfigPanel = ({
|
|
|
14363
14380
|
setToolsLoading(false);
|
|
14364
14381
|
}
|
|
14365
14382
|
}, [get, visible]);
|
|
14366
|
-
(0,
|
|
14383
|
+
(0, import_react50.useEffect)(() => {
|
|
14367
14384
|
if (visible && assistant) {
|
|
14368
14385
|
fetchTools();
|
|
14369
14386
|
if (parsedConfig) {
|
|
@@ -15019,12 +15036,12 @@ var AgentConfigPanel = ({
|
|
|
15019
15036
|
var AgentConfigPanel_default = AgentConfigPanel;
|
|
15020
15037
|
|
|
15021
15038
|
// src/components/Chat/CreateAssistantModal.tsx
|
|
15022
|
-
var
|
|
15039
|
+
var import_react52 = require("react");
|
|
15023
15040
|
var import_antd46 = require("antd");
|
|
15024
15041
|
var import_icons24 = require("@ant-design/icons");
|
|
15025
15042
|
|
|
15026
15043
|
// src/components/Chat/ParentAgentSelector.tsx
|
|
15027
|
-
var
|
|
15044
|
+
var import_react51 = require("react");
|
|
15028
15045
|
var import_antd44 = require("antd");
|
|
15029
15046
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
15030
15047
|
var { Text: Text19 } = import_antd44.Typography;
|
|
@@ -15033,10 +15050,10 @@ var ParentAgentSelector = ({
|
|
|
15033
15050
|
value,
|
|
15034
15051
|
placeholder = "Select a parent agent to extend..."
|
|
15035
15052
|
}) => {
|
|
15036
|
-
const [assistants, setAssistants] = (0,
|
|
15037
|
-
const [loading, setLoading] = (0,
|
|
15053
|
+
const [assistants, setAssistants] = (0, import_react51.useState)([]);
|
|
15054
|
+
const [loading, setLoading] = (0, import_react51.useState)(false);
|
|
15038
15055
|
const { get } = useApi();
|
|
15039
|
-
(0,
|
|
15056
|
+
(0, import_react51.useEffect)(() => {
|
|
15040
15057
|
const fetchAssistants = async () => {
|
|
15041
15058
|
setLoading(true);
|
|
15042
15059
|
try {
|
|
@@ -15176,17 +15193,17 @@ var CreateAssistantModal = ({
|
|
|
15176
15193
|
onSuccess
|
|
15177
15194
|
}) => {
|
|
15178
15195
|
const [form] = import_antd46.Form.useForm();
|
|
15179
|
-
const [loading, setLoading] = (0,
|
|
15180
|
-
const [creationMode, setCreationMode] = (0,
|
|
15181
|
-
const [parentAssistant, setParentAssistant] = (0,
|
|
15182
|
-
const [subAgentDecisions, setSubAgentDecisions] = (0,
|
|
15196
|
+
const [loading, setLoading] = (0, import_react52.useState)(false);
|
|
15197
|
+
const [creationMode, setCreationMode] = (0, import_react52.useState)("scratch");
|
|
15198
|
+
const [parentAssistant, setParentAssistant] = (0, import_react52.useState)(null);
|
|
15199
|
+
const [subAgentDecisions, setSubAgentDecisions] = (0, import_react52.useState)([]);
|
|
15183
15200
|
const { get, post } = useApi();
|
|
15184
15201
|
const { token } = import_antd46.theme.useToken();
|
|
15185
|
-
const resetExtendState = (0,
|
|
15202
|
+
const resetExtendState = (0, import_react52.useCallback)(() => {
|
|
15186
15203
|
setParentAssistant(null);
|
|
15187
15204
|
setSubAgentDecisions([]);
|
|
15188
15205
|
}, []);
|
|
15189
|
-
const handleParentSelect = (0,
|
|
15206
|
+
const handleParentSelect = (0, import_react52.useCallback)(
|
|
15190
15207
|
(assistant) => {
|
|
15191
15208
|
setParentAssistant(assistant);
|
|
15192
15209
|
if (!assistant) {
|
|
@@ -15211,7 +15228,7 @@ var CreateAssistantModal = ({
|
|
|
15211
15228
|
},
|
|
15212
15229
|
[form]
|
|
15213
15230
|
);
|
|
15214
|
-
const handleModeChange = (0,
|
|
15231
|
+
const handleModeChange = (0, import_react52.useCallback)(
|
|
15215
15232
|
(mode) => {
|
|
15216
15233
|
setCreationMode(mode);
|
|
15217
15234
|
if (mode === "scratch") {
|
|
@@ -15565,33 +15582,33 @@ var import_antd47 = require("antd");
|
|
|
15565
15582
|
var import_icons25 = require("@ant-design/icons");
|
|
15566
15583
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
15567
15584
|
var AssistantFlowInner = ({ onChat }) => {
|
|
15568
|
-
const { setCenter, fitView } = (0,
|
|
15569
|
-
const [nodes, setNodes, onNodesChange] = (0,
|
|
15570
|
-
const [edges, setEdges, onEdgesChange] = (0,
|
|
15571
|
-
const [assistants, setAssistants] = (0,
|
|
15572
|
-
const [assistantsLoading, setAssistantsLoading] = (0,
|
|
15573
|
-
const [configPanelVisible, setConfigPanelVisible] = (0,
|
|
15574
|
-
const [selectedAssistant, setSelectedAssistant] = (0,
|
|
15575
|
-
const [isCreateModalOpen, setIsCreateModalOpen] = (0,
|
|
15585
|
+
const { setCenter, fitView } = (0, import_react54.useReactFlow)();
|
|
15586
|
+
const [nodes, setNodes, onNodesChange] = (0, import_react54.useNodesState)([]);
|
|
15587
|
+
const [edges, setEdges, onEdgesChange] = (0, import_react54.useEdgesState)([]);
|
|
15588
|
+
const [assistants, setAssistants] = (0, import_react53.useState)([]);
|
|
15589
|
+
const [assistantsLoading, setAssistantsLoading] = (0, import_react53.useState)(false);
|
|
15590
|
+
const [configPanelVisible, setConfigPanelVisible] = (0, import_react53.useState)(false);
|
|
15591
|
+
const [selectedAssistant, setSelectedAssistant] = (0, import_react53.useState)(null);
|
|
15592
|
+
const [isCreateModalOpen, setIsCreateModalOpen] = (0, import_react53.useState)(false);
|
|
15576
15593
|
const { get, del, put } = useApi();
|
|
15577
15594
|
const { config } = useLatticeChatShellContext();
|
|
15578
15595
|
const { token } = import_antd47.theme.useToken();
|
|
15579
15596
|
const { enableAssistantCreation = true, enableAssistantEditing = true } = config;
|
|
15580
|
-
const nodeTypes2 = (0,
|
|
15597
|
+
const nodeTypes2 = (0, import_react53.useMemo)(
|
|
15581
15598
|
() => ({
|
|
15582
15599
|
assistant: AssistantNode_default
|
|
15583
15600
|
}),
|
|
15584
15601
|
[]
|
|
15585
15602
|
);
|
|
15586
|
-
const handleConfigure = (0,
|
|
15603
|
+
const handleConfigure = (0, import_react53.useCallback)((assistant) => {
|
|
15587
15604
|
setSelectedAssistant(assistant);
|
|
15588
15605
|
setConfigPanelVisible(true);
|
|
15589
15606
|
}, []);
|
|
15590
|
-
const handleClosePanel = (0,
|
|
15607
|
+
const handleClosePanel = (0, import_react53.useCallback)(() => {
|
|
15591
15608
|
setConfigPanelVisible(false);
|
|
15592
15609
|
setSelectedAssistant(null);
|
|
15593
15610
|
}, []);
|
|
15594
|
-
const handleSelectionChange = (0,
|
|
15611
|
+
const handleSelectionChange = (0, import_react53.useCallback)(
|
|
15595
15612
|
({ nodes: selectedNodes }) => {
|
|
15596
15613
|
if (selectedNodes.length === 1 && enableAssistantEditing) {
|
|
15597
15614
|
const nodeData = selectedNodes[0].data;
|
|
@@ -15620,10 +15637,10 @@ var AssistantFlowInner = ({ onChat }) => {
|
|
|
15620
15637
|
setAssistantsLoading(false);
|
|
15621
15638
|
}
|
|
15622
15639
|
};
|
|
15623
|
-
(0,
|
|
15640
|
+
(0, import_react53.useEffect)(() => {
|
|
15624
15641
|
fetchAssistants();
|
|
15625
15642
|
}, []);
|
|
15626
|
-
(0,
|
|
15643
|
+
(0, import_react53.useEffect)(() => {
|
|
15627
15644
|
if (!assistants || assistants.length === 0) {
|
|
15628
15645
|
setNodes([]);
|
|
15629
15646
|
setEdges([]);
|
|
@@ -15887,7 +15904,7 @@ var AssistantFlowInner = ({ onChat }) => {
|
|
|
15887
15904
|
});
|
|
15888
15905
|
lastCreatedAssistantRef.current = createdAssistant;
|
|
15889
15906
|
};
|
|
15890
|
-
(0,
|
|
15907
|
+
(0, import_react53.useEffect)(() => {
|
|
15891
15908
|
if (selectedAssistant) {
|
|
15892
15909
|
const node = nodes.find((n) => n.id === selectedAssistant.id);
|
|
15893
15910
|
if (node) {
|
|
@@ -15895,7 +15912,7 @@ var AssistantFlowInner = ({ onChat }) => {
|
|
|
15895
15912
|
}
|
|
15896
15913
|
}
|
|
15897
15914
|
}, [selectedAssistant, nodes, setCenter]);
|
|
15898
|
-
(0,
|
|
15915
|
+
(0, import_react53.useEffect)(() => {
|
|
15899
15916
|
if (assistants.length > 0 && selectedAssistant) {
|
|
15900
15917
|
const assistant = assistants.find((a) => a.id === selectedAssistant.id);
|
|
15901
15918
|
if (assistant && !configPanelVisible) {
|
|
@@ -15903,8 +15920,8 @@ var AssistantFlowInner = ({ onChat }) => {
|
|
|
15903
15920
|
}
|
|
15904
15921
|
}
|
|
15905
15922
|
}, [assistants, selectedAssistant, configPanelVisible]);
|
|
15906
|
-
const lastCreatedAssistantRef = (0,
|
|
15907
|
-
(0,
|
|
15923
|
+
const lastCreatedAssistantRef = (0, import_react53.useRef)(null);
|
|
15924
|
+
(0, import_react53.useEffect)(() => {
|
|
15908
15925
|
if (lastCreatedAssistantRef.current && !assistants.find((a) => a.id === lastCreatedAssistantRef.current?.id)) {
|
|
15909
15926
|
lastCreatedAssistantRef.current = null;
|
|
15910
15927
|
}
|
|
@@ -15946,7 +15963,7 @@ var AssistantFlowInner = ({ onChat }) => {
|
|
|
15946
15963
|
},
|
|
15947
15964
|
children: [
|
|
15948
15965
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
15949
|
-
|
|
15966
|
+
import_react54.ReactFlow,
|
|
15950
15967
|
{
|
|
15951
15968
|
nodes,
|
|
15952
15969
|
edges,
|
|
@@ -15956,8 +15973,8 @@ var AssistantFlowInner = ({ onChat }) => {
|
|
|
15956
15973
|
nodeTypes: nodeTypes2,
|
|
15957
15974
|
fitView: true,
|
|
15958
15975
|
children: [
|
|
15959
|
-
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
15960
|
-
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
15976
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react54.Background, { color: "#eee", gap: 20 }),
|
|
15977
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react54.Controls, {})
|
|
15961
15978
|
]
|
|
15962
15979
|
}
|
|
15963
15980
|
),
|
|
@@ -16015,19 +16032,19 @@ var AssistantFlowInner = ({ onChat }) => {
|
|
|
16015
16032
|
)
|
|
16016
16033
|
] });
|
|
16017
16034
|
};
|
|
16018
|
-
var AssistantFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
16035
|
+
var AssistantFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react54.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(AssistantFlowInner, { ...props }) });
|
|
16019
16036
|
var AssistantFlow_default = AssistantFlow;
|
|
16020
16037
|
|
|
16021
16038
|
// src/components/Chat/SkillFlow.tsx
|
|
16022
|
-
var
|
|
16023
|
-
var
|
|
16039
|
+
var import_react58 = require("react");
|
|
16040
|
+
var import_react59 = require("@xyflow/react");
|
|
16024
16041
|
var import_style2 = require("@xyflow/react/dist/style.css");
|
|
16025
16042
|
var import_antd51 = require("antd");
|
|
16026
16043
|
var import_icons28 = require("@ant-design/icons");
|
|
16027
16044
|
|
|
16028
16045
|
// src/components/Chat/SkillNode.tsx
|
|
16029
|
-
var
|
|
16030
|
-
var
|
|
16046
|
+
var import_react55 = require("react");
|
|
16047
|
+
var import_react56 = require("@xyflow/react");
|
|
16031
16048
|
var import_antd48 = require("antd");
|
|
16032
16049
|
var import_icons26 = require("@ant-design/icons");
|
|
16033
16050
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
@@ -16070,12 +16087,12 @@ var SkillNode = ({ data }) => {
|
|
|
16070
16087
|
if (!skill) {
|
|
16071
16088
|
return null;
|
|
16072
16089
|
}
|
|
16073
|
-
const [currentSkill, setCurrentSkill] = (0,
|
|
16090
|
+
const [currentSkill, setCurrentSkill] = (0, import_react55.useState)(skill);
|
|
16074
16091
|
const badgeColor = getBadgeColor2(currentSkill.name);
|
|
16075
16092
|
const initials = currentSkill.name?.split("-").map((n) => n.charAt(0)).join("").toUpperCase().slice(0, 2) || "SK";
|
|
16076
16093
|
const hasSubSkills = currentSkill.subSkills && currentSkill.subSkills.length > 0;
|
|
16077
16094
|
const category = currentSkill.metadata && currentSkill.metadata.category || "global";
|
|
16078
|
-
const metadataEntries = (0,
|
|
16095
|
+
const metadataEntries = (0, import_react55.useMemo)(
|
|
16079
16096
|
() => currentSkill.metadata ? Object.entries(
|
|
16080
16097
|
currentSkill.metadata
|
|
16081
16098
|
).filter(
|
|
@@ -16092,20 +16109,20 @@ var SkillNode = ({ data }) => {
|
|
|
16092
16109
|
const handleCopy = (text) => {
|
|
16093
16110
|
navigator.clipboard.writeText(text);
|
|
16094
16111
|
};
|
|
16095
|
-
const [isEditing, setIsEditing] = (0,
|
|
16096
|
-
const [draftSkill, setDraftSkill] = (0,
|
|
16112
|
+
const [isEditing, setIsEditing] = (0, import_react55.useState)(false);
|
|
16113
|
+
const [draftSkill, setDraftSkill] = (0, import_react55.useState)({
|
|
16097
16114
|
...skill,
|
|
16098
16115
|
id: skill.name
|
|
16099
16116
|
});
|
|
16100
|
-
const [metadataRows, setMetadataRows] = (0,
|
|
16117
|
+
const [metadataRows, setMetadataRows] = (0, import_react55.useState)(
|
|
16101
16118
|
metadataEntries.map(([key, value]) => ({
|
|
16102
16119
|
key,
|
|
16103
16120
|
value
|
|
16104
16121
|
}))
|
|
16105
16122
|
);
|
|
16106
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
16107
|
-
const [saving, setSaving] = (0,
|
|
16108
|
-
(0,
|
|
16123
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react55.useState)(false);
|
|
16124
|
+
const [saving, setSaving] = (0, import_react55.useState)(false);
|
|
16125
|
+
(0, import_react55.useEffect)(() => {
|
|
16109
16126
|
setIsEditing(false);
|
|
16110
16127
|
setCurrentSkill(skill);
|
|
16111
16128
|
setDraftSkill({ ...skill, id: skill.name });
|
|
@@ -16865,10 +16882,10 @@ var SkillNode = ({ data }) => {
|
|
|
16865
16882
|
},
|
|
16866
16883
|
children: [
|
|
16867
16884
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
16868
|
-
|
|
16885
|
+
import_react56.Handle,
|
|
16869
16886
|
{
|
|
16870
16887
|
type: "target",
|
|
16871
|
-
position:
|
|
16888
|
+
position: import_react56.Position.Top,
|
|
16872
16889
|
style: hiddenHandleStyle,
|
|
16873
16890
|
isConnectable: false
|
|
16874
16891
|
}
|
|
@@ -17193,10 +17210,10 @@ var SkillNode = ({ data }) => {
|
|
|
17193
17210
|
}
|
|
17194
17211
|
),
|
|
17195
17212
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
17196
|
-
|
|
17213
|
+
import_react56.Handle,
|
|
17197
17214
|
{
|
|
17198
17215
|
type: "source",
|
|
17199
|
-
position:
|
|
17216
|
+
position: import_react56.Position.Bottom,
|
|
17200
17217
|
style: hiddenHandleStyle,
|
|
17201
17218
|
isConnectable: false
|
|
17202
17219
|
}
|
|
@@ -17208,7 +17225,7 @@ var SkillNode = ({ data }) => {
|
|
|
17208
17225
|
var SkillNode_default = SkillNode;
|
|
17209
17226
|
|
|
17210
17227
|
// src/components/Chat/CreateSkillModal.tsx
|
|
17211
|
-
var
|
|
17228
|
+
var import_react57 = require("react");
|
|
17212
17229
|
var import_antd49 = require("antd");
|
|
17213
17230
|
var import_icons27 = require("@ant-design/icons");
|
|
17214
17231
|
var import_antd50 = require("antd");
|
|
@@ -17221,11 +17238,11 @@ var CreateSkillModal = ({
|
|
|
17221
17238
|
onSuccess
|
|
17222
17239
|
}) => {
|
|
17223
17240
|
const [form] = import_antd49.Form.useForm();
|
|
17224
|
-
const [loading, setLoading] = (0,
|
|
17241
|
+
const [loading, setLoading] = (0, import_react57.useState)(false);
|
|
17225
17242
|
const { post } = useApi();
|
|
17226
17243
|
const { token } = import_antd50.theme.useToken();
|
|
17227
17244
|
const defaultMetadataRows = [{ key: "category", value: "global" }];
|
|
17228
|
-
const [metadataRows, setMetadataRows] = (0,
|
|
17245
|
+
const [metadataRows, setMetadataRows] = (0, import_react57.useState)(defaultMetadataRows);
|
|
17229
17246
|
const handleSubmit = async () => {
|
|
17230
17247
|
try {
|
|
17231
17248
|
const values = await form.validateFields();
|
|
@@ -17493,14 +17510,14 @@ var CreateSkillModal_default = CreateSkillModal;
|
|
|
17493
17510
|
// src/components/Chat/SkillFlow.tsx
|
|
17494
17511
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
17495
17512
|
var SkillFlowInner = ({ onNodeClick }) => {
|
|
17496
|
-
const [nodes, setNodes, onNodesChange] = (0,
|
|
17497
|
-
const [edges, setEdges, onEdgesChange] = (0,
|
|
17498
|
-
const [isCreateModalOpen, setIsCreateModalOpen] = (0,
|
|
17499
|
-
const [skills, setSkills] = (0,
|
|
17500
|
-
const [skillsLoading, setSkillsLoading] = (0,
|
|
17513
|
+
const [nodes, setNodes, onNodesChange] = (0, import_react59.useNodesState)([]);
|
|
17514
|
+
const [edges, setEdges, onEdgesChange] = (0, import_react59.useEdgesState)([]);
|
|
17515
|
+
const [isCreateModalOpen, setIsCreateModalOpen] = (0, import_react58.useState)(false);
|
|
17516
|
+
const [skills, setSkills] = (0, import_react58.useState)([]);
|
|
17517
|
+
const [skillsLoading, setSkillsLoading] = (0, import_react58.useState)(false);
|
|
17501
17518
|
const { token } = import_antd51.theme.useToken();
|
|
17502
17519
|
const { get } = useApi();
|
|
17503
|
-
const nodeTypes2 = (0,
|
|
17520
|
+
const nodeTypes2 = (0, import_react58.useMemo)(
|
|
17504
17521
|
() => ({
|
|
17505
17522
|
skill: SkillNode_default
|
|
17506
17523
|
}),
|
|
@@ -17520,10 +17537,10 @@ var SkillFlowInner = ({ onNodeClick }) => {
|
|
|
17520
17537
|
setSkillsLoading(false);
|
|
17521
17538
|
}
|
|
17522
17539
|
};
|
|
17523
|
-
(0,
|
|
17540
|
+
(0, import_react58.useEffect)(() => {
|
|
17524
17541
|
fetchSkills();
|
|
17525
17542
|
}, []);
|
|
17526
|
-
(0,
|
|
17543
|
+
(0, import_react58.useEffect)(() => {
|
|
17527
17544
|
if (!skills || skills.length === 0) {
|
|
17528
17545
|
setNodes([]);
|
|
17529
17546
|
setEdges([]);
|
|
@@ -17672,7 +17689,7 @@ var SkillFlowInner = ({ onNodeClick }) => {
|
|
|
17672
17689
|
}
|
|
17673
17690
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { style: { width: "100%", height: "100%", background: "#fafafa", position: "relative" }, children: [
|
|
17674
17691
|
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
17675
|
-
|
|
17692
|
+
import_react59.ReactFlow,
|
|
17676
17693
|
{
|
|
17677
17694
|
nodes,
|
|
17678
17695
|
edges,
|
|
@@ -17681,8 +17698,8 @@ var SkillFlowInner = ({ onNodeClick }) => {
|
|
|
17681
17698
|
nodeTypes: nodeTypes2,
|
|
17682
17699
|
fitView: true,
|
|
17683
17700
|
children: [
|
|
17684
|
-
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
17685
|
-
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
17701
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react59.Background, { color: "#eee", gap: 20 }),
|
|
17702
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react59.Controls, {})
|
|
17686
17703
|
]
|
|
17687
17704
|
}
|
|
17688
17705
|
),
|
|
@@ -17726,13 +17743,13 @@ var SkillFlowInner = ({ onNodeClick }) => {
|
|
|
17726
17743
|
)
|
|
17727
17744
|
] });
|
|
17728
17745
|
};
|
|
17729
|
-
var SkillFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
17746
|
+
var SkillFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react59.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(SkillFlowInner, { ...props }) });
|
|
17730
17747
|
var SkillFlow_default = SkillFlow;
|
|
17731
17748
|
|
|
17732
17749
|
// src/components/Chat/ToolsList.tsx
|
|
17733
17750
|
var import_antd52 = require("antd");
|
|
17734
17751
|
var import_icons29 = require("@ant-design/icons");
|
|
17735
|
-
var
|
|
17752
|
+
var import_react60 = require("react");
|
|
17736
17753
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
17737
17754
|
var ToolsList = ({
|
|
17738
17755
|
onToolSelect,
|
|
@@ -17740,13 +17757,13 @@ var ToolsList = ({
|
|
|
17740
17757
|
}) => {
|
|
17741
17758
|
const { token } = import_antd52.theme.useToken();
|
|
17742
17759
|
const { get } = useApi();
|
|
17743
|
-
const [state, setState] = (0,
|
|
17760
|
+
const [state, setState] = (0, import_react60.useState)({
|
|
17744
17761
|
tools: [],
|
|
17745
17762
|
isLoading: false,
|
|
17746
17763
|
error: null
|
|
17747
17764
|
});
|
|
17748
|
-
const [selectedToolId, setSelectedToolId] = (0,
|
|
17749
|
-
const fetchTools = (0,
|
|
17765
|
+
const [selectedToolId, setSelectedToolId] = (0, import_react60.useState)(null);
|
|
17766
|
+
const fetchTools = (0, import_react60.useCallback)(async () => {
|
|
17750
17767
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
17751
17768
|
try {
|
|
17752
17769
|
const data = await get("/api/tools");
|
|
@@ -17768,17 +17785,17 @@ var ToolsList = ({
|
|
|
17768
17785
|
}));
|
|
17769
17786
|
}
|
|
17770
17787
|
}, [get]);
|
|
17771
|
-
const handleToolSelect = (0,
|
|
17788
|
+
const handleToolSelect = (0, import_react60.useCallback)(
|
|
17772
17789
|
(tool) => {
|
|
17773
17790
|
setSelectedToolId(tool.id);
|
|
17774
17791
|
onToolSelect?.(tool);
|
|
17775
17792
|
},
|
|
17776
17793
|
[onToolSelect]
|
|
17777
17794
|
);
|
|
17778
|
-
const handleRefresh = (0,
|
|
17795
|
+
const handleRefresh = (0, import_react60.useCallback)(() => {
|
|
17779
17796
|
fetchTools();
|
|
17780
17797
|
}, [fetchTools]);
|
|
17781
|
-
(0,
|
|
17798
|
+
(0, import_react60.useEffect)(() => {
|
|
17782
17799
|
if (autoLoad) {
|
|
17783
17800
|
fetchTools();
|
|
17784
17801
|
}
|
|
@@ -17968,14 +17985,14 @@ var ToolsList = ({
|
|
|
17968
17985
|
};
|
|
17969
17986
|
|
|
17970
17987
|
// src/components/Chat/TopologyAutomationView.tsx
|
|
17971
|
-
var
|
|
17972
|
-
var
|
|
17988
|
+
var import_react64 = require("react");
|
|
17989
|
+
var import_react65 = require("@xyflow/react");
|
|
17973
17990
|
var import_style3 = require("@xyflow/react/dist/style.css");
|
|
17974
17991
|
var import_antd56 = require("antd");
|
|
17975
17992
|
var import_icons32 = require("@ant-design/icons");
|
|
17976
17993
|
|
|
17977
17994
|
// src/components/Chat/TopologyNode.tsx
|
|
17978
|
-
var
|
|
17995
|
+
var import_react61 = require("@xyflow/react");
|
|
17979
17996
|
var import_antd53 = require("antd");
|
|
17980
17997
|
var import_icons30 = require("@ant-design/icons");
|
|
17981
17998
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
@@ -17987,7 +18004,7 @@ var TopologyNode = ({ data }) => {
|
|
|
17987
18004
|
if (!data) return null;
|
|
17988
18005
|
const { agentName, description, outgoingEdges, incomingEdges } = data;
|
|
17989
18006
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { style: { padding: 4 }, children: [
|
|
17990
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
18007
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_react61.Handle, { type: "target", position: import_react61.Position.Top }),
|
|
17991
18008
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
17992
18009
|
"div",
|
|
17993
18010
|
{
|
|
@@ -18083,13 +18100,13 @@ var TopologyNode = ({ data }) => {
|
|
|
18083
18100
|
] })
|
|
18084
18101
|
}
|
|
18085
18102
|
),
|
|
18086
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
18103
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_react61.Handle, { type: "source", position: import_react61.Position.Bottom })
|
|
18087
18104
|
] });
|
|
18088
18105
|
};
|
|
18089
18106
|
var TopologyNode_default = TopologyNode;
|
|
18090
18107
|
|
|
18091
18108
|
// src/components/Chat/CopilotPanel.tsx
|
|
18092
|
-
var
|
|
18109
|
+
var import_react62 = require("react");
|
|
18093
18110
|
var import_antd54 = require("antd");
|
|
18094
18111
|
var import_icons31 = require("@ant-design/icons");
|
|
18095
18112
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
@@ -18103,13 +18120,13 @@ var CopilotPanel = ({
|
|
|
18103
18120
|
}) => {
|
|
18104
18121
|
const client = useClient("agent-architect");
|
|
18105
18122
|
const threadId = workflowContext?.id ? `${client.tenantId}:${workflowContext.id}` : null;
|
|
18106
|
-
const systemContext = (0,
|
|
18123
|
+
const systemContext = (0, import_react62.useMemo)(() => {
|
|
18107
18124
|
if (workflowContext?.id && workflowContext?.name) {
|
|
18108
18125
|
return `[Context: You're viewing workflow "${workflowContext.name}" (agent: ${workflowContext.id})]`;
|
|
18109
18126
|
}
|
|
18110
18127
|
return void 0;
|
|
18111
18128
|
}, [workflowContext]);
|
|
18112
|
-
const initialMessageContent = (0,
|
|
18129
|
+
const initialMessageContent = (0, import_react62.useMemo)(() => {
|
|
18113
18130
|
if (!initialMessage || !workflowContext?.id) return void 0;
|
|
18114
18131
|
return [
|
|
18115
18132
|
`Purpose: ${initialMessage.trim()}`,
|
|
@@ -18210,7 +18227,7 @@ var CopilotPanel = ({
|
|
|
18210
18227
|
};
|
|
18211
18228
|
|
|
18212
18229
|
// src/components/Chat/CreateWorkflowModal.tsx
|
|
18213
|
-
var
|
|
18230
|
+
var import_react63 = require("react");
|
|
18214
18231
|
var import_antd55 = require("antd");
|
|
18215
18232
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
18216
18233
|
function extractName(purpose) {
|
|
@@ -18235,7 +18252,7 @@ var CreateWorkflowModal = ({
|
|
|
18235
18252
|
}) => {
|
|
18236
18253
|
const { post } = useApi();
|
|
18237
18254
|
const [form] = import_antd55.Form.useForm();
|
|
18238
|
-
(0,
|
|
18255
|
+
(0, import_react63.useEffect)(() => {
|
|
18239
18256
|
if (open) {
|
|
18240
18257
|
form.resetFields();
|
|
18241
18258
|
}
|
|
@@ -18406,7 +18423,7 @@ function buildGraph(agents, agentNameMap) {
|
|
|
18406
18423
|
animated: true,
|
|
18407
18424
|
type: "smoothstep",
|
|
18408
18425
|
style: { stroke: "#6366f1", strokeWidth: 2 },
|
|
18409
|
-
markerEnd: { type:
|
|
18426
|
+
markerEnd: { type: import_react65.MarkerType.ArrowClosed, color: "#6366f1", width: 20, height: 20 },
|
|
18410
18427
|
labelStyle: { fill: "#6366f1", fontWeight: 500, fontSize: 12 },
|
|
18411
18428
|
labelBgStyle: { fill: "#EEF2FF", fillOpacity: 0.9 },
|
|
18412
18429
|
labelBgPadding: [8, 4],
|
|
@@ -18423,11 +18440,11 @@ function TopologyFlowInner({
|
|
|
18423
18440
|
nodes: initialNodes,
|
|
18424
18441
|
edges: initialEdges
|
|
18425
18442
|
}) {
|
|
18426
|
-
const [nodes, setNodes, onNodesChange] = (0,
|
|
18427
|
-
const [edges, setEdges, onEdgesChange] = (0,
|
|
18428
|
-
const [specModalOpen, setSpecModalOpen] = (0,
|
|
18429
|
-
const nodeTypes2 = (0,
|
|
18430
|
-
(0,
|
|
18443
|
+
const [nodes, setNodes, onNodesChange] = (0, import_react65.useNodesState)(initialNodes);
|
|
18444
|
+
const [edges, setEdges, onEdgesChange] = (0, import_react65.useEdgesState)(initialEdges);
|
|
18445
|
+
const [specModalOpen, setSpecModalOpen] = (0, import_react64.useState)(false);
|
|
18446
|
+
const nodeTypes2 = (0, import_react64.useMemo)(() => ({ topologyNode: TopologyNode_default }), []);
|
|
18447
|
+
(0, import_react64.useEffect)(() => {
|
|
18431
18448
|
setNodes(initialNodes);
|
|
18432
18449
|
setEdges(initialEdges);
|
|
18433
18450
|
}, [initialNodes, initialEdges, setNodes, setEdges]);
|
|
@@ -18515,7 +18532,7 @@ function TopologyFlowInner({
|
|
|
18515
18532
|
),
|
|
18516
18533
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { style: { flex: 1 }, children: selectedAgent ? /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { style: { position: "relative", height: "100%" }, children: [
|
|
18517
18534
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
18518
|
-
|
|
18535
|
+
import_react65.ReactFlow,
|
|
18519
18536
|
{
|
|
18520
18537
|
nodes,
|
|
18521
18538
|
edges,
|
|
@@ -18526,10 +18543,10 @@ function TopologyFlowInner({
|
|
|
18526
18543
|
minZoom: 0.1,
|
|
18527
18544
|
maxZoom: 2,
|
|
18528
18545
|
children: [
|
|
18529
|
-
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18530
|
-
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18546
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react65.Background, { variant: import_react65.BackgroundVariant.Dots, gap: 20, size: 1 }),
|
|
18547
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react65.Controls, {}),
|
|
18531
18548
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18532
|
-
|
|
18549
|
+
import_react65.MiniMap,
|
|
18533
18550
|
{
|
|
18534
18551
|
nodeStrokeWidth: 3,
|
|
18535
18552
|
pannable: true,
|
|
@@ -18635,15 +18652,15 @@ function TopologyFlowInner({
|
|
|
18635
18652
|
}
|
|
18636
18653
|
var TopologyAutomationView = () => {
|
|
18637
18654
|
const { get, del } = useApi();
|
|
18638
|
-
const [agents, setAgents] = (0,
|
|
18639
|
-
const [agentNameMap, setAgentNameMap] = (0,
|
|
18640
|
-
const [selectedWorkflowId, setSelectedWorkflowId] = (0,
|
|
18641
|
-
const [copilotOpen, setCopilotOpen] = (0,
|
|
18642
|
-
const [initialLoading, setInitialLoading] = (0,
|
|
18643
|
-
const [error, setError] = (0,
|
|
18644
|
-
const [isCreateModalOpen, setIsCreateModalOpen] = (0,
|
|
18645
|
-
const [initialMessage, setInitialMessage] = (0,
|
|
18646
|
-
const workflowTools = (0,
|
|
18655
|
+
const [agents, setAgents] = (0, import_react64.useState)([]);
|
|
18656
|
+
const [agentNameMap, setAgentNameMap] = (0, import_react64.useState)(/* @__PURE__ */ new Map());
|
|
18657
|
+
const [selectedWorkflowId, setSelectedWorkflowId] = (0, import_react64.useState)(null);
|
|
18658
|
+
const [copilotOpen, setCopilotOpen] = (0, import_react64.useState)(true);
|
|
18659
|
+
const [initialLoading, setInitialLoading] = (0, import_react64.useState)(true);
|
|
18660
|
+
const [error, setError] = (0, import_react64.useState)(null);
|
|
18661
|
+
const [isCreateModalOpen, setIsCreateModalOpen] = (0, import_react64.useState)(false);
|
|
18662
|
+
const [initialMessage, setInitialMessage] = (0, import_react64.useState)(null);
|
|
18663
|
+
const workflowTools = (0, import_react64.useMemo)(
|
|
18647
18664
|
() => [
|
|
18648
18665
|
"create_agent",
|
|
18649
18666
|
"create_processing_agent",
|
|
@@ -18653,7 +18670,7 @@ var TopologyAutomationView = () => {
|
|
|
18653
18670
|
],
|
|
18654
18671
|
[]
|
|
18655
18672
|
);
|
|
18656
|
-
const fetchData = (0,
|
|
18673
|
+
const fetchData = (0, import_react64.useCallback)(async () => {
|
|
18657
18674
|
const [wfRes, assistantsRes] = await Promise.all([
|
|
18658
18675
|
get("/api/workflows/definitions"),
|
|
18659
18676
|
get("/api/assistants")
|
|
@@ -18677,7 +18694,7 @@ var TopologyAutomationView = () => {
|
|
|
18677
18694
|
}
|
|
18678
18695
|
setError(null);
|
|
18679
18696
|
}, [get]);
|
|
18680
|
-
(0,
|
|
18697
|
+
(0, import_react64.useEffect)(() => {
|
|
18681
18698
|
let cancelled = false;
|
|
18682
18699
|
const load = async () => {
|
|
18683
18700
|
try {
|
|
@@ -18696,7 +18713,7 @@ var TopologyAutomationView = () => {
|
|
|
18696
18713
|
cancelled = true;
|
|
18697
18714
|
};
|
|
18698
18715
|
}, [fetchData]);
|
|
18699
|
-
const handleWorkflowCreated = (0,
|
|
18716
|
+
const handleWorkflowCreated = (0, import_react64.useCallback)((id, purpose) => {
|
|
18700
18717
|
setIsCreateModalOpen(false);
|
|
18701
18718
|
fetchData().then(() => {
|
|
18702
18719
|
setSelectedWorkflowId(id);
|
|
@@ -18705,10 +18722,10 @@ var TopologyAutomationView = () => {
|
|
|
18705
18722
|
}
|
|
18706
18723
|
});
|
|
18707
18724
|
}, [fetchData]);
|
|
18708
|
-
const handleSelectWorkflow = (0,
|
|
18725
|
+
const handleSelectWorkflow = (0, import_react64.useCallback)((id) => {
|
|
18709
18726
|
setSelectedWorkflowId(id);
|
|
18710
18727
|
}, []);
|
|
18711
|
-
const handleDeleteWorkflow = (0,
|
|
18728
|
+
const handleDeleteWorkflow = (0, import_react64.useCallback)(async (id) => {
|
|
18712
18729
|
try {
|
|
18713
18730
|
await del(`/api/assistants/${id}`);
|
|
18714
18731
|
setSelectedWorkflowId(null);
|
|
@@ -18718,19 +18735,19 @@ var TopologyAutomationView = () => {
|
|
|
18718
18735
|
setError(message23);
|
|
18719
18736
|
}
|
|
18720
18737
|
}, [del, fetchData]);
|
|
18721
|
-
const selectedAgent = (0,
|
|
18738
|
+
const selectedAgent = (0, import_react64.useMemo)(
|
|
18722
18739
|
() => agents.find((a) => a.id === selectedWorkflowId) || null,
|
|
18723
18740
|
[agents, selectedWorkflowId]
|
|
18724
18741
|
);
|
|
18725
|
-
const selectedWorkflowName = (0,
|
|
18742
|
+
const selectedWorkflowName = (0, import_react64.useMemo)(
|
|
18726
18743
|
() => selectedAgent?.name || null,
|
|
18727
18744
|
[selectedAgent]
|
|
18728
18745
|
);
|
|
18729
|
-
const workflowContext = (0,
|
|
18746
|
+
const workflowContext = (0, import_react64.useMemo)(
|
|
18730
18747
|
() => selectedWorkflowId && selectedWorkflowName ? { id: selectedWorkflowId, name: selectedWorkflowName } : null,
|
|
18731
18748
|
[selectedWorkflowId, selectedWorkflowName]
|
|
18732
18749
|
);
|
|
18733
|
-
const { nodes, edges } = (0,
|
|
18750
|
+
const { nodes, edges } = (0, import_react64.useMemo)(
|
|
18734
18751
|
() => selectedAgent ? buildGraph([selectedAgent], agentNameMap) : { nodes: [], edges: [] },
|
|
18735
18752
|
[selectedAgent, agentNameMap]
|
|
18736
18753
|
);
|
|
@@ -18770,7 +18787,7 @@ var TopologyAutomationView = () => {
|
|
|
18770
18787
|
onCreated: handleWorkflowCreated
|
|
18771
18788
|
}
|
|
18772
18789
|
),
|
|
18773
|
-
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18790
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react65.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { style: { display: "flex", height: "100%", width: "100%", overflow: "hidden" }, children: [
|
|
18774
18791
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
18775
18792
|
"div",
|
|
18776
18793
|
{
|
|
@@ -18846,10 +18863,10 @@ var TopologyAutomationView = () => {
|
|
|
18846
18863
|
};
|
|
18847
18864
|
|
|
18848
18865
|
// src/components/Chat/TopologyRuntimeView.tsx
|
|
18849
|
-
var
|
|
18866
|
+
var import_react66 = require("react");
|
|
18850
18867
|
var import_antd57 = require("antd");
|
|
18851
18868
|
var import_icons33 = require("@ant-design/icons");
|
|
18852
|
-
var
|
|
18869
|
+
var import_react67 = require("@xyflow/react");
|
|
18853
18870
|
var import_style4 = require("@xyflow/react/dist/style.css");
|
|
18854
18871
|
var import_dagre = __toESM(require("dagre"));
|
|
18855
18872
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
@@ -18893,7 +18910,7 @@ function StepNode({ data, selected }) {
|
|
|
18893
18910
|
const shadow = isSelected ? `0 4px 14px ${ssc.color}20` : "0 1px 6px rgba(0,0,0,0.08)";
|
|
18894
18911
|
const borderWidth = isSelected ? 2 : 1;
|
|
18895
18912
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { style: { padding: 4 }, children: [
|
|
18896
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
18913
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_react67.Handle, { type: "target", position: import_react67.Position.Top }),
|
|
18897
18914
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
18898
18915
|
"div",
|
|
18899
18916
|
{
|
|
@@ -18953,12 +18970,12 @@ function StepNode({ data, selected }) {
|
|
|
18953
18970
|
] })
|
|
18954
18971
|
}
|
|
18955
18972
|
),
|
|
18956
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
18973
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_react67.Handle, { type: "source", position: import_react67.Position.Bottom })
|
|
18957
18974
|
] });
|
|
18958
18975
|
}
|
|
18959
18976
|
var nodeTypes = { stepNode: StepNode };
|
|
18960
18977
|
function useLayoutedElements(steps) {
|
|
18961
|
-
return (0,
|
|
18978
|
+
return (0, import_react66.useMemo)(() => {
|
|
18962
18979
|
if (steps.length === 0) return [];
|
|
18963
18980
|
const g = new import_dagre.default.graphlib.Graph();
|
|
18964
18981
|
g.setGraph({ rankdir: "TB", nodesep: 40, ranksep: 40 });
|
|
@@ -18984,7 +19001,7 @@ function useLayoutedElements(steps) {
|
|
|
18984
19001
|
}, [steps]);
|
|
18985
19002
|
}
|
|
18986
19003
|
function useEdgesFromSteps(steps) {
|
|
18987
|
-
return (0,
|
|
19004
|
+
return (0, import_react66.useMemo)(() => {
|
|
18988
19005
|
const edges = [];
|
|
18989
19006
|
for (let i = 0; i < steps.length - 1; i++) {
|
|
18990
19007
|
const fromStep = steps[i];
|
|
@@ -18998,7 +19015,7 @@ function useEdgesFromSteps(steps) {
|
|
|
18998
19015
|
animated: true,
|
|
18999
19016
|
label: purpose || void 0,
|
|
19000
19017
|
style: { stroke: "#6366f1", strokeWidth: 2 },
|
|
19001
|
-
markerEnd: { type:
|
|
19018
|
+
markerEnd: { type: import_react67.MarkerType.ArrowClosed, color: "#6366f1", width: 20, height: 20 },
|
|
19002
19019
|
labelStyle: { fill: "#6366f1", fontWeight: 500, fontSize: 12 },
|
|
19003
19020
|
labelBgStyle: { fill: "#EEF2FF", fillOpacity: 0.9 },
|
|
19004
19021
|
labelBgPadding: [8, 4],
|
|
@@ -19125,18 +19142,18 @@ function StepDetailPopover({ step }) {
|
|
|
19125
19142
|
function FlowCanvas({ steps }) {
|
|
19126
19143
|
const initialNodes = useLayoutedElements(steps);
|
|
19127
19144
|
const initialEdges = useEdgesFromSteps(steps);
|
|
19128
|
-
const [nodes, setNodes, onNodesChange] = (0,
|
|
19129
|
-
const [edges, setEdges, onEdgesChange] = (0,
|
|
19130
|
-
const [selectedNodeId, setSelectedNodeId] = (0,
|
|
19131
|
-
const selectedStep = (0,
|
|
19145
|
+
const [nodes, setNodes, onNodesChange] = (0, import_react67.useNodesState)(initialNodes);
|
|
19146
|
+
const [edges, setEdges, onEdgesChange] = (0, import_react67.useEdgesState)(initialEdges);
|
|
19147
|
+
const [selectedNodeId, setSelectedNodeId] = (0, import_react66.useState)(null);
|
|
19148
|
+
const selectedStep = (0, import_react66.useMemo)(
|
|
19132
19149
|
() => steps.find((s) => s.id === selectedNodeId) || null,
|
|
19133
19150
|
[steps, selectedNodeId]
|
|
19134
19151
|
);
|
|
19135
|
-
(0,
|
|
19152
|
+
(0, import_react66.useEffect)(() => {
|
|
19136
19153
|
setNodes(initialNodes);
|
|
19137
19154
|
setEdges(initialEdges);
|
|
19138
19155
|
}, [initialNodes, initialEdges, setNodes, setEdges]);
|
|
19139
|
-
(0,
|
|
19156
|
+
(0, import_react66.useEffect)(() => {
|
|
19140
19157
|
if (selectedNodeId) {
|
|
19141
19158
|
setNodes(
|
|
19142
19159
|
(nds) => nds.map((n) => ({
|
|
@@ -19146,13 +19163,13 @@ function FlowCanvas({ steps }) {
|
|
|
19146
19163
|
);
|
|
19147
19164
|
}
|
|
19148
19165
|
}, [selectedNodeId, setNodes]);
|
|
19149
|
-
const onNodeClick = (0,
|
|
19166
|
+
const onNodeClick = (0, import_react66.useCallback)(
|
|
19150
19167
|
(_event, node) => {
|
|
19151
19168
|
setSelectedNodeId(node.id);
|
|
19152
19169
|
},
|
|
19153
19170
|
[]
|
|
19154
19171
|
);
|
|
19155
|
-
const onPaneClick = (0,
|
|
19172
|
+
const onPaneClick = (0, import_react66.useCallback)(() => {
|
|
19156
19173
|
setNodes(
|
|
19157
19174
|
(nds) => nds.map((n) => ({
|
|
19158
19175
|
...n,
|
|
@@ -19163,7 +19180,7 @@ function FlowCanvas({ steps }) {
|
|
|
19163
19180
|
}, [setNodes]);
|
|
19164
19181
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
|
|
19165
19182
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
19166
|
-
|
|
19183
|
+
import_react67.ReactFlow,
|
|
19167
19184
|
{
|
|
19168
19185
|
nodes,
|
|
19169
19186
|
edges,
|
|
@@ -19179,10 +19196,10 @@ function FlowCanvas({ steps }) {
|
|
|
19179
19196
|
nodesDraggable: false,
|
|
19180
19197
|
nodesConnectable: false,
|
|
19181
19198
|
children: [
|
|
19182
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
19183
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
19199
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_react67.Background, { variant: import_react67.BackgroundVariant.Dots, gap: 20, size: 1 }),
|
|
19200
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_react67.Controls, {}),
|
|
19184
19201
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
19185
|
-
|
|
19202
|
+
import_react67.MiniMap,
|
|
19186
19203
|
{
|
|
19187
19204
|
nodeStrokeWidth: 3,
|
|
19188
19205
|
pannable: true,
|
|
@@ -19331,11 +19348,11 @@ function RunSummaryBanner({ run, agentName }) {
|
|
|
19331
19348
|
}
|
|
19332
19349
|
var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh, onAutoRefreshChange }) => {
|
|
19333
19350
|
const { get } = useApi();
|
|
19334
|
-
const [steps, setSteps] = (0,
|
|
19335
|
-
const [loading, setLoading] = (0,
|
|
19336
|
-
const stepsPollTimeoutRef = (0,
|
|
19337
|
-
const stepsPollSessionRef = (0,
|
|
19338
|
-
const fetchSteps = (0,
|
|
19351
|
+
const [steps, setSteps] = (0, import_react66.useState)([]);
|
|
19352
|
+
const [loading, setLoading] = (0, import_react66.useState)(false);
|
|
19353
|
+
const stepsPollTimeoutRef = (0, import_react66.useRef)(null);
|
|
19354
|
+
const stepsPollSessionRef = (0, import_react66.useRef)(0);
|
|
19355
|
+
const fetchSteps = (0, import_react66.useCallback)(async () => {
|
|
19339
19356
|
try {
|
|
19340
19357
|
const [stepsRes, runsRes] = await Promise.all([
|
|
19341
19358
|
get(
|
|
@@ -19353,12 +19370,12 @@ var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh, onAu
|
|
|
19353
19370
|
} catch {
|
|
19354
19371
|
}
|
|
19355
19372
|
}, [get, run.id, onRunUpdate]);
|
|
19356
|
-
(0,
|
|
19373
|
+
(0, import_react66.useEffect)(() => {
|
|
19357
19374
|
if (!open) return;
|
|
19358
19375
|
setLoading(true);
|
|
19359
19376
|
fetchSteps().finally(() => setLoading(false));
|
|
19360
19377
|
}, [open, run.id, fetchSteps]);
|
|
19361
|
-
(0,
|
|
19378
|
+
(0, import_react66.useEffect)(() => {
|
|
19362
19379
|
if (stepsPollTimeoutRef.current) {
|
|
19363
19380
|
clearTimeout(stepsPollTimeoutRef.current);
|
|
19364
19381
|
stepsPollTimeoutRef.current = null;
|
|
@@ -19400,7 +19417,7 @@ var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh, onAu
|
|
|
19400
19417
|
styles: { body: { padding: "12px 0" } },
|
|
19401
19418
|
children: [
|
|
19402
19419
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { style: { padding: "0 12px", marginBottom: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(RunSummaryBanner, { run, agentName }) }),
|
|
19403
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: 300 }, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_antd57.Spin, { size: "large" }) }) : steps.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { style: { padding: "0 12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Text27, { type: "secondary", children: "No step records yet" }) }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { style: { width: "100%", height: "calc(100vh - 200px)", position: "relative" }, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
19420
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: 300 }, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_antd57.Spin, { size: "large" }) }) : steps.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { style: { padding: "0 12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Text27, { type: "secondary", children: "No step records yet" }) }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { style: { width: "100%", height: "calc(100vh - 200px)", position: "relative" }, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_react67.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(FlowCanvas, { steps }) }) }),
|
|
19404
19421
|
run.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { style: { padding: "0 12px", marginTop: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
19405
19422
|
"div",
|
|
19406
19423
|
{
|
|
@@ -19420,20 +19437,20 @@ var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh, onAu
|
|
|
19420
19437
|
var POLLING_INTERVAL = 3e3;
|
|
19421
19438
|
var TopologyRuntimeView = () => {
|
|
19422
19439
|
const { get, del } = useApi();
|
|
19423
|
-
const [runs, setRuns] = (0,
|
|
19424
|
-
const [agentNames, setAgentNames] = (0,
|
|
19425
|
-
const [loading, setLoading] = (0,
|
|
19426
|
-
const [error, setError] = (0,
|
|
19427
|
-
const [selectedRun, setSelectedRun] = (0,
|
|
19428
|
-
const [autoRefresh, setAutoRefresh] = (0,
|
|
19429
|
-
const pollingSessionRef = (0,
|
|
19430
|
-
const handleRunUpdate = (0,
|
|
19440
|
+
const [runs, setRuns] = (0, import_react66.useState)([]);
|
|
19441
|
+
const [agentNames, setAgentNames] = (0, import_react66.useState)({});
|
|
19442
|
+
const [loading, setLoading] = (0, import_react66.useState)(true);
|
|
19443
|
+
const [error, setError] = (0, import_react66.useState)(null);
|
|
19444
|
+
const [selectedRun, setSelectedRun] = (0, import_react66.useState)(null);
|
|
19445
|
+
const [autoRefresh, setAutoRefresh] = (0, import_react66.useState)(true);
|
|
19446
|
+
const pollingSessionRef = (0, import_react66.useRef)(0);
|
|
19447
|
+
const handleRunUpdate = (0, import_react66.useCallback)((updated) => {
|
|
19431
19448
|
setRuns(
|
|
19432
19449
|
(prev) => prev.map((r) => r.id === updated.id ? updated : r)
|
|
19433
19450
|
);
|
|
19434
19451
|
setSelectedRun((prev) => prev?.id === updated.id ? updated : prev);
|
|
19435
19452
|
}, []);
|
|
19436
|
-
const handleDeleteRun = (0,
|
|
19453
|
+
const handleDeleteRun = (0, import_react66.useCallback)(async (runId) => {
|
|
19437
19454
|
try {
|
|
19438
19455
|
await del(`/api/workflows/runs/${runId}`);
|
|
19439
19456
|
setRuns((prev) => prev.filter((r) => r.id !== runId));
|
|
@@ -19443,7 +19460,7 @@ var TopologyRuntimeView = () => {
|
|
|
19443
19460
|
setError(message23);
|
|
19444
19461
|
}
|
|
19445
19462
|
}, [del]);
|
|
19446
|
-
const refreshRuns = (0,
|
|
19463
|
+
const refreshRuns = (0, import_react66.useCallback)(async () => {
|
|
19447
19464
|
setLoading(true);
|
|
19448
19465
|
try {
|
|
19449
19466
|
const defsRes = await get("/api/workflows/definitions");
|
|
@@ -19472,7 +19489,7 @@ var TopologyRuntimeView = () => {
|
|
|
19472
19489
|
setLoading(false);
|
|
19473
19490
|
}
|
|
19474
19491
|
}, [get]);
|
|
19475
|
-
(0,
|
|
19492
|
+
(0, import_react66.useEffect)(() => {
|
|
19476
19493
|
let cancelled = false;
|
|
19477
19494
|
const init2 = async () => {
|
|
19478
19495
|
try {
|
|
@@ -19508,7 +19525,7 @@ var TopologyRuntimeView = () => {
|
|
|
19508
19525
|
cancelled = true;
|
|
19509
19526
|
};
|
|
19510
19527
|
}, [get]);
|
|
19511
|
-
(0,
|
|
19528
|
+
(0, import_react66.useEffect)(() => {
|
|
19512
19529
|
return () => {
|
|
19513
19530
|
pollingSessionRef.current = 0;
|
|
19514
19531
|
};
|
|
@@ -19616,15 +19633,15 @@ var TopologyRuntimeView = () => {
|
|
|
19616
19633
|
};
|
|
19617
19634
|
|
|
19618
19635
|
// src/components/Chat/TopologyInboxView.tsx
|
|
19619
|
-
var
|
|
19636
|
+
var import_react68 = require("react");
|
|
19620
19637
|
var import_antd58 = require("antd");
|
|
19621
19638
|
var import_icons34 = require("@ant-design/icons");
|
|
19622
19639
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
19623
19640
|
var { Text: Text28, Title: Title6 } = import_antd58.Typography;
|
|
19624
19641
|
var TopologyInboxView = () => {
|
|
19625
19642
|
const { get } = useApi();
|
|
19626
|
-
const [items, setItems] = (0,
|
|
19627
|
-
const [loading, setLoading] = (0,
|
|
19643
|
+
const [items, setItems] = (0, import_react68.useState)([]);
|
|
19644
|
+
const [loading, setLoading] = (0, import_react68.useState)(true);
|
|
19628
19645
|
const fetchInbox = async () => {
|
|
19629
19646
|
setLoading(true);
|
|
19630
19647
|
try {
|
|
@@ -19651,7 +19668,7 @@ var TopologyInboxView = () => {
|
|
|
19651
19668
|
setLoading(false);
|
|
19652
19669
|
}
|
|
19653
19670
|
};
|
|
19654
|
-
(0,
|
|
19671
|
+
(0, import_react68.useEffect)(() => {
|
|
19655
19672
|
fetchInbox();
|
|
19656
19673
|
}, [get]);
|
|
19657
19674
|
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { style: { height: "100%", display: "flex", flexDirection: "column" }, children: [
|
|
@@ -19734,7 +19751,7 @@ var TopologyInboxView = () => {
|
|
|
19734
19751
|
};
|
|
19735
19752
|
|
|
19736
19753
|
// src/components/Eval/EvalPanel.tsx
|
|
19737
|
-
var
|
|
19754
|
+
var import_react71 = __toESM(require("react"));
|
|
19738
19755
|
var import_antd_style22 = require("antd-style");
|
|
19739
19756
|
var import_antd62 = require("antd");
|
|
19740
19757
|
var import_lucide_react13 = require("lucide-react");
|
|
@@ -19851,7 +19868,7 @@ var EvalSuiteCardList = ({ projectId, onSelectSuite }) => {
|
|
|
19851
19868
|
};
|
|
19852
19869
|
|
|
19853
19870
|
// src/components/Eval/EvalSuiteDetail.tsx
|
|
19854
|
-
var
|
|
19871
|
+
var import_react69 = require("react");
|
|
19855
19872
|
var import_antd_style20 = require("antd-style");
|
|
19856
19873
|
var import_antd60 = require("antd");
|
|
19857
19874
|
var import_lucide_react11 = require("lucide-react");
|
|
@@ -19955,9 +19972,9 @@ var EvalSuiteDetail = ({ projectId, suiteId, onBack, onRun }) => {
|
|
|
19955
19972
|
const { suites } = useEvalSuites(projectId);
|
|
19956
19973
|
const { cases, create: createCase, remove: removeCase } = useEvalCases(projectId, suiteId);
|
|
19957
19974
|
const { start } = useEvalRuns(projectId);
|
|
19958
|
-
const [modalOpen, setModalOpen] = (0,
|
|
19975
|
+
const [modalOpen, setModalOpen] = (0, import_react69.useState)(false);
|
|
19959
19976
|
const [form] = import_antd60.Form.useForm();
|
|
19960
|
-
const [agents, setAgents] = (0,
|
|
19977
|
+
const [agents, setAgents] = (0, import_react69.useState)([]);
|
|
19961
19978
|
const suite = suites.find((s) => s.id === suiteId) || {};
|
|
19962
19979
|
const loadAgents = async () => {
|
|
19963
19980
|
try {
|
|
@@ -20090,7 +20107,7 @@ var EvalSuiteDetail = ({ projectId, suiteId, onBack, onRun }) => {
|
|
|
20090
20107
|
};
|
|
20091
20108
|
|
|
20092
20109
|
// src/components/Eval/EvalRunResults.tsx
|
|
20093
|
-
var
|
|
20110
|
+
var import_react70 = require("react");
|
|
20094
20111
|
var import_antd_style21 = require("antd-style");
|
|
20095
20112
|
var import_antd61 = require("antd");
|
|
20096
20113
|
var import_lucide_react12 = require("lucide-react");
|
|
@@ -20179,9 +20196,9 @@ var useStyle11 = (0, import_antd_style21.createStyles)(({ token, css }) => ({
|
|
|
20179
20196
|
var EvalRunResults = ({ runId, onBack }) => {
|
|
20180
20197
|
const { styles } = useStyle11();
|
|
20181
20198
|
const client = useClient("__GLOBAL__");
|
|
20182
|
-
const [run, setRun] = (0,
|
|
20199
|
+
const [run, setRun] = (0, import_react70.useState)(null);
|
|
20183
20200
|
const { status: streamingStatus, progress, connected } = useEvalRunStream(runId);
|
|
20184
|
-
(0,
|
|
20201
|
+
(0, import_react70.useEffect)(() => {
|
|
20185
20202
|
client.eval.runs.get(runId).then(setRun).catch(console.error);
|
|
20186
20203
|
}, [runId, client]);
|
|
20187
20204
|
if (!run) {
|
|
@@ -20532,18 +20549,18 @@ var EvalPanel = () => {
|
|
|
20532
20549
|
const { styles, cx } = useStyle12();
|
|
20533
20550
|
const { token } = import_antd62.theme.useToken();
|
|
20534
20551
|
const { projects } = useEvalProjects();
|
|
20535
|
-
const [projectId, setProjectId] = (0,
|
|
20536
|
-
const [page, setPage] = (0,
|
|
20537
|
-
const [suiteId, setSuiteId] = (0,
|
|
20538
|
-
const [runId, setRunId] = (0,
|
|
20539
|
-
|
|
20552
|
+
const [projectId, setProjectId] = (0, import_react71.useState)("");
|
|
20553
|
+
const [page, setPage] = (0, import_react71.useState)("dashboard");
|
|
20554
|
+
const [suiteId, setSuiteId] = (0, import_react71.useState)("");
|
|
20555
|
+
const [runId, setRunId] = (0, import_react71.useState)("");
|
|
20556
|
+
import_react71.default.useEffect(() => {
|
|
20540
20557
|
if (!projectId && projects.length > 0) {
|
|
20541
20558
|
setProjectId(projects[0].id);
|
|
20542
20559
|
}
|
|
20543
20560
|
}, [projects, projectId]);
|
|
20544
20561
|
const { suites } = useEvalSuites(projectId);
|
|
20545
20562
|
const { runs, start, remove } = useEvalRuns(projectId);
|
|
20546
|
-
const stats = (0,
|
|
20563
|
+
const stats = (0, import_react71.useMemo)(() => {
|
|
20547
20564
|
const totalCases = suites.reduce((s, x) => s + (x.caseCount ?? 0), 0);
|
|
20548
20565
|
const latest = runs[0];
|
|
20549
20566
|
const passRate = latest?.totalCases > 0 ? Math.round(latest.passedCases / latest.totalCases * 100) : null;
|
|
@@ -20723,8 +20740,8 @@ var EvalPanel = () => {
|
|
|
20723
20740
|
] });
|
|
20724
20741
|
}
|
|
20725
20742
|
const SuiteListPage = () => {
|
|
20726
|
-
const [showAdd, setShowAdd] = (0,
|
|
20727
|
-
const [name, setName] = (0,
|
|
20743
|
+
const [showAdd, setShowAdd] = (0, import_react71.useState)(false);
|
|
20744
|
+
const [name, setName] = (0, import_react71.useState)("");
|
|
20728
20745
|
const { create } = useEvalSuites(projectId);
|
|
20729
20746
|
const handleAdd = async () => {
|
|
20730
20747
|
if (!name.trim()) return;
|
|
@@ -20906,9 +20923,9 @@ var WorkspaceResourceManager = ({
|
|
|
20906
20923
|
logo
|
|
20907
20924
|
}) => {
|
|
20908
20925
|
const { openContentApp, menuCollapsed, setMenuCollapsed } = useChatUIContext();
|
|
20909
|
-
const hasOpenedDefault = (0,
|
|
20910
|
-
const hasRegistered = (0,
|
|
20911
|
-
(0,
|
|
20926
|
+
const hasOpenedDefault = (0, import_react72.useRef)(false);
|
|
20927
|
+
const hasRegistered = (0, import_react72.useRef)(false);
|
|
20928
|
+
(0, import_react72.useEffect)(() => {
|
|
20912
20929
|
if (!hasRegistered.current) {
|
|
20913
20930
|
hasRegistered.current = true;
|
|
20914
20931
|
regsiterElement("workspace_projects", {
|
|
@@ -20967,9 +20984,9 @@ var WorkspaceResourceManager = ({
|
|
|
20967
20984
|
const { user, logout, tenants, currentTenant, selectTenant, isLoading } = useAuth();
|
|
20968
20985
|
const { setWorkspace, setProject } = useWorkspaceContext();
|
|
20969
20986
|
const { config } = useLatticeChatShellContext();
|
|
20970
|
-
const [tenantModalOpen, setTenantModalOpen] = (0,
|
|
20971
|
-
const [changePasswordOpen, setChangePasswordOpen] = (0,
|
|
20972
|
-
const menuItems = (0,
|
|
20987
|
+
const [tenantModalOpen, setTenantModalOpen] = (0, import_react72.useState)(false);
|
|
20988
|
+
const [changePasswordOpen, setChangePasswordOpen] = (0, import_react72.useState)(false);
|
|
20989
|
+
const menuItems = (0, import_react72.useMemo)(() => {
|
|
20973
20990
|
const items = config.workspaceMenuItems?.length ? [...config.workspaceMenuItems] : [...DEFAULT_WORKSPACE_MENU_ITEMS];
|
|
20974
20991
|
return items.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
20975
20992
|
}, [config.workspaceMenuItems]);
|
|
@@ -21000,7 +21017,7 @@ var WorkspaceResourceManager = ({
|
|
|
21000
21017
|
});
|
|
21001
21018
|
}
|
|
21002
21019
|
};
|
|
21003
|
-
(0,
|
|
21020
|
+
(0, import_react72.useEffect)(() => {
|
|
21004
21021
|
if (!hasOpenedDefault.current && menuItems.length > 0) {
|
|
21005
21022
|
hasOpenedDefault.current = true;
|
|
21006
21023
|
const firstRoute = menuItems.find((item) => item.type === "route");
|
|
@@ -21189,9 +21206,9 @@ var WorkspaceResourceUIContext = ({
|
|
|
21189
21206
|
|
|
21190
21207
|
// src/context/WorkspaceContext.tsx
|
|
21191
21208
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
21192
|
-
var WorkspaceContext = (0,
|
|
21209
|
+
var WorkspaceContext = (0, import_react73.createContext)(null);
|
|
21193
21210
|
var useWorkspaceContext = () => {
|
|
21194
|
-
const context = (0,
|
|
21211
|
+
const context = (0, import_react73.useContext)(WorkspaceContext);
|
|
21195
21212
|
if (!context) {
|
|
21196
21213
|
throw new Error("useWorkspaceContext must be used within a WorkspaceContextProvider");
|
|
21197
21214
|
}
|
|
@@ -21216,23 +21233,23 @@ var WorkspaceContextProvider = ({
|
|
|
21216
21233
|
}
|
|
21217
21234
|
return null;
|
|
21218
21235
|
};
|
|
21219
|
-
const [workspaceId, setWorkspaceId] = (0,
|
|
21220
|
-
const [projectId, setProjectId] = (0,
|
|
21221
|
-
|
|
21236
|
+
const [workspaceId, setWorkspaceId] = (0, import_react73.useState)(getInitialWorkspaceId);
|
|
21237
|
+
const [projectId, setProjectId] = (0, import_react73.useState)(getInitialProjectId);
|
|
21238
|
+
import_react73.default.useEffect(() => {
|
|
21222
21239
|
const wsId = getInitialWorkspaceId();
|
|
21223
21240
|
const pjId = getInitialProjectId();
|
|
21224
21241
|
if (wsId || pjId) {
|
|
21225
21242
|
import_client_sdk6.Client.setWorkspaceContext(wsId || void 0, pjId || void 0);
|
|
21226
21243
|
}
|
|
21227
21244
|
}, []);
|
|
21228
|
-
(0,
|
|
21245
|
+
(0, import_react73.useEffect)(() => {
|
|
21229
21246
|
import_client_sdk6.Client.setWorkspaceContext(workspaceId || void 0, projectId || void 0);
|
|
21230
21247
|
}, [workspaceId, projectId]);
|
|
21231
|
-
const [workspaces, setWorkspaces] = (0,
|
|
21232
|
-
const [projects, setProjects] = (0,
|
|
21233
|
-
const [loading, setLoading] = (0,
|
|
21234
|
-
const [error, setError] = (0,
|
|
21235
|
-
const client =
|
|
21248
|
+
const [workspaces, setWorkspaces] = (0, import_react73.useState)([]);
|
|
21249
|
+
const [projects, setProjects] = (0, import_react73.useState)([]);
|
|
21250
|
+
const [loading, setLoading] = (0, import_react73.useState)(false);
|
|
21251
|
+
const [error, setError] = (0, import_react73.useState)(null);
|
|
21252
|
+
const client = import_react73.default.useMemo(() => {
|
|
21236
21253
|
const authApiKey = isAuthenticated ? sessionStorage.getItem("lattice_token") || config.apiKey || "" : config.apiKey || "";
|
|
21237
21254
|
return new import_client_sdk6.WorkspaceClient({
|
|
21238
21255
|
baseURL: config.baseURL,
|
|
@@ -21241,22 +21258,22 @@ var WorkspaceContextProvider = ({
|
|
|
21241
21258
|
transport: "sse"
|
|
21242
21259
|
}, tenantId);
|
|
21243
21260
|
}, [config.baseURL, config.apiKey, tenantId, isAuthenticated]);
|
|
21244
|
-
const resetSelectedWorkspace = (0,
|
|
21261
|
+
const resetSelectedWorkspace = (0, import_react73.useCallback)(() => {
|
|
21245
21262
|
setProjects([]);
|
|
21246
21263
|
setWorkspaceId(null);
|
|
21247
21264
|
sessionStorage.removeItem("workspaceId");
|
|
21248
21265
|
setProjectId(null);
|
|
21249
21266
|
sessionStorage.removeItem("projectId");
|
|
21250
21267
|
}, [setProjects, setWorkspaceId, setProjectId]);
|
|
21251
|
-
const resetWS = (0,
|
|
21268
|
+
const resetWS = (0, import_react73.useCallback)(() => {
|
|
21252
21269
|
setWorkspaces([]);
|
|
21253
21270
|
resetSelectedWorkspace();
|
|
21254
21271
|
}, [resetSelectedWorkspace, setWorkspaces]);
|
|
21255
|
-
(0,
|
|
21272
|
+
(0, import_react73.useEffect)(() => {
|
|
21256
21273
|
resetWS();
|
|
21257
21274
|
refreshWorkspaces();
|
|
21258
21275
|
}, [tenantId]);
|
|
21259
|
-
const refreshWorkspaces = (0,
|
|
21276
|
+
const refreshWorkspaces = (0, import_react73.useCallback)(async () => {
|
|
21260
21277
|
setLoading(true);
|
|
21261
21278
|
setError(null);
|
|
21262
21279
|
try {
|
|
@@ -21268,7 +21285,7 @@ var WorkspaceContextProvider = ({
|
|
|
21268
21285
|
setLoading(false);
|
|
21269
21286
|
}
|
|
21270
21287
|
}, [client]);
|
|
21271
|
-
const refreshProjects = (0,
|
|
21288
|
+
const refreshProjects = (0, import_react73.useCallback)(async (wsId) => {
|
|
21272
21289
|
const targetWorkspaceId = wsId || workspaceId;
|
|
21273
21290
|
if (!targetWorkspaceId) {
|
|
21274
21291
|
setProjects([]);
|
|
@@ -21285,28 +21302,28 @@ var WorkspaceContextProvider = ({
|
|
|
21285
21302
|
setLoading(false);
|
|
21286
21303
|
}
|
|
21287
21304
|
}, [client, workspaceId]);
|
|
21288
|
-
(0,
|
|
21305
|
+
(0, import_react73.useEffect)(() => {
|
|
21289
21306
|
if (workspaceId && typeof window !== "undefined") {
|
|
21290
21307
|
sessionStorage.setItem("workspaceId", workspaceId);
|
|
21291
21308
|
}
|
|
21292
21309
|
}, [workspaceId]);
|
|
21293
|
-
(0,
|
|
21310
|
+
(0, import_react73.useEffect)(() => {
|
|
21294
21311
|
if (projectId && typeof window !== "undefined") {
|
|
21295
21312
|
sessionStorage.setItem("projectId", projectId);
|
|
21296
21313
|
}
|
|
21297
21314
|
}, [projectId]);
|
|
21298
|
-
(0,
|
|
21315
|
+
(0, import_react73.useEffect)(() => {
|
|
21299
21316
|
refreshWorkspaces().catch((err) => {
|
|
21300
21317
|
console.warn("Failed to load workspaces:", err);
|
|
21301
21318
|
});
|
|
21302
21319
|
}, [refreshWorkspaces]);
|
|
21303
|
-
(0,
|
|
21320
|
+
(0, import_react73.useEffect)(() => {
|
|
21304
21321
|
if (workspaces.length > 0 && !workspaceId) {
|
|
21305
21322
|
const firstWorkspace = workspaces[0];
|
|
21306
21323
|
setWorkspaceId(firstWorkspace.id);
|
|
21307
21324
|
}
|
|
21308
21325
|
}, [workspaces, workspaceId]);
|
|
21309
|
-
(0,
|
|
21326
|
+
(0, import_react73.useEffect)(() => {
|
|
21310
21327
|
if (workspaceId) {
|
|
21311
21328
|
refreshProjects(workspaceId);
|
|
21312
21329
|
} else {
|
|
@@ -21314,7 +21331,7 @@ var WorkspaceContextProvider = ({
|
|
|
21314
21331
|
}
|
|
21315
21332
|
setProjectId(null);
|
|
21316
21333
|
}, [workspaceId, refreshProjects]);
|
|
21317
|
-
const createWorkspace = (0,
|
|
21334
|
+
const createWorkspace = (0, import_react73.useCallback)(async (data) => {
|
|
21318
21335
|
setLoading(true);
|
|
21319
21336
|
setError(null);
|
|
21320
21337
|
try {
|
|
@@ -21329,7 +21346,7 @@ var WorkspaceContextProvider = ({
|
|
|
21329
21346
|
setLoading(false);
|
|
21330
21347
|
}
|
|
21331
21348
|
}, [client, refreshWorkspaces]);
|
|
21332
|
-
const updateWorkspace = (0,
|
|
21349
|
+
const updateWorkspace = (0, import_react73.useCallback)(async (id, updates) => {
|
|
21333
21350
|
setLoading(true);
|
|
21334
21351
|
setError(null);
|
|
21335
21352
|
try {
|
|
@@ -21344,7 +21361,7 @@ var WorkspaceContextProvider = ({
|
|
|
21344
21361
|
setLoading(false);
|
|
21345
21362
|
}
|
|
21346
21363
|
}, [client, refreshWorkspaces]);
|
|
21347
|
-
const deleteWorkspace = (0,
|
|
21364
|
+
const deleteWorkspace = (0, import_react73.useCallback)(async (id) => {
|
|
21348
21365
|
setLoading(true);
|
|
21349
21366
|
setError(null);
|
|
21350
21367
|
try {
|
|
@@ -21361,7 +21378,7 @@ var WorkspaceContextProvider = ({
|
|
|
21361
21378
|
setLoading(false);
|
|
21362
21379
|
}
|
|
21363
21380
|
}, [client, workspaceId, refreshWorkspaces]);
|
|
21364
|
-
const createProject = (0,
|
|
21381
|
+
const createProject = (0, import_react73.useCallback)(async (wsId, data) => {
|
|
21365
21382
|
setLoading(true);
|
|
21366
21383
|
setError(null);
|
|
21367
21384
|
try {
|
|
@@ -21376,7 +21393,7 @@ var WorkspaceContextProvider = ({
|
|
|
21376
21393
|
setLoading(false);
|
|
21377
21394
|
}
|
|
21378
21395
|
}, [client, refreshProjects]);
|
|
21379
|
-
const updateProject = (0,
|
|
21396
|
+
const updateProject = (0, import_react73.useCallback)(async (wsId, id, updates) => {
|
|
21380
21397
|
setLoading(true);
|
|
21381
21398
|
setError(null);
|
|
21382
21399
|
try {
|
|
@@ -21391,7 +21408,7 @@ var WorkspaceContextProvider = ({
|
|
|
21391
21408
|
setLoading(false);
|
|
21392
21409
|
}
|
|
21393
21410
|
}, [client, refreshProjects]);
|
|
21394
|
-
const deleteProject = (0,
|
|
21411
|
+
const deleteProject = (0, import_react73.useCallback)(async (wsId, id) => {
|
|
21395
21412
|
setLoading(true);
|
|
21396
21413
|
setError(null);
|
|
21397
21414
|
try {
|
|
@@ -21408,7 +21425,7 @@ var WorkspaceContextProvider = ({
|
|
|
21408
21425
|
setLoading(false);
|
|
21409
21426
|
}
|
|
21410
21427
|
}, [client, projectId, refreshProjects]);
|
|
21411
|
-
const listPath = (0,
|
|
21428
|
+
const listPath = (0, import_react73.useCallback)(
|
|
21412
21429
|
async (path = "/", assistantId) => {
|
|
21413
21430
|
if (!workspaceId || !projectId) {
|
|
21414
21431
|
return [];
|
|
@@ -21427,7 +21444,7 @@ var WorkspaceContextProvider = ({
|
|
|
21427
21444
|
},
|
|
21428
21445
|
[client, workspaceId, projectId]
|
|
21429
21446
|
);
|
|
21430
|
-
const listPathByFolder = (0,
|
|
21447
|
+
const listPathByFolder = (0, import_react73.useCallback)(
|
|
21431
21448
|
async (folder, assistantId) => {
|
|
21432
21449
|
let normalizedPath = folder;
|
|
21433
21450
|
if (normalizedPath.startsWith("~/")) {
|
|
@@ -21440,7 +21457,7 @@ var WorkspaceContextProvider = ({
|
|
|
21440
21457
|
},
|
|
21441
21458
|
[listPath]
|
|
21442
21459
|
);
|
|
21443
|
-
const uploadFile = (0,
|
|
21460
|
+
const uploadFile = (0, import_react73.useCallback)(
|
|
21444
21461
|
async (path, file, assistantId) => {
|
|
21445
21462
|
if (!workspaceId || !projectId) {
|
|
21446
21463
|
throw new Error("Workspace and project must be selected before uploading files");
|
|
@@ -21460,7 +21477,7 @@ var WorkspaceContextProvider = ({
|
|
|
21460
21477
|
},
|
|
21461
21478
|
[client, workspaceId, projectId]
|
|
21462
21479
|
);
|
|
21463
|
-
const uploadFileToFolder = (0,
|
|
21480
|
+
const uploadFileToFolder = (0, import_react73.useCallback)(
|
|
21464
21481
|
async (folder, file, assistantId) => {
|
|
21465
21482
|
let normalizedFolder = folder;
|
|
21466
21483
|
if (normalizedFolder.startsWith("~/")) {
|
|
@@ -21470,7 +21487,7 @@ var WorkspaceContextProvider = ({
|
|
|
21470
21487
|
},
|
|
21471
21488
|
[uploadFile]
|
|
21472
21489
|
);
|
|
21473
|
-
const getFileViewUrl = (0,
|
|
21490
|
+
const getFileViewUrl = (0, import_react73.useCallback)(
|
|
21474
21491
|
(filePath, assistantId) => {
|
|
21475
21492
|
if (!workspaceId || !projectId) {
|
|
21476
21493
|
return "";
|
|
@@ -21522,17 +21539,17 @@ var WorkspaceContextProvider = ({
|
|
|
21522
21539
|
};
|
|
21523
21540
|
|
|
21524
21541
|
// src/components/Chat/DatabasePicker.tsx
|
|
21525
|
-
var
|
|
21542
|
+
var import_react74 = require("react");
|
|
21526
21543
|
var import_antd64 = require("antd");
|
|
21527
21544
|
var import_lucide_react15 = require("lucide-react");
|
|
21528
21545
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
21529
21546
|
var DatabasePicker = ({ senderRef, iconOnly }) => {
|
|
21530
|
-
const [modalOpen, setModalOpen] = (0,
|
|
21531
|
-
const [databases, setDatabases] = (0,
|
|
21532
|
-
const [loading, setLoading] = (0,
|
|
21533
|
-
const [selectedDatabases, setSelectedDatabases] = (0,
|
|
21547
|
+
const [modalOpen, setModalOpen] = (0, import_react74.useState)(false);
|
|
21548
|
+
const [databases, setDatabases] = (0, import_react74.useState)([]);
|
|
21549
|
+
const [loading, setLoading] = (0, import_react74.useState)(false);
|
|
21550
|
+
const [selectedDatabases, setSelectedDatabases] = (0, import_react74.useState)([]);
|
|
21534
21551
|
const { get } = useApi();
|
|
21535
|
-
const fetchedRef = (0,
|
|
21552
|
+
const fetchedRef = (0, import_react74.useRef)(false);
|
|
21536
21553
|
const loadDatabases = async () => {
|
|
21537
21554
|
setLoading(true);
|
|
21538
21555
|
try {
|
|
@@ -21672,17 +21689,17 @@ var DatabasePicker = ({ senderRef, iconOnly }) => {
|
|
|
21672
21689
|
};
|
|
21673
21690
|
|
|
21674
21691
|
// src/components/Chat/SkillPicker.tsx
|
|
21675
|
-
var
|
|
21692
|
+
var import_react75 = require("react");
|
|
21676
21693
|
var import_antd65 = require("antd");
|
|
21677
21694
|
var import_lucide_react16 = require("lucide-react");
|
|
21678
21695
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
21679
21696
|
var SkillPicker = ({ senderRef, iconOnly }) => {
|
|
21680
|
-
const [modalOpen, setModalOpen] = (0,
|
|
21681
|
-
const [skills, setSkills] = (0,
|
|
21682
|
-
const [loading, setLoading] = (0,
|
|
21683
|
-
const [selectedSkills, setSelectedSkills] = (0,
|
|
21697
|
+
const [modalOpen, setModalOpen] = (0, import_react75.useState)(false);
|
|
21698
|
+
const [skills, setSkills] = (0, import_react75.useState)([]);
|
|
21699
|
+
const [loading, setLoading] = (0, import_react75.useState)(false);
|
|
21700
|
+
const [selectedSkills, setSelectedSkills] = (0, import_react75.useState)([]);
|
|
21684
21701
|
const { get } = useApi();
|
|
21685
|
-
const fetchedRef = (0,
|
|
21702
|
+
const fetchedRef = (0, import_react75.useRef)(false);
|
|
21686
21703
|
const loadSkills = async () => {
|
|
21687
21704
|
setLoading(true);
|
|
21688
21705
|
try {
|
|
@@ -21822,16 +21839,16 @@ var SkillPicker = ({ senderRef, iconOnly }) => {
|
|
|
21822
21839
|
};
|
|
21823
21840
|
|
|
21824
21841
|
// src/components/Chat/AgentPicker.tsx
|
|
21825
|
-
var
|
|
21842
|
+
var import_react76 = require("react");
|
|
21826
21843
|
var import_antd66 = require("antd");
|
|
21827
21844
|
var import_lucide_react17 = require("lucide-react");
|
|
21828
21845
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
21829
21846
|
var AgentPicker = ({ senderRef, iconOnly }) => {
|
|
21830
|
-
const [modalOpen, setModalOpen] = (0,
|
|
21831
|
-
const [loading, setLoading] = (0,
|
|
21832
|
-
const [selectedAgent, setSelectedAgent] = (0,
|
|
21847
|
+
const [modalOpen, setModalOpen] = (0, import_react76.useState)(false);
|
|
21848
|
+
const [loading, setLoading] = (0, import_react76.useState)(false);
|
|
21849
|
+
const [selectedAgent, setSelectedAgent] = (0, import_react76.useState)(null);
|
|
21833
21850
|
const { assistants, currentAssistant, selectAssistant } = useAssistantContext();
|
|
21834
|
-
const fetchedRef = (0,
|
|
21851
|
+
const fetchedRef = (0, import_react76.useRef)(false);
|
|
21835
21852
|
const handleOpenModal = () => {
|
|
21836
21853
|
setSelectedAgent(currentAssistant?.id || null);
|
|
21837
21854
|
setModalOpen(true);
|
|
@@ -21938,7 +21955,7 @@ var AgentPicker = ({ senderRef, iconOnly }) => {
|
|
|
21938
21955
|
};
|
|
21939
21956
|
|
|
21940
21957
|
// src/components/Chat/MetricsDataSourcePicker.tsx
|
|
21941
|
-
var
|
|
21958
|
+
var import_react77 = require("react");
|
|
21942
21959
|
var import_antd67 = require("antd");
|
|
21943
21960
|
var import_lucide_react18 = require("lucide-react");
|
|
21944
21961
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
@@ -21947,13 +21964,13 @@ var MetricsDataSourcePicker = ({
|
|
|
21947
21964
|
senderRef,
|
|
21948
21965
|
iconOnly
|
|
21949
21966
|
}) => {
|
|
21950
|
-
const [modalOpen, setModalOpen] = (0,
|
|
21951
|
-
const [loading, setLoading] = (0,
|
|
21952
|
-
const [dataSources, setDataSources] = (0,
|
|
21967
|
+
const [modalOpen, setModalOpen] = (0, import_react77.useState)(false);
|
|
21968
|
+
const [loading, setLoading] = (0, import_react77.useState)(false);
|
|
21969
|
+
const [dataSources, setDataSources] = (0, import_react77.useState)([]);
|
|
21953
21970
|
const { config } = useLatticeChatShellContext();
|
|
21954
21971
|
const { customRunConfig, updateCustomRunConfig } = useConversationContext();
|
|
21955
21972
|
const { get } = useApi();
|
|
21956
|
-
const hasInitializedRef = (0,
|
|
21973
|
+
const hasInitializedRef = (0, import_react77.useRef)(false);
|
|
21957
21974
|
const loadDataSources = async () => {
|
|
21958
21975
|
setLoading(true);
|
|
21959
21976
|
try {
|
|
@@ -22027,7 +22044,7 @@ var MetricsDataSourcePicker = ({
|
|
|
22027
22044
|
console.error("Failed to save datasource to sessionStorage:", error);
|
|
22028
22045
|
}
|
|
22029
22046
|
};
|
|
22030
|
-
(0,
|
|
22047
|
+
(0, import_react77.useEffect)(() => {
|
|
22031
22048
|
if (hasInitializedRef.current) return;
|
|
22032
22049
|
hasInitializedRef.current = true;
|
|
22033
22050
|
loadDataSources().then(() => {
|
|
@@ -22278,7 +22295,7 @@ var MetricsDataSourcePicker = ({
|
|
|
22278
22295
|
};
|
|
22279
22296
|
|
|
22280
22297
|
// src/components/Chat/ModelSelector.tsx
|
|
22281
|
-
var
|
|
22298
|
+
var import_react78 = require("react");
|
|
22282
22299
|
var import_antd68 = require("antd");
|
|
22283
22300
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
22284
22301
|
var ModelSelector = ({
|
|
@@ -22287,22 +22304,22 @@ var ModelSelector = ({
|
|
|
22287
22304
|
defaultModelKey = "default",
|
|
22288
22305
|
style
|
|
22289
22306
|
}) => {
|
|
22290
|
-
const [models, setModels] = (0,
|
|
22291
|
-
const [isLoading, setIsLoading] = (0,
|
|
22292
|
-
const [internalValue, setInternalValue] = (0,
|
|
22293
|
-
const [dropdownOpen, setDropdownOpen] = (0,
|
|
22294
|
-
const [isHovered, setIsHovered] = (0,
|
|
22295
|
-
const hasFetchedRef = (0,
|
|
22296
|
-
const hasSetDefaultRef = (0,
|
|
22307
|
+
const [models, setModels] = (0, import_react78.useState)([]);
|
|
22308
|
+
const [isLoading, setIsLoading] = (0, import_react78.useState)(false);
|
|
22309
|
+
const [internalValue, setInternalValue] = (0, import_react78.useState)(null);
|
|
22310
|
+
const [dropdownOpen, setDropdownOpen] = (0, import_react78.useState)(false);
|
|
22311
|
+
const [isHovered, setIsHovered] = (0, import_react78.useState)(false);
|
|
22312
|
+
const hasFetchedRef = (0, import_react78.useRef)(false);
|
|
22313
|
+
const hasSetDefaultRef = (0, import_react78.useRef)(false);
|
|
22297
22314
|
const { get } = useApi();
|
|
22298
22315
|
const selectedModelConfig = value !== void 0 ? value : internalValue;
|
|
22299
|
-
const setSelectedModelConfig = (0,
|
|
22316
|
+
const setSelectedModelConfig = (0, import_react78.useCallback)((config) => {
|
|
22300
22317
|
if (value === void 0) {
|
|
22301
22318
|
setInternalValue(config);
|
|
22302
22319
|
}
|
|
22303
22320
|
onChange?.(config);
|
|
22304
22321
|
}, [value, onChange]);
|
|
22305
|
-
const fetchModels = (0,
|
|
22322
|
+
const fetchModels = (0, import_react78.useCallback)(async () => {
|
|
22306
22323
|
if (hasFetchedRef.current) return;
|
|
22307
22324
|
hasFetchedRef.current = true;
|
|
22308
22325
|
setIsLoading(true);
|
|
@@ -22323,7 +22340,7 @@ var ModelSelector = ({
|
|
|
22323
22340
|
setIsLoading(false);
|
|
22324
22341
|
}
|
|
22325
22342
|
}, [get, defaultModelKey]);
|
|
22326
|
-
(0,
|
|
22343
|
+
(0, import_react78.useEffect)(() => {
|
|
22327
22344
|
fetchModels();
|
|
22328
22345
|
}, [fetchModels]);
|
|
22329
22346
|
const handleChange = (modelKey) => {
|
|
@@ -22370,7 +22387,7 @@ var ModelSelector = ({
|
|
|
22370
22387
|
var import_icons35 = require("@ant-design/icons");
|
|
22371
22388
|
var import_x4 = require("@ant-design/x");
|
|
22372
22389
|
var import_antd69 = require("antd");
|
|
22373
|
-
var
|
|
22390
|
+
var import_react79 = require("react");
|
|
22374
22391
|
var import_lucide_react19 = require("lucide-react");
|
|
22375
22392
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
22376
22393
|
var categoryConfig = {
|
|
@@ -22455,12 +22472,12 @@ var SkillCategoryPrompts = ({
|
|
|
22455
22472
|
senderRef,
|
|
22456
22473
|
visible = true
|
|
22457
22474
|
}) => {
|
|
22458
|
-
const [skills, setSkills] = (0,
|
|
22459
|
-
const [loading, setLoading] = (0,
|
|
22460
|
-
const [showAll, setShowAll] = (0,
|
|
22475
|
+
const [skills, setSkills] = (0, import_react79.useState)([]);
|
|
22476
|
+
const [loading, setLoading] = (0, import_react79.useState)(false);
|
|
22477
|
+
const [showAll, setShowAll] = (0, import_react79.useState)(false);
|
|
22461
22478
|
const { get } = useApi();
|
|
22462
22479
|
const MAX_SIMPLE_ITEMS = 10;
|
|
22463
|
-
(0,
|
|
22480
|
+
(0, import_react79.useEffect)(() => {
|
|
22464
22481
|
const loadSkills = async () => {
|
|
22465
22482
|
setLoading(true);
|
|
22466
22483
|
try {
|
|
@@ -22478,7 +22495,7 @@ var SkillCategoryPrompts = ({
|
|
|
22478
22495
|
loadSkills();
|
|
22479
22496
|
}
|
|
22480
22497
|
}, [get, visible]);
|
|
22481
|
-
const groupedSkills = (0,
|
|
22498
|
+
const groupedSkills = (0, import_react79.useMemo)(() => {
|
|
22482
22499
|
const groups = {};
|
|
22483
22500
|
skills.forEach((skill) => {
|
|
22484
22501
|
const category = skill.metadata?.category || "global";
|
|
@@ -22633,7 +22650,7 @@ var SkillCategoryPrompts_default = SkillCategoryPrompts;
|
|
|
22633
22650
|
var import_icons36 = require("@ant-design/icons");
|
|
22634
22651
|
var import_x5 = require("@ant-design/x");
|
|
22635
22652
|
var import_antd70 = require("antd");
|
|
22636
|
-
var
|
|
22653
|
+
var import_react80 = require("react");
|
|
22637
22654
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
22638
22655
|
var defaultCategoryIcons = {
|
|
22639
22656
|
financial: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_icons36.DollarOutlined, {}),
|
|
@@ -22852,9 +22869,9 @@ var BusinessAnalysisPrompts = ({
|
|
|
22852
22869
|
simpleModeTitle = "Quick Analysis",
|
|
22853
22870
|
expandModeTitle = "Analysis Categories"
|
|
22854
22871
|
}) => {
|
|
22855
|
-
const [showAll, setShowAll] = (0,
|
|
22872
|
+
const [showAll, setShowAll] = (0, import_react80.useState)(false);
|
|
22856
22873
|
const { config } = useLatticeChatShellContext();
|
|
22857
|
-
const analysisData = (0,
|
|
22874
|
+
const analysisData = (0, import_react80.useMemo)(() => {
|
|
22858
22875
|
const customData = config.quickPromptsData;
|
|
22859
22876
|
if (customData && Array.isArray(customData) && customData.length > 0) {
|
|
22860
22877
|
return customData.map((category) => ({
|
|
@@ -22874,7 +22891,7 @@ var BusinessAnalysisPrompts = ({
|
|
|
22874
22891
|
color: defaultCategoryColors[category.key] || "#8C8C8C"
|
|
22875
22892
|
}));
|
|
22876
22893
|
}, [config.quickPromptsData]);
|
|
22877
|
-
const allItems = (0,
|
|
22894
|
+
const allItems = (0, import_react80.useMemo)(() => {
|
|
22878
22895
|
const items = [];
|
|
22879
22896
|
analysisData.forEach((category) => {
|
|
22880
22897
|
category.items.forEach((item) => {
|
|
@@ -23025,12 +23042,12 @@ var Chating = ({
|
|
|
23025
23042
|
initialMessage,
|
|
23026
23043
|
onInitialMessageSent
|
|
23027
23044
|
}) => {
|
|
23028
|
-
const [content, setContent] = (0,
|
|
23029
|
-
const [attachedFiles, setAttachedFiles] = (0,
|
|
23045
|
+
const [content, setContent] = (0, import_react81.useState)("");
|
|
23046
|
+
const [attachedFiles, setAttachedFiles] = (0, import_react81.useState)([]);
|
|
23030
23047
|
const { styles } = useStyle();
|
|
23031
|
-
const [headerOpen, setHeaderOpen] = (0,
|
|
23032
|
-
const attachmentsRef = (0,
|
|
23033
|
-
const senderRef =
|
|
23048
|
+
const [headerOpen, setHeaderOpen] = (0, import_react81.useState)(false);
|
|
23049
|
+
const attachmentsRef = (0, import_react81.useRef)(null);
|
|
23050
|
+
const senderRef = import_react81.default.useRef(null);
|
|
23034
23051
|
const {
|
|
23035
23052
|
assistantId,
|
|
23036
23053
|
threadId,
|
|
@@ -23053,8 +23070,8 @@ var Chating = ({
|
|
|
23053
23070
|
const hasPendingMessages = pendingMessages?.length > 0;
|
|
23054
23071
|
const isInputDisabled = interrupts && interrupts.length > 0;
|
|
23055
23072
|
const typingFrames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
23056
|
-
const [typingFrameIndex, setTypingFrameIndex] = (0,
|
|
23057
|
-
(0,
|
|
23073
|
+
const [typingFrameIndex, setTypingFrameIndex] = (0, import_react81.useState)(0);
|
|
23074
|
+
(0, import_react81.useEffect)(() => {
|
|
23058
23075
|
if (!isStreaming) return;
|
|
23059
23076
|
const interval = setInterval(() => {
|
|
23060
23077
|
setTypingFrameIndex((prev) => (prev + 1) % typingFrames.length);
|
|
@@ -23062,16 +23079,16 @@ var Chating = ({
|
|
|
23062
23079
|
return () => clearInterval(interval);
|
|
23063
23080
|
}, [isStreaming]);
|
|
23064
23081
|
const conversationContext = useConversationContext();
|
|
23065
|
-
const systemContextSentRef = (0,
|
|
23066
|
-
const initialMessageSentRef = (0,
|
|
23067
|
-
const prevLoadingRef = (0,
|
|
23068
|
-
(0,
|
|
23082
|
+
const systemContextSentRef = (0, import_react81.useRef)(false);
|
|
23083
|
+
const initialMessageSentRef = (0, import_react81.useRef)(false);
|
|
23084
|
+
const prevLoadingRef = (0, import_react81.useRef)(false);
|
|
23085
|
+
(0, import_react81.useEffect)(() => {
|
|
23069
23086
|
systemContextSentRef.current = false;
|
|
23070
23087
|
}, [threadId]);
|
|
23071
|
-
(0,
|
|
23088
|
+
(0, import_react81.useEffect)(() => {
|
|
23072
23089
|
initialMessageSentRef.current = false;
|
|
23073
23090
|
}, [threadId]);
|
|
23074
|
-
(0,
|
|
23091
|
+
(0, import_react81.useEffect)(() => {
|
|
23075
23092
|
const wasLoading = prevLoadingRef.current;
|
|
23076
23093
|
prevLoadingRef.current = isLoading;
|
|
23077
23094
|
if (wasLoading && !isLoading && initialMessage && threadId && !initialMessageSentRef.current) {
|
|
@@ -23083,16 +23100,16 @@ var Chating = ({
|
|
|
23083
23100
|
onInitialMessageSent?.();
|
|
23084
23101
|
}
|
|
23085
23102
|
}, [isLoading, initialMessage, threadId, sendMessage, onInitialMessageSent]);
|
|
23086
|
-
const [modelConfig, setModelConfig] = (0,
|
|
23087
|
-
const handleModelChange = (0,
|
|
23103
|
+
const [modelConfig, setModelConfig] = (0, import_react81.useState)(null);
|
|
23104
|
+
const handleModelChange = (0, import_react81.useCallback)((config2) => {
|
|
23088
23105
|
setModelConfig(config2);
|
|
23089
23106
|
if (config2) {
|
|
23090
23107
|
updateCustomRunConfig({ modelConfig: config2 });
|
|
23091
23108
|
}
|
|
23092
23109
|
}, [updateCustomRunConfig]);
|
|
23093
|
-
const [isEmptyState, setIsEmptyState] = (0,
|
|
23094
|
-
const [isTransitioning, setIsTransitioning] = (0,
|
|
23095
|
-
(0,
|
|
23110
|
+
const [isEmptyState, setIsEmptyState] = (0, import_react81.useState)(showEmptyState && messages.length === 0 && !pendingMessages?.length);
|
|
23111
|
+
const [isTransitioning, setIsTransitioning] = (0, import_react81.useState)(false);
|
|
23112
|
+
(0, import_react81.useEffect)(() => {
|
|
23096
23113
|
if (!showEmptyState) {
|
|
23097
23114
|
setIsEmptyState(false);
|
|
23098
23115
|
return;
|
|
@@ -23112,14 +23129,14 @@ var Chating = ({
|
|
|
23112
23129
|
const { baseURL } = config;
|
|
23113
23130
|
const user = useAuthOptional()?.user;
|
|
23114
23131
|
const displayUserName = user?.name || user?.email?.split("@")[0] || "there";
|
|
23115
|
-
const workspaceContext = (0,
|
|
23132
|
+
const workspaceContext = (0, import_react81.useContext)(WorkspaceContext);
|
|
23116
23133
|
const listPath = workspaceContext?.listPath ?? (async () => []);
|
|
23117
23134
|
const listPathByFolder = workspaceContext?.listPathByFolder ?? (async () => []);
|
|
23118
23135
|
const workspaceId = workspaceContext?.workspaceId ?? null;
|
|
23119
23136
|
const projectId = workspaceContext?.projectId ?? null;
|
|
23120
|
-
const [workspaceFiles, setWorkspaceFiles] = (0,
|
|
23121
|
-
const [suggestionsLoading, setSuggestionsLoading] = (0,
|
|
23122
|
-
const [suggestionsOpen, setSuggestionsOpen] = (0,
|
|
23137
|
+
const [workspaceFiles, setWorkspaceFiles] = (0, import_react81.useState)([]);
|
|
23138
|
+
const [suggestionsLoading, setSuggestionsLoading] = (0, import_react81.useState)(false);
|
|
23139
|
+
const [suggestionsOpen, setSuggestionsOpen] = (0, import_react81.useState)(false);
|
|
23123
23140
|
const getFileIcon3 = (filename) => {
|
|
23124
23141
|
const ext = filename.split(".").pop()?.toLowerCase();
|
|
23125
23142
|
const iconStyle = { fontSize: 16 };
|
|
@@ -23179,7 +23196,7 @@ var Chating = ({
|
|
|
23179
23196
|
setSuggestionsLoading(false);
|
|
23180
23197
|
}
|
|
23181
23198
|
};
|
|
23182
|
-
(0,
|
|
23199
|
+
(0, import_react81.useEffect)(() => {
|
|
23183
23200
|
regsiterElement("action_show_attachments_uploader", {
|
|
23184
23201
|
card_view: () => null,
|
|
23185
23202
|
action: (data) => {
|
|
@@ -23377,8 +23394,8 @@ ${nextContent}`;
|
|
|
23377
23394
|
...showRefreshButton ? [refreshButton] : [],
|
|
23378
23395
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ThreadManagementButtons, {}, "thread-buttons")
|
|
23379
23396
|
];
|
|
23380
|
-
const [skills, setSkills] = (0,
|
|
23381
|
-
const [skillsLoading, setSkillsLoading] = (0,
|
|
23397
|
+
const [skills, setSkills] = (0, import_react81.useState)([]);
|
|
23398
|
+
const [skillsLoading, setSkillsLoading] = (0, import_react81.useState)(false);
|
|
23382
23399
|
const { get: apiGet } = useApi();
|
|
23383
23400
|
const loadSkills = async () => {
|
|
23384
23401
|
if (skills.length > 0) return;
|
|
@@ -23402,7 +23419,7 @@ ${nextContent}`;
|
|
|
23402
23419
|
return isEmpty ? "Type / to see available skills, or @ to reference files" : void 0;
|
|
23403
23420
|
};
|
|
23404
23421
|
const renderSender = (isEmpty) => {
|
|
23405
|
-
const [suggestionMode, setSuggestionMode] = (0,
|
|
23422
|
+
const [suggestionMode, setSuggestionMode] = (0, import_react81.useState)(null);
|
|
23406
23423
|
const suggestionItems = suggestionMode === "skills" ? skills.map((skill) => ({
|
|
23407
23424
|
value: skill.name,
|
|
23408
23425
|
icon: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react20.BrainCircuit, { size: 14, style: { color: "#722ed1" } }),
|
|
@@ -23729,7 +23746,7 @@ var InternetSearchCard = ({
|
|
|
23729
23746
|
const toolCallData = data;
|
|
23730
23747
|
const { query } = toolCallData?.args || {};
|
|
23731
23748
|
const dataSource = JSON.parse(toolCallData.response || "[]");
|
|
23732
|
-
const
|
|
23749
|
+
const openSideApp = useSideAppOpener();
|
|
23733
23750
|
if (!toolCallData) {
|
|
23734
23751
|
return null;
|
|
23735
23752
|
}
|
|
@@ -23779,7 +23796,7 @@ var InternetSearchCard = ({
|
|
|
23779
23796
|
};
|
|
23780
23797
|
|
|
23781
23798
|
// src/components/GenUI/elements/schedule_viewer.tsx
|
|
23782
|
-
var
|
|
23799
|
+
var import_react82 = require("react");
|
|
23783
23800
|
var import_antd74 = require("antd");
|
|
23784
23801
|
var import_icons39 = require("@ant-design/icons");
|
|
23785
23802
|
var import_antd_style24 = require("antd-style");
|
|
@@ -23918,10 +23935,10 @@ var ScheduleViewer = ({ data }) => {
|
|
|
23918
23935
|
const { styles } = useStyles8();
|
|
23919
23936
|
const { threadId, assistantId, tasks: initialTasks, onRefresh } = data ?? {};
|
|
23920
23937
|
const client = useClient(assistantId || "");
|
|
23921
|
-
const [tasks, setTasks] = (0,
|
|
23922
|
-
const [loading, setLoading] = (0,
|
|
23923
|
-
const [actionLoading, setActionLoading] = (0,
|
|
23924
|
-
const handleRefresh = (0,
|
|
23938
|
+
const [tasks, setTasks] = (0, import_react82.useState)(initialTasks || []);
|
|
23939
|
+
const [loading, setLoading] = (0, import_react82.useState)(false);
|
|
23940
|
+
const [actionLoading, setActionLoading] = (0, import_react82.useState)(null);
|
|
23941
|
+
const handleRefresh = (0, import_react82.useCallback)(async () => {
|
|
23925
23942
|
if (!threadId) return;
|
|
23926
23943
|
setLoading(true);
|
|
23927
23944
|
try {
|
|
@@ -23935,7 +23952,7 @@ var ScheduleViewer = ({ data }) => {
|
|
|
23935
23952
|
setLoading(false);
|
|
23936
23953
|
}
|
|
23937
23954
|
}, [client, threadId, onRefresh]);
|
|
23938
|
-
const handleCancel = (0,
|
|
23955
|
+
const handleCancel = (0, import_react82.useCallback)(
|
|
23939
23956
|
async (taskId) => {
|
|
23940
23957
|
setActionLoading(taskId);
|
|
23941
23958
|
try {
|
|
@@ -23951,7 +23968,7 @@ var ScheduleViewer = ({ data }) => {
|
|
|
23951
23968
|
},
|
|
23952
23969
|
[client, handleRefresh]
|
|
23953
23970
|
);
|
|
23954
|
-
const handlePause = (0,
|
|
23971
|
+
const handlePause = (0, import_react82.useCallback)(
|
|
23955
23972
|
async (taskId) => {
|
|
23956
23973
|
setActionLoading(taskId);
|
|
23957
23974
|
try {
|
|
@@ -23967,7 +23984,7 @@ var ScheduleViewer = ({ data }) => {
|
|
|
23967
23984
|
},
|
|
23968
23985
|
[client, handleRefresh]
|
|
23969
23986
|
);
|
|
23970
|
-
const handleResume = (0,
|
|
23987
|
+
const handleResume = (0, import_react82.useCallback)(
|
|
23971
23988
|
async (taskId) => {
|
|
23972
23989
|
setActionLoading(taskId);
|
|
23973
23990
|
try {
|
|
@@ -23983,12 +24000,12 @@ var ScheduleViewer = ({ data }) => {
|
|
|
23983
24000
|
},
|
|
23984
24001
|
[client, handleRefresh]
|
|
23985
24002
|
);
|
|
23986
|
-
(0,
|
|
24003
|
+
(0, import_react82.useEffect)(() => {
|
|
23987
24004
|
if (threadId && (!initialTasks || initialTasks.length === 0)) {
|
|
23988
24005
|
handleRefresh();
|
|
23989
24006
|
}
|
|
23990
24007
|
}, [threadId]);
|
|
23991
|
-
(0,
|
|
24008
|
+
(0, import_react82.useEffect)(() => {
|
|
23992
24009
|
if (initialTasks) {
|
|
23993
24010
|
setTasks(initialTasks);
|
|
23994
24011
|
}
|
|
@@ -24183,7 +24200,7 @@ var BrowserViewer = ({
|
|
|
24183
24200
|
}
|
|
24184
24201
|
)
|
|
24185
24202
|
] });
|
|
24186
|
-
const
|
|
24203
|
+
const openSideApp = useSideAppOpener();
|
|
24187
24204
|
if (!toolCallData) {
|
|
24188
24205
|
return null;
|
|
24189
24206
|
}
|
|
@@ -24230,7 +24247,7 @@ var ExecuteCode = ({
|
|
|
24230
24247
|
}) => {
|
|
24231
24248
|
const toolCallData = data;
|
|
24232
24249
|
const { language, code } = toolCallData?.args || {};
|
|
24233
|
-
const
|
|
24250
|
+
const openSideApp = useSideAppOpener();
|
|
24234
24251
|
if (!toolCallData) {
|
|
24235
24252
|
return null;
|
|
24236
24253
|
}
|
|
@@ -24332,7 +24349,7 @@ var TeamGraph = ({ data }) => {
|
|
|
24332
24349
|
const teammates = safeGetTeammates(data);
|
|
24333
24350
|
const tasks = safeGetTasks(data);
|
|
24334
24351
|
const teamId = safeGetTeamId(data);
|
|
24335
|
-
const
|
|
24352
|
+
const openSideApp = useSideAppOpener();
|
|
24336
24353
|
const { threadId, assistantId } = useAgentChat();
|
|
24337
24354
|
const colors3 = [
|
|
24338
24355
|
"#1890ff",
|
|
@@ -24456,13 +24473,13 @@ var TeamGraph = ({ data }) => {
|
|
|
24456
24473
|
var TeamGraph_default = TeamGraph;
|
|
24457
24474
|
|
|
24458
24475
|
// src/components/GenUI/elements/TeamWorkspace/index.tsx
|
|
24459
|
-
var
|
|
24476
|
+
var import_react90 = require("react");
|
|
24460
24477
|
var import_antd86 = require("antd");
|
|
24461
24478
|
var import_lucide_react28 = require("lucide-react");
|
|
24462
24479
|
var import_antd_style33 = require("antd-style");
|
|
24463
24480
|
|
|
24464
24481
|
// src/components/GenUI/elements/TeamWorkspace/TeamWorkspaceMenu.tsx
|
|
24465
|
-
var
|
|
24482
|
+
var import_react83 = __toESM(require("react"));
|
|
24466
24483
|
var import_lucide_react22 = require("lucide-react");
|
|
24467
24484
|
var import_antd78 = require("antd");
|
|
24468
24485
|
var import_antd_style25 = require("antd-style");
|
|
@@ -24648,7 +24665,7 @@ var TeamWorkspaceMenu = ({
|
|
|
24648
24665
|
onItemClick
|
|
24649
24666
|
}) => {
|
|
24650
24667
|
const { styles } = useStyles9();
|
|
24651
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
24668
|
+
const [isExpanded, setIsExpanded] = (0, import_react83.useState)(false);
|
|
24652
24669
|
const mainItems = items.filter((item) => !item.group);
|
|
24653
24670
|
const teammateItems = items.filter((item) => item.group === "Teammates");
|
|
24654
24671
|
const teamItems = items.filter((item) => item.group === "Team");
|
|
@@ -24676,7 +24693,7 @@ var TeamWorkspaceMenu = ({
|
|
|
24676
24693
|
if (showTooltip && !isExpanded) {
|
|
24677
24694
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_antd78.Tooltip, { title: item.name, placement: "right", children: content }, item.id);
|
|
24678
24695
|
}
|
|
24679
|
-
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
24696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_react83.default.Fragment, { children: content }, item.id);
|
|
24680
24697
|
};
|
|
24681
24698
|
const renderGroup = (groupItems, groupLabel, showDivider) => {
|
|
24682
24699
|
if (groupItems.length === 0) return null;
|
|
@@ -24722,13 +24739,13 @@ var import_lucide_react23 = require("lucide-react");
|
|
|
24722
24739
|
var import_antd_style26 = require("antd-style");
|
|
24723
24740
|
|
|
24724
24741
|
// src/components/GenUI/elements/TeamWorkspace/hooks/useTeamWorkspaceData.ts
|
|
24725
|
-
var
|
|
24742
|
+
var import_react84 = require("react");
|
|
24726
24743
|
function useTeamWorkspaceData(threadId, assistantId) {
|
|
24727
24744
|
const { agentState, isLoading, error, refresh } = useAgentState(threadId, assistantId, {
|
|
24728
24745
|
pollingInterval: 5e3,
|
|
24729
24746
|
autoStart: true
|
|
24730
24747
|
});
|
|
24731
|
-
const data = (0,
|
|
24748
|
+
const data = (0, import_react84.useMemo)(() => {
|
|
24732
24749
|
const team = agentState?.values?.team || null;
|
|
24733
24750
|
const tasks = agentState?.values?.tasks || [];
|
|
24734
24751
|
const mailbox = agentState?.values?.team_mailbox || [];
|
|
@@ -25117,13 +25134,13 @@ var TeamDashboard = ({
|
|
|
25117
25134
|
};
|
|
25118
25135
|
|
|
25119
25136
|
// src/components/GenUI/elements/TeamWorkspace/IssuesView.tsx
|
|
25120
|
-
var
|
|
25137
|
+
var import_react86 = require("react");
|
|
25121
25138
|
var import_antd81 = require("antd");
|
|
25122
25139
|
var import_lucide_react25 = require("lucide-react");
|
|
25123
25140
|
var import_antd_style28 = require("antd-style");
|
|
25124
25141
|
|
|
25125
25142
|
// src/components/GenUI/elements/TeamWorkspace/TaskDetailModal.tsx
|
|
25126
|
-
var
|
|
25143
|
+
var import_react85 = require("react");
|
|
25127
25144
|
var import_antd80 = require("antd");
|
|
25128
25145
|
var import_antd_style27 = require("antd-style");
|
|
25129
25146
|
var import_lucide_react24 = require("lucide-react");
|
|
@@ -25538,7 +25555,7 @@ var TaskDetailModal = ({
|
|
|
25538
25555
|
onClose
|
|
25539
25556
|
}) => {
|
|
25540
25557
|
const { styles } = useStyles11();
|
|
25541
|
-
const [activeTab, setActiveTab] = (0,
|
|
25558
|
+
const [activeTab, setActiveTab] = (0, import_react85.useState)("comments");
|
|
25542
25559
|
if (!task) return null;
|
|
25543
25560
|
const statusConfig2 = getStatusConfig2(task.status);
|
|
25544
25561
|
const tabItems = [
|
|
@@ -25964,7 +25981,7 @@ var formatDate2 = (timestamp) => {
|
|
|
25964
25981
|
});
|
|
25965
25982
|
};
|
|
25966
25983
|
var ListGroupComponent = ({ group, styles, defaultExpanded = true, onTaskClick }) => {
|
|
25967
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
25984
|
+
const [isExpanded, setIsExpanded] = (0, import_react86.useState)(defaultExpanded);
|
|
25968
25985
|
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: styles.listGroup, children: [
|
|
25969
25986
|
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(
|
|
25970
25987
|
"div",
|
|
@@ -26007,10 +26024,10 @@ var IssuesView = ({
|
|
|
26007
26024
|
teammates
|
|
26008
26025
|
}) => {
|
|
26009
26026
|
const { styles } = useStyles12();
|
|
26010
|
-
const [viewMode, setViewMode] = (0,
|
|
26011
|
-
const [selectedTask, setSelectedTask] = (0,
|
|
26012
|
-
const [modalVisible, setModalVisible] = (0,
|
|
26013
|
-
const listGroups = (0,
|
|
26027
|
+
const [viewMode, setViewMode] = (0, import_react86.useState)("list");
|
|
26028
|
+
const [selectedTask, setSelectedTask] = (0, import_react86.useState)(null);
|
|
26029
|
+
const [modalVisible, setModalVisible] = (0, import_react86.useState)(false);
|
|
26030
|
+
const listGroups = (0, import_react86.useMemo)(() => {
|
|
26014
26031
|
const groups = [
|
|
26015
26032
|
{
|
|
26016
26033
|
id: "pending",
|
|
@@ -26049,7 +26066,7 @@ var IssuesView = ({
|
|
|
26049
26066
|
});
|
|
26050
26067
|
return groups;
|
|
26051
26068
|
}, [tasks]);
|
|
26052
|
-
const tasksByStatus = (0,
|
|
26069
|
+
const tasksByStatus = (0, import_react86.useMemo)(() => {
|
|
26053
26070
|
const grouped = {
|
|
26054
26071
|
pending: [],
|
|
26055
26072
|
claimed: [],
|
|
@@ -26182,8 +26199,8 @@ var IssuesView = ({
|
|
|
26182
26199
|
};
|
|
26183
26200
|
|
|
26184
26201
|
// src/components/GenUI/elements/TeamWorkspace/TeamOrgCanvas.tsx
|
|
26185
|
-
var
|
|
26186
|
-
var
|
|
26202
|
+
var import_react87 = __toESM(require("react"));
|
|
26203
|
+
var import_react88 = require("@xyflow/react");
|
|
26187
26204
|
var import_style5 = require("@xyflow/react/dist/style.css");
|
|
26188
26205
|
var import_antd82 = require("antd");
|
|
26189
26206
|
var import_antd_style29 = require("antd-style");
|
|
@@ -26339,8 +26356,8 @@ var TeamOrgCanvasInner = ({
|
|
|
26339
26356
|
tasks
|
|
26340
26357
|
}) => {
|
|
26341
26358
|
const { styles } = useStyles13();
|
|
26342
|
-
const { fitView } = (0,
|
|
26343
|
-
const taskStatsByTeammate = (0,
|
|
26359
|
+
const { fitView } = (0, import_react88.useReactFlow)();
|
|
26360
|
+
const taskStatsByTeammate = (0, import_react87.useMemo)(() => {
|
|
26344
26361
|
const stats = {};
|
|
26345
26362
|
teammates.forEach((t) => {
|
|
26346
26363
|
stats[t.name] = { completed: 0, inProgress: 0, pending: 0 };
|
|
@@ -26358,7 +26375,7 @@ var TeamOrgCanvasInner = ({
|
|
|
26358
26375
|
});
|
|
26359
26376
|
return stats;
|
|
26360
26377
|
}, [teammates, tasks]);
|
|
26361
|
-
const { nodes, edges } = (0,
|
|
26378
|
+
const { nodes, edges } = (0, import_react87.useMemo)(() => {
|
|
26362
26379
|
const newNodes = [];
|
|
26363
26380
|
const newEdges = [];
|
|
26364
26381
|
const teamLeadId = team?.teamLeadId || "team_lead";
|
|
@@ -26413,9 +26430,9 @@ var TeamOrgCanvasInner = ({
|
|
|
26413
26430
|
});
|
|
26414
26431
|
return { nodes: newNodes, edges: newEdges };
|
|
26415
26432
|
}, [team, teammates, taskStatsByTeammate]);
|
|
26416
|
-
const [flowNodes, setNodes, onNodesChange] = (0,
|
|
26417
|
-
const [flowEdges, setEdges, onEdgesChange] = (0,
|
|
26418
|
-
|
|
26433
|
+
const [flowNodes, setNodes, onNodesChange] = (0, import_react88.useNodesState)(nodes);
|
|
26434
|
+
const [flowEdges, setEdges, onEdgesChange] = (0, import_react88.useEdgesState)(edges);
|
|
26435
|
+
import_react87.default.useEffect(() => {
|
|
26419
26436
|
setNodes(nodes);
|
|
26420
26437
|
setEdges(edges);
|
|
26421
26438
|
setTimeout(() => fitView({ padding: 0.2 }), 100);
|
|
@@ -26435,7 +26452,7 @@ var TeamOrgCanvasInner = ({
|
|
|
26435
26452
|
] }),
|
|
26436
26453
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: styles.canvas, children: [
|
|
26437
26454
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(
|
|
26438
|
-
|
|
26455
|
+
import_react88.ReactFlow,
|
|
26439
26456
|
{
|
|
26440
26457
|
nodes: flowNodes,
|
|
26441
26458
|
edges: flowEdges,
|
|
@@ -26445,8 +26462,8 @@ var TeamOrgCanvasInner = ({
|
|
|
26445
26462
|
fitView: true,
|
|
26446
26463
|
attributionPosition: "bottom-right",
|
|
26447
26464
|
children: [
|
|
26448
|
-
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
26449
|
-
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
26465
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react88.Background, { color: "#eee", gap: 20 }),
|
|
26466
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react88.Controls, {})
|
|
26450
26467
|
]
|
|
26451
26468
|
}
|
|
26452
26469
|
),
|
|
@@ -26486,7 +26503,7 @@ var TeamOrgCanvasInner = ({
|
|
|
26486
26503
|
] })
|
|
26487
26504
|
] });
|
|
26488
26505
|
};
|
|
26489
|
-
var TeamOrgCanvas = (props) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
26506
|
+
var TeamOrgCanvas = (props) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react88.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(TeamOrgCanvasInner, { ...props }) });
|
|
26490
26507
|
|
|
26491
26508
|
// src/components/GenUI/elements/TeamWorkspace/TeamMemberChat.tsx
|
|
26492
26509
|
var import_antd83 = require("antd");
|
|
@@ -26612,7 +26629,7 @@ var TeamMemberChat = ({
|
|
|
26612
26629
|
};
|
|
26613
26630
|
|
|
26614
26631
|
// src/components/GenUI/elements/MailboxPanel.tsx
|
|
26615
|
-
var
|
|
26632
|
+
var import_react89 = require("react");
|
|
26616
26633
|
var import_antd85 = require("antd");
|
|
26617
26634
|
var import_antd_style32 = require("antd-style");
|
|
26618
26635
|
var import_lucide_react27 = require("lucide-react");
|
|
@@ -27030,7 +27047,7 @@ var getMessagePreview = (content) => {
|
|
|
27030
27047
|
return firstLine.length > 80 ? firstLine.slice(0, 80) + "..." : firstLine;
|
|
27031
27048
|
};
|
|
27032
27049
|
var MessageGroupComponent = ({ group, styles, defaultExpanded = true, onMessageClick }) => {
|
|
27033
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
27050
|
+
const [isExpanded, setIsExpanded] = (0, import_react89.useState)(defaultExpanded);
|
|
27034
27051
|
return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: styles.listGroup, children: [
|
|
27035
27052
|
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
|
|
27036
27053
|
"div",
|
|
@@ -27085,10 +27102,10 @@ var MessageGroupComponent = ({ group, styles, defaultExpanded = true, onMessageC
|
|
|
27085
27102
|
};
|
|
27086
27103
|
var MailboxPanel = ({ data }) => {
|
|
27087
27104
|
const { styles } = useStyles16();
|
|
27088
|
-
const [selectedMessage, setSelectedMessage] = (0,
|
|
27089
|
-
const [modalVisible, setModalVisible] = (0,
|
|
27105
|
+
const [selectedMessage, setSelectedMessage] = (0, import_react89.useState)(null);
|
|
27106
|
+
const [modalVisible, setModalVisible] = (0, import_react89.useState)(false);
|
|
27090
27107
|
const { teamMailbox = [] } = data || {};
|
|
27091
|
-
const messageGroups = (0,
|
|
27108
|
+
const messageGroups = (0, import_react89.useMemo)(() => {
|
|
27092
27109
|
const groupsMap = /* @__PURE__ */ new Map();
|
|
27093
27110
|
teamMailbox.forEach((message23) => {
|
|
27094
27111
|
const sender = message23.from;
|
|
@@ -27216,8 +27233,8 @@ var TeamWorkspace = ({
|
|
|
27216
27233
|
isLoading,
|
|
27217
27234
|
refresh
|
|
27218
27235
|
} = useTeamWorkspaceData(parent_thread_id || null, assistantId);
|
|
27219
|
-
const [activeMenuId, setActiveMenuId] = (0,
|
|
27220
|
-
const menuItems = (0,
|
|
27236
|
+
const [activeMenuId, setActiveMenuId] = (0, import_react90.useState)("dashboard");
|
|
27237
|
+
const menuItems = (0, import_react90.useMemo)(() => {
|
|
27221
27238
|
const items = [
|
|
27222
27239
|
{
|
|
27223
27240
|
id: "dashboard",
|
|
@@ -27354,7 +27371,7 @@ var TeamWorkspace = ({
|
|
|
27354
27371
|
};
|
|
27355
27372
|
|
|
27356
27373
|
// src/components/GenUI/elements/TaskBoard.tsx
|
|
27357
|
-
var
|
|
27374
|
+
var import_react91 = require("react");
|
|
27358
27375
|
|
|
27359
27376
|
// src/components/GenUI/elements/TaskBoardCard.tsx
|
|
27360
27377
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
@@ -27633,7 +27650,7 @@ var TaskBoard = ({
|
|
|
27633
27650
|
const { tasks: contextTasks } = useAgentChat();
|
|
27634
27651
|
const { tasks: propTasks, onAddTask, teammates } = data || {};
|
|
27635
27652
|
const tasks = contextTasks || propTasks || [];
|
|
27636
|
-
const tasksByStatus = (0,
|
|
27653
|
+
const tasksByStatus = (0, import_react91.useMemo)(() => {
|
|
27637
27654
|
const grouped = {
|
|
27638
27655
|
pending: [],
|
|
27639
27656
|
in_progress: [],
|
|
@@ -27699,7 +27716,7 @@ var TaskBoard = ({
|
|
|
27699
27716
|
};
|
|
27700
27717
|
|
|
27701
27718
|
// src/components/GenUI/elements/Mailbox.tsx
|
|
27702
|
-
var
|
|
27719
|
+
var import_react92 = require("react");
|
|
27703
27720
|
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
27704
27721
|
var useStyle16 = () => {
|
|
27705
27722
|
return {
|
|
@@ -27985,17 +28002,17 @@ var renderMessageWithMentions = (content, mentions, styles) => {
|
|
|
27985
28002
|
var TeamChat = ({ data }) => {
|
|
27986
28003
|
const styles = useStyle16();
|
|
27987
28004
|
const { teamName, currentUser, teammates, messages, onSendMessage } = data || {};
|
|
27988
|
-
const [inputValue, setInputValue] = (0,
|
|
27989
|
-
const messagesEndRef = (0,
|
|
27990
|
-
const sortedMessages = (0,
|
|
28005
|
+
const [inputValue, setInputValue] = (0, import_react92.useState)("");
|
|
28006
|
+
const messagesEndRef = (0, import_react92.useRef)(null);
|
|
28007
|
+
const sortedMessages = (0, import_react92.useMemo)(() => {
|
|
27991
28008
|
return [...messages || []].sort(
|
|
27992
28009
|
(a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()
|
|
27993
28010
|
);
|
|
27994
28011
|
}, [messages]);
|
|
27995
|
-
const mentions = (0,
|
|
28012
|
+
const mentions = (0, import_react92.useMemo)(() => {
|
|
27996
28013
|
return teammates?.map((t) => t.name) || [];
|
|
27997
28014
|
}, [teammates]);
|
|
27998
|
-
(0,
|
|
28015
|
+
(0, import_react92.useEffect)(() => {
|
|
27999
28016
|
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
28000
28017
|
}, [sortedMessages]);
|
|
28001
28018
|
const handleSend = () => {
|
|
@@ -28164,12 +28181,12 @@ var TeamChat = ({ data }) => {
|
|
|
28164
28181
|
};
|
|
28165
28182
|
|
|
28166
28183
|
// src/components/GenUI/elements/ShowWidget.tsx
|
|
28167
|
-
var
|
|
28184
|
+
var import_react94 = require("react");
|
|
28168
28185
|
var import_antd87 = require("antd");
|
|
28169
28186
|
var import_icons42 = require("@ant-design/icons");
|
|
28170
28187
|
|
|
28171
28188
|
// src/streaming-html/StreamingHTMLRenderer.tsx
|
|
28172
|
-
var
|
|
28189
|
+
var import_react93 = __toESM(require("react"));
|
|
28173
28190
|
|
|
28174
28191
|
// src/streaming-html/show-widget-css-generator.ts
|
|
28175
28192
|
function generateShowWidgetCSS(tokens) {
|
|
@@ -28860,22 +28877,22 @@ var StreamingHTMLRenderer = ({
|
|
|
28860
28877
|
title,
|
|
28861
28878
|
loadingMessages
|
|
28862
28879
|
}) => {
|
|
28863
|
-
const iframeRef = (0,
|
|
28864
|
-
const containerRef = (0,
|
|
28865
|
-
const resizeObserverRef = (0,
|
|
28866
|
-
const prevHTMLRef = (0,
|
|
28867
|
-
const isReadyRef = (0,
|
|
28868
|
-
const pendingChunksRef = (0,
|
|
28869
|
-
const isCompleteRef = (0,
|
|
28870
|
-
const isScriptExecuted = (0,
|
|
28871
|
-
const [iframeHeight, setIframeHeight] =
|
|
28872
|
-
const [iframeWidth, setIframeWidth] =
|
|
28873
|
-
const [currentMessageIndex, setCurrentMessageIndex] = (0,
|
|
28874
|
-
const [showLoading, setShowLoading] = (0,
|
|
28875
|
-
(0,
|
|
28880
|
+
const iframeRef = (0, import_react93.useRef)(null);
|
|
28881
|
+
const containerRef = (0, import_react93.useRef)(null);
|
|
28882
|
+
const resizeObserverRef = (0, import_react93.useRef)(null);
|
|
28883
|
+
const prevHTMLRef = (0, import_react93.useRef)("");
|
|
28884
|
+
const isReadyRef = (0, import_react93.useRef)(false);
|
|
28885
|
+
const pendingChunksRef = (0, import_react93.useRef)([]);
|
|
28886
|
+
const isCompleteRef = (0, import_react93.useRef)(isComplete);
|
|
28887
|
+
const isScriptExecuted = (0, import_react93.useRef)(false);
|
|
28888
|
+
const [iframeHeight, setIframeHeight] = import_react93.default.useState(0);
|
|
28889
|
+
const [iframeWidth, setIframeWidth] = import_react93.default.useState(void 0);
|
|
28890
|
+
const [currentMessageIndex, setCurrentMessageIndex] = (0, import_react93.useState)(0);
|
|
28891
|
+
const [showLoading, setShowLoading] = (0, import_react93.useState)(true);
|
|
28892
|
+
(0, import_react93.useEffect)(() => {
|
|
28876
28893
|
isCompleteRef.current = isComplete;
|
|
28877
28894
|
}, [isComplete]);
|
|
28878
|
-
(0,
|
|
28895
|
+
(0, import_react93.useEffect)(() => {
|
|
28879
28896
|
if (iframeHeight > 0) {
|
|
28880
28897
|
setShowLoading(false);
|
|
28881
28898
|
return;
|
|
@@ -28900,7 +28917,7 @@ var StreamingHTMLRenderer = ({
|
|
|
28900
28917
|
}, 1500);
|
|
28901
28918
|
return () => clearInterval(interval);
|
|
28902
28919
|
}, [iframeHeight, loadingMessages]);
|
|
28903
|
-
const executeScripts = (0,
|
|
28920
|
+
const executeScripts = (0, import_react93.useCallback)(() => {
|
|
28904
28921
|
if (isScriptExecuted.current) {
|
|
28905
28922
|
console.log("[StreamingHTMLRenderer] scripts is executed");
|
|
28906
28923
|
return;
|
|
@@ -28927,7 +28944,7 @@ var StreamingHTMLRenderer = ({
|
|
|
28927
28944
|
onError?.(streamingError);
|
|
28928
28945
|
}
|
|
28929
28946
|
}, [onError]);
|
|
28930
|
-
const sendChunk = (0,
|
|
28947
|
+
const sendChunk = (0, import_react93.useCallback)((chunk) => {
|
|
28931
28948
|
const iframe = iframeRef.current;
|
|
28932
28949
|
if (!iframe || !iframe.contentWindow) {
|
|
28933
28950
|
return;
|
|
@@ -28951,7 +28968,7 @@ var StreamingHTMLRenderer = ({
|
|
|
28951
28968
|
onError?.(streamingError);
|
|
28952
28969
|
}
|
|
28953
28970
|
}, [onError]);
|
|
28954
|
-
(0,
|
|
28971
|
+
(0, import_react93.useEffect)(() => {
|
|
28955
28972
|
const handleMessage = (event) => {
|
|
28956
28973
|
const iframe = iframeRef.current;
|
|
28957
28974
|
if (!iframe || event.source !== iframe.contentWindow) {
|
|
@@ -29004,7 +29021,7 @@ var StreamingHTMLRenderer = ({
|
|
|
29004
29021
|
window.removeEventListener("message", handleMessage);
|
|
29005
29022
|
};
|
|
29006
29023
|
}, [onError, onPrompt, sendChunk, executeScripts]);
|
|
29007
|
-
(0,
|
|
29024
|
+
(0, import_react93.useEffect)(() => {
|
|
29008
29025
|
if (html === prevHTMLRef.current) {
|
|
29009
29026
|
return;
|
|
29010
29027
|
}
|
|
@@ -29015,12 +29032,12 @@ var StreamingHTMLRenderer = ({
|
|
|
29015
29032
|
sendChunk(newChunk);
|
|
29016
29033
|
}
|
|
29017
29034
|
}, [html, sendChunk]);
|
|
29018
|
-
(0,
|
|
29035
|
+
(0, import_react93.useEffect)(() => {
|
|
29019
29036
|
if (isComplete && isReadyRef.current) {
|
|
29020
29037
|
executeScripts();
|
|
29021
29038
|
}
|
|
29022
29039
|
}, [isComplete, executeScripts]);
|
|
29023
|
-
(0,
|
|
29040
|
+
(0, import_react93.useEffect)(() => {
|
|
29024
29041
|
const container = containerRef.current;
|
|
29025
29042
|
if (!container) return;
|
|
29026
29043
|
const antBubble = container.closest(".ant-bubble");
|
|
@@ -29046,7 +29063,7 @@ var StreamingHTMLRenderer = ({
|
|
|
29046
29063
|
resizeObserverRef.current = null;
|
|
29047
29064
|
};
|
|
29048
29065
|
}, []);
|
|
29049
|
-
(0,
|
|
29066
|
+
(0, import_react93.useEffect)(() => {
|
|
29050
29067
|
return () => {
|
|
29051
29068
|
isReadyRef.current = false;
|
|
29052
29069
|
pendingChunksRef.current = [];
|
|
@@ -29131,7 +29148,7 @@ var ShowWidget = ({
|
|
|
29131
29148
|
}) => {
|
|
29132
29149
|
const toolCallData = data;
|
|
29133
29150
|
const { title, loading_messages, widget_code } = toolCallData?.args || {};
|
|
29134
|
-
const
|
|
29151
|
+
const openSideApp = useSideAppOpener();
|
|
29135
29152
|
const { sendMessage } = useAgentChat();
|
|
29136
29153
|
if (!toolCallData) {
|
|
29137
29154
|
return null;
|
|
@@ -29149,14 +29166,14 @@ var ShowWidget = ({
|
|
|
29149
29166
|
console.warn("Failed to parse tool response:", e);
|
|
29150
29167
|
}
|
|
29151
29168
|
}
|
|
29152
|
-
const sendPrompt = (0,
|
|
29169
|
+
const sendPrompt = (0, import_react94.useCallback)((text) => {
|
|
29153
29170
|
sendMessage({
|
|
29154
29171
|
input: {
|
|
29155
29172
|
message: text
|
|
29156
29173
|
}
|
|
29157
29174
|
});
|
|
29158
29175
|
}, [sendMessage]);
|
|
29159
|
-
const handleOpenInSideApp = (0,
|
|
29176
|
+
const handleOpenInSideApp = (0, import_react94.useCallback)(() => {
|
|
29160
29177
|
openSideApp({
|
|
29161
29178
|
component_key: "show_widget",
|
|
29162
29179
|
data: {
|
|
@@ -29225,14 +29242,14 @@ var ShowWidget = ({
|
|
|
29225
29242
|
};
|
|
29226
29243
|
|
|
29227
29244
|
// src/components/GenUI/elements/ShowWidgetApp.tsx
|
|
29228
|
-
var
|
|
29245
|
+
var import_react95 = require("react");
|
|
29229
29246
|
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
29230
29247
|
var ShowWidgetApp = ({
|
|
29231
29248
|
data
|
|
29232
29249
|
}) => {
|
|
29233
29250
|
const { widget_code, title } = data || {};
|
|
29234
29251
|
const { sendMessage } = useAgentChat();
|
|
29235
|
-
const sendPrompt = (0,
|
|
29252
|
+
const sendPrompt = (0, import_react95.useCallback)(
|
|
29236
29253
|
(text) => {
|
|
29237
29254
|
sendMessage({
|
|
29238
29255
|
input: {
|
|
@@ -29359,7 +29376,7 @@ var regsiterElement = (language, ElementMeta) => {
|
|
|
29359
29376
|
// src/components/Chat/SideAppViewBrowser.tsx
|
|
29360
29377
|
var import_antd88 = require("antd");
|
|
29361
29378
|
var import_antd_style34 = require("antd-style");
|
|
29362
|
-
var
|
|
29379
|
+
var import_react96 = require("react");
|
|
29363
29380
|
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
29364
29381
|
var useStyle17 = (0, import_antd_style34.createStyles)(({ token, css }) => {
|
|
29365
29382
|
return {
|
|
@@ -29553,15 +29570,18 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
29553
29570
|
sideAppSelectedCard,
|
|
29554
29571
|
contentAppSelectedCard: contextAppSelectedCard,
|
|
29555
29572
|
closeSideApp,
|
|
29556
|
-
closeContentApp
|
|
29573
|
+
closeContentApp,
|
|
29574
|
+
openSideApp,
|
|
29575
|
+
openContentApp
|
|
29557
29576
|
} = useChatUIContext();
|
|
29558
29577
|
const selectedCard = region === "side" ? sideAppSelectedCard : contextAppSelectedCard;
|
|
29559
29578
|
const closeApp = region === "side" ? closeSideApp : closeContentApp;
|
|
29560
|
-
const
|
|
29579
|
+
const openApp = region === "side" ? openSideApp : openContentApp;
|
|
29580
|
+
const [activeKey, setActiveKey] = (0, import_react96.useState)(
|
|
29561
29581
|
JSON.stringify(selectedCard)
|
|
29562
29582
|
);
|
|
29563
|
-
const [hoveredTab, setHoveredTab] = (0,
|
|
29564
|
-
const [items, setItems] = (0,
|
|
29583
|
+
const [hoveredTab, setHoveredTab] = (0, import_react96.useState)(null);
|
|
29584
|
+
const [items, setItems] = (0, import_react96.useState)([]);
|
|
29565
29585
|
const add = (key, label, children, componentKey) => {
|
|
29566
29586
|
const newPanes = [...items, { label, children, key, componentKey }];
|
|
29567
29587
|
setItems(newPanes);
|
|
@@ -29588,7 +29608,7 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
29588
29608
|
const switchTab = (key) => {
|
|
29589
29609
|
setActiveKey(key);
|
|
29590
29610
|
};
|
|
29591
|
-
(0,
|
|
29611
|
+
(0, import_react96.useEffect)(() => {
|
|
29592
29612
|
if (!selectedCard) return;
|
|
29593
29613
|
const key = JSON.stringify(selectedCard);
|
|
29594
29614
|
if (items.find((item) => item.key === key)) {
|
|
@@ -29644,6 +29664,10 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
29644
29664
|
),
|
|
29645
29665
|
onClick: () => switchTab(item.key)
|
|
29646
29666
|
}));
|
|
29667
|
+
const sideAppBrowserValue = (0, import_react96.useMemo)(
|
|
29668
|
+
() => ({ openApp }),
|
|
29669
|
+
[openApp]
|
|
29670
|
+
);
|
|
29647
29671
|
return /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: styles.container, children: [
|
|
29648
29672
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: styles.header, children: [
|
|
29649
29673
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)("div", { className: styles.tabsStrip, children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_antd88.Tooltip, { title: item.label, placement: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(
|
|
@@ -29685,15 +29709,15 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
29685
29709
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_antd88.Tooltip, { title: "Close", children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("button", { className: styles.actionBtn, onClick: closeApp, children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_icons43.CloseOutlined, {}) }) })
|
|
29686
29710
|
] })
|
|
29687
29711
|
] }),
|
|
29688
|
-
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)("div", { className: styles.content, children: activeItem ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("div", { className: styles.contentWrapper, children: activeItem.children }, activeItem.key) : /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: styles.emptyState, children: [
|
|
29712
|
+
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)("div", { className: styles.content, children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(SideAppBrowserContext.Provider, { value: sideAppBrowserValue, children: activeItem ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("div", { className: styles.contentWrapper, children: activeItem.children }, activeItem.key) : /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: styles.emptyState, children: [
|
|
29689
29713
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_icons43.AppstoreOutlined, { className: "icon" }),
|
|
29690
29714
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)("span", { children: "Select an app to start" })
|
|
29691
|
-
] }) })
|
|
29715
|
+
] }) }) })
|
|
29692
29716
|
] });
|
|
29693
29717
|
};
|
|
29694
29718
|
|
|
29695
29719
|
// src/components/Chat/ProjectSelector.tsx
|
|
29696
|
-
var
|
|
29720
|
+
var import_react97 = require("react");
|
|
29697
29721
|
var import_antd89 = require("antd");
|
|
29698
29722
|
var import_antd_style35 = require("antd-style");
|
|
29699
29723
|
var import_lucide_react29 = require("lucide-react");
|
|
@@ -29929,34 +29953,34 @@ var ProjectSelector = ({
|
|
|
29929
29953
|
setProject,
|
|
29930
29954
|
createProject
|
|
29931
29955
|
} = useWorkspaceContext();
|
|
29932
|
-
const [isWorkspaceListOpen, setIsWorkspaceListOpen] = (0,
|
|
29933
|
-
const workspaceDropdownRef = (0,
|
|
29934
|
-
const [isProjectListOpen, setIsProjectListOpen] = (0,
|
|
29935
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
29936
|
-
const [projectName, setProjectName] = (0,
|
|
29937
|
-
const [validationError, setValidationError] = (0,
|
|
29938
|
-
const [isCreating, setIsCreating] = (0,
|
|
29939
|
-
const projectNameInputRef = (0,
|
|
29940
|
-
const currentProject = (0,
|
|
29956
|
+
const [isWorkspaceListOpen, setIsWorkspaceListOpen] = (0, import_react97.useState)(false);
|
|
29957
|
+
const workspaceDropdownRef = (0, import_react97.useRef)(null);
|
|
29958
|
+
const [isProjectListOpen, setIsProjectListOpen] = (0, import_react97.useState)(false);
|
|
29959
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react97.useState)(false);
|
|
29960
|
+
const [projectName, setProjectName] = (0, import_react97.useState)("");
|
|
29961
|
+
const [validationError, setValidationError] = (0, import_react97.useState)(null);
|
|
29962
|
+
const [isCreating, setIsCreating] = (0, import_react97.useState)(false);
|
|
29963
|
+
const projectNameInputRef = (0, import_react97.useRef)(null);
|
|
29964
|
+
const currentProject = (0, import_react97.useMemo)(() => {
|
|
29941
29965
|
return projects.find((p) => p.id === projectId);
|
|
29942
29966
|
}, [projects, projectId]);
|
|
29943
|
-
const currentWorkspace = (0,
|
|
29967
|
+
const currentWorkspace = (0, import_react97.useMemo)(() => {
|
|
29944
29968
|
return workspaces.find((w) => w.id === workspaceId);
|
|
29945
29969
|
}, [workspaces, workspaceId]);
|
|
29946
|
-
const handleSelectProject = (0,
|
|
29970
|
+
const handleSelectProject = (0, import_react97.useCallback)((selectedProjectId) => {
|
|
29947
29971
|
setProject(selectedProjectId);
|
|
29948
29972
|
setIsProjectListOpen(false);
|
|
29949
29973
|
}, [setProject]);
|
|
29950
|
-
const handleWorkspaceClick = (0,
|
|
29974
|
+
const handleWorkspaceClick = (0, import_react97.useCallback)(() => {
|
|
29951
29975
|
setProject(null);
|
|
29952
29976
|
}, [setProject]);
|
|
29953
|
-
const toggleProjectList = (0,
|
|
29977
|
+
const toggleProjectList = (0, import_react97.useCallback)(() => {
|
|
29954
29978
|
setIsProjectListOpen((prev) => !prev);
|
|
29955
29979
|
}, []);
|
|
29956
|
-
const toggleWorkspaceList = (0,
|
|
29980
|
+
const toggleWorkspaceList = (0, import_react97.useCallback)(() => {
|
|
29957
29981
|
setIsWorkspaceListOpen((prev) => !prev);
|
|
29958
29982
|
}, []);
|
|
29959
|
-
const validateProjectName = (0,
|
|
29983
|
+
const validateProjectName = (0, import_react97.useCallback)((name) => {
|
|
29960
29984
|
const trimmed = name.trim();
|
|
29961
29985
|
if (!trimmed) return "Project name is required";
|
|
29962
29986
|
if (trimmed.length > PROJECT_NAME_MAX_LENGTH) {
|
|
@@ -29964,7 +29988,7 @@ var ProjectSelector = ({
|
|
|
29964
29988
|
}
|
|
29965
29989
|
return null;
|
|
29966
29990
|
}, []);
|
|
29967
|
-
const handleOpenModal = (0,
|
|
29991
|
+
const handleOpenModal = (0, import_react97.useCallback)((e) => {
|
|
29968
29992
|
e.stopPropagation();
|
|
29969
29993
|
if (!workspaceId) {
|
|
29970
29994
|
import_antd89.message.warning("Please select a workspace first");
|
|
@@ -29975,7 +29999,7 @@ var ProjectSelector = ({
|
|
|
29975
29999
|
setIsModalOpen(true);
|
|
29976
30000
|
setTimeout(() => projectNameInputRef.current?.input?.focus(), 100);
|
|
29977
30001
|
}, [workspaceId]);
|
|
29978
|
-
const handleCloseModal = (0,
|
|
30002
|
+
const handleCloseModal = (0, import_react97.useCallback)(() => {
|
|
29979
30003
|
setIsModalOpen(false);
|
|
29980
30004
|
setProjectName("");
|
|
29981
30005
|
setValidationError(null);
|
|
@@ -29985,7 +30009,7 @@ var ProjectSelector = ({
|
|
|
29985
30009
|
setProjectName(value);
|
|
29986
30010
|
setValidationError(validateProjectName(value));
|
|
29987
30011
|
};
|
|
29988
|
-
const handleCreateProject = (0,
|
|
30012
|
+
const handleCreateProject = (0, import_react97.useCallback)(async () => {
|
|
29989
30013
|
if (!workspaceId) return;
|
|
29990
30014
|
const trimmed = projectName.trim();
|
|
29991
30015
|
const error = validateProjectName(trimmed);
|
|
@@ -30104,11 +30128,11 @@ var ProjectSelector = ({
|
|
|
30104
30128
|
};
|
|
30105
30129
|
|
|
30106
30130
|
// src/components/Chat/ToolPanelFiles.tsx
|
|
30107
|
-
var
|
|
30131
|
+
var import_react99 = require("react");
|
|
30108
30132
|
var import_antd91 = require("antd");
|
|
30109
30133
|
|
|
30110
30134
|
// src/components/Chat/FileDirectoryPanel.tsx
|
|
30111
|
-
var
|
|
30135
|
+
var import_react98 = __toESM(require("react"));
|
|
30112
30136
|
var import_antd90 = require("antd");
|
|
30113
30137
|
var import_lucide_react30 = require("lucide-react");
|
|
30114
30138
|
var import_antd_style36 = require("antd-style");
|
|
@@ -30340,7 +30364,7 @@ var FileDirectoryPanel = ({
|
|
|
30340
30364
|
onAssetClick
|
|
30341
30365
|
}) => {
|
|
30342
30366
|
const { styles } = useStyles19();
|
|
30343
|
-
const renderEntry =
|
|
30367
|
+
const renderEntry = import_react98.default.useCallback((entry, depth) => {
|
|
30344
30368
|
const entryName = getEntryName(entry);
|
|
30345
30369
|
if (entry.is_dir) {
|
|
30346
30370
|
const isExpanded = directoryExpanded[entry.path] || false;
|
|
@@ -30463,16 +30487,16 @@ var ToolPanelFiles = () => {
|
|
|
30463
30487
|
uploadFileToFolder
|
|
30464
30488
|
} = useWorkspaceContext();
|
|
30465
30489
|
const { currentAssistant } = useAssistantContext();
|
|
30466
|
-
const [folderEntries, setFolderEntries] = (0,
|
|
30467
|
-
const [folderLoading, setFolderLoading] = (0,
|
|
30468
|
-
const [directoryChildren, setDirectoryChildren] = (0,
|
|
30469
|
-
const [directoryLoading, setDirectoryLoading] = (0,
|
|
30470
|
-
const [directoryExpanded, setDirectoryExpanded] = (0,
|
|
30471
|
-
const [uploadingFolder, setUploadingFolder] = (0,
|
|
30472
|
-
const resourceFolders = (0,
|
|
30490
|
+
const [folderEntries, setFolderEntries] = (0, import_react99.useState)({});
|
|
30491
|
+
const [folderLoading, setFolderLoading] = (0, import_react99.useState)({});
|
|
30492
|
+
const [directoryChildren, setDirectoryChildren] = (0, import_react99.useState)({});
|
|
30493
|
+
const [directoryLoading, setDirectoryLoading] = (0, import_react99.useState)({});
|
|
30494
|
+
const [directoryExpanded, setDirectoryExpanded] = (0, import_react99.useState)({});
|
|
30495
|
+
const [uploadingFolder, setUploadingFolder] = (0, import_react99.useState)(null);
|
|
30496
|
+
const resourceFolders = (0, import_react99.useMemo)(() => {
|
|
30473
30497
|
return config.resourceFolders && config.resourceFolders.length > 0 ? config.resourceFolders : [{ name: "/", displayName: "Project Assets", allowUpload: true }];
|
|
30474
30498
|
}, [config.resourceFolders]);
|
|
30475
|
-
const loadAssetsForFolder = (0,
|
|
30499
|
+
const loadAssetsForFolder = (0, import_react99.useCallback)(
|
|
30476
30500
|
async (folder, clearSubdirectoryCache = true) => {
|
|
30477
30501
|
if (!workspaceId || !projectId) {
|
|
30478
30502
|
setFolderEntries((prev) => ({ ...prev, [folder.name]: [] }));
|
|
@@ -30512,7 +30536,7 @@ var ToolPanelFiles = () => {
|
|
|
30512
30536
|
},
|
|
30513
30537
|
[workspaceId, projectId, listPathByFolder, currentAssistant?.id]
|
|
30514
30538
|
);
|
|
30515
|
-
const handleToggleDirectory = (0,
|
|
30539
|
+
const handleToggleDirectory = (0, import_react99.useCallback)(async (path) => {
|
|
30516
30540
|
const isExpanded = directoryExpanded[path] || false;
|
|
30517
30541
|
if (isExpanded) {
|
|
30518
30542
|
setDirectoryExpanded((prev) => ({ ...prev, [path]: false }));
|
|
@@ -30530,12 +30554,12 @@ var ToolPanelFiles = () => {
|
|
|
30530
30554
|
setDirectoryLoading((prev) => ({ ...prev, [path]: false }));
|
|
30531
30555
|
}
|
|
30532
30556
|
}, [directoryExpanded, listPath, currentAssistant?.id]);
|
|
30533
|
-
(0,
|
|
30557
|
+
(0, import_react99.useEffect)(() => {
|
|
30534
30558
|
resourceFolders.forEach((folder) => {
|
|
30535
30559
|
void loadAssetsForFolder(folder, false);
|
|
30536
30560
|
});
|
|
30537
30561
|
}, [resourceFolders, loadAssetsForFolder]);
|
|
30538
|
-
const handleAssetClick = (0,
|
|
30562
|
+
const handleAssetClick = (0, import_react99.useCallback)((asset) => {
|
|
30539
30563
|
const fileUrl = getFileViewUrl(asset.path, currentAssistant?.id);
|
|
30540
30564
|
if (!fileUrl) {
|
|
30541
30565
|
import_antd91.message.warning("Please select a workspace and project first.");
|
|
@@ -30551,7 +30575,7 @@ var ToolPanelFiles = () => {
|
|
|
30551
30575
|
message: `Preview: ${asset.name || asset.path}`
|
|
30552
30576
|
});
|
|
30553
30577
|
}, [getFileViewUrl, openSideApp, currentAssistant?.id]);
|
|
30554
|
-
const handleUploadFolder = (0,
|
|
30578
|
+
const handleUploadFolder = (0, import_react99.useCallback)(async (folderName) => {
|
|
30555
30579
|
if (!workspaceId || !projectId) {
|
|
30556
30580
|
import_antd91.message.warning("Please select a workspace and project before uploading.");
|
|
30557
30581
|
return;
|
|
@@ -30731,7 +30755,7 @@ var LatticeChat = (props) => {
|
|
|
30731
30755
|
// src/components/Chat/AgentConversations.tsx
|
|
30732
30756
|
var import_x7 = require("@ant-design/x");
|
|
30733
30757
|
var import_antd93 = require("antd");
|
|
30734
|
-
var
|
|
30758
|
+
var import_react100 = require("react");
|
|
30735
30759
|
var import_jsx_runtime119 = require("react/jsx-runtime");
|
|
30736
30760
|
var AgentConversations = ({
|
|
30737
30761
|
enableThreadCreation = true,
|
|
@@ -30752,7 +30776,7 @@ var AgentConversations = ({
|
|
|
30752
30776
|
background: "transparent",
|
|
30753
30777
|
borderRadius: token.borderRadius
|
|
30754
30778
|
};
|
|
30755
|
-
const threadItems = (0,
|
|
30779
|
+
const threadItems = (0, import_react100.useMemo)(() => {
|
|
30756
30780
|
return threads || [];
|
|
30757
30781
|
}, [threads]);
|
|
30758
30782
|
const items = threadItems.map((thread2) => ({
|
|
@@ -30787,15 +30811,15 @@ var AgentConversations = ({
|
|
|
30787
30811
|
};
|
|
30788
30812
|
|
|
30789
30813
|
// src/components/Chat/LatticeChatView.tsx
|
|
30790
|
-
var
|
|
30814
|
+
var import_react103 = require("react");
|
|
30791
30815
|
|
|
30792
30816
|
// src/components/Chat/ChatSidebar.tsx
|
|
30793
|
-
var
|
|
30817
|
+
var import_react102 = require("react");
|
|
30794
30818
|
var import_antd95 = require("antd");
|
|
30795
30819
|
var import_lucide_react33 = require("lucide-react");
|
|
30796
30820
|
|
|
30797
30821
|
// src/components/Chat/ThreadHistoryMenuContent.tsx
|
|
30798
|
-
var
|
|
30822
|
+
var import_react101 = __toESM(require("react"));
|
|
30799
30823
|
var import_antd_style39 = require("antd-style");
|
|
30800
30824
|
var import_lucide_react32 = require("lucide-react");
|
|
30801
30825
|
var import_antd94 = require("antd");
|
|
@@ -30909,7 +30933,7 @@ var ThreadHistoryMenuContent = () => {
|
|
|
30909
30933
|
deleteThread,
|
|
30910
30934
|
isLoading
|
|
30911
30935
|
} = useConversationContext();
|
|
30912
|
-
const handleDeleteThread = (0,
|
|
30936
|
+
const handleDeleteThread = (0, import_react101.useCallback)(
|
|
30913
30937
|
async (e, threadIdToDelete) => {
|
|
30914
30938
|
e.stopPropagation();
|
|
30915
30939
|
import_antd94.Modal.confirm({
|
|
@@ -30930,7 +30954,7 @@ var ThreadHistoryMenuContent = () => {
|
|
|
30930
30954
|
},
|
|
30931
30955
|
[deleteThread]
|
|
30932
30956
|
);
|
|
30933
|
-
const sortedThreads =
|
|
30957
|
+
const sortedThreads = import_react101.default.useMemo(() => {
|
|
30934
30958
|
return [...threads].sort((a, b) => {
|
|
30935
30959
|
const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
|
|
30936
30960
|
const dateB = b.updatedAt ? new Date(b.updatedAt).getTime() : 0;
|
|
@@ -31022,8 +31046,8 @@ var ChatSidebar = ({
|
|
|
31022
31046
|
const { sideAppVisible, menuCollapsed, setMenuCollapsed } = useChatUIContext();
|
|
31023
31047
|
const { user, logout } = useAuth();
|
|
31024
31048
|
const { createThread } = useConversationContext();
|
|
31025
|
-
const [drawerStates, setDrawerStates] = (0,
|
|
31026
|
-
const [changePasswordOpen, setChangePasswordOpen] = (0,
|
|
31049
|
+
const [drawerStates, setDrawerStates] = (0, import_react102.useState)({});
|
|
31050
|
+
const [changePasswordOpen, setChangePasswordOpen] = (0, import_react102.useState)(false);
|
|
31027
31051
|
const {
|
|
31028
31052
|
sidebarMode,
|
|
31029
31053
|
sidebarShowToggle,
|
|
@@ -31032,11 +31056,11 @@ var ChatSidebar = ({
|
|
|
31032
31056
|
sidebarLogoIcon
|
|
31033
31057
|
} = config;
|
|
31034
31058
|
const isExpandedMode = sidebarMode === "expanded";
|
|
31035
|
-
const menuItems = (0,
|
|
31059
|
+
const menuItems = (0, import_react102.useMemo)(() => {
|
|
31036
31060
|
const items = customMenuItems.length > 0 ? [...customMenuItems] : [...DEFAULT_MENU_ITEMS];
|
|
31037
31061
|
return items.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
31038
31062
|
}, [customMenuItems]);
|
|
31039
|
-
const handleMenuClick = (0,
|
|
31063
|
+
const handleMenuClick = (0, import_react102.useCallback)(async (item) => {
|
|
31040
31064
|
if (item.builtin === "settings") {
|
|
31041
31065
|
setSettingsModalOpen(true);
|
|
31042
31066
|
onSettingsClick?.();
|
|
@@ -31059,17 +31083,17 @@ var ChatSidebar = ({
|
|
|
31059
31083
|
}
|
|
31060
31084
|
}
|
|
31061
31085
|
}, [onSettingsClick, setSettingsModalOpen, createThread, logout]);
|
|
31062
|
-
const handleCloseDrawer = (0,
|
|
31086
|
+
const handleCloseDrawer = (0, import_react102.useCallback)((itemId) => {
|
|
31063
31087
|
setDrawerStates((prev) => ({ ...prev, [itemId]: false }));
|
|
31064
31088
|
}, []);
|
|
31065
|
-
const handleNewAnalysis = (0,
|
|
31089
|
+
const handleNewAnalysis = (0, import_react102.useCallback)(async () => {
|
|
31066
31090
|
try {
|
|
31067
31091
|
await createThread("New Analysis");
|
|
31068
31092
|
} catch (error) {
|
|
31069
31093
|
console.error("Failed to create new thread:", error);
|
|
31070
31094
|
}
|
|
31071
31095
|
}, [createThread]);
|
|
31072
|
-
const renderDrawerContent = (0,
|
|
31096
|
+
const renderDrawerContent = (0, import_react102.useCallback)((item) => {
|
|
31073
31097
|
switch (item.builtin) {
|
|
31074
31098
|
case "thread-history":
|
|
31075
31099
|
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(ThreadHistoryMenuContent, {});
|
|
@@ -31251,7 +31275,7 @@ var ChatSidebar = ({
|
|
|
31251
31275
|
// src/components/Chat/LatticeChatView.tsx
|
|
31252
31276
|
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
31253
31277
|
var LatticeChatView = (props) => {
|
|
31254
|
-
const shellContext = (0,
|
|
31278
|
+
const shellContext = (0, import_react103.useContext)(LatticeChatShellContext);
|
|
31255
31279
|
const { showSideMenu, sideMenuItems } = shellContext.config;
|
|
31256
31280
|
const { assistantId, thread } = useConversationContext();
|
|
31257
31281
|
const { currentAssistant } = useAssistantContext();
|
|
@@ -31282,7 +31306,7 @@ var LatticeChatView = (props) => {
|
|
|
31282
31306
|
};
|
|
31283
31307
|
|
|
31284
31308
|
// src/components/Chat/SettingsModal.tsx
|
|
31285
|
-
var
|
|
31309
|
+
var import_react104 = require("react");
|
|
31286
31310
|
var import_antd96 = require("antd");
|
|
31287
31311
|
var import_icons44 = require("@ant-design/icons");
|
|
31288
31312
|
var import_antd_style40 = require("antd-style");
|
|
@@ -31648,7 +31672,7 @@ var SettingsModal = ({
|
|
|
31648
31672
|
}) => {
|
|
31649
31673
|
const { styles } = useStyles23();
|
|
31650
31674
|
const { config: shellConfig, updateConfigValue } = useLatticeChatShellContext();
|
|
31651
|
-
const [connections, setConnections] = (0,
|
|
31675
|
+
const [connections, setConnections] = (0, import_react104.useState)(() => {
|
|
31652
31676
|
if (typeof window !== "undefined") {
|
|
31653
31677
|
try {
|
|
31654
31678
|
const stored = localStorage.getItem("lattice_server_connections");
|
|
@@ -31671,21 +31695,21 @@ var SettingsModal = ({
|
|
|
31671
31695
|
}
|
|
31672
31696
|
return [];
|
|
31673
31697
|
});
|
|
31674
|
-
const [serverConfigs, setServerConfigs] = (0,
|
|
31675
|
-
const connectionsRef = (0,
|
|
31676
|
-
(0,
|
|
31698
|
+
const [serverConfigs, setServerConfigs] = (0, import_react104.useState)({});
|
|
31699
|
+
const connectionsRef = (0, import_react104.useRef)(connections);
|
|
31700
|
+
(0, import_react104.useEffect)(() => {
|
|
31677
31701
|
connectionsRef.current = connections;
|
|
31678
31702
|
}, [connections]);
|
|
31679
|
-
const [activeTabKey, setActiveTabKey] = (0,
|
|
31703
|
+
const [activeTabKey, setActiveTabKey] = (0, import_react104.useState)(
|
|
31680
31704
|
connections.length > 0 ? connections[0].id : ""
|
|
31681
31705
|
);
|
|
31682
|
-
const [activeMenu, setActiveMenu] = (0,
|
|
31683
|
-
const [loading, setLoading] = (0,
|
|
31684
|
-
const [showAddServerModal, setShowAddServerModal] = (0,
|
|
31685
|
-
const [newServerUrl, setNewServerUrl] = (0,
|
|
31686
|
-
const [newServerName, setNewServerName] = (0,
|
|
31687
|
-
const [newServerApiKey, setNewServerApiKey] = (0,
|
|
31688
|
-
const [addingServer, setAddingServer] = (0,
|
|
31706
|
+
const [activeMenu, setActiveMenu] = (0, import_react104.useState)("environment");
|
|
31707
|
+
const [loading, setLoading] = (0, import_react104.useState)(false);
|
|
31708
|
+
const [showAddServerModal, setShowAddServerModal] = (0, import_react104.useState)(false);
|
|
31709
|
+
const [newServerUrl, setNewServerUrl] = (0, import_react104.useState)("");
|
|
31710
|
+
const [newServerName, setNewServerName] = (0, import_react104.useState)("");
|
|
31711
|
+
const [newServerApiKey, setNewServerApiKey] = (0, import_react104.useState)("");
|
|
31712
|
+
const [addingServer, setAddingServer] = (0, import_react104.useState)(false);
|
|
31689
31713
|
const saveConnections = (newConnections) => {
|
|
31690
31714
|
setConnections(newConnections);
|
|
31691
31715
|
if (typeof window !== "undefined") {
|
|
@@ -31875,7 +31899,7 @@ var SettingsModal = ({
|
|
|
31875
31899
|
console.error("Failed to load models configuration:", error);
|
|
31876
31900
|
}
|
|
31877
31901
|
};
|
|
31878
|
-
(0,
|
|
31902
|
+
(0, import_react104.useEffect)(() => {
|
|
31879
31903
|
if (open && activeTabKey) {
|
|
31880
31904
|
initializeServerConfig(activeTabKey);
|
|
31881
31905
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
@@ -31884,7 +31908,7 @@ var SettingsModal = ({
|
|
|
31884
31908
|
}
|
|
31885
31909
|
}
|
|
31886
31910
|
}, [open, activeTabKey]);
|
|
31887
|
-
(0,
|
|
31911
|
+
(0, import_react104.useEffect)(() => {
|
|
31888
31912
|
if (open && activeTabKey) {
|
|
31889
31913
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
31890
31914
|
if (connection?.connected) {
|
|
@@ -32664,17 +32688,17 @@ var LatticeChatShell = (props) => {
|
|
|
32664
32688
|
};
|
|
32665
32689
|
|
|
32666
32690
|
// src/components/Chat/ChannelInstallationsDrawerContent.tsx
|
|
32667
|
-
var
|
|
32691
|
+
var import_react105 = require("react");
|
|
32668
32692
|
var import_antd97 = require("antd");
|
|
32669
32693
|
var import_lucide_react34 = require("lucide-react");
|
|
32670
32694
|
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
32671
32695
|
var { Text: Text47, Title: Title17 } = import_antd97.Typography;
|
|
32672
32696
|
var ChannelInstallationsDrawerContent = () => {
|
|
32673
32697
|
const { get, post, put, del } = useApi();
|
|
32674
|
-
const [installations, setInstallations] = (0,
|
|
32675
|
-
const [loading, setLoading] = (0,
|
|
32676
|
-
const [formModalOpen, setFormModalOpen] = (0,
|
|
32677
|
-
const [editingInstallation, setEditingInstallation] = (0,
|
|
32698
|
+
const [installations, setInstallations] = (0, import_react105.useState)([]);
|
|
32699
|
+
const [loading, setLoading] = (0, import_react105.useState)(false);
|
|
32700
|
+
const [formModalOpen, setFormModalOpen] = (0, import_react105.useState)(false);
|
|
32701
|
+
const [editingInstallation, setEditingInstallation] = (0, import_react105.useState)(null);
|
|
32678
32702
|
const loadInstallations = async () => {
|
|
32679
32703
|
setLoading(true);
|
|
32680
32704
|
try {
|
|
@@ -32695,7 +32719,7 @@ var ChannelInstallationsDrawerContent = () => {
|
|
|
32695
32719
|
setLoading(false);
|
|
32696
32720
|
}
|
|
32697
32721
|
};
|
|
32698
|
-
(0,
|
|
32722
|
+
(0, import_react105.useEffect)(() => {
|
|
32699
32723
|
loadInstallations();
|
|
32700
32724
|
}, []);
|
|
32701
32725
|
const handleDelete = async (installation) => {
|
|
@@ -32843,7 +32867,7 @@ var ChannelInstallationsDrawerContent = () => {
|
|
|
32843
32867
|
};
|
|
32844
32868
|
var LarkChannelInstallationFormModal = ({ installation, open, post, put, onCancel, onSave }) => {
|
|
32845
32869
|
const [form] = import_antd97.Form.useForm();
|
|
32846
|
-
(0,
|
|
32870
|
+
(0, import_react105.useEffect)(() => {
|
|
32847
32871
|
if (installation) {
|
|
32848
32872
|
const config = installation.config;
|
|
32849
32873
|
form.setFieldsValue({
|
|
@@ -32982,6 +33006,7 @@ var LarkChannelInstallationFormModal = ({ installation, open, post, put, onCance
|
|
|
32982
33006
|
ProtectedRoute,
|
|
32983
33007
|
RegisterForm,
|
|
32984
33008
|
ScheduleButton,
|
|
33009
|
+
SideAppBrowserContext,
|
|
32985
33010
|
SideAppViewBrowser,
|
|
32986
33011
|
SkillCategoryPrompts,
|
|
32987
33012
|
SkillFlow,
|
|
@@ -33025,6 +33050,8 @@ var LarkChannelInstallationFormModal = ({ installation, open, post, put, onCance
|
|
|
33025
33050
|
useEvalRuns,
|
|
33026
33051
|
useEvalSuites,
|
|
33027
33052
|
useLatticeChatShellContext,
|
|
33053
|
+
useSideAppBrowser,
|
|
33054
|
+
useSideAppOpener,
|
|
33028
33055
|
useTenants,
|
|
33029
33056
|
useUsers,
|
|
33030
33057
|
...require("@axiom-lattice/protocols")
|