@axiom-lattice/react-sdk 2.1.83 → 2.1.84
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.js +755 -643
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +496 -384
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4224,6 +4224,11 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
|
|
|
4224
4224
|
.ant-prompts {
|
|
4225
4225
|
color: ${token.colorText};
|
|
4226
4226
|
}
|
|
4227
|
+
|
|
4228
|
+
@media (max-width: 768px) {
|
|
4229
|
+
padding: 0;
|
|
4230
|
+
gap: 0;
|
|
4231
|
+
}
|
|
4227
4232
|
`,
|
|
4228
4233
|
header: css`
|
|
4229
4234
|
min-height: 40px;
|
|
@@ -4232,6 +4237,11 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
|
|
|
4232
4237
|
padding: 0 ${token.padding}px;
|
|
4233
4238
|
box-sizing: border-box;
|
|
4234
4239
|
flex-shrink: 0;
|
|
4240
|
+
|
|
4241
|
+
@media (max-width: 768px) {
|
|
4242
|
+
padding: 0 8px;
|
|
4243
|
+
min-height: 36px;
|
|
4244
|
+
}
|
|
4235
4245
|
`,
|
|
4236
4246
|
contentArea: css`
|
|
4237
4247
|
flex: 1;
|
|
@@ -4239,12 +4249,20 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
|
|
|
4239
4249
|
flex-direction: column;
|
|
4240
4250
|
overflow: hidden;
|
|
4241
4251
|
gap: 8px;
|
|
4252
|
+
|
|
4253
|
+
@media (max-width: 768px) {
|
|
4254
|
+
gap: 4px;
|
|
4255
|
+
}
|
|
4242
4256
|
`,
|
|
4243
4257
|
columns: css`
|
|
4244
4258
|
flex: 1;
|
|
4245
4259
|
display: flex;
|
|
4246
4260
|
gap: 8px;
|
|
4247
4261
|
overflow: hidden;
|
|
4262
|
+
|
|
4263
|
+
@media (max-width: 768px) {
|
|
4264
|
+
gap: 0;
|
|
4265
|
+
}
|
|
4248
4266
|
`,
|
|
4249
4267
|
menu: css`
|
|
4250
4268
|
// background: ${token.colorBgContainer}90;
|
|
@@ -4261,6 +4279,22 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
|
|
|
4261
4279
|
&.expanded {
|
|
4262
4280
|
width: 240px;
|
|
4263
4281
|
}
|
|
4282
|
+
|
|
4283
|
+
@media (max-width: 768px) {
|
|
4284
|
+
position: fixed;
|
|
4285
|
+
left: 0;
|
|
4286
|
+
top: 0;
|
|
4287
|
+
bottom: 0;
|
|
4288
|
+
z-index: 100;
|
|
4289
|
+
background: ${token.colorBgLayout};
|
|
4290
|
+
border-right: 1px solid ${token.colorBorder};
|
|
4291
|
+
box-shadow: ${token.boxShadow};
|
|
4292
|
+
width: 0;
|
|
4293
|
+
|
|
4294
|
+
&.expanded {
|
|
4295
|
+
width: 240px;
|
|
4296
|
+
}
|
|
4297
|
+
}
|
|
4264
4298
|
`,
|
|
4265
4299
|
menuToggle: css`
|
|
4266
4300
|
position: relative;
|
|
@@ -4332,6 +4366,13 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
|
|
|
4332
4366
|
white-space: pre-wrap;
|
|
4333
4367
|
word-break: break-all;
|
|
4334
4368
|
}
|
|
4369
|
+
|
|
4370
|
+
@media (max-width: 768px) {
|
|
4371
|
+
min-width: 0;
|
|
4372
|
+
border-radius: 0;
|
|
4373
|
+
border: none;
|
|
4374
|
+
gap: 8px;
|
|
4375
|
+
}
|
|
4335
4376
|
`,
|
|
4336
4377
|
chat: css`
|
|
4337
4378
|
width: 100%;
|
|
@@ -4364,6 +4405,10 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
|
|
|
4364
4405
|
background-repeat: no-repeat;
|
|
4365
4406
|
background-position: bottom;
|
|
4366
4407
|
}
|
|
4408
|
+
|
|
4409
|
+
@media (max-width: 768px) {
|
|
4410
|
+
padding: 4px;
|
|
4411
|
+
}
|
|
4367
4412
|
`,
|
|
4368
4413
|
detailPanel: css`
|
|
4369
4414
|
display: flex;
|
|
@@ -4401,6 +4446,29 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
|
|
|
4401
4446
|
bottom: 16px;
|
|
4402
4447
|
top: 2px;
|
|
4403
4448
|
}
|
|
4449
|
+
|
|
4450
|
+
@media (max-width: 768px) {
|
|
4451
|
+
border-radius: 0;
|
|
4452
|
+
|
|
4453
|
+
&.open {
|
|
4454
|
+
position: fixed;
|
|
4455
|
+
top: 0;
|
|
4456
|
+
right: 0;
|
|
4457
|
+
bottom: 0;
|
|
4458
|
+
left: 0;
|
|
4459
|
+
width: 100vw !important;
|
|
4460
|
+
height: 100dvh;
|
|
4461
|
+
z-index: 50;
|
|
4462
|
+
border: none;
|
|
4463
|
+
}
|
|
4464
|
+
|
|
4465
|
+
&.small,
|
|
4466
|
+
&.middle,
|
|
4467
|
+
&.large,
|
|
4468
|
+
&.full {
|
|
4469
|
+
width: 100vw !important;
|
|
4470
|
+
}
|
|
4471
|
+
}
|
|
4404
4472
|
`,
|
|
4405
4473
|
toolPanel: css`
|
|
4406
4474
|
display: flex;
|
|
@@ -4418,6 +4486,22 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
|
|
|
4418
4486
|
box-shadow: ${token.boxShadow};
|
|
4419
4487
|
border-color: ${token.colorBorder};
|
|
4420
4488
|
}
|
|
4489
|
+
|
|
4490
|
+
@media (max-width: 768px) {
|
|
4491
|
+
border-radius: 0;
|
|
4492
|
+
|
|
4493
|
+
&.open {
|
|
4494
|
+
position: fixed;
|
|
4495
|
+
top: 0;
|
|
4496
|
+
right: 0;
|
|
4497
|
+
bottom: 0;
|
|
4498
|
+
left: 0;
|
|
4499
|
+
width: 100vw !important;
|
|
4500
|
+
height: 100dvh;
|
|
4501
|
+
z-index: 50;
|
|
4502
|
+
border: none;
|
|
4503
|
+
}
|
|
4504
|
+
}
|
|
4421
4505
|
`,
|
|
4422
4506
|
detailContent: css`
|
|
4423
4507
|
// padding: 8px 8px;
|
|
@@ -4983,6 +5067,26 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
|
|
|
4983
5067
|
};
|
|
4984
5068
|
});
|
|
4985
5069
|
|
|
5070
|
+
// src/hooks/useMediaQuery.ts
|
|
5071
|
+
var import_react21 = require("react");
|
|
5072
|
+
function useMediaQuery(query) {
|
|
5073
|
+
const [matches, setMatches] = (0, import_react21.useState)(() => {
|
|
5074
|
+
if (typeof window !== "undefined") {
|
|
5075
|
+
return window.matchMedia(query).matches;
|
|
5076
|
+
}
|
|
5077
|
+
return false;
|
|
5078
|
+
});
|
|
5079
|
+
(0, import_react21.useEffect)(() => {
|
|
5080
|
+
const mql = window.matchMedia(query);
|
|
5081
|
+
const handler = (event) => {
|
|
5082
|
+
setMatches(event.matches);
|
|
5083
|
+
};
|
|
5084
|
+
mql.addEventListener("change", handler);
|
|
5085
|
+
return () => mql.removeEventListener("change", handler);
|
|
5086
|
+
}, [query]);
|
|
5087
|
+
return matches;
|
|
5088
|
+
}
|
|
5089
|
+
|
|
4986
5090
|
// src/components/Chat/ColumnLayout.tsx
|
|
4987
5091
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
4988
5092
|
var ColumnLayout = ({
|
|
@@ -5003,7 +5107,8 @@ var ColumnLayout = ({
|
|
|
5003
5107
|
contentAppSelectedCard,
|
|
5004
5108
|
menuCollapsed
|
|
5005
5109
|
} = useChatUIContext();
|
|
5006
|
-
const
|
|
5110
|
+
const isMobile = useMediaQuery("(max-width: 768px)");
|
|
5111
|
+
const isMenuCollapsed = menuCollapsed ?? (isMobile || detailVisible);
|
|
5007
5112
|
const menuStateClass = isMenuCollapsed ? "collapsed" : "expanded";
|
|
5008
5113
|
const hasSidePanelsOpen = detailVisible || toolsVisible;
|
|
5009
5114
|
const resolvedDetailSize = toolsVisible && (detailSize || "large") === "large" ? "middle" : detailSize || "large";
|
|
@@ -5014,17 +5119,24 @@ var ColumnLayout = ({
|
|
|
5014
5119
|
] }),
|
|
5015
5120
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: styles.contentArea, children: [
|
|
5016
5121
|
header && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: styles.header, children: header }),
|
|
5017
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
{
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5122
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
5123
|
+
"div",
|
|
5124
|
+
{
|
|
5125
|
+
className: styles.columns,
|
|
5126
|
+
style: { gap: hasSidePanelsOpen ? void 0 : 0 },
|
|
5127
|
+
children: [
|
|
5128
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${styles.mainContent} ${hasSidePanelsOpen ? "open" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${styles.chat} ${contentAppSelectedCard ? "full_content_width" : ""}`, children: main }) }),
|
|
5129
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
5130
|
+
"div",
|
|
5131
|
+
{
|
|
5132
|
+
className: `${styles.detailPanel} ${detailVisible ? `open ${resolvedDetailSize}` : ""}`,
|
|
5133
|
+
children: detailVisible && detailSelectedCard && detail ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: styles.detailContent, children: detail }) : null
|
|
5134
|
+
}
|
|
5135
|
+
),
|
|
5136
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${styles.toolPanel} ${toolsVisible ? "open" : ""}`, children: toolsVisible && tools ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: styles.detailContent, children: tools }) : null })
|
|
5137
|
+
]
|
|
5138
|
+
}
|
|
5139
|
+
)
|
|
5028
5140
|
] })
|
|
5029
5141
|
] });
|
|
5030
5142
|
};
|
|
@@ -5034,11 +5146,11 @@ var import_icons43 = require("@ant-design/icons");
|
|
|
5034
5146
|
|
|
5035
5147
|
// src/components/GenUI/elements/confirm_feedback.tsx
|
|
5036
5148
|
var import_antd12 = require("antd");
|
|
5037
|
-
var
|
|
5149
|
+
var import_react32 = require("react");
|
|
5038
5150
|
|
|
5039
5151
|
// src/components/GenUI/MDResponse.tsx
|
|
5040
5152
|
var import_x_markdown = __toESM(require("@ant-design/x-markdown"));
|
|
5041
|
-
var
|
|
5153
|
+
var import_react31 = __toESM(require("react"));
|
|
5042
5154
|
var import_antd_style6 = require("antd-style");
|
|
5043
5155
|
|
|
5044
5156
|
// src/components/GenUI/Code.tsx
|
|
@@ -5046,13 +5158,13 @@ var import_x = require("@ant-design/x");
|
|
|
5046
5158
|
|
|
5047
5159
|
// src/components/GenUI/ReactInfographic.tsx
|
|
5048
5160
|
var import_infographic = require("@antv/infographic");
|
|
5049
|
-
var
|
|
5161
|
+
var import_react22 = require("react");
|
|
5050
5162
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
5051
5163
|
var ReactInfographic = (props) => {
|
|
5052
5164
|
const { children } = props;
|
|
5053
|
-
const $container = (0,
|
|
5054
|
-
let infographicInstance = (0,
|
|
5055
|
-
(0,
|
|
5165
|
+
const $container = (0, import_react22.useRef)(null);
|
|
5166
|
+
let infographicInstance = (0, import_react22.useRef)(null);
|
|
5167
|
+
(0, import_react22.useEffect)(() => {
|
|
5056
5168
|
if ($container.current) {
|
|
5057
5169
|
infographicInstance.current = new import_infographic.Infographic({
|
|
5058
5170
|
container: $container.current,
|
|
@@ -5067,7 +5179,7 @@ var ReactInfographic = (props) => {
|
|
|
5067
5179
|
infographicInstance.current?.destroy();
|
|
5068
5180
|
};
|
|
5069
5181
|
}, []);
|
|
5070
|
-
(0,
|
|
5182
|
+
(0, import_react22.useEffect)(() => {
|
|
5071
5183
|
const a = `infographic sequence-steps-simple
|
|
5072
5184
|
data
|
|
5073
5185
|
sequences
|
|
@@ -5083,25 +5195,25 @@ data
|
|
|
5083
5195
|
};
|
|
5084
5196
|
|
|
5085
5197
|
// src/components/GenUI/ReactChart.tsx
|
|
5086
|
-
var
|
|
5198
|
+
var import_react25 = require("react");
|
|
5087
5199
|
var echarts = __toESM(require("echarts"));
|
|
5088
5200
|
var import_antd6 = require("antd");
|
|
5089
5201
|
var import_best_effort_json_parser = require("best-effort-json-parser");
|
|
5090
5202
|
|
|
5091
5203
|
// src/components/GenUI/elements/generic_data_table.tsx
|
|
5092
5204
|
var import_antd5 = require("antd");
|
|
5093
|
-
var
|
|
5205
|
+
var import_react24 = require("react");
|
|
5094
5206
|
var import_icons3 = require("@ant-design/icons");
|
|
5095
5207
|
|
|
5096
5208
|
// src/components/Chat/SideAppBrowserContext.tsx
|
|
5097
|
-
var
|
|
5098
|
-
var SideAppBrowserContext = (0,
|
|
5209
|
+
var import_react23 = require("react");
|
|
5210
|
+
var SideAppBrowserContext = (0, import_react23.createContext)(null);
|
|
5099
5211
|
var useSideAppBrowser = () => {
|
|
5100
|
-
return (0,
|
|
5212
|
+
return (0, import_react23.useContext)(SideAppBrowserContext);
|
|
5101
5213
|
};
|
|
5102
5214
|
var useSideAppOpener = () => {
|
|
5103
5215
|
const { openSideApp } = useChatUIContext();
|
|
5104
|
-
const browserCtx = (0,
|
|
5216
|
+
const browserCtx = (0, import_react23.useContext)(SideAppBrowserContext);
|
|
5105
5217
|
return browserCtx?.openApp ?? openSideApp;
|
|
5106
5218
|
};
|
|
5107
5219
|
|
|
@@ -5110,7 +5222,7 @@ var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
|
5110
5222
|
var { Text: Text3 } = import_antd5.Typography;
|
|
5111
5223
|
var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = true }) => {
|
|
5112
5224
|
const { dataSource, message: message23 } = data ?? {};
|
|
5113
|
-
const [expandedRowKeys, setExpandedRowKeys] = (0,
|
|
5225
|
+
const [expandedRowKeys, setExpandedRowKeys] = (0, import_react24.useState)([]);
|
|
5114
5226
|
const openSideApp = useSideAppOpener();
|
|
5115
5227
|
const processedData = dataSource?.map((item, index) => ({
|
|
5116
5228
|
...item,
|
|
@@ -5587,11 +5699,11 @@ function parseAndValidateChartData(input) {
|
|
|
5587
5699
|
}
|
|
5588
5700
|
var ReactChart = (props) => {
|
|
5589
5701
|
const { children } = props;
|
|
5590
|
-
const chartRef = (0,
|
|
5591
|
-
const chartInstance = (0,
|
|
5592
|
-
const resizeObserverRef = (0,
|
|
5593
|
-
const [tableData, setTableData] = (0,
|
|
5594
|
-
(0,
|
|
5702
|
+
const chartRef = (0, import_react25.useRef)(null);
|
|
5703
|
+
const chartInstance = (0, import_react25.useRef)(null);
|
|
5704
|
+
const resizeObserverRef = (0, import_react25.useRef)(null);
|
|
5705
|
+
const [tableData, setTableData] = (0, import_react25.useState)(null);
|
|
5706
|
+
(0, import_react25.useEffect)(() => {
|
|
5595
5707
|
if (!chartRef.current) {
|
|
5596
5708
|
return;
|
|
5597
5709
|
}
|
|
@@ -5664,7 +5776,7 @@ var ReactChart = (props) => {
|
|
|
5664
5776
|
window.removeEventListener("resize", handleResize);
|
|
5665
5777
|
};
|
|
5666
5778
|
}, [children]);
|
|
5667
|
-
(0,
|
|
5779
|
+
(0, import_react25.useEffect)(() => {
|
|
5668
5780
|
return () => {
|
|
5669
5781
|
if (resizeObserverRef.current) {
|
|
5670
5782
|
resizeObserverRef.current.disconnect();
|
|
@@ -5719,17 +5831,17 @@ var ReactChart = (props) => {
|
|
|
5719
5831
|
};
|
|
5720
5832
|
|
|
5721
5833
|
// src/components/GenUI/Embed.tsx
|
|
5722
|
-
var
|
|
5834
|
+
var import_react28 = require("react");
|
|
5723
5835
|
var import_antd9 = require("antd");
|
|
5724
5836
|
var import_antd_style5 = require("antd-style");
|
|
5725
5837
|
|
|
5726
5838
|
// src/components/GenUI/FileRenderer.tsx
|
|
5727
|
-
var
|
|
5839
|
+
var import_react27 = require("react");
|
|
5728
5840
|
var import_antd8 = require("antd");
|
|
5729
5841
|
var import_antd_style4 = require("antd-style");
|
|
5730
5842
|
|
|
5731
5843
|
// src/components/GenUI/MarkdownViewer.tsx
|
|
5732
|
-
var
|
|
5844
|
+
var import_react26 = __toESM(require("react"));
|
|
5733
5845
|
var import_antd7 = require("antd");
|
|
5734
5846
|
var import_icons4 = require("@ant-design/icons");
|
|
5735
5847
|
var import_jspdf = require("jspdf");
|
|
@@ -5996,9 +6108,9 @@ var MarkdownViewer = ({
|
|
|
5996
6108
|
style
|
|
5997
6109
|
}) => {
|
|
5998
6110
|
const { styles, cx } = useStyles();
|
|
5999
|
-
const [copied, setCopied] = (0,
|
|
6000
|
-
const contentRef = (0,
|
|
6001
|
-
(0,
|
|
6111
|
+
const [copied, setCopied] = (0, import_react26.useState)(false);
|
|
6112
|
+
const contentRef = (0, import_react26.useRef)(null);
|
|
6113
|
+
(0, import_react26.useEffect)(() => {
|
|
6002
6114
|
if (copied) {
|
|
6003
6115
|
const timer = setTimeout(() => setCopied(false), 2e3);
|
|
6004
6116
|
return () => clearTimeout(timer);
|
|
@@ -6114,7 +6226,7 @@ var MarkdownViewer = ({
|
|
|
6114
6226
|
import_antd7.message.error({ content: "Failed to generate PDF", key: "pdf" });
|
|
6115
6227
|
}
|
|
6116
6228
|
};
|
|
6117
|
-
const displayContent =
|
|
6229
|
+
const displayContent = import_react26.default.useMemo(() => {
|
|
6118
6230
|
const lang = getLanguageFromFileName(fileName);
|
|
6119
6231
|
if (lang && lang !== "markdown" && lang !== "text") {
|
|
6120
6232
|
return `\`\`\`${lang}
|
|
@@ -6251,11 +6363,11 @@ var FileRenderer = ({
|
|
|
6251
6363
|
showHeader = true
|
|
6252
6364
|
}) => {
|
|
6253
6365
|
const { styles } = useStyles2();
|
|
6254
|
-
const [content, setContent] = (0,
|
|
6255
|
-
const [loading, setLoading] = (0,
|
|
6256
|
-
const [error, setError] = (0,
|
|
6257
|
-
const category = (0,
|
|
6258
|
-
(0,
|
|
6366
|
+
const [content, setContent] = (0, import_react27.useState)("");
|
|
6367
|
+
const [loading, setLoading] = (0, import_react27.useState)(true);
|
|
6368
|
+
const [error, setError] = (0, import_react27.useState)(null);
|
|
6369
|
+
const category = (0, import_react27.useMemo)(() => getFileCategory(fileName), [fileName]);
|
|
6370
|
+
(0, import_react27.useEffect)(() => {
|
|
6259
6371
|
if (category === "markdown" || category === "text") {
|
|
6260
6372
|
setLoading(true);
|
|
6261
6373
|
setError(null);
|
|
@@ -6402,13 +6514,13 @@ var Embed = ({ children }) => {
|
|
|
6402
6514
|
const { styles } = useStyles3();
|
|
6403
6515
|
const { config } = useLatticeChatShellContext();
|
|
6404
6516
|
const { threadId, assistantId } = useConversationContext();
|
|
6405
|
-
const embedConfig = (0,
|
|
6406
|
-
const fileUrl = (0,
|
|
6517
|
+
const embedConfig = (0, import_react28.useMemo)(() => parseEmbedContent(children), [children]);
|
|
6518
|
+
const fileUrl = (0, import_react28.useMemo)(() => {
|
|
6407
6519
|
if (embedConfig.url) return embedConfig.url;
|
|
6408
6520
|
if (!embedConfig.path || !config?.baseURL || !assistantId || !threadId) return null;
|
|
6409
6521
|
return `${config.baseURL}/api/assistants/${assistantId}/threads/${threadId}/sandbox/downloadfile?path=${encodeURIComponent(embedConfig.path)}`;
|
|
6410
6522
|
}, [embedConfig, config?.baseURL, assistantId, threadId]);
|
|
6411
|
-
const displayTitle = (0,
|
|
6523
|
+
const displayTitle = (0, import_react28.useMemo)(() => {
|
|
6412
6524
|
if (embedConfig.title) return embedConfig.title;
|
|
6413
6525
|
if (embedConfig.path) return embedConfig.path.split("/").pop() || embedConfig.path;
|
|
6414
6526
|
if (embedConfig.url) {
|
|
@@ -6420,7 +6532,7 @@ var Embed = ({ children }) => {
|
|
|
6420
6532
|
}
|
|
6421
6533
|
return "Embedded File";
|
|
6422
6534
|
}, [embedConfig]);
|
|
6423
|
-
const fileIcon = (0,
|
|
6535
|
+
const fileIcon = (0, import_react28.useMemo)(() => {
|
|
6424
6536
|
const fileName = embedConfig.path || embedConfig.url || "";
|
|
6425
6537
|
return getFileIcon(fileName);
|
|
6426
6538
|
}, [embedConfig]);
|
|
@@ -6531,7 +6643,7 @@ var MDComponentWrap = (Element) => {
|
|
|
6531
6643
|
|
|
6532
6644
|
// src/components/GenUI/elements/file_link.tsx
|
|
6533
6645
|
var import_antd11 = require("antd");
|
|
6534
|
-
var
|
|
6646
|
+
var import_react29 = require("react");
|
|
6535
6647
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
6536
6648
|
var FileLink = ({ data }) => {
|
|
6537
6649
|
if (!data) {
|
|
@@ -6543,13 +6655,13 @@ var FileLink = ({ data }) => {
|
|
|
6543
6655
|
const openSideApp = useSideAppOpener();
|
|
6544
6656
|
const { threadId, assistantId } = useConversationContext();
|
|
6545
6657
|
const { config } = useLatticeChatShellContext();
|
|
6546
|
-
const fileBaseURL = (0,
|
|
6658
|
+
const fileBaseURL = (0, import_react29.useMemo)(() => {
|
|
6547
6659
|
if (!config?.baseURL || !assistantId || !threadId) {
|
|
6548
6660
|
return null;
|
|
6549
6661
|
}
|
|
6550
6662
|
return `${config.baseURL}/api/assistants/${assistantId}/threads/${threadId}/sandbox/downloadfile?path=`;
|
|
6551
6663
|
}, [config?.baseURL, assistantId, threadId]);
|
|
6552
|
-
const handleItemClick = (0,
|
|
6664
|
+
const handleItemClick = (0, import_react29.useCallback)((path) => {
|
|
6553
6665
|
if (!fileBaseURL) return;
|
|
6554
6666
|
openSideApp({
|
|
6555
6667
|
component_key: "attachments",
|
|
@@ -6568,7 +6680,7 @@ var FileLink = ({ data }) => {
|
|
|
6568
6680
|
};
|
|
6569
6681
|
|
|
6570
6682
|
// src/components/GenUI/elements/MarkdownTable.tsx
|
|
6571
|
-
var
|
|
6683
|
+
var import_react30 = require("react");
|
|
6572
6684
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
6573
6685
|
var extractTableData = (domNode) => {
|
|
6574
6686
|
if (!domNode || !domNode.children) {
|
|
@@ -6635,7 +6747,7 @@ var extractTableData = (domNode) => {
|
|
|
6635
6747
|
};
|
|
6636
6748
|
var MarkdownTable = (props) => {
|
|
6637
6749
|
const { domNode } = props;
|
|
6638
|
-
const tableData = (0,
|
|
6750
|
+
const tableData = (0, import_react30.useMemo)(() => {
|
|
6639
6751
|
return extractTableData(domNode);
|
|
6640
6752
|
}, [domNode]);
|
|
6641
6753
|
if (!tableData || tableData.dataSource.length === 0) {
|
|
@@ -6733,7 +6845,7 @@ var useStyles4 = (0, import_antd_style6.createStyles)(({ token, css }) => ({
|
|
|
6733
6845
|
}
|
|
6734
6846
|
`
|
|
6735
6847
|
}));
|
|
6736
|
-
var MarkdownErrorBoundary = class extends
|
|
6848
|
+
var MarkdownErrorBoundary = class extends import_react31.default.Component {
|
|
6737
6849
|
constructor(props) {
|
|
6738
6850
|
super(props);
|
|
6739
6851
|
this.state = { hasError: false };
|
|
@@ -6751,8 +6863,8 @@ var MarkdownErrorBoundary = class extends import_react30.default.Component {
|
|
|
6751
6863
|
return this.props.children;
|
|
6752
6864
|
}
|
|
6753
6865
|
};
|
|
6754
|
-
var SafeXMarkdown =
|
|
6755
|
-
const deferredContent = (0,
|
|
6866
|
+
var SafeXMarkdown = import_react31.default.memo(({ content, components, className }) => {
|
|
6867
|
+
const deferredContent = (0, import_react31.useDeferredValue)(content);
|
|
6756
6868
|
if (typeof deferredContent !== "string") {
|
|
6757
6869
|
console.warn("[MDResponse] Content is not a string:", typeof deferredContent, deferredContent);
|
|
6758
6870
|
}
|
|
@@ -6776,7 +6888,7 @@ var MDResponseInner = ({
|
|
|
6776
6888
|
noGenUI
|
|
6777
6889
|
}) => {
|
|
6778
6890
|
const { styles } = useStyles4();
|
|
6779
|
-
const fallbackContent = (0,
|
|
6891
|
+
const fallbackContent = (0, import_react31.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]);
|
|
6780
6892
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MarkdownErrorBoundary, { fallback: fallbackContent, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
6781
6893
|
SafeXMarkdown,
|
|
6782
6894
|
{
|
|
@@ -6786,7 +6898,7 @@ var MDResponseInner = ({
|
|
|
6786
6898
|
}
|
|
6787
6899
|
) });
|
|
6788
6900
|
};
|
|
6789
|
-
var MDResponse =
|
|
6901
|
+
var MDResponse = import_react31.default.memo(MDResponseInner);
|
|
6790
6902
|
MDResponse.displayName = "MDResponse";
|
|
6791
6903
|
var MDViewFormItem = ({ value }) => {
|
|
6792
6904
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MDResponse, { content: value || "" });
|
|
@@ -6801,7 +6913,7 @@ var ConfirmFeedback = ({
|
|
|
6801
6913
|
}) => {
|
|
6802
6914
|
const { message: message23, type, config, feedback, options } = data ?? {};
|
|
6803
6915
|
const { sendMessage } = useAgentChat();
|
|
6804
|
-
const [clicked, setClicked] = (0,
|
|
6916
|
+
const [clicked, setClicked] = (0, import_react32.useState)(false);
|
|
6805
6917
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_antd12.Space, { direction: "vertical", style: { width: "100%" }, children: [
|
|
6806
6918
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MDResponse, { content: message23 }),
|
|
6807
6919
|
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)(
|
|
@@ -6880,7 +6992,7 @@ var ConfirmFeedback = ({
|
|
|
6880
6992
|
|
|
6881
6993
|
// src/components/GenUI/elements/clarify_feedback.tsx
|
|
6882
6994
|
var import_antd13 = require("antd");
|
|
6883
|
-
var
|
|
6995
|
+
var import_react33 = require("react");
|
|
6884
6996
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
6885
6997
|
var { Text: Text5 } = import_antd13.Typography;
|
|
6886
6998
|
var ClarifyFeedback = ({
|
|
@@ -6889,9 +7001,9 @@ var ClarifyFeedback = ({
|
|
|
6889
7001
|
}) => {
|
|
6890
7002
|
const { questions } = data ?? {};
|
|
6891
7003
|
const { sendMessage } = useAgentChat();
|
|
6892
|
-
const [currentStep, setCurrentStep] = (0,
|
|
6893
|
-
const [answers, setAnswers] = (0,
|
|
6894
|
-
const [submitted, setSubmitted] = (0,
|
|
7004
|
+
const [currentStep, setCurrentStep] = (0, import_react33.useState)(0);
|
|
7005
|
+
const [answers, setAnswers] = (0, import_react33.useState)({});
|
|
7006
|
+
const [submitted, setSubmitted] = (0, import_react33.useState)(false);
|
|
6895
7007
|
const currentQuestion = questions?.[currentStep];
|
|
6896
7008
|
const totalQuestions = questions?.length || 0;
|
|
6897
7009
|
const handleOptionChange = (selected) => {
|
|
@@ -7398,7 +7510,7 @@ var ToolCall = ({ data }) => {
|
|
|
7398
7510
|
var import_antd16 = require("antd");
|
|
7399
7511
|
var import_antd_style8 = require("antd-style");
|
|
7400
7512
|
var import_icons9 = require("@ant-design/icons");
|
|
7401
|
-
var
|
|
7513
|
+
var import_react34 = require("react");
|
|
7402
7514
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
7403
7515
|
var { Text: Text7 } = import_antd16.Typography;
|
|
7404
7516
|
var useStyle3 = (0, import_antd_style8.createStyles)(({ token, css }) => ({
|
|
@@ -7443,10 +7555,10 @@ var Todo = ({
|
|
|
7443
7555
|
const allCompleted = data.every((item) => item.status === "completed");
|
|
7444
7556
|
return allPending || allCompleted;
|
|
7445
7557
|
};
|
|
7446
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
7558
|
+
const [isExpanded, setIsExpanded] = (0, import_react34.useState)(
|
|
7447
7559
|
() => smartCollapse ? getDefaultExpanded() : false
|
|
7448
7560
|
);
|
|
7449
|
-
(0,
|
|
7561
|
+
(0, import_react34.useEffect)(() => {
|
|
7450
7562
|
if (smartCollapse) {
|
|
7451
7563
|
setIsExpanded(getDefaultExpanded());
|
|
7452
7564
|
}
|
|
@@ -7637,7 +7749,7 @@ var WriteTodos = ({
|
|
|
7637
7749
|
};
|
|
7638
7750
|
|
|
7639
7751
|
// src/components/GenUI/FileExplorer.tsx
|
|
7640
|
-
var
|
|
7752
|
+
var import_react35 = require("react");
|
|
7641
7753
|
var import_antd18 = require("antd");
|
|
7642
7754
|
var import_icons12 = require("@ant-design/icons");
|
|
7643
7755
|
var import_antd_style9 = require("antd-style");
|
|
@@ -7905,10 +8017,10 @@ var FileExplorer = ({
|
|
|
7905
8017
|
}) => {
|
|
7906
8018
|
const { files } = data ?? {};
|
|
7907
8019
|
const { styles, cx } = useStyles5();
|
|
7908
|
-
const [fileList, setFileList] = (0,
|
|
7909
|
-
const [selectedKey, setSelectedKey] = (0,
|
|
7910
|
-
const [expandedKeys, setExpandedKeys] = (0,
|
|
7911
|
-
(0,
|
|
8020
|
+
const [fileList, setFileList] = (0, import_react35.useState)([]);
|
|
8021
|
+
const [selectedKey, setSelectedKey] = (0, import_react35.useState)("");
|
|
8022
|
+
const [expandedKeys, setExpandedKeys] = (0, import_react35.useState)([]);
|
|
8023
|
+
(0, import_react35.useEffect)(() => {
|
|
7912
8024
|
let list = [];
|
|
7913
8025
|
if (Array.isArray(files)) {
|
|
7914
8026
|
list = files;
|
|
@@ -7924,11 +8036,11 @@ var FileExplorer = ({
|
|
|
7924
8036
|
setSelectedKey(list[0].name);
|
|
7925
8037
|
}
|
|
7926
8038
|
}, [files]);
|
|
7927
|
-
const treeData = (0,
|
|
8039
|
+
const treeData = (0, import_react35.useMemo)(
|
|
7928
8040
|
() => buildTreeData(fileList, expandedKeys),
|
|
7929
8041
|
[fileList, expandedKeys]
|
|
7930
8042
|
);
|
|
7931
|
-
(0,
|
|
8043
|
+
(0, import_react35.useEffect)(() => {
|
|
7932
8044
|
if (treeData.length > 0 && expandedKeys.length === 0) {
|
|
7933
8045
|
const getAllKeys = (nodes) => {
|
|
7934
8046
|
let keys = [];
|
|
@@ -7945,7 +8057,7 @@ var FileExplorer = ({
|
|
|
7945
8057
|
setExpandedKeys(getAllKeys(treeData));
|
|
7946
8058
|
}
|
|
7947
8059
|
}, [treeData.length]);
|
|
7948
|
-
const selectedFile = (0,
|
|
8060
|
+
const selectedFile = (0, import_react35.useMemo)(() => {
|
|
7949
8061
|
return fileList.find((f) => f.name === selectedKey);
|
|
7950
8062
|
}, [fileList, selectedKey]);
|
|
7951
8063
|
const renderContent = () => {
|
|
@@ -8014,7 +8126,7 @@ var FileExplorer = ({
|
|
|
8014
8126
|
var import_x2 = require("@ant-design/x");
|
|
8015
8127
|
var import_antd19 = require("antd");
|
|
8016
8128
|
var import_dayjs = __toESM(require("dayjs"));
|
|
8017
|
-
var
|
|
8129
|
+
var import_react36 = require("react");
|
|
8018
8130
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
8019
8131
|
var AttachmentsCard = ({
|
|
8020
8132
|
data,
|
|
@@ -8028,7 +8140,7 @@ var AttachmentsCard = ({
|
|
|
8028
8140
|
const baseURL = config.baseURL;
|
|
8029
8141
|
const fileBaseURL = `${baseURL}/api/assistants/${assistantId}/threads/${threadId}/sandbox/downloadfile?path=`;
|
|
8030
8142
|
const { Text: Text48 } = import_antd19.Typography;
|
|
8031
|
-
const [showAll, setShowAll] = (0,
|
|
8143
|
+
const [showAll, setShowAll] = (0, import_react36.useState)(false);
|
|
8032
8144
|
const openSideApp = useSideAppOpener();
|
|
8033
8145
|
const getStyles = () => {
|
|
8034
8146
|
switch (size) {
|
|
@@ -8210,7 +8322,7 @@ var AttachmentsCard = ({
|
|
|
8210
8322
|
|
|
8211
8323
|
// src/components/GenUI/elements/attachments_viewer_side_app.tsx
|
|
8212
8324
|
var import_antd20 = require("antd");
|
|
8213
|
-
var
|
|
8325
|
+
var import_react37 = require("react");
|
|
8214
8326
|
|
|
8215
8327
|
// src/components/GenUI/RenderMDFromURL.tsx
|
|
8216
8328
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
@@ -8231,13 +8343,13 @@ function AttachmentsViewerSideApp({
|
|
|
8231
8343
|
data,
|
|
8232
8344
|
component_key
|
|
8233
8345
|
}) {
|
|
8234
|
-
const [loading, setLoading] = (0,
|
|
8346
|
+
const [loading, setLoading] = (0, import_react37.useState)(false);
|
|
8235
8347
|
const { file_id, url, full_url } = data ?? {};
|
|
8236
|
-
const [fileUri, setFileUri] = (0,
|
|
8348
|
+
const [fileUri, setFileUri] = (0, import_react37.useState)({
|
|
8237
8349
|
url: full_url || "",
|
|
8238
8350
|
fileName: extractFileName(file_id || "")
|
|
8239
8351
|
});
|
|
8240
|
-
(0,
|
|
8352
|
+
(0, import_react37.useEffect)(() => {
|
|
8241
8353
|
setFileUri({
|
|
8242
8354
|
url: full_url || "",
|
|
8243
8355
|
fileName: extractFileName(file_id || "")
|
|
@@ -8281,7 +8393,7 @@ function AttachmentsViewerSideApp({
|
|
|
8281
8393
|
var import_antd22 = require("antd");
|
|
8282
8394
|
|
|
8283
8395
|
// src/components/GenUI/elements/ContentPreviewCollapse.tsx
|
|
8284
|
-
var
|
|
8396
|
+
var import_react38 = require("react");
|
|
8285
8397
|
var import_antd21 = require("antd");
|
|
8286
8398
|
var import_antd_style10 = require("antd-style");
|
|
8287
8399
|
var import_icons13 = require("@ant-design/icons");
|
|
@@ -8351,18 +8463,18 @@ var ContentPreviewCollapse = ({
|
|
|
8351
8463
|
showAllText = "Show all content",
|
|
8352
8464
|
showLessText = "Show less"
|
|
8353
8465
|
}) => {
|
|
8354
|
-
const [showFullContent, setShowFullContent] = (0,
|
|
8355
|
-
const [isOverflowing, setIsOverflowing] = (0,
|
|
8356
|
-
const contentRef = (0,
|
|
8466
|
+
const [showFullContent, setShowFullContent] = (0, import_react38.useState)(false);
|
|
8467
|
+
const [isOverflowing, setIsOverflowing] = (0, import_react38.useState)(false);
|
|
8468
|
+
const contentRef = (0, import_react38.useRef)(null);
|
|
8357
8469
|
const showShadow = isOverflowing && !showFullContent;
|
|
8358
8470
|
const { styles, cx } = useStyle4({ showShadow });
|
|
8359
|
-
const checkOverflow = (0,
|
|
8471
|
+
const checkOverflow = (0, import_react38.useCallback)(() => {
|
|
8360
8472
|
if (contentRef.current) {
|
|
8361
8473
|
const scrollHeight = contentRef.current.scrollHeight;
|
|
8362
8474
|
setIsOverflowing(scrollHeight > collapsedMaxHeight);
|
|
8363
8475
|
}
|
|
8364
8476
|
}, [collapsedMaxHeight]);
|
|
8365
|
-
(0,
|
|
8477
|
+
(0, import_react38.useEffect)(() => {
|
|
8366
8478
|
const element = contentRef.current;
|
|
8367
8479
|
if (!element) return;
|
|
8368
8480
|
checkOverflow();
|
|
@@ -8827,17 +8939,17 @@ var import_x6 = require("@ant-design/x");
|
|
|
8827
8939
|
var import_x3 = require("@ant-design/x");
|
|
8828
8940
|
var import_antd25 = require("antd");
|
|
8829
8941
|
var import_ErrorBoundary = __toESM(require("antd/es/alert/ErrorBoundary"));
|
|
8830
|
-
var
|
|
8942
|
+
var import_react39 = require("react");
|
|
8831
8943
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
8832
8944
|
var LazyBubble = ({
|
|
8833
8945
|
message: message23,
|
|
8834
8946
|
renderContent,
|
|
8835
8947
|
autoLoadRightPanel
|
|
8836
8948
|
}) => {
|
|
8837
|
-
const ref = (0,
|
|
8838
|
-
const [isVisible, setIsVisible] = (0,
|
|
8839
|
-
const [wasEverVisible, setWasEverVisible] = (0,
|
|
8840
|
-
(0,
|
|
8949
|
+
const ref = (0, import_react39.useRef)(null);
|
|
8950
|
+
const [isVisible, setIsVisible] = (0, import_react39.useState)(false);
|
|
8951
|
+
const [wasEverVisible, setWasEverVisible] = (0, import_react39.useState)(false);
|
|
8952
|
+
(0, import_react39.useEffect)(() => {
|
|
8841
8953
|
const observer = new IntersectionObserver(
|
|
8842
8954
|
([entry]) => {
|
|
8843
8955
|
const visible = entry.isIntersecting;
|
|
@@ -8857,7 +8969,7 @@ var LazyBubble = ({
|
|
|
8857
8969
|
}
|
|
8858
8970
|
};
|
|
8859
8971
|
}, [wasEverVisible]);
|
|
8860
|
-
(0,
|
|
8972
|
+
(0, import_react39.useEffect)(() => {
|
|
8861
8973
|
autoLoadRightPanel?.();
|
|
8862
8974
|
}, []);
|
|
8863
8975
|
const getPlaceholder = () => {
|
|
@@ -8866,7 +8978,7 @@ var LazyBubble = ({
|
|
|
8866
8978
|
};
|
|
8867
8979
|
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() }) });
|
|
8868
8980
|
};
|
|
8869
|
-
var MemoizedBubbleList = (0,
|
|
8981
|
+
var MemoizedBubbleList = (0, import_react39.memo)(
|
|
8870
8982
|
({
|
|
8871
8983
|
items,
|
|
8872
8984
|
role,
|
|
@@ -8889,13 +9001,13 @@ var MessageList = ({
|
|
|
8889
9001
|
}) => {
|
|
8890
9002
|
const { styles } = useStyle();
|
|
8891
9003
|
const openSideApp = useSideAppOpener();
|
|
8892
|
-
const messageLengthRef = (0,
|
|
8893
|
-
(0,
|
|
9004
|
+
const messageLengthRef = (0, import_react39.useRef)(messages?.length ?? 0);
|
|
9005
|
+
(0, import_react39.useEffect)(() => {
|
|
8894
9006
|
if (messages?.length) {
|
|
8895
9007
|
messageLengthRef.current = messages?.length;
|
|
8896
9008
|
}
|
|
8897
9009
|
}, [messages?.length]);
|
|
8898
|
-
const renderContent = (0,
|
|
9010
|
+
const renderContent = (0, import_react39.useCallback)((message23) => {
|
|
8899
9011
|
const { content } = message23;
|
|
8900
9012
|
try {
|
|
8901
9013
|
const json = JSON.parse(content);
|
|
@@ -8912,7 +9024,7 @@ ${JSON.stringify(tool_call)}
|
|
|
8912
9024
|
const content_md = [content, ...tool_calls_md].join("\n");
|
|
8913
9025
|
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 }) });
|
|
8914
9026
|
}, []);
|
|
8915
|
-
const items = (0,
|
|
9027
|
+
const items = (0, import_react39.useMemo)(
|
|
8916
9028
|
() => messages.map((message23, index) => ({
|
|
8917
9029
|
key: message23.id,
|
|
8918
9030
|
role: message23.role,
|
|
@@ -8991,7 +9103,7 @@ ${JSON.stringify(tool_call)}
|
|
|
8991
9103
|
|
|
8992
9104
|
// src/components/Chat/Chating.tsx
|
|
8993
9105
|
var import_antd71 = require("antd");
|
|
8994
|
-
var
|
|
9106
|
+
var import_react82 = __toESM(require("react"));
|
|
8995
9107
|
var import_lucide_react20 = require("lucide-react");
|
|
8996
9108
|
|
|
8997
9109
|
// src/components/GenUI/HITLContainer.tsx
|
|
@@ -9060,7 +9172,7 @@ var HITLContainer = () => {
|
|
|
9060
9172
|
var import_antd27 = require("antd");
|
|
9061
9173
|
var import_antd_style13 = require("antd-style");
|
|
9062
9174
|
var import_icons15 = require("@ant-design/icons");
|
|
9063
|
-
var
|
|
9175
|
+
var import_react40 = require("react");
|
|
9064
9176
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
9065
9177
|
var useStyle7 = (0, import_antd_style13.createStyles)(({ css, token }) => ({
|
|
9066
9178
|
container: css`
|
|
@@ -9150,9 +9262,9 @@ var useStyle7 = (0, import_antd_style13.createStyles)(({ css, token }) => ({
|
|
|
9150
9262
|
var PendingMessagesContainer = () => {
|
|
9151
9263
|
const { styles } = useStyle7();
|
|
9152
9264
|
const { pendingMessages, sendMessage, removePendingMessage } = useAgentChat();
|
|
9153
|
-
const [expanded, setExpanded] = (0,
|
|
9154
|
-
const [sendingId, setSendingId] = (0,
|
|
9155
|
-
const [deletingId, setDeletingId] = (0,
|
|
9265
|
+
const [expanded, setExpanded] = (0, import_react40.useState)(true);
|
|
9266
|
+
const [sendingId, setSendingId] = (0, import_react40.useState)(null);
|
|
9267
|
+
const [deletingId, setDeletingId] = (0, import_react40.useState)(null);
|
|
9156
9268
|
if (!pendingMessages || pendingMessages.length === 0) return null;
|
|
9157
9269
|
const handleSendMessage = async (msg) => {
|
|
9158
9270
|
if (sendingId || deletingId) return;
|
|
@@ -9607,7 +9719,7 @@ var FileExplorerButton = ({}) => {
|
|
|
9607
9719
|
};
|
|
9608
9720
|
|
|
9609
9721
|
// src/components/Chat/ScheduleButton.tsx
|
|
9610
|
-
var
|
|
9722
|
+
var import_react41 = require("react");
|
|
9611
9723
|
var import_antd31 = require("antd");
|
|
9612
9724
|
var import_icons17 = require("@ant-design/icons");
|
|
9613
9725
|
var import_client_sdk5 = require("@axiom-lattice/client-sdk");
|
|
@@ -9618,10 +9730,10 @@ var ScheduleButton = ({
|
|
|
9618
9730
|
const { threadId, assistantId } = useAgentChat();
|
|
9619
9731
|
const { openSideApp } = useChatUIContext();
|
|
9620
9732
|
const client = useClient(assistantId || "");
|
|
9621
|
-
const [scheduledTasks, setScheduledTasks] = (0,
|
|
9622
|
-
const [loading, setLoading] = (0,
|
|
9623
|
-
const [taskCount, setTaskCount] = (0,
|
|
9624
|
-
const fetchScheduledTasks = (0,
|
|
9733
|
+
const [scheduledTasks, setScheduledTasks] = (0, import_react41.useState)([]);
|
|
9734
|
+
const [loading, setLoading] = (0, import_react41.useState)(false);
|
|
9735
|
+
const [taskCount, setTaskCount] = (0, import_react41.useState)(0);
|
|
9736
|
+
const fetchScheduledTasks = (0, import_react41.useCallback)(async () => {
|
|
9625
9737
|
if (!threadId) return;
|
|
9626
9738
|
setLoading(true);
|
|
9627
9739
|
try {
|
|
@@ -9639,7 +9751,7 @@ var ScheduleButton = ({
|
|
|
9639
9751
|
setLoading(false);
|
|
9640
9752
|
}
|
|
9641
9753
|
}, [client, threadId]);
|
|
9642
|
-
(0,
|
|
9754
|
+
(0, import_react41.useEffect)(() => {
|
|
9643
9755
|
fetchScheduledTasks();
|
|
9644
9756
|
}, [fetchScheduledTasks]);
|
|
9645
9757
|
if (!threadId) {
|
|
@@ -9933,7 +10045,7 @@ var AgentHeader = ({
|
|
|
9933
10045
|
};
|
|
9934
10046
|
|
|
9935
10047
|
// src/components/Chat/ThreadManagementButtons.tsx
|
|
9936
|
-
var
|
|
10048
|
+
var import_react42 = require("react");
|
|
9937
10049
|
var import_antd35 = require("antd");
|
|
9938
10050
|
var import_icons20 = require("@ant-design/icons");
|
|
9939
10051
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
@@ -9946,7 +10058,7 @@ var CreateThreadButton = () => {
|
|
|
9946
10058
|
if (!assistantId) {
|
|
9947
10059
|
return null;
|
|
9948
10060
|
}
|
|
9949
|
-
const handleCreateThread = (0,
|
|
10061
|
+
const handleCreateThread = (0, import_react42.useCallback)(async () => {
|
|
9950
10062
|
try {
|
|
9951
10063
|
await createThread();
|
|
9952
10064
|
} catch (error) {
|
|
@@ -9979,7 +10091,7 @@ var ThreadListButton = () => {
|
|
|
9979
10091
|
if (!assistantId) {
|
|
9980
10092
|
return null;
|
|
9981
10093
|
}
|
|
9982
|
-
const handleRefresh = (0,
|
|
10094
|
+
const handleRefresh = (0, import_react42.useCallback)(async () => {
|
|
9983
10095
|
try {
|
|
9984
10096
|
await listThreads();
|
|
9985
10097
|
} catch (error) {
|
|
@@ -10023,8 +10135,8 @@ var ThreadListButton = () => {
|
|
|
10023
10135
|
) });
|
|
10024
10136
|
};
|
|
10025
10137
|
var ThreadManagementButtons = () => {
|
|
10026
|
-
const shellContext = (0,
|
|
10027
|
-
const conversationContext = (0,
|
|
10138
|
+
const shellContext = (0, import_react42.useContext)(LatticeChatShellContext);
|
|
10139
|
+
const conversationContext = (0, import_react42.useContext)(ConversationContext);
|
|
10028
10140
|
if (!shellContext || !conversationContext) {
|
|
10029
10141
|
return null;
|
|
10030
10142
|
}
|
|
@@ -10044,16 +10156,16 @@ var ThreadManagementButtons = () => {
|
|
|
10044
10156
|
};
|
|
10045
10157
|
|
|
10046
10158
|
// src/context/WorkspaceContext.tsx
|
|
10047
|
-
var
|
|
10159
|
+
var import_react74 = __toESM(require("react"));
|
|
10048
10160
|
var import_client_sdk6 = require("@axiom-lattice/client-sdk");
|
|
10049
10161
|
|
|
10050
10162
|
// src/components/Chat/WorkspaceResourceManager.tsx
|
|
10051
|
-
var
|
|
10163
|
+
var import_react73 = require("react");
|
|
10052
10164
|
var import_lucide_react14 = require("lucide-react");
|
|
10053
10165
|
var import_antd63 = require("antd");
|
|
10054
10166
|
|
|
10055
10167
|
// src/components/Chat/Menu.tsx
|
|
10056
|
-
var
|
|
10168
|
+
var import_react43 = __toESM(require("react"));
|
|
10057
10169
|
var import_antd36 = require("antd");
|
|
10058
10170
|
var import_lucide_react4 = require("lucide-react");
|
|
10059
10171
|
var import_antd_style16 = require("antd-style");
|
|
@@ -10165,10 +10277,10 @@ var Menu = ({
|
|
|
10165
10277
|
const { styles: menuStyles } = useMenuStyles();
|
|
10166
10278
|
const { styles } = useStyle();
|
|
10167
10279
|
const isControlled = collapsed !== void 0;
|
|
10168
|
-
const [internalIsIconView, setInternalIsIconView] = (0,
|
|
10280
|
+
const [internalIsIconView, setInternalIsIconView] = (0, import_react43.useState)(!defaultExpanded);
|
|
10169
10281
|
const isIconView = isControlled ? collapsed : internalIsIconView;
|
|
10170
|
-
const [drawerStates, setDrawerStates] = (0,
|
|
10171
|
-
const [expandedInlineDrawers, setExpandedInlineDrawers] = (0,
|
|
10282
|
+
const [drawerStates, setDrawerStates] = (0, import_react43.useState)({});
|
|
10283
|
+
const [expandedInlineDrawers, setExpandedInlineDrawers] = (0, import_react43.useState)(
|
|
10172
10284
|
() => {
|
|
10173
10285
|
const defaultExpanded2 = /* @__PURE__ */ new Set();
|
|
10174
10286
|
items.forEach((item) => {
|
|
@@ -10182,8 +10294,8 @@ var Menu = ({
|
|
|
10182
10294
|
const shouldShowIconMode = isIconView || forceIconMode;
|
|
10183
10295
|
const isExpanded = !shouldShowIconMode;
|
|
10184
10296
|
const isCollapsed = !isExpanded;
|
|
10185
|
-
const groupedItems = (0,
|
|
10186
|
-
const handleItemClick = (0,
|
|
10297
|
+
const groupedItems = (0, import_react43.useMemo)(() => groupMenuItems(items), [items]);
|
|
10298
|
+
const handleItemClick = (0, import_react43.useCallback)(
|
|
10187
10299
|
(item) => {
|
|
10188
10300
|
onItemClick?.(item);
|
|
10189
10301
|
if (item.type === "drawer") {
|
|
@@ -10205,10 +10317,10 @@ var Menu = ({
|
|
|
10205
10317
|
},
|
|
10206
10318
|
[onItemClick, shouldShowIconMode]
|
|
10207
10319
|
);
|
|
10208
|
-
const handleCloseDrawer = (0,
|
|
10320
|
+
const handleCloseDrawer = (0, import_react43.useCallback)((itemId) => {
|
|
10209
10321
|
setDrawerStates((prev) => ({ ...prev, [itemId]: false }));
|
|
10210
10322
|
}, []);
|
|
10211
|
-
const handleToggleExpand = (0,
|
|
10323
|
+
const handleToggleExpand = (0, import_react43.useCallback)(() => {
|
|
10212
10324
|
if (!forceIconMode) {
|
|
10213
10325
|
const newValue = !isIconView;
|
|
10214
10326
|
if (isControlled) {
|
|
@@ -10220,7 +10332,7 @@ var Menu = ({
|
|
|
10220
10332
|
}, [forceIconMode, isIconView, isControlled, onCollapsedChange]);
|
|
10221
10333
|
const renderIconMode = () => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: `${menuStyles.sidebar} ${styles.iconMode} ${className || ""}`, style, children: [
|
|
10222
10334
|
/* @__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" }) }),
|
|
10223
|
-
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: styles.iconModeContainer, children: groupedItems.map(({ group, items: items2 }, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
10335
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: styles.iconModeContainer, children: groupedItems.map(({ group, items: items2 }, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react43.default.Fragment, { children: [
|
|
10224
10336
|
groupIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: styles.iconModeDivider }),
|
|
10225
10337
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: styles.iconModeGroup, children: items2.map((item) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
10226
10338
|
"button",
|
|
@@ -10271,7 +10383,7 @@ var Menu = ({
|
|
|
10271
10383
|
items2.map((item) => {
|
|
10272
10384
|
const isInline = item.inline ?? false;
|
|
10273
10385
|
const isExpanded2 = expandedInlineDrawers.has(item.id);
|
|
10274
|
-
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
10386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react43.default.Fragment, { children: [
|
|
10275
10387
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
10276
10388
|
"button",
|
|
10277
10389
|
{
|
|
@@ -10368,13 +10480,13 @@ var Menu = ({
|
|
|
10368
10480
|
};
|
|
10369
10481
|
|
|
10370
10482
|
// src/components/Chat/ProjectCardList.tsx
|
|
10371
|
-
var
|
|
10483
|
+
var import_react45 = require("react");
|
|
10372
10484
|
var import_antd38 = require("antd");
|
|
10373
10485
|
var import_antd_style17 = require("antd-style");
|
|
10374
10486
|
var import_lucide_react5 = require("lucide-react");
|
|
10375
10487
|
|
|
10376
10488
|
// src/components/Chat/CreateProjectModal.tsx
|
|
10377
|
-
var
|
|
10489
|
+
var import_react44 = require("react");
|
|
10378
10490
|
var import_antd37 = require("antd");
|
|
10379
10491
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
10380
10492
|
var CreateProjectModal = ({
|
|
@@ -10383,7 +10495,7 @@ var CreateProjectModal = ({
|
|
|
10383
10495
|
onCreate
|
|
10384
10496
|
}) => {
|
|
10385
10497
|
const [form] = import_antd37.Form.useForm();
|
|
10386
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
10498
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react44.useState)(false);
|
|
10387
10499
|
const handleSubmit = async (values) => {
|
|
10388
10500
|
setIsSubmitting(true);
|
|
10389
10501
|
try {
|
|
@@ -10736,8 +10848,8 @@ var useStyle8 = (0, import_antd_style17.createStyles)(({ css, token }) => ({
|
|
|
10736
10848
|
var ProjectCardList = () => {
|
|
10737
10849
|
const { styles } = useStyle8();
|
|
10738
10850
|
const { token } = import_antd38.theme.useToken();
|
|
10739
|
-
const [viewMode, setViewMode] = (0,
|
|
10740
|
-
const [isCreateModalOpen, setIsCreateModalOpen] = (0,
|
|
10851
|
+
const [viewMode, setViewMode] = (0, import_react45.useState)("grid");
|
|
10852
|
+
const [isCreateModalOpen, setIsCreateModalOpen] = (0, import_react45.useState)(false);
|
|
10741
10853
|
const {
|
|
10742
10854
|
projects,
|
|
10743
10855
|
loading,
|
|
@@ -10880,7 +10992,7 @@ var ProjectCardList = () => {
|
|
|
10880
10992
|
};
|
|
10881
10993
|
|
|
10882
10994
|
// src/components/Chat/MetricsConfigDrawerContent.tsx
|
|
10883
|
-
var
|
|
10995
|
+
var import_react46 = require("react");
|
|
10884
10996
|
var import_lucide_react6 = require("lucide-react");
|
|
10885
10997
|
var import_antd39 = require("antd");
|
|
10886
10998
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
@@ -10891,13 +11003,13 @@ var MetricsConfigDrawerContent = () => {
|
|
|
10891
11003
|
const { config } = useLatticeChatShellContext();
|
|
10892
11004
|
const { token } = useToken2();
|
|
10893
11005
|
const { get, post, put, del } = useApi();
|
|
10894
|
-
const [configs, setConfigs] = (0,
|
|
10895
|
-
const [loading, setLoading] = (0,
|
|
10896
|
-
const [testingId, setTestingId] = (0,
|
|
10897
|
-
const [formModalOpen, setFormModalOpen] = (0,
|
|
10898
|
-
const [editingConfig, setEditingConfig] = (0,
|
|
11006
|
+
const [configs, setConfigs] = (0, import_react46.useState)([]);
|
|
11007
|
+
const [loading, setLoading] = (0, import_react46.useState)(false);
|
|
11008
|
+
const [testingId, setTestingId] = (0, import_react46.useState)(null);
|
|
11009
|
+
const [formModalOpen, setFormModalOpen] = (0, import_react46.useState)(false);
|
|
11010
|
+
const [editingConfig, setEditingConfig] = (0, import_react46.useState)(null);
|
|
10899
11011
|
const tenantId = config.headers?.["x-tenant-id"] || "default";
|
|
10900
|
-
(0,
|
|
11012
|
+
(0, import_react46.useEffect)(() => {
|
|
10901
11013
|
loadConfigs();
|
|
10902
11014
|
}, [tenantId]);
|
|
10903
11015
|
const loadConfigs = async () => {
|
|
@@ -11096,14 +11208,14 @@ var MetricsConfigFormModal = ({
|
|
|
11096
11208
|
const { token } = useToken2();
|
|
11097
11209
|
const { get, post, put } = useApi();
|
|
11098
11210
|
const tenantId = config.headers?.["x-tenant-id"] || "default";
|
|
11099
|
-
const [currentStep, setCurrentStep] = (0,
|
|
11100
|
-
const [saving, setSaving] = (0,
|
|
11101
|
-
const [fetchingDatasources, setFetchingDatasources] = (0,
|
|
11102
|
-
const [availableDatasources, setAvailableDatasources] = (0,
|
|
11103
|
-
const [selectedViewDatasource, setSelectedViewDatasource] = (0,
|
|
11104
|
-
const [availableMetrics, setAvailableMetrics] = (0,
|
|
11105
|
-
const [fetchingMetrics, setFetchingMetrics] = (0,
|
|
11106
|
-
const [formData, setFormData] = (0,
|
|
11211
|
+
const [currentStep, setCurrentStep] = (0, import_react46.useState)(0);
|
|
11212
|
+
const [saving, setSaving] = (0, import_react46.useState)(false);
|
|
11213
|
+
const [fetchingDatasources, setFetchingDatasources] = (0, import_react46.useState)(false);
|
|
11214
|
+
const [availableDatasources, setAvailableDatasources] = (0, import_react46.useState)([]);
|
|
11215
|
+
const [selectedViewDatasource, setSelectedViewDatasource] = (0, import_react46.useState)(null);
|
|
11216
|
+
const [availableMetrics, setAvailableMetrics] = (0, import_react46.useState)([]);
|
|
11217
|
+
const [fetchingMetrics, setFetchingMetrics] = (0, import_react46.useState)(false);
|
|
11218
|
+
const [formData, setFormData] = (0, import_react46.useState)({
|
|
11107
11219
|
key: editingConfig?.key || "",
|
|
11108
11220
|
name: editingConfig?.name || "",
|
|
11109
11221
|
description: editingConfig?.description || "",
|
|
@@ -11143,12 +11255,12 @@ var MetricsConfigFormModal = ({
|
|
|
11143
11255
|
selectedDataSources: editingConfig?.config?.selectedDataSources || []
|
|
11144
11256
|
});
|
|
11145
11257
|
};
|
|
11146
|
-
(0,
|
|
11258
|
+
(0, import_react46.useEffect)(() => {
|
|
11147
11259
|
if (open) {
|
|
11148
11260
|
resetForm();
|
|
11149
11261
|
}
|
|
11150
11262
|
}, [open, editingConfig]);
|
|
11151
|
-
(0,
|
|
11263
|
+
(0, import_react46.useEffect)(() => {
|
|
11152
11264
|
if (currentStep === 1 && availableDatasources.length === 0 && !fetchingDatasources) {
|
|
11153
11265
|
handleFetchDatasources();
|
|
11154
11266
|
}
|
|
@@ -11546,7 +11658,7 @@ var MetricsConfigFormModal = ({
|
|
|
11546
11658
|
};
|
|
11547
11659
|
|
|
11548
11660
|
// src/components/Chat/DatabaseConfigDrawerContent.tsx
|
|
11549
|
-
var
|
|
11661
|
+
var import_react47 = require("react");
|
|
11550
11662
|
var import_antd_style18 = require("antd-style");
|
|
11551
11663
|
var import_lucide_react7 = require("lucide-react");
|
|
11552
11664
|
var import_antd40 = require("antd");
|
|
@@ -11620,12 +11732,12 @@ var DatabaseConfigDrawerContent = ({
|
|
|
11620
11732
|
const { styles } = useStyles7();
|
|
11621
11733
|
const { config } = useLatticeChatShellContext();
|
|
11622
11734
|
const { get, post, put, del } = useApi();
|
|
11623
|
-
const [configs, setConfigs] = (0,
|
|
11624
|
-
const [loading, setLoading] = (0,
|
|
11625
|
-
const [testingId, setTestingId] = (0,
|
|
11626
|
-
const [formModalOpen, setFormModalOpen] = (0,
|
|
11627
|
-
const [editingConfig, setEditingConfig] = (0,
|
|
11628
|
-
(0,
|
|
11735
|
+
const [configs, setConfigs] = (0, import_react47.useState)([]);
|
|
11736
|
+
const [loading, setLoading] = (0, import_react47.useState)(false);
|
|
11737
|
+
const [testingId, setTestingId] = (0, import_react47.useState)(null);
|
|
11738
|
+
const [formModalOpen, setFormModalOpen] = (0, import_react47.useState)(false);
|
|
11739
|
+
const [editingConfig, setEditingConfig] = (0, import_react47.useState)(null);
|
|
11740
|
+
(0, import_react47.useEffect)(() => {
|
|
11629
11741
|
loadConfigs();
|
|
11630
11742
|
}, [tenantId]);
|
|
11631
11743
|
const loadConfigs = async () => {
|
|
@@ -11834,7 +11946,7 @@ var DatabaseConfigFormModal = ({
|
|
|
11834
11946
|
}) => {
|
|
11835
11947
|
const { config } = useLatticeChatShellContext();
|
|
11836
11948
|
const { post, put } = useApi();
|
|
11837
|
-
const [formData, setFormData] = (0,
|
|
11949
|
+
const [formData, setFormData] = (0, import_react47.useState)({
|
|
11838
11950
|
key: editingConfig?.key || "",
|
|
11839
11951
|
name: editingConfig?.name || "",
|
|
11840
11952
|
description: editingConfig?.description || "",
|
|
@@ -11846,7 +11958,7 @@ var DatabaseConfigFormModal = ({
|
|
|
11846
11958
|
password: editingConfig?.config.password || "",
|
|
11847
11959
|
connectionString: editingConfig?.config.connectionString || ""
|
|
11848
11960
|
});
|
|
11849
|
-
const [saving, setSaving] = (0,
|
|
11961
|
+
const [saving, setSaving] = (0, import_react47.useState)(false);
|
|
11850
11962
|
const handleSubmit = async () => {
|
|
11851
11963
|
setSaving(true);
|
|
11852
11964
|
try {
|
|
@@ -12058,7 +12170,7 @@ var DatabaseConfigFormModal = ({
|
|
|
12058
12170
|
};
|
|
12059
12171
|
|
|
12060
12172
|
// src/components/Chat/McpConfigDrawerContent.tsx
|
|
12061
|
-
var
|
|
12173
|
+
var import_react48 = require("react");
|
|
12062
12174
|
var import_lucide_react8 = require("lucide-react");
|
|
12063
12175
|
var import_antd41 = require("antd");
|
|
12064
12176
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
@@ -12072,12 +12184,12 @@ var McpConfigDrawerContent = ({
|
|
|
12072
12184
|
const { config } = useLatticeChatShellContext();
|
|
12073
12185
|
const { token } = useToken3();
|
|
12074
12186
|
const { get, post, put, del } = useApi();
|
|
12075
|
-
const [configs, setConfigs] = (0,
|
|
12076
|
-
const [loading, setLoading] = (0,
|
|
12077
|
-
const [testingId, setTestingId] = (0,
|
|
12078
|
-
const [formModalOpen, setFormModalOpen] = (0,
|
|
12079
|
-
const [editingConfig, setEditingConfig] = (0,
|
|
12080
|
-
(0,
|
|
12187
|
+
const [configs, setConfigs] = (0, import_react48.useState)([]);
|
|
12188
|
+
const [loading, setLoading] = (0, import_react48.useState)(false);
|
|
12189
|
+
const [testingId, setTestingId] = (0, import_react48.useState)(null);
|
|
12190
|
+
const [formModalOpen, setFormModalOpen] = (0, import_react48.useState)(false);
|
|
12191
|
+
const [editingConfig, setEditingConfig] = (0, import_react48.useState)(null);
|
|
12192
|
+
(0, import_react48.useEffect)(() => {
|
|
12081
12193
|
loadConfigs();
|
|
12082
12194
|
}, [tenantId]);
|
|
12083
12195
|
const loadConfigs = async () => {
|
|
@@ -12291,11 +12403,11 @@ var McpConfigFormModal = ({
|
|
|
12291
12403
|
const { config } = useLatticeChatShellContext();
|
|
12292
12404
|
const { token } = useToken3();
|
|
12293
12405
|
const { post, put } = useApi();
|
|
12294
|
-
const [currentStep, setCurrentStep] = (0,
|
|
12295
|
-
const [saving, setSaving] = (0,
|
|
12296
|
-
const [fetchingTools, setFetchingTools] = (0,
|
|
12297
|
-
const [availableTools, setAvailableTools] = (0,
|
|
12298
|
-
const [formData, setFormData] = (0,
|
|
12406
|
+
const [currentStep, setCurrentStep] = (0, import_react48.useState)(0);
|
|
12407
|
+
const [saving, setSaving] = (0, import_react48.useState)(false);
|
|
12408
|
+
const [fetchingTools, setFetchingTools] = (0, import_react48.useState)(false);
|
|
12409
|
+
const [availableTools, setAvailableTools] = (0, import_react48.useState)([]);
|
|
12410
|
+
const [formData, setFormData] = (0, import_react48.useState)({
|
|
12299
12411
|
key: editingConfig?.key || "",
|
|
12300
12412
|
name: editingConfig?.name || "",
|
|
12301
12413
|
description: editingConfig?.description || "",
|
|
@@ -12335,12 +12447,12 @@ var McpConfigFormModal = ({
|
|
|
12335
12447
|
selectedTools: editingConfig?.selectedTools || []
|
|
12336
12448
|
});
|
|
12337
12449
|
};
|
|
12338
|
-
(0,
|
|
12450
|
+
(0, import_react48.useEffect)(() => {
|
|
12339
12451
|
if (open) {
|
|
12340
12452
|
resetForm();
|
|
12341
12453
|
}
|
|
12342
12454
|
}, [open, editingConfig]);
|
|
12343
|
-
(0,
|
|
12455
|
+
(0, import_react48.useEffect)(() => {
|
|
12344
12456
|
if (currentStep === 1 && availableTools.length === 0 && !fetchingTools) {
|
|
12345
12457
|
handleFetchTools();
|
|
12346
12458
|
}
|
|
@@ -12691,13 +12803,13 @@ var McpConfigFormModal = ({
|
|
|
12691
12803
|
};
|
|
12692
12804
|
|
|
12693
12805
|
// src/components/Chat/AssistantFlow.tsx
|
|
12694
|
-
var
|
|
12695
|
-
var
|
|
12806
|
+
var import_react54 = require("react");
|
|
12807
|
+
var import_react55 = require("@xyflow/react");
|
|
12696
12808
|
var import_style = require("@xyflow/react/dist/style.css");
|
|
12697
12809
|
|
|
12698
12810
|
// src/components/Chat/AssistantNode.tsx
|
|
12699
|
-
var
|
|
12700
|
-
var
|
|
12811
|
+
var import_react49 = require("react");
|
|
12812
|
+
var import_react50 = require("@xyflow/react");
|
|
12701
12813
|
var import_antd42 = require("antd");
|
|
12702
12814
|
var import_icons21 = require("@ant-design/icons");
|
|
12703
12815
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
@@ -12741,7 +12853,7 @@ var AssistantNode = ({
|
|
|
12741
12853
|
}
|
|
12742
12854
|
const badgeColor = getBadgeColor(assistant.id);
|
|
12743
12855
|
const initials = assistant.name?.split(" ").map((n) => n.charAt(0)).join("").toUpperCase().slice(0, 2) || "A";
|
|
12744
|
-
const { modelKey, tools, agentType, prompt, subAgents } = (0,
|
|
12856
|
+
const { modelKey, tools, agentType, prompt, subAgents } = (0, import_react49.useMemo)(() => {
|
|
12745
12857
|
if (!assistant.graphDefinition) {
|
|
12746
12858
|
return {
|
|
12747
12859
|
modelKey: void 0,
|
|
@@ -13146,7 +13258,7 @@ var AssistantNode = ({
|
|
|
13146
13258
|
padding: 4
|
|
13147
13259
|
},
|
|
13148
13260
|
children: [
|
|
13149
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
13261
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react50.Handle, { type: "target", position: import_react50.Position.Top }),
|
|
13150
13262
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
13151
13263
|
"div",
|
|
13152
13264
|
{
|
|
@@ -13470,7 +13582,7 @@ var AssistantNode = ({
|
|
|
13470
13582
|
]
|
|
13471
13583
|
}
|
|
13472
13584
|
),
|
|
13473
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
13585
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react50.Handle, { type: "source", position: import_react50.Position.Bottom })
|
|
13474
13586
|
]
|
|
13475
13587
|
}
|
|
13476
13588
|
)
|
|
@@ -13481,7 +13593,7 @@ var AssistantNode = ({
|
|
|
13481
13593
|
var AssistantNode_default = AssistantNode;
|
|
13482
13594
|
|
|
13483
13595
|
// src/components/Chat/AgentConfigPanel.tsx
|
|
13484
|
-
var
|
|
13596
|
+
var import_react51 = require("react");
|
|
13485
13597
|
var import_antd43 = require("antd");
|
|
13486
13598
|
var import_icons22 = require("@ant-design/icons");
|
|
13487
13599
|
var import_lucide_react9 = require("lucide-react");
|
|
@@ -13490,7 +13602,7 @@ var { TextArea: TextArea4 } = import_antd43.Input;
|
|
|
13490
13602
|
var { Text: Text18, Title: Title4 } = import_antd43.Typography;
|
|
13491
13603
|
var SectionCard = ({ title, icon, badge, children, defaultExpanded = true }) => {
|
|
13492
13604
|
const { token } = import_antd43.theme.useToken();
|
|
13493
|
-
const [expanded, setExpanded] = (0,
|
|
13605
|
+
const [expanded, setExpanded] = (0, import_react51.useState)(defaultExpanded);
|
|
13494
13606
|
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
13495
13607
|
import_antd43.Card,
|
|
13496
13608
|
{
|
|
@@ -13704,11 +13816,11 @@ var getMiddlewareTypeDefinition = (middlewareType, availableTypes) => {
|
|
|
13704
13816
|
return availableTypes?.find((t) => t.type === middlewareType);
|
|
13705
13817
|
};
|
|
13706
13818
|
var SkillListField = ({ propertyKey, label, value, onChange, token }) => {
|
|
13707
|
-
const [skills, setSkills] = (0,
|
|
13708
|
-
const [loading, setLoading] = (0,
|
|
13819
|
+
const [skills, setSkills] = (0, import_react51.useState)([]);
|
|
13820
|
+
const [loading, setLoading] = (0, import_react51.useState)(false);
|
|
13709
13821
|
const { get } = useApi();
|
|
13710
|
-
const fetchedRef = (0,
|
|
13711
|
-
(0,
|
|
13822
|
+
const fetchedRef = (0, import_react51.useRef)(false);
|
|
13823
|
+
(0, import_react51.useEffect)(() => {
|
|
13712
13824
|
if (fetchedRef.current) return;
|
|
13713
13825
|
fetchedRef.current = true;
|
|
13714
13826
|
const fetchSkills = async () => {
|
|
@@ -13815,11 +13927,11 @@ var SkillListField = ({ propertyKey, label, value, onChange, token }) => {
|
|
|
13815
13927
|
] }, propertyKey) });
|
|
13816
13928
|
};
|
|
13817
13929
|
var DatabaseListField = ({ propertyKey, label, value, onChange, token }) => {
|
|
13818
|
-
const [databases, setDatabases] = (0,
|
|
13819
|
-
const [loading, setLoading] = (0,
|
|
13930
|
+
const [databases, setDatabases] = (0, import_react51.useState)([]);
|
|
13931
|
+
const [loading, setLoading] = (0, import_react51.useState)(false);
|
|
13820
13932
|
const { get } = useApi();
|
|
13821
|
-
const fetchedRef = (0,
|
|
13822
|
-
(0,
|
|
13933
|
+
const fetchedRef = (0, import_react51.useRef)(false);
|
|
13934
|
+
(0, import_react51.useEffect)(() => {
|
|
13823
13935
|
if (fetchedRef.current) return;
|
|
13824
13936
|
fetchedRef.current = true;
|
|
13825
13937
|
const fetchDatabases = async () => {
|
|
@@ -13930,11 +14042,11 @@ var DatabaseListField = ({ propertyKey, label, value, onChange, token }) => {
|
|
|
13930
14042
|
] }, propertyKey) });
|
|
13931
14043
|
};
|
|
13932
14044
|
var MetricsListField = ({ propertyKey, label, value, onChange, token }) => {
|
|
13933
|
-
const [servers, setServers] = (0,
|
|
13934
|
-
const [loading, setLoading] = (0,
|
|
14045
|
+
const [servers, setServers] = (0, import_react51.useState)([]);
|
|
14046
|
+
const [loading, setLoading] = (0, import_react51.useState)(false);
|
|
13935
14047
|
const { get } = useApi();
|
|
13936
|
-
const fetchedRef = (0,
|
|
13937
|
-
(0,
|
|
14048
|
+
const fetchedRef = (0, import_react51.useRef)(false);
|
|
14049
|
+
(0, import_react51.useEffect)(() => {
|
|
13938
14050
|
if (fetchedRef.current) return;
|
|
13939
14051
|
fetchedRef.current = true;
|
|
13940
14052
|
const fetchMetricsServers = async () => {
|
|
@@ -14046,7 +14158,7 @@ var MetricsListField = ({ propertyKey, label, value, onChange, token }) => {
|
|
|
14046
14158
|
};
|
|
14047
14159
|
var TopologyEdgeField = ({ propertyKey, label, value, onChange, token }) => {
|
|
14048
14160
|
const edges = Array.isArray(value) ? value : [];
|
|
14049
|
-
const [newEdge, setNewEdge] = (0,
|
|
14161
|
+
const [newEdge, setNewEdge] = (0, import_react51.useState)({ from: "", to: "", purpose: "" });
|
|
14050
14162
|
const handleAdd = () => {
|
|
14051
14163
|
if (!newEdge.from.trim() || !newEdge.to.trim() || !newEdge.purpose.trim()) return;
|
|
14052
14164
|
onChange([...edges, { ...newEdge }]);
|
|
@@ -14139,7 +14251,7 @@ var TopologyEdgeField = ({ propertyKey, label, value, onChange, token }) => {
|
|
|
14139
14251
|
] }, propertyKey) });
|
|
14140
14252
|
};
|
|
14141
14253
|
var MiddlewareSectionCard = ({ middleware, middlewareType, onToggle, onConfigChange, token }) => {
|
|
14142
|
-
const [expanded, setExpanded] = (0,
|
|
14254
|
+
const [expanded, setExpanded] = (0, import_react51.useState)(middleware.enabled);
|
|
14143
14255
|
const getIcon = () => {
|
|
14144
14256
|
switch (middleware.type) {
|
|
14145
14257
|
case "browser":
|
|
@@ -14305,18 +14417,18 @@ var AgentConfigPanel = ({
|
|
|
14305
14417
|
const { token } = import_antd43.theme.useToken();
|
|
14306
14418
|
const { config } = useLatticeChatShellContext();
|
|
14307
14419
|
const { get } = useApi();
|
|
14308
|
-
const [toolsLoading, setToolsLoading] = (0,
|
|
14309
|
-
const [saving, setSaving] = (0,
|
|
14310
|
-
const [deleting, setDeleting] = (0,
|
|
14311
|
-
const [isDeleteModalOpen, setIsDeleteModalOpen] = (0,
|
|
14312
|
-
const [tools, setTools] = (0,
|
|
14313
|
-
const [selectedTools, setSelectedTools] = (0,
|
|
14314
|
-
const [selectedSubAgents, setSelectedSubAgents] = (0,
|
|
14315
|
-
const [agentPrompt, setAgentPrompt] = (0,
|
|
14316
|
-
const [isPromptModalOpen, setIsPromptModalOpen] = (0,
|
|
14317
|
-
const [agentType, setAgentType] = (0,
|
|
14318
|
-
const [middleware, setMiddleware] = (0,
|
|
14319
|
-
const parsedConfig = (0,
|
|
14420
|
+
const [toolsLoading, setToolsLoading] = (0, import_react51.useState)(false);
|
|
14421
|
+
const [saving, setSaving] = (0, import_react51.useState)(false);
|
|
14422
|
+
const [deleting, setDeleting] = (0, import_react51.useState)(false);
|
|
14423
|
+
const [isDeleteModalOpen, setIsDeleteModalOpen] = (0, import_react51.useState)(false);
|
|
14424
|
+
const [tools, setTools] = (0, import_react51.useState)([]);
|
|
14425
|
+
const [selectedTools, setSelectedTools] = (0, import_react51.useState)([]);
|
|
14426
|
+
const [selectedSubAgents, setSelectedSubAgents] = (0, import_react51.useState)([]);
|
|
14427
|
+
const [agentPrompt, setAgentPrompt] = (0, import_react51.useState)("");
|
|
14428
|
+
const [isPromptModalOpen, setIsPromptModalOpen] = (0, import_react51.useState)(false);
|
|
14429
|
+
const [agentType, setAgentType] = (0, import_react51.useState)("react");
|
|
14430
|
+
const [middleware, setMiddleware] = (0, import_react51.useState)([]);
|
|
14431
|
+
const parsedConfig = (0, import_react51.useMemo)(() => {
|
|
14320
14432
|
if (!assistant?.graphDefinition) {
|
|
14321
14433
|
return null;
|
|
14322
14434
|
}
|
|
@@ -14333,7 +14445,7 @@ var AgentConfigPanel = ({
|
|
|
14333
14445
|
return null;
|
|
14334
14446
|
}
|
|
14335
14447
|
}, [assistant]);
|
|
14336
|
-
const initializeMiddleware = (0,
|
|
14448
|
+
const initializeMiddleware = (0, import_react51.useCallback)((types) => {
|
|
14337
14449
|
const middlewareTypes = types || [];
|
|
14338
14450
|
return middlewareTypes.map((type, index) => ({
|
|
14339
14451
|
id: `${type.type}-${index + 1}`,
|
|
@@ -14344,7 +14456,7 @@ var AgentConfigPanel = ({
|
|
|
14344
14456
|
config: {}
|
|
14345
14457
|
}));
|
|
14346
14458
|
}, []);
|
|
14347
|
-
const mergeMiddlewareConfig = (0,
|
|
14459
|
+
const mergeMiddlewareConfig = (0, import_react51.useCallback)((savedConfigs, availableTypes) => {
|
|
14348
14460
|
const types = availableTypes || [];
|
|
14349
14461
|
const savedMap = new Map(savedConfigs?.map((cfg) => [cfg.type, cfg]) || []);
|
|
14350
14462
|
return types.map((type, index) => {
|
|
@@ -14366,7 +14478,7 @@ var AgentConfigPanel = ({
|
|
|
14366
14478
|
};
|
|
14367
14479
|
});
|
|
14368
14480
|
}, []);
|
|
14369
|
-
const fetchTools = (0,
|
|
14481
|
+
const fetchTools = (0, import_react51.useCallback)(async () => {
|
|
14370
14482
|
if (!visible) return;
|
|
14371
14483
|
setToolsLoading(true);
|
|
14372
14484
|
try {
|
|
@@ -14380,7 +14492,7 @@ var AgentConfigPanel = ({
|
|
|
14380
14492
|
setToolsLoading(false);
|
|
14381
14493
|
}
|
|
14382
14494
|
}, [get, visible]);
|
|
14383
|
-
(0,
|
|
14495
|
+
(0, import_react51.useEffect)(() => {
|
|
14384
14496
|
if (visible && assistant) {
|
|
14385
14497
|
fetchTools();
|
|
14386
14498
|
if (parsedConfig) {
|
|
@@ -15036,12 +15148,12 @@ var AgentConfigPanel = ({
|
|
|
15036
15148
|
var AgentConfigPanel_default = AgentConfigPanel;
|
|
15037
15149
|
|
|
15038
15150
|
// src/components/Chat/CreateAssistantModal.tsx
|
|
15039
|
-
var
|
|
15151
|
+
var import_react53 = require("react");
|
|
15040
15152
|
var import_antd46 = require("antd");
|
|
15041
15153
|
var import_icons24 = require("@ant-design/icons");
|
|
15042
15154
|
|
|
15043
15155
|
// src/components/Chat/ParentAgentSelector.tsx
|
|
15044
|
-
var
|
|
15156
|
+
var import_react52 = require("react");
|
|
15045
15157
|
var import_antd44 = require("antd");
|
|
15046
15158
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
15047
15159
|
var { Text: Text19 } = import_antd44.Typography;
|
|
@@ -15050,10 +15162,10 @@ var ParentAgentSelector = ({
|
|
|
15050
15162
|
value,
|
|
15051
15163
|
placeholder = "Select a parent agent to extend..."
|
|
15052
15164
|
}) => {
|
|
15053
|
-
const [assistants, setAssistants] = (0,
|
|
15054
|
-
const [loading, setLoading] = (0,
|
|
15165
|
+
const [assistants, setAssistants] = (0, import_react52.useState)([]);
|
|
15166
|
+
const [loading, setLoading] = (0, import_react52.useState)(false);
|
|
15055
15167
|
const { get } = useApi();
|
|
15056
|
-
(0,
|
|
15168
|
+
(0, import_react52.useEffect)(() => {
|
|
15057
15169
|
const fetchAssistants = async () => {
|
|
15058
15170
|
setLoading(true);
|
|
15059
15171
|
try {
|
|
@@ -15193,17 +15305,17 @@ var CreateAssistantModal = ({
|
|
|
15193
15305
|
onSuccess
|
|
15194
15306
|
}) => {
|
|
15195
15307
|
const [form] = import_antd46.Form.useForm();
|
|
15196
|
-
const [loading, setLoading] = (0,
|
|
15197
|
-
const [creationMode, setCreationMode] = (0,
|
|
15198
|
-
const [parentAssistant, setParentAssistant] = (0,
|
|
15199
|
-
const [subAgentDecisions, setSubAgentDecisions] = (0,
|
|
15308
|
+
const [loading, setLoading] = (0, import_react53.useState)(false);
|
|
15309
|
+
const [creationMode, setCreationMode] = (0, import_react53.useState)("scratch");
|
|
15310
|
+
const [parentAssistant, setParentAssistant] = (0, import_react53.useState)(null);
|
|
15311
|
+
const [subAgentDecisions, setSubAgentDecisions] = (0, import_react53.useState)([]);
|
|
15200
15312
|
const { get, post } = useApi();
|
|
15201
15313
|
const { token } = import_antd46.theme.useToken();
|
|
15202
|
-
const resetExtendState = (0,
|
|
15314
|
+
const resetExtendState = (0, import_react53.useCallback)(() => {
|
|
15203
15315
|
setParentAssistant(null);
|
|
15204
15316
|
setSubAgentDecisions([]);
|
|
15205
15317
|
}, []);
|
|
15206
|
-
const handleParentSelect = (0,
|
|
15318
|
+
const handleParentSelect = (0, import_react53.useCallback)(
|
|
15207
15319
|
(assistant) => {
|
|
15208
15320
|
setParentAssistant(assistant);
|
|
15209
15321
|
if (!assistant) {
|
|
@@ -15228,7 +15340,7 @@ var CreateAssistantModal = ({
|
|
|
15228
15340
|
},
|
|
15229
15341
|
[form]
|
|
15230
15342
|
);
|
|
15231
|
-
const handleModeChange = (0,
|
|
15343
|
+
const handleModeChange = (0, import_react53.useCallback)(
|
|
15232
15344
|
(mode) => {
|
|
15233
15345
|
setCreationMode(mode);
|
|
15234
15346
|
if (mode === "scratch") {
|
|
@@ -15582,33 +15694,33 @@ var import_antd47 = require("antd");
|
|
|
15582
15694
|
var import_icons25 = require("@ant-design/icons");
|
|
15583
15695
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
15584
15696
|
var AssistantFlowInner = ({ onChat }) => {
|
|
15585
|
-
const { setCenter, fitView } = (0,
|
|
15586
|
-
const [nodes, setNodes, onNodesChange] = (0,
|
|
15587
|
-
const [edges, setEdges, onEdgesChange] = (0,
|
|
15588
|
-
const [assistants, setAssistants] = (0,
|
|
15589
|
-
const [assistantsLoading, setAssistantsLoading] = (0,
|
|
15590
|
-
const [configPanelVisible, setConfigPanelVisible] = (0,
|
|
15591
|
-
const [selectedAssistant, setSelectedAssistant] = (0,
|
|
15592
|
-
const [isCreateModalOpen, setIsCreateModalOpen] = (0,
|
|
15697
|
+
const { setCenter, fitView } = (0, import_react55.useReactFlow)();
|
|
15698
|
+
const [nodes, setNodes, onNodesChange] = (0, import_react55.useNodesState)([]);
|
|
15699
|
+
const [edges, setEdges, onEdgesChange] = (0, import_react55.useEdgesState)([]);
|
|
15700
|
+
const [assistants, setAssistants] = (0, import_react54.useState)([]);
|
|
15701
|
+
const [assistantsLoading, setAssistantsLoading] = (0, import_react54.useState)(false);
|
|
15702
|
+
const [configPanelVisible, setConfigPanelVisible] = (0, import_react54.useState)(false);
|
|
15703
|
+
const [selectedAssistant, setSelectedAssistant] = (0, import_react54.useState)(null);
|
|
15704
|
+
const [isCreateModalOpen, setIsCreateModalOpen] = (0, import_react54.useState)(false);
|
|
15593
15705
|
const { get, del, put } = useApi();
|
|
15594
15706
|
const { config } = useLatticeChatShellContext();
|
|
15595
15707
|
const { token } = import_antd47.theme.useToken();
|
|
15596
15708
|
const { enableAssistantCreation = true, enableAssistantEditing = true } = config;
|
|
15597
|
-
const nodeTypes2 = (0,
|
|
15709
|
+
const nodeTypes2 = (0, import_react54.useMemo)(
|
|
15598
15710
|
() => ({
|
|
15599
15711
|
assistant: AssistantNode_default
|
|
15600
15712
|
}),
|
|
15601
15713
|
[]
|
|
15602
15714
|
);
|
|
15603
|
-
const handleConfigure = (0,
|
|
15715
|
+
const handleConfigure = (0, import_react54.useCallback)((assistant) => {
|
|
15604
15716
|
setSelectedAssistant(assistant);
|
|
15605
15717
|
setConfigPanelVisible(true);
|
|
15606
15718
|
}, []);
|
|
15607
|
-
const handleClosePanel = (0,
|
|
15719
|
+
const handleClosePanel = (0, import_react54.useCallback)(() => {
|
|
15608
15720
|
setConfigPanelVisible(false);
|
|
15609
15721
|
setSelectedAssistant(null);
|
|
15610
15722
|
}, []);
|
|
15611
|
-
const handleSelectionChange = (0,
|
|
15723
|
+
const handleSelectionChange = (0, import_react54.useCallback)(
|
|
15612
15724
|
({ nodes: selectedNodes }) => {
|
|
15613
15725
|
if (selectedNodes.length === 1 && enableAssistantEditing) {
|
|
15614
15726
|
const nodeData = selectedNodes[0].data;
|
|
@@ -15637,10 +15749,10 @@ var AssistantFlowInner = ({ onChat }) => {
|
|
|
15637
15749
|
setAssistantsLoading(false);
|
|
15638
15750
|
}
|
|
15639
15751
|
};
|
|
15640
|
-
(0,
|
|
15752
|
+
(0, import_react54.useEffect)(() => {
|
|
15641
15753
|
fetchAssistants();
|
|
15642
15754
|
}, []);
|
|
15643
|
-
(0,
|
|
15755
|
+
(0, import_react54.useEffect)(() => {
|
|
15644
15756
|
if (!assistants || assistants.length === 0) {
|
|
15645
15757
|
setNodes([]);
|
|
15646
15758
|
setEdges([]);
|
|
@@ -15904,7 +16016,7 @@ var AssistantFlowInner = ({ onChat }) => {
|
|
|
15904
16016
|
});
|
|
15905
16017
|
lastCreatedAssistantRef.current = createdAssistant;
|
|
15906
16018
|
};
|
|
15907
|
-
(0,
|
|
16019
|
+
(0, import_react54.useEffect)(() => {
|
|
15908
16020
|
if (selectedAssistant) {
|
|
15909
16021
|
const node = nodes.find((n) => n.id === selectedAssistant.id);
|
|
15910
16022
|
if (node) {
|
|
@@ -15912,7 +16024,7 @@ var AssistantFlowInner = ({ onChat }) => {
|
|
|
15912
16024
|
}
|
|
15913
16025
|
}
|
|
15914
16026
|
}, [selectedAssistant, nodes, setCenter]);
|
|
15915
|
-
(0,
|
|
16027
|
+
(0, import_react54.useEffect)(() => {
|
|
15916
16028
|
if (assistants.length > 0 && selectedAssistant) {
|
|
15917
16029
|
const assistant = assistants.find((a) => a.id === selectedAssistant.id);
|
|
15918
16030
|
if (assistant && !configPanelVisible) {
|
|
@@ -15920,8 +16032,8 @@ var AssistantFlowInner = ({ onChat }) => {
|
|
|
15920
16032
|
}
|
|
15921
16033
|
}
|
|
15922
16034
|
}, [assistants, selectedAssistant, configPanelVisible]);
|
|
15923
|
-
const lastCreatedAssistantRef = (0,
|
|
15924
|
-
(0,
|
|
16035
|
+
const lastCreatedAssistantRef = (0, import_react54.useRef)(null);
|
|
16036
|
+
(0, import_react54.useEffect)(() => {
|
|
15925
16037
|
if (lastCreatedAssistantRef.current && !assistants.find((a) => a.id === lastCreatedAssistantRef.current?.id)) {
|
|
15926
16038
|
lastCreatedAssistantRef.current = null;
|
|
15927
16039
|
}
|
|
@@ -15963,7 +16075,7 @@ var AssistantFlowInner = ({ onChat }) => {
|
|
|
15963
16075
|
},
|
|
15964
16076
|
children: [
|
|
15965
16077
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
15966
|
-
|
|
16078
|
+
import_react55.ReactFlow,
|
|
15967
16079
|
{
|
|
15968
16080
|
nodes,
|
|
15969
16081
|
edges,
|
|
@@ -15973,8 +16085,8 @@ var AssistantFlowInner = ({ onChat }) => {
|
|
|
15973
16085
|
nodeTypes: nodeTypes2,
|
|
15974
16086
|
fitView: true,
|
|
15975
16087
|
children: [
|
|
15976
|
-
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
15977
|
-
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
16088
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react55.Background, { color: "#eee", gap: 20 }),
|
|
16089
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react55.Controls, {})
|
|
15978
16090
|
]
|
|
15979
16091
|
}
|
|
15980
16092
|
),
|
|
@@ -16032,19 +16144,19 @@ var AssistantFlowInner = ({ onChat }) => {
|
|
|
16032
16144
|
)
|
|
16033
16145
|
] });
|
|
16034
16146
|
};
|
|
16035
|
-
var AssistantFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
16147
|
+
var AssistantFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react55.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(AssistantFlowInner, { ...props }) });
|
|
16036
16148
|
var AssistantFlow_default = AssistantFlow;
|
|
16037
16149
|
|
|
16038
16150
|
// src/components/Chat/SkillFlow.tsx
|
|
16039
|
-
var
|
|
16040
|
-
var
|
|
16151
|
+
var import_react59 = require("react");
|
|
16152
|
+
var import_react60 = require("@xyflow/react");
|
|
16041
16153
|
var import_style2 = require("@xyflow/react/dist/style.css");
|
|
16042
16154
|
var import_antd51 = require("antd");
|
|
16043
16155
|
var import_icons28 = require("@ant-design/icons");
|
|
16044
16156
|
|
|
16045
16157
|
// src/components/Chat/SkillNode.tsx
|
|
16046
|
-
var
|
|
16047
|
-
var
|
|
16158
|
+
var import_react56 = require("react");
|
|
16159
|
+
var import_react57 = require("@xyflow/react");
|
|
16048
16160
|
var import_antd48 = require("antd");
|
|
16049
16161
|
var import_icons26 = require("@ant-design/icons");
|
|
16050
16162
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
@@ -16087,12 +16199,12 @@ var SkillNode = ({ data }) => {
|
|
|
16087
16199
|
if (!skill) {
|
|
16088
16200
|
return null;
|
|
16089
16201
|
}
|
|
16090
|
-
const [currentSkill, setCurrentSkill] = (0,
|
|
16202
|
+
const [currentSkill, setCurrentSkill] = (0, import_react56.useState)(skill);
|
|
16091
16203
|
const badgeColor = getBadgeColor2(currentSkill.name);
|
|
16092
16204
|
const initials = currentSkill.name?.split("-").map((n) => n.charAt(0)).join("").toUpperCase().slice(0, 2) || "SK";
|
|
16093
16205
|
const hasSubSkills = currentSkill.subSkills && currentSkill.subSkills.length > 0;
|
|
16094
16206
|
const category = currentSkill.metadata && currentSkill.metadata.category || "global";
|
|
16095
|
-
const metadataEntries = (0,
|
|
16207
|
+
const metadataEntries = (0, import_react56.useMemo)(
|
|
16096
16208
|
() => currentSkill.metadata ? Object.entries(
|
|
16097
16209
|
currentSkill.metadata
|
|
16098
16210
|
).filter(
|
|
@@ -16109,20 +16221,20 @@ var SkillNode = ({ data }) => {
|
|
|
16109
16221
|
const handleCopy = (text) => {
|
|
16110
16222
|
navigator.clipboard.writeText(text);
|
|
16111
16223
|
};
|
|
16112
|
-
const [isEditing, setIsEditing] = (0,
|
|
16113
|
-
const [draftSkill, setDraftSkill] = (0,
|
|
16224
|
+
const [isEditing, setIsEditing] = (0, import_react56.useState)(false);
|
|
16225
|
+
const [draftSkill, setDraftSkill] = (0, import_react56.useState)({
|
|
16114
16226
|
...skill,
|
|
16115
16227
|
id: skill.name
|
|
16116
16228
|
});
|
|
16117
|
-
const [metadataRows, setMetadataRows] = (0,
|
|
16229
|
+
const [metadataRows, setMetadataRows] = (0, import_react56.useState)(
|
|
16118
16230
|
metadataEntries.map(([key, value]) => ({
|
|
16119
16231
|
key,
|
|
16120
16232
|
value
|
|
16121
16233
|
}))
|
|
16122
16234
|
);
|
|
16123
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
16124
|
-
const [saving, setSaving] = (0,
|
|
16125
|
-
(0,
|
|
16235
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react56.useState)(false);
|
|
16236
|
+
const [saving, setSaving] = (0, import_react56.useState)(false);
|
|
16237
|
+
(0, import_react56.useEffect)(() => {
|
|
16126
16238
|
setIsEditing(false);
|
|
16127
16239
|
setCurrentSkill(skill);
|
|
16128
16240
|
setDraftSkill({ ...skill, id: skill.name });
|
|
@@ -16882,10 +16994,10 @@ var SkillNode = ({ data }) => {
|
|
|
16882
16994
|
},
|
|
16883
16995
|
children: [
|
|
16884
16996
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
16885
|
-
|
|
16997
|
+
import_react57.Handle,
|
|
16886
16998
|
{
|
|
16887
16999
|
type: "target",
|
|
16888
|
-
position:
|
|
17000
|
+
position: import_react57.Position.Top,
|
|
16889
17001
|
style: hiddenHandleStyle,
|
|
16890
17002
|
isConnectable: false
|
|
16891
17003
|
}
|
|
@@ -17210,10 +17322,10 @@ var SkillNode = ({ data }) => {
|
|
|
17210
17322
|
}
|
|
17211
17323
|
),
|
|
17212
17324
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
17213
|
-
|
|
17325
|
+
import_react57.Handle,
|
|
17214
17326
|
{
|
|
17215
17327
|
type: "source",
|
|
17216
|
-
position:
|
|
17328
|
+
position: import_react57.Position.Bottom,
|
|
17217
17329
|
style: hiddenHandleStyle,
|
|
17218
17330
|
isConnectable: false
|
|
17219
17331
|
}
|
|
@@ -17225,7 +17337,7 @@ var SkillNode = ({ data }) => {
|
|
|
17225
17337
|
var SkillNode_default = SkillNode;
|
|
17226
17338
|
|
|
17227
17339
|
// src/components/Chat/CreateSkillModal.tsx
|
|
17228
|
-
var
|
|
17340
|
+
var import_react58 = require("react");
|
|
17229
17341
|
var import_antd49 = require("antd");
|
|
17230
17342
|
var import_icons27 = require("@ant-design/icons");
|
|
17231
17343
|
var import_antd50 = require("antd");
|
|
@@ -17238,11 +17350,11 @@ var CreateSkillModal = ({
|
|
|
17238
17350
|
onSuccess
|
|
17239
17351
|
}) => {
|
|
17240
17352
|
const [form] = import_antd49.Form.useForm();
|
|
17241
|
-
const [loading, setLoading] = (0,
|
|
17353
|
+
const [loading, setLoading] = (0, import_react58.useState)(false);
|
|
17242
17354
|
const { post } = useApi();
|
|
17243
17355
|
const { token } = import_antd50.theme.useToken();
|
|
17244
17356
|
const defaultMetadataRows = [{ key: "category", value: "global" }];
|
|
17245
|
-
const [metadataRows, setMetadataRows] = (0,
|
|
17357
|
+
const [metadataRows, setMetadataRows] = (0, import_react58.useState)(defaultMetadataRows);
|
|
17246
17358
|
const handleSubmit = async () => {
|
|
17247
17359
|
try {
|
|
17248
17360
|
const values = await form.validateFields();
|
|
@@ -17510,14 +17622,14 @@ var CreateSkillModal_default = CreateSkillModal;
|
|
|
17510
17622
|
// src/components/Chat/SkillFlow.tsx
|
|
17511
17623
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
17512
17624
|
var SkillFlowInner = ({ onNodeClick }) => {
|
|
17513
|
-
const [nodes, setNodes, onNodesChange] = (0,
|
|
17514
|
-
const [edges, setEdges, onEdgesChange] = (0,
|
|
17515
|
-
const [isCreateModalOpen, setIsCreateModalOpen] = (0,
|
|
17516
|
-
const [skills, setSkills] = (0,
|
|
17517
|
-
const [skillsLoading, setSkillsLoading] = (0,
|
|
17625
|
+
const [nodes, setNodes, onNodesChange] = (0, import_react60.useNodesState)([]);
|
|
17626
|
+
const [edges, setEdges, onEdgesChange] = (0, import_react60.useEdgesState)([]);
|
|
17627
|
+
const [isCreateModalOpen, setIsCreateModalOpen] = (0, import_react59.useState)(false);
|
|
17628
|
+
const [skills, setSkills] = (0, import_react59.useState)([]);
|
|
17629
|
+
const [skillsLoading, setSkillsLoading] = (0, import_react59.useState)(false);
|
|
17518
17630
|
const { token } = import_antd51.theme.useToken();
|
|
17519
17631
|
const { get } = useApi();
|
|
17520
|
-
const nodeTypes2 = (0,
|
|
17632
|
+
const nodeTypes2 = (0, import_react59.useMemo)(
|
|
17521
17633
|
() => ({
|
|
17522
17634
|
skill: SkillNode_default
|
|
17523
17635
|
}),
|
|
@@ -17537,10 +17649,10 @@ var SkillFlowInner = ({ onNodeClick }) => {
|
|
|
17537
17649
|
setSkillsLoading(false);
|
|
17538
17650
|
}
|
|
17539
17651
|
};
|
|
17540
|
-
(0,
|
|
17652
|
+
(0, import_react59.useEffect)(() => {
|
|
17541
17653
|
fetchSkills();
|
|
17542
17654
|
}, []);
|
|
17543
|
-
(0,
|
|
17655
|
+
(0, import_react59.useEffect)(() => {
|
|
17544
17656
|
if (!skills || skills.length === 0) {
|
|
17545
17657
|
setNodes([]);
|
|
17546
17658
|
setEdges([]);
|
|
@@ -17689,7 +17801,7 @@ var SkillFlowInner = ({ onNodeClick }) => {
|
|
|
17689
17801
|
}
|
|
17690
17802
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { style: { width: "100%", height: "100%", background: "#fafafa", position: "relative" }, children: [
|
|
17691
17803
|
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
17692
|
-
|
|
17804
|
+
import_react60.ReactFlow,
|
|
17693
17805
|
{
|
|
17694
17806
|
nodes,
|
|
17695
17807
|
edges,
|
|
@@ -17698,8 +17810,8 @@ var SkillFlowInner = ({ onNodeClick }) => {
|
|
|
17698
17810
|
nodeTypes: nodeTypes2,
|
|
17699
17811
|
fitView: true,
|
|
17700
17812
|
children: [
|
|
17701
|
-
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
17702
|
-
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
17813
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react60.Background, { color: "#eee", gap: 20 }),
|
|
17814
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react60.Controls, {})
|
|
17703
17815
|
]
|
|
17704
17816
|
}
|
|
17705
17817
|
),
|
|
@@ -17743,13 +17855,13 @@ var SkillFlowInner = ({ onNodeClick }) => {
|
|
|
17743
17855
|
)
|
|
17744
17856
|
] });
|
|
17745
17857
|
};
|
|
17746
|
-
var SkillFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
17858
|
+
var SkillFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react60.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(SkillFlowInner, { ...props }) });
|
|
17747
17859
|
var SkillFlow_default = SkillFlow;
|
|
17748
17860
|
|
|
17749
17861
|
// src/components/Chat/ToolsList.tsx
|
|
17750
17862
|
var import_antd52 = require("antd");
|
|
17751
17863
|
var import_icons29 = require("@ant-design/icons");
|
|
17752
|
-
var
|
|
17864
|
+
var import_react61 = require("react");
|
|
17753
17865
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
17754
17866
|
var ToolsList = ({
|
|
17755
17867
|
onToolSelect,
|
|
@@ -17757,13 +17869,13 @@ var ToolsList = ({
|
|
|
17757
17869
|
}) => {
|
|
17758
17870
|
const { token } = import_antd52.theme.useToken();
|
|
17759
17871
|
const { get } = useApi();
|
|
17760
|
-
const [state, setState] = (0,
|
|
17872
|
+
const [state, setState] = (0, import_react61.useState)({
|
|
17761
17873
|
tools: [],
|
|
17762
17874
|
isLoading: false,
|
|
17763
17875
|
error: null
|
|
17764
17876
|
});
|
|
17765
|
-
const [selectedToolId, setSelectedToolId] = (0,
|
|
17766
|
-
const fetchTools = (0,
|
|
17877
|
+
const [selectedToolId, setSelectedToolId] = (0, import_react61.useState)(null);
|
|
17878
|
+
const fetchTools = (0, import_react61.useCallback)(async () => {
|
|
17767
17879
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
17768
17880
|
try {
|
|
17769
17881
|
const data = await get("/api/tools");
|
|
@@ -17785,17 +17897,17 @@ var ToolsList = ({
|
|
|
17785
17897
|
}));
|
|
17786
17898
|
}
|
|
17787
17899
|
}, [get]);
|
|
17788
|
-
const handleToolSelect = (0,
|
|
17900
|
+
const handleToolSelect = (0, import_react61.useCallback)(
|
|
17789
17901
|
(tool) => {
|
|
17790
17902
|
setSelectedToolId(tool.id);
|
|
17791
17903
|
onToolSelect?.(tool);
|
|
17792
17904
|
},
|
|
17793
17905
|
[onToolSelect]
|
|
17794
17906
|
);
|
|
17795
|
-
const handleRefresh = (0,
|
|
17907
|
+
const handleRefresh = (0, import_react61.useCallback)(() => {
|
|
17796
17908
|
fetchTools();
|
|
17797
17909
|
}, [fetchTools]);
|
|
17798
|
-
(0,
|
|
17910
|
+
(0, import_react61.useEffect)(() => {
|
|
17799
17911
|
if (autoLoad) {
|
|
17800
17912
|
fetchTools();
|
|
17801
17913
|
}
|
|
@@ -17985,14 +18097,14 @@ var ToolsList = ({
|
|
|
17985
18097
|
};
|
|
17986
18098
|
|
|
17987
18099
|
// src/components/Chat/TopologyAutomationView.tsx
|
|
17988
|
-
var
|
|
17989
|
-
var
|
|
18100
|
+
var import_react65 = require("react");
|
|
18101
|
+
var import_react66 = require("@xyflow/react");
|
|
17990
18102
|
var import_style3 = require("@xyflow/react/dist/style.css");
|
|
17991
18103
|
var import_antd56 = require("antd");
|
|
17992
18104
|
var import_icons32 = require("@ant-design/icons");
|
|
17993
18105
|
|
|
17994
18106
|
// src/components/Chat/TopologyNode.tsx
|
|
17995
|
-
var
|
|
18107
|
+
var import_react62 = require("@xyflow/react");
|
|
17996
18108
|
var import_antd53 = require("antd");
|
|
17997
18109
|
var import_icons30 = require("@ant-design/icons");
|
|
17998
18110
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
@@ -18004,7 +18116,7 @@ var TopologyNode = ({ data }) => {
|
|
|
18004
18116
|
if (!data) return null;
|
|
18005
18117
|
const { agentName, description, outgoingEdges, incomingEdges } = data;
|
|
18006
18118
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { style: { padding: 4 }, children: [
|
|
18007
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
18119
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_react62.Handle, { type: "target", position: import_react62.Position.Top }),
|
|
18008
18120
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
18009
18121
|
"div",
|
|
18010
18122
|
{
|
|
@@ -18100,13 +18212,13 @@ var TopologyNode = ({ data }) => {
|
|
|
18100
18212
|
] })
|
|
18101
18213
|
}
|
|
18102
18214
|
),
|
|
18103
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
18215
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_react62.Handle, { type: "source", position: import_react62.Position.Bottom })
|
|
18104
18216
|
] });
|
|
18105
18217
|
};
|
|
18106
18218
|
var TopologyNode_default = TopologyNode;
|
|
18107
18219
|
|
|
18108
18220
|
// src/components/Chat/CopilotPanel.tsx
|
|
18109
|
-
var
|
|
18221
|
+
var import_react63 = require("react");
|
|
18110
18222
|
var import_antd54 = require("antd");
|
|
18111
18223
|
var import_icons31 = require("@ant-design/icons");
|
|
18112
18224
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
@@ -18120,13 +18232,13 @@ var CopilotPanel = ({
|
|
|
18120
18232
|
}) => {
|
|
18121
18233
|
const client = useClient("agent-architect");
|
|
18122
18234
|
const threadId = workflowContext?.id ? `${client.tenantId}:${workflowContext.id}` : null;
|
|
18123
|
-
const systemContext = (0,
|
|
18235
|
+
const systemContext = (0, import_react63.useMemo)(() => {
|
|
18124
18236
|
if (workflowContext?.id && workflowContext?.name) {
|
|
18125
18237
|
return `[Context: You're viewing workflow "${workflowContext.name}" (agent: ${workflowContext.id})]`;
|
|
18126
18238
|
}
|
|
18127
18239
|
return void 0;
|
|
18128
18240
|
}, [workflowContext]);
|
|
18129
|
-
const initialMessageContent = (0,
|
|
18241
|
+
const initialMessageContent = (0, import_react63.useMemo)(() => {
|
|
18130
18242
|
if (!initialMessage || !workflowContext?.id) return void 0;
|
|
18131
18243
|
return [
|
|
18132
18244
|
`Purpose: ${initialMessage.trim()}`,
|
|
@@ -18227,7 +18339,7 @@ var CopilotPanel = ({
|
|
|
18227
18339
|
};
|
|
18228
18340
|
|
|
18229
18341
|
// src/components/Chat/CreateWorkflowModal.tsx
|
|
18230
|
-
var
|
|
18342
|
+
var import_react64 = require("react");
|
|
18231
18343
|
var import_antd55 = require("antd");
|
|
18232
18344
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
18233
18345
|
function extractName(purpose) {
|
|
@@ -18252,7 +18364,7 @@ var CreateWorkflowModal = ({
|
|
|
18252
18364
|
}) => {
|
|
18253
18365
|
const { post } = useApi();
|
|
18254
18366
|
const [form] = import_antd55.Form.useForm();
|
|
18255
|
-
(0,
|
|
18367
|
+
(0, import_react64.useEffect)(() => {
|
|
18256
18368
|
if (open) {
|
|
18257
18369
|
form.resetFields();
|
|
18258
18370
|
}
|
|
@@ -18423,7 +18535,7 @@ function buildGraph(agents, agentNameMap) {
|
|
|
18423
18535
|
animated: true,
|
|
18424
18536
|
type: "smoothstep",
|
|
18425
18537
|
style: { stroke: "#6366f1", strokeWidth: 2 },
|
|
18426
|
-
markerEnd: { type:
|
|
18538
|
+
markerEnd: { type: import_react66.MarkerType.ArrowClosed, color: "#6366f1", width: 20, height: 20 },
|
|
18427
18539
|
labelStyle: { fill: "#6366f1", fontWeight: 500, fontSize: 12 },
|
|
18428
18540
|
labelBgStyle: { fill: "#EEF2FF", fillOpacity: 0.9 },
|
|
18429
18541
|
labelBgPadding: [8, 4],
|
|
@@ -18440,11 +18552,11 @@ function TopologyFlowInner({
|
|
|
18440
18552
|
nodes: initialNodes,
|
|
18441
18553
|
edges: initialEdges
|
|
18442
18554
|
}) {
|
|
18443
|
-
const [nodes, setNodes, onNodesChange] = (0,
|
|
18444
|
-
const [edges, setEdges, onEdgesChange] = (0,
|
|
18445
|
-
const [specModalOpen, setSpecModalOpen] = (0,
|
|
18446
|
-
const nodeTypes2 = (0,
|
|
18447
|
-
(0,
|
|
18555
|
+
const [nodes, setNodes, onNodesChange] = (0, import_react66.useNodesState)(initialNodes);
|
|
18556
|
+
const [edges, setEdges, onEdgesChange] = (0, import_react66.useEdgesState)(initialEdges);
|
|
18557
|
+
const [specModalOpen, setSpecModalOpen] = (0, import_react65.useState)(false);
|
|
18558
|
+
const nodeTypes2 = (0, import_react65.useMemo)(() => ({ topologyNode: TopologyNode_default }), []);
|
|
18559
|
+
(0, import_react65.useEffect)(() => {
|
|
18448
18560
|
setNodes(initialNodes);
|
|
18449
18561
|
setEdges(initialEdges);
|
|
18450
18562
|
}, [initialNodes, initialEdges, setNodes, setEdges]);
|
|
@@ -18532,7 +18644,7 @@ function TopologyFlowInner({
|
|
|
18532
18644
|
),
|
|
18533
18645
|
/* @__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: [
|
|
18534
18646
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
18535
|
-
|
|
18647
|
+
import_react66.ReactFlow,
|
|
18536
18648
|
{
|
|
18537
18649
|
nodes,
|
|
18538
18650
|
edges,
|
|
@@ -18543,10 +18655,10 @@ function TopologyFlowInner({
|
|
|
18543
18655
|
minZoom: 0.1,
|
|
18544
18656
|
maxZoom: 2,
|
|
18545
18657
|
children: [
|
|
18546
|
-
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18547
|
-
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18658
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react66.Background, { variant: import_react66.BackgroundVariant.Dots, gap: 20, size: 1 }),
|
|
18659
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react66.Controls, {}),
|
|
18548
18660
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18549
|
-
|
|
18661
|
+
import_react66.MiniMap,
|
|
18550
18662
|
{
|
|
18551
18663
|
nodeStrokeWidth: 3,
|
|
18552
18664
|
pannable: true,
|
|
@@ -18652,15 +18764,15 @@ function TopologyFlowInner({
|
|
|
18652
18764
|
}
|
|
18653
18765
|
var TopologyAutomationView = () => {
|
|
18654
18766
|
const { get, del } = useApi();
|
|
18655
|
-
const [agents, setAgents] = (0,
|
|
18656
|
-
const [agentNameMap, setAgentNameMap] = (0,
|
|
18657
|
-
const [selectedWorkflowId, setSelectedWorkflowId] = (0,
|
|
18658
|
-
const [copilotOpen, setCopilotOpen] = (0,
|
|
18659
|
-
const [initialLoading, setInitialLoading] = (0,
|
|
18660
|
-
const [error, setError] = (0,
|
|
18661
|
-
const [isCreateModalOpen, setIsCreateModalOpen] = (0,
|
|
18662
|
-
const [initialMessage, setInitialMessage] = (0,
|
|
18663
|
-
const workflowTools = (0,
|
|
18767
|
+
const [agents, setAgents] = (0, import_react65.useState)([]);
|
|
18768
|
+
const [agentNameMap, setAgentNameMap] = (0, import_react65.useState)(/* @__PURE__ */ new Map());
|
|
18769
|
+
const [selectedWorkflowId, setSelectedWorkflowId] = (0, import_react65.useState)(null);
|
|
18770
|
+
const [copilotOpen, setCopilotOpen] = (0, import_react65.useState)(true);
|
|
18771
|
+
const [initialLoading, setInitialLoading] = (0, import_react65.useState)(true);
|
|
18772
|
+
const [error, setError] = (0, import_react65.useState)(null);
|
|
18773
|
+
const [isCreateModalOpen, setIsCreateModalOpen] = (0, import_react65.useState)(false);
|
|
18774
|
+
const [initialMessage, setInitialMessage] = (0, import_react65.useState)(null);
|
|
18775
|
+
const workflowTools = (0, import_react65.useMemo)(
|
|
18664
18776
|
() => [
|
|
18665
18777
|
"create_agent",
|
|
18666
18778
|
"create_processing_agent",
|
|
@@ -18670,7 +18782,7 @@ var TopologyAutomationView = () => {
|
|
|
18670
18782
|
],
|
|
18671
18783
|
[]
|
|
18672
18784
|
);
|
|
18673
|
-
const fetchData = (0,
|
|
18785
|
+
const fetchData = (0, import_react65.useCallback)(async () => {
|
|
18674
18786
|
const [wfRes, assistantsRes] = await Promise.all([
|
|
18675
18787
|
get("/api/workflows/definitions"),
|
|
18676
18788
|
get("/api/assistants")
|
|
@@ -18694,7 +18806,7 @@ var TopologyAutomationView = () => {
|
|
|
18694
18806
|
}
|
|
18695
18807
|
setError(null);
|
|
18696
18808
|
}, [get]);
|
|
18697
|
-
(0,
|
|
18809
|
+
(0, import_react65.useEffect)(() => {
|
|
18698
18810
|
let cancelled = false;
|
|
18699
18811
|
const load = async () => {
|
|
18700
18812
|
try {
|
|
@@ -18713,7 +18825,7 @@ var TopologyAutomationView = () => {
|
|
|
18713
18825
|
cancelled = true;
|
|
18714
18826
|
};
|
|
18715
18827
|
}, [fetchData]);
|
|
18716
|
-
const handleWorkflowCreated = (0,
|
|
18828
|
+
const handleWorkflowCreated = (0, import_react65.useCallback)((id, purpose) => {
|
|
18717
18829
|
setIsCreateModalOpen(false);
|
|
18718
18830
|
fetchData().then(() => {
|
|
18719
18831
|
setSelectedWorkflowId(id);
|
|
@@ -18722,10 +18834,10 @@ var TopologyAutomationView = () => {
|
|
|
18722
18834
|
}
|
|
18723
18835
|
});
|
|
18724
18836
|
}, [fetchData]);
|
|
18725
|
-
const handleSelectWorkflow = (0,
|
|
18837
|
+
const handleSelectWorkflow = (0, import_react65.useCallback)((id) => {
|
|
18726
18838
|
setSelectedWorkflowId(id);
|
|
18727
18839
|
}, []);
|
|
18728
|
-
const handleDeleteWorkflow = (0,
|
|
18840
|
+
const handleDeleteWorkflow = (0, import_react65.useCallback)(async (id) => {
|
|
18729
18841
|
try {
|
|
18730
18842
|
await del(`/api/assistants/${id}`);
|
|
18731
18843
|
setSelectedWorkflowId(null);
|
|
@@ -18735,19 +18847,19 @@ var TopologyAutomationView = () => {
|
|
|
18735
18847
|
setError(message23);
|
|
18736
18848
|
}
|
|
18737
18849
|
}, [del, fetchData]);
|
|
18738
|
-
const selectedAgent = (0,
|
|
18850
|
+
const selectedAgent = (0, import_react65.useMemo)(
|
|
18739
18851
|
() => agents.find((a) => a.id === selectedWorkflowId) || null,
|
|
18740
18852
|
[agents, selectedWorkflowId]
|
|
18741
18853
|
);
|
|
18742
|
-
const selectedWorkflowName = (0,
|
|
18854
|
+
const selectedWorkflowName = (0, import_react65.useMemo)(
|
|
18743
18855
|
() => selectedAgent?.name || null,
|
|
18744
18856
|
[selectedAgent]
|
|
18745
18857
|
);
|
|
18746
|
-
const workflowContext = (0,
|
|
18858
|
+
const workflowContext = (0, import_react65.useMemo)(
|
|
18747
18859
|
() => selectedWorkflowId && selectedWorkflowName ? { id: selectedWorkflowId, name: selectedWorkflowName } : null,
|
|
18748
18860
|
[selectedWorkflowId, selectedWorkflowName]
|
|
18749
18861
|
);
|
|
18750
|
-
const { nodes, edges } = (0,
|
|
18862
|
+
const { nodes, edges } = (0, import_react65.useMemo)(
|
|
18751
18863
|
() => selectedAgent ? buildGraph([selectedAgent], agentNameMap) : { nodes: [], edges: [] },
|
|
18752
18864
|
[selectedAgent, agentNameMap]
|
|
18753
18865
|
);
|
|
@@ -18787,7 +18899,7 @@ var TopologyAutomationView = () => {
|
|
|
18787
18899
|
onCreated: handleWorkflowCreated
|
|
18788
18900
|
}
|
|
18789
18901
|
),
|
|
18790
|
-
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18902
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react66.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { style: { display: "flex", height: "100%", width: "100%", overflow: "hidden" }, children: [
|
|
18791
18903
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
18792
18904
|
"div",
|
|
18793
18905
|
{
|
|
@@ -18863,10 +18975,10 @@ var TopologyAutomationView = () => {
|
|
|
18863
18975
|
};
|
|
18864
18976
|
|
|
18865
18977
|
// src/components/Chat/TopologyRuntimeView.tsx
|
|
18866
|
-
var
|
|
18978
|
+
var import_react67 = require("react");
|
|
18867
18979
|
var import_antd57 = require("antd");
|
|
18868
18980
|
var import_icons33 = require("@ant-design/icons");
|
|
18869
|
-
var
|
|
18981
|
+
var import_react68 = require("@xyflow/react");
|
|
18870
18982
|
var import_style4 = require("@xyflow/react/dist/style.css");
|
|
18871
18983
|
var import_dagre = __toESM(require("dagre"));
|
|
18872
18984
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
@@ -18910,7 +19022,7 @@ function StepNode({ data, selected }) {
|
|
|
18910
19022
|
const shadow = isSelected ? `0 4px 14px ${ssc.color}20` : "0 1px 6px rgba(0,0,0,0.08)";
|
|
18911
19023
|
const borderWidth = isSelected ? 2 : 1;
|
|
18912
19024
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { style: { padding: 4 }, children: [
|
|
18913
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
19025
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_react68.Handle, { type: "target", position: import_react68.Position.Top }),
|
|
18914
19026
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
18915
19027
|
"div",
|
|
18916
19028
|
{
|
|
@@ -18970,12 +19082,12 @@ function StepNode({ data, selected }) {
|
|
|
18970
19082
|
] })
|
|
18971
19083
|
}
|
|
18972
19084
|
),
|
|
18973
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
19085
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_react68.Handle, { type: "source", position: import_react68.Position.Bottom })
|
|
18974
19086
|
] });
|
|
18975
19087
|
}
|
|
18976
19088
|
var nodeTypes = { stepNode: StepNode };
|
|
18977
19089
|
function useLayoutedElements(steps) {
|
|
18978
|
-
return (0,
|
|
19090
|
+
return (0, import_react67.useMemo)(() => {
|
|
18979
19091
|
if (steps.length === 0) return [];
|
|
18980
19092
|
const g = new import_dagre.default.graphlib.Graph();
|
|
18981
19093
|
g.setGraph({ rankdir: "TB", nodesep: 40, ranksep: 40 });
|
|
@@ -19001,7 +19113,7 @@ function useLayoutedElements(steps) {
|
|
|
19001
19113
|
}, [steps]);
|
|
19002
19114
|
}
|
|
19003
19115
|
function useEdgesFromSteps(steps) {
|
|
19004
|
-
return (0,
|
|
19116
|
+
return (0, import_react67.useMemo)(() => {
|
|
19005
19117
|
const edges = [];
|
|
19006
19118
|
for (let i = 0; i < steps.length - 1; i++) {
|
|
19007
19119
|
const fromStep = steps[i];
|
|
@@ -19015,7 +19127,7 @@ function useEdgesFromSteps(steps) {
|
|
|
19015
19127
|
animated: true,
|
|
19016
19128
|
label: purpose || void 0,
|
|
19017
19129
|
style: { stroke: "#6366f1", strokeWidth: 2 },
|
|
19018
|
-
markerEnd: { type:
|
|
19130
|
+
markerEnd: { type: import_react68.MarkerType.ArrowClosed, color: "#6366f1", width: 20, height: 20 },
|
|
19019
19131
|
labelStyle: { fill: "#6366f1", fontWeight: 500, fontSize: 12 },
|
|
19020
19132
|
labelBgStyle: { fill: "#EEF2FF", fillOpacity: 0.9 },
|
|
19021
19133
|
labelBgPadding: [8, 4],
|
|
@@ -19142,18 +19254,18 @@ function StepDetailPopover({ step }) {
|
|
|
19142
19254
|
function FlowCanvas({ steps }) {
|
|
19143
19255
|
const initialNodes = useLayoutedElements(steps);
|
|
19144
19256
|
const initialEdges = useEdgesFromSteps(steps);
|
|
19145
|
-
const [nodes, setNodes, onNodesChange] = (0,
|
|
19146
|
-
const [edges, setEdges, onEdgesChange] = (0,
|
|
19147
|
-
const [selectedNodeId, setSelectedNodeId] = (0,
|
|
19148
|
-
const selectedStep = (0,
|
|
19257
|
+
const [nodes, setNodes, onNodesChange] = (0, import_react68.useNodesState)(initialNodes);
|
|
19258
|
+
const [edges, setEdges, onEdgesChange] = (0, import_react68.useEdgesState)(initialEdges);
|
|
19259
|
+
const [selectedNodeId, setSelectedNodeId] = (0, import_react67.useState)(null);
|
|
19260
|
+
const selectedStep = (0, import_react67.useMemo)(
|
|
19149
19261
|
() => steps.find((s) => s.id === selectedNodeId) || null,
|
|
19150
19262
|
[steps, selectedNodeId]
|
|
19151
19263
|
);
|
|
19152
|
-
(0,
|
|
19264
|
+
(0, import_react67.useEffect)(() => {
|
|
19153
19265
|
setNodes(initialNodes);
|
|
19154
19266
|
setEdges(initialEdges);
|
|
19155
19267
|
}, [initialNodes, initialEdges, setNodes, setEdges]);
|
|
19156
|
-
(0,
|
|
19268
|
+
(0, import_react67.useEffect)(() => {
|
|
19157
19269
|
if (selectedNodeId) {
|
|
19158
19270
|
setNodes(
|
|
19159
19271
|
(nds) => nds.map((n) => ({
|
|
@@ -19163,13 +19275,13 @@ function FlowCanvas({ steps }) {
|
|
|
19163
19275
|
);
|
|
19164
19276
|
}
|
|
19165
19277
|
}, [selectedNodeId, setNodes]);
|
|
19166
|
-
const onNodeClick = (0,
|
|
19278
|
+
const onNodeClick = (0, import_react67.useCallback)(
|
|
19167
19279
|
(_event, node) => {
|
|
19168
19280
|
setSelectedNodeId(node.id);
|
|
19169
19281
|
},
|
|
19170
19282
|
[]
|
|
19171
19283
|
);
|
|
19172
|
-
const onPaneClick = (0,
|
|
19284
|
+
const onPaneClick = (0, import_react67.useCallback)(() => {
|
|
19173
19285
|
setNodes(
|
|
19174
19286
|
(nds) => nds.map((n) => ({
|
|
19175
19287
|
...n,
|
|
@@ -19180,7 +19292,7 @@ function FlowCanvas({ steps }) {
|
|
|
19180
19292
|
}, [setNodes]);
|
|
19181
19293
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
|
|
19182
19294
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
19183
|
-
|
|
19295
|
+
import_react68.ReactFlow,
|
|
19184
19296
|
{
|
|
19185
19297
|
nodes,
|
|
19186
19298
|
edges,
|
|
@@ -19196,10 +19308,10 @@ function FlowCanvas({ steps }) {
|
|
|
19196
19308
|
nodesDraggable: false,
|
|
19197
19309
|
nodesConnectable: false,
|
|
19198
19310
|
children: [
|
|
19199
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
19200
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
19311
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_react68.Background, { variant: import_react68.BackgroundVariant.Dots, gap: 20, size: 1 }),
|
|
19312
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_react68.Controls, {}),
|
|
19201
19313
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
19202
|
-
|
|
19314
|
+
import_react68.MiniMap,
|
|
19203
19315
|
{
|
|
19204
19316
|
nodeStrokeWidth: 3,
|
|
19205
19317
|
pannable: true,
|
|
@@ -19348,11 +19460,11 @@ function RunSummaryBanner({ run, agentName }) {
|
|
|
19348
19460
|
}
|
|
19349
19461
|
var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh, onAutoRefreshChange }) => {
|
|
19350
19462
|
const { get } = useApi();
|
|
19351
|
-
const [steps, setSteps] = (0,
|
|
19352
|
-
const [loading, setLoading] = (0,
|
|
19353
|
-
const stepsPollTimeoutRef = (0,
|
|
19354
|
-
const stepsPollSessionRef = (0,
|
|
19355
|
-
const fetchSteps = (0,
|
|
19463
|
+
const [steps, setSteps] = (0, import_react67.useState)([]);
|
|
19464
|
+
const [loading, setLoading] = (0, import_react67.useState)(false);
|
|
19465
|
+
const stepsPollTimeoutRef = (0, import_react67.useRef)(null);
|
|
19466
|
+
const stepsPollSessionRef = (0, import_react67.useRef)(0);
|
|
19467
|
+
const fetchSteps = (0, import_react67.useCallback)(async () => {
|
|
19356
19468
|
try {
|
|
19357
19469
|
const [stepsRes, runsRes] = await Promise.all([
|
|
19358
19470
|
get(
|
|
@@ -19370,12 +19482,12 @@ var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh, onAu
|
|
|
19370
19482
|
} catch {
|
|
19371
19483
|
}
|
|
19372
19484
|
}, [get, run.id, onRunUpdate]);
|
|
19373
|
-
(0,
|
|
19485
|
+
(0, import_react67.useEffect)(() => {
|
|
19374
19486
|
if (!open) return;
|
|
19375
19487
|
setLoading(true);
|
|
19376
19488
|
fetchSteps().finally(() => setLoading(false));
|
|
19377
19489
|
}, [open, run.id, fetchSteps]);
|
|
19378
|
-
(0,
|
|
19490
|
+
(0, import_react67.useEffect)(() => {
|
|
19379
19491
|
if (stepsPollTimeoutRef.current) {
|
|
19380
19492
|
clearTimeout(stepsPollTimeoutRef.current);
|
|
19381
19493
|
stepsPollTimeoutRef.current = null;
|
|
@@ -19417,7 +19529,7 @@ var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh, onAu
|
|
|
19417
19529
|
styles: { body: { padding: "12px 0" } },
|
|
19418
19530
|
children: [
|
|
19419
19531
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { style: { padding: "0 12px", marginBottom: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(RunSummaryBanner, { run, agentName }) }),
|
|
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)(
|
|
19532
|
+
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_react68.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(FlowCanvas, { steps }) }) }),
|
|
19421
19533
|
run.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { style: { padding: "0 12px", marginTop: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
19422
19534
|
"div",
|
|
19423
19535
|
{
|
|
@@ -19437,20 +19549,20 @@ var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh, onAu
|
|
|
19437
19549
|
var POLLING_INTERVAL = 3e3;
|
|
19438
19550
|
var TopologyRuntimeView = () => {
|
|
19439
19551
|
const { get, del } = useApi();
|
|
19440
|
-
const [runs, setRuns] = (0,
|
|
19441
|
-
const [agentNames, setAgentNames] = (0,
|
|
19442
|
-
const [loading, setLoading] = (0,
|
|
19443
|
-
const [error, setError] = (0,
|
|
19444
|
-
const [selectedRun, setSelectedRun] = (0,
|
|
19445
|
-
const [autoRefresh, setAutoRefresh] = (0,
|
|
19446
|
-
const pollingSessionRef = (0,
|
|
19447
|
-
const handleRunUpdate = (0,
|
|
19552
|
+
const [runs, setRuns] = (0, import_react67.useState)([]);
|
|
19553
|
+
const [agentNames, setAgentNames] = (0, import_react67.useState)({});
|
|
19554
|
+
const [loading, setLoading] = (0, import_react67.useState)(true);
|
|
19555
|
+
const [error, setError] = (0, import_react67.useState)(null);
|
|
19556
|
+
const [selectedRun, setSelectedRun] = (0, import_react67.useState)(null);
|
|
19557
|
+
const [autoRefresh, setAutoRefresh] = (0, import_react67.useState)(true);
|
|
19558
|
+
const pollingSessionRef = (0, import_react67.useRef)(0);
|
|
19559
|
+
const handleRunUpdate = (0, import_react67.useCallback)((updated) => {
|
|
19448
19560
|
setRuns(
|
|
19449
19561
|
(prev) => prev.map((r) => r.id === updated.id ? updated : r)
|
|
19450
19562
|
);
|
|
19451
19563
|
setSelectedRun((prev) => prev?.id === updated.id ? updated : prev);
|
|
19452
19564
|
}, []);
|
|
19453
|
-
const handleDeleteRun = (0,
|
|
19565
|
+
const handleDeleteRun = (0, import_react67.useCallback)(async (runId) => {
|
|
19454
19566
|
try {
|
|
19455
19567
|
await del(`/api/workflows/runs/${runId}`);
|
|
19456
19568
|
setRuns((prev) => prev.filter((r) => r.id !== runId));
|
|
@@ -19460,7 +19572,7 @@ var TopologyRuntimeView = () => {
|
|
|
19460
19572
|
setError(message23);
|
|
19461
19573
|
}
|
|
19462
19574
|
}, [del]);
|
|
19463
|
-
const refreshRuns = (0,
|
|
19575
|
+
const refreshRuns = (0, import_react67.useCallback)(async () => {
|
|
19464
19576
|
setLoading(true);
|
|
19465
19577
|
try {
|
|
19466
19578
|
const defsRes = await get("/api/workflows/definitions");
|
|
@@ -19489,7 +19601,7 @@ var TopologyRuntimeView = () => {
|
|
|
19489
19601
|
setLoading(false);
|
|
19490
19602
|
}
|
|
19491
19603
|
}, [get]);
|
|
19492
|
-
(0,
|
|
19604
|
+
(0, import_react67.useEffect)(() => {
|
|
19493
19605
|
let cancelled = false;
|
|
19494
19606
|
const init2 = async () => {
|
|
19495
19607
|
try {
|
|
@@ -19525,7 +19637,7 @@ var TopologyRuntimeView = () => {
|
|
|
19525
19637
|
cancelled = true;
|
|
19526
19638
|
};
|
|
19527
19639
|
}, [get]);
|
|
19528
|
-
(0,
|
|
19640
|
+
(0, import_react67.useEffect)(() => {
|
|
19529
19641
|
return () => {
|
|
19530
19642
|
pollingSessionRef.current = 0;
|
|
19531
19643
|
};
|
|
@@ -19633,15 +19745,15 @@ var TopologyRuntimeView = () => {
|
|
|
19633
19745
|
};
|
|
19634
19746
|
|
|
19635
19747
|
// src/components/Chat/TopologyInboxView.tsx
|
|
19636
|
-
var
|
|
19748
|
+
var import_react69 = require("react");
|
|
19637
19749
|
var import_antd58 = require("antd");
|
|
19638
19750
|
var import_icons34 = require("@ant-design/icons");
|
|
19639
19751
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
19640
19752
|
var { Text: Text28, Title: Title6 } = import_antd58.Typography;
|
|
19641
19753
|
var TopologyInboxView = () => {
|
|
19642
19754
|
const { get } = useApi();
|
|
19643
|
-
const [items, setItems] = (0,
|
|
19644
|
-
const [loading, setLoading] = (0,
|
|
19755
|
+
const [items, setItems] = (0, import_react69.useState)([]);
|
|
19756
|
+
const [loading, setLoading] = (0, import_react69.useState)(true);
|
|
19645
19757
|
const fetchInbox = async () => {
|
|
19646
19758
|
setLoading(true);
|
|
19647
19759
|
try {
|
|
@@ -19668,7 +19780,7 @@ var TopologyInboxView = () => {
|
|
|
19668
19780
|
setLoading(false);
|
|
19669
19781
|
}
|
|
19670
19782
|
};
|
|
19671
|
-
(0,
|
|
19783
|
+
(0, import_react69.useEffect)(() => {
|
|
19672
19784
|
fetchInbox();
|
|
19673
19785
|
}, [get]);
|
|
19674
19786
|
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { style: { height: "100%", display: "flex", flexDirection: "column" }, children: [
|
|
@@ -19751,7 +19863,7 @@ var TopologyInboxView = () => {
|
|
|
19751
19863
|
};
|
|
19752
19864
|
|
|
19753
19865
|
// src/components/Eval/EvalPanel.tsx
|
|
19754
|
-
var
|
|
19866
|
+
var import_react72 = __toESM(require("react"));
|
|
19755
19867
|
var import_antd_style22 = require("antd-style");
|
|
19756
19868
|
var import_antd62 = require("antd");
|
|
19757
19869
|
var import_lucide_react13 = require("lucide-react");
|
|
@@ -19868,7 +19980,7 @@ var EvalSuiteCardList = ({ projectId, onSelectSuite }) => {
|
|
|
19868
19980
|
};
|
|
19869
19981
|
|
|
19870
19982
|
// src/components/Eval/EvalSuiteDetail.tsx
|
|
19871
|
-
var
|
|
19983
|
+
var import_react70 = require("react");
|
|
19872
19984
|
var import_antd_style20 = require("antd-style");
|
|
19873
19985
|
var import_antd60 = require("antd");
|
|
19874
19986
|
var import_lucide_react11 = require("lucide-react");
|
|
@@ -19972,9 +20084,9 @@ var EvalSuiteDetail = ({ projectId, suiteId, onBack, onRun }) => {
|
|
|
19972
20084
|
const { suites } = useEvalSuites(projectId);
|
|
19973
20085
|
const { cases, create: createCase, remove: removeCase } = useEvalCases(projectId, suiteId);
|
|
19974
20086
|
const { start } = useEvalRuns(projectId);
|
|
19975
|
-
const [modalOpen, setModalOpen] = (0,
|
|
20087
|
+
const [modalOpen, setModalOpen] = (0, import_react70.useState)(false);
|
|
19976
20088
|
const [form] = import_antd60.Form.useForm();
|
|
19977
|
-
const [agents, setAgents] = (0,
|
|
20089
|
+
const [agents, setAgents] = (0, import_react70.useState)([]);
|
|
19978
20090
|
const suite = suites.find((s) => s.id === suiteId) || {};
|
|
19979
20091
|
const loadAgents = async () => {
|
|
19980
20092
|
try {
|
|
@@ -20107,7 +20219,7 @@ var EvalSuiteDetail = ({ projectId, suiteId, onBack, onRun }) => {
|
|
|
20107
20219
|
};
|
|
20108
20220
|
|
|
20109
20221
|
// src/components/Eval/EvalRunResults.tsx
|
|
20110
|
-
var
|
|
20222
|
+
var import_react71 = require("react");
|
|
20111
20223
|
var import_antd_style21 = require("antd-style");
|
|
20112
20224
|
var import_antd61 = require("antd");
|
|
20113
20225
|
var import_lucide_react12 = require("lucide-react");
|
|
@@ -20196,9 +20308,9 @@ var useStyle11 = (0, import_antd_style21.createStyles)(({ token, css }) => ({
|
|
|
20196
20308
|
var EvalRunResults = ({ runId, onBack }) => {
|
|
20197
20309
|
const { styles } = useStyle11();
|
|
20198
20310
|
const client = useClient("__GLOBAL__");
|
|
20199
|
-
const [run, setRun] = (0,
|
|
20311
|
+
const [run, setRun] = (0, import_react71.useState)(null);
|
|
20200
20312
|
const { status: streamingStatus, progress, connected } = useEvalRunStream(runId);
|
|
20201
|
-
(0,
|
|
20313
|
+
(0, import_react71.useEffect)(() => {
|
|
20202
20314
|
client.eval.runs.get(runId).then(setRun).catch(console.error);
|
|
20203
20315
|
}, [runId, client]);
|
|
20204
20316
|
if (!run) {
|
|
@@ -20549,18 +20661,18 @@ var EvalPanel = () => {
|
|
|
20549
20661
|
const { styles, cx } = useStyle12();
|
|
20550
20662
|
const { token } = import_antd62.theme.useToken();
|
|
20551
20663
|
const { projects } = useEvalProjects();
|
|
20552
|
-
const [projectId, setProjectId] = (0,
|
|
20553
|
-
const [page, setPage] = (0,
|
|
20554
|
-
const [suiteId, setSuiteId] = (0,
|
|
20555
|
-
const [runId, setRunId] = (0,
|
|
20556
|
-
|
|
20664
|
+
const [projectId, setProjectId] = (0, import_react72.useState)("");
|
|
20665
|
+
const [page, setPage] = (0, import_react72.useState)("dashboard");
|
|
20666
|
+
const [suiteId, setSuiteId] = (0, import_react72.useState)("");
|
|
20667
|
+
const [runId, setRunId] = (0, import_react72.useState)("");
|
|
20668
|
+
import_react72.default.useEffect(() => {
|
|
20557
20669
|
if (!projectId && projects.length > 0) {
|
|
20558
20670
|
setProjectId(projects[0].id);
|
|
20559
20671
|
}
|
|
20560
20672
|
}, [projects, projectId]);
|
|
20561
20673
|
const { suites } = useEvalSuites(projectId);
|
|
20562
20674
|
const { runs, start, remove } = useEvalRuns(projectId);
|
|
20563
|
-
const stats = (0,
|
|
20675
|
+
const stats = (0, import_react72.useMemo)(() => {
|
|
20564
20676
|
const totalCases = suites.reduce((s, x) => s + (x.caseCount ?? 0), 0);
|
|
20565
20677
|
const latest = runs[0];
|
|
20566
20678
|
const passRate = latest?.totalCases > 0 ? Math.round(latest.passedCases / latest.totalCases * 100) : null;
|
|
@@ -20740,8 +20852,8 @@ var EvalPanel = () => {
|
|
|
20740
20852
|
] });
|
|
20741
20853
|
}
|
|
20742
20854
|
const SuiteListPage = () => {
|
|
20743
|
-
const [showAdd, setShowAdd] = (0,
|
|
20744
|
-
const [name, setName] = (0,
|
|
20855
|
+
const [showAdd, setShowAdd] = (0, import_react72.useState)(false);
|
|
20856
|
+
const [name, setName] = (0, import_react72.useState)("");
|
|
20745
20857
|
const { create } = useEvalSuites(projectId);
|
|
20746
20858
|
const handleAdd = async () => {
|
|
20747
20859
|
if (!name.trim()) return;
|
|
@@ -20923,9 +21035,9 @@ var WorkspaceResourceManager = ({
|
|
|
20923
21035
|
logo
|
|
20924
21036
|
}) => {
|
|
20925
21037
|
const { openContentApp, menuCollapsed, setMenuCollapsed } = useChatUIContext();
|
|
20926
|
-
const hasOpenedDefault = (0,
|
|
20927
|
-
const hasRegistered = (0,
|
|
20928
|
-
(0,
|
|
21038
|
+
const hasOpenedDefault = (0, import_react73.useRef)(false);
|
|
21039
|
+
const hasRegistered = (0, import_react73.useRef)(false);
|
|
21040
|
+
(0, import_react73.useEffect)(() => {
|
|
20929
21041
|
if (!hasRegistered.current) {
|
|
20930
21042
|
hasRegistered.current = true;
|
|
20931
21043
|
regsiterElement("workspace_projects", {
|
|
@@ -20984,9 +21096,9 @@ var WorkspaceResourceManager = ({
|
|
|
20984
21096
|
const { user, logout, tenants, currentTenant, selectTenant, isLoading } = useAuth();
|
|
20985
21097
|
const { setWorkspace, setProject } = useWorkspaceContext();
|
|
20986
21098
|
const { config } = useLatticeChatShellContext();
|
|
20987
|
-
const [tenantModalOpen, setTenantModalOpen] = (0,
|
|
20988
|
-
const [changePasswordOpen, setChangePasswordOpen] = (0,
|
|
20989
|
-
const menuItems = (0,
|
|
21099
|
+
const [tenantModalOpen, setTenantModalOpen] = (0, import_react73.useState)(false);
|
|
21100
|
+
const [changePasswordOpen, setChangePasswordOpen] = (0, import_react73.useState)(false);
|
|
21101
|
+
const menuItems = (0, import_react73.useMemo)(() => {
|
|
20990
21102
|
const items = config.workspaceMenuItems?.length ? [...config.workspaceMenuItems] : [...DEFAULT_WORKSPACE_MENU_ITEMS];
|
|
20991
21103
|
return items.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
20992
21104
|
}, [config.workspaceMenuItems]);
|
|
@@ -21017,7 +21129,7 @@ var WorkspaceResourceManager = ({
|
|
|
21017
21129
|
});
|
|
21018
21130
|
}
|
|
21019
21131
|
};
|
|
21020
|
-
(0,
|
|
21132
|
+
(0, import_react73.useEffect)(() => {
|
|
21021
21133
|
if (!hasOpenedDefault.current && menuItems.length > 0) {
|
|
21022
21134
|
hasOpenedDefault.current = true;
|
|
21023
21135
|
const firstRoute = menuItems.find((item) => item.type === "route");
|
|
@@ -21206,9 +21318,9 @@ var WorkspaceResourceUIContext = ({
|
|
|
21206
21318
|
|
|
21207
21319
|
// src/context/WorkspaceContext.tsx
|
|
21208
21320
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
21209
|
-
var WorkspaceContext = (0,
|
|
21321
|
+
var WorkspaceContext = (0, import_react74.createContext)(null);
|
|
21210
21322
|
var useWorkspaceContext = () => {
|
|
21211
|
-
const context = (0,
|
|
21323
|
+
const context = (0, import_react74.useContext)(WorkspaceContext);
|
|
21212
21324
|
if (!context) {
|
|
21213
21325
|
throw new Error("useWorkspaceContext must be used within a WorkspaceContextProvider");
|
|
21214
21326
|
}
|
|
@@ -21233,23 +21345,23 @@ var WorkspaceContextProvider = ({
|
|
|
21233
21345
|
}
|
|
21234
21346
|
return null;
|
|
21235
21347
|
};
|
|
21236
|
-
const [workspaceId, setWorkspaceId] = (0,
|
|
21237
|
-
const [projectId, setProjectId] = (0,
|
|
21238
|
-
|
|
21348
|
+
const [workspaceId, setWorkspaceId] = (0, import_react74.useState)(getInitialWorkspaceId);
|
|
21349
|
+
const [projectId, setProjectId] = (0, import_react74.useState)(getInitialProjectId);
|
|
21350
|
+
import_react74.default.useEffect(() => {
|
|
21239
21351
|
const wsId = getInitialWorkspaceId();
|
|
21240
21352
|
const pjId = getInitialProjectId();
|
|
21241
21353
|
if (wsId || pjId) {
|
|
21242
21354
|
import_client_sdk6.Client.setWorkspaceContext(wsId || void 0, pjId || void 0);
|
|
21243
21355
|
}
|
|
21244
21356
|
}, []);
|
|
21245
|
-
(0,
|
|
21357
|
+
(0, import_react74.useEffect)(() => {
|
|
21246
21358
|
import_client_sdk6.Client.setWorkspaceContext(workspaceId || void 0, projectId || void 0);
|
|
21247
21359
|
}, [workspaceId, projectId]);
|
|
21248
|
-
const [workspaces, setWorkspaces] = (0,
|
|
21249
|
-
const [projects, setProjects] = (0,
|
|
21250
|
-
const [loading, setLoading] = (0,
|
|
21251
|
-
const [error, setError] = (0,
|
|
21252
|
-
const client =
|
|
21360
|
+
const [workspaces, setWorkspaces] = (0, import_react74.useState)([]);
|
|
21361
|
+
const [projects, setProjects] = (0, import_react74.useState)([]);
|
|
21362
|
+
const [loading, setLoading] = (0, import_react74.useState)(false);
|
|
21363
|
+
const [error, setError] = (0, import_react74.useState)(null);
|
|
21364
|
+
const client = import_react74.default.useMemo(() => {
|
|
21253
21365
|
const authApiKey = isAuthenticated ? sessionStorage.getItem("lattice_token") || config.apiKey || "" : config.apiKey || "";
|
|
21254
21366
|
return new import_client_sdk6.WorkspaceClient({
|
|
21255
21367
|
baseURL: config.baseURL,
|
|
@@ -21258,22 +21370,22 @@ var WorkspaceContextProvider = ({
|
|
|
21258
21370
|
transport: "sse"
|
|
21259
21371
|
}, tenantId);
|
|
21260
21372
|
}, [config.baseURL, config.apiKey, tenantId, isAuthenticated]);
|
|
21261
|
-
const resetSelectedWorkspace = (0,
|
|
21373
|
+
const resetSelectedWorkspace = (0, import_react74.useCallback)(() => {
|
|
21262
21374
|
setProjects([]);
|
|
21263
21375
|
setWorkspaceId(null);
|
|
21264
21376
|
sessionStorage.removeItem("workspaceId");
|
|
21265
21377
|
setProjectId(null);
|
|
21266
21378
|
sessionStorage.removeItem("projectId");
|
|
21267
21379
|
}, [setProjects, setWorkspaceId, setProjectId]);
|
|
21268
|
-
const resetWS = (0,
|
|
21380
|
+
const resetWS = (0, import_react74.useCallback)(() => {
|
|
21269
21381
|
setWorkspaces([]);
|
|
21270
21382
|
resetSelectedWorkspace();
|
|
21271
21383
|
}, [resetSelectedWorkspace, setWorkspaces]);
|
|
21272
|
-
(0,
|
|
21384
|
+
(0, import_react74.useEffect)(() => {
|
|
21273
21385
|
resetWS();
|
|
21274
21386
|
refreshWorkspaces();
|
|
21275
21387
|
}, [tenantId]);
|
|
21276
|
-
const refreshWorkspaces = (0,
|
|
21388
|
+
const refreshWorkspaces = (0, import_react74.useCallback)(async () => {
|
|
21277
21389
|
setLoading(true);
|
|
21278
21390
|
setError(null);
|
|
21279
21391
|
try {
|
|
@@ -21285,7 +21397,7 @@ var WorkspaceContextProvider = ({
|
|
|
21285
21397
|
setLoading(false);
|
|
21286
21398
|
}
|
|
21287
21399
|
}, [client]);
|
|
21288
|
-
const refreshProjects = (0,
|
|
21400
|
+
const refreshProjects = (0, import_react74.useCallback)(async (wsId) => {
|
|
21289
21401
|
const targetWorkspaceId = wsId || workspaceId;
|
|
21290
21402
|
if (!targetWorkspaceId) {
|
|
21291
21403
|
setProjects([]);
|
|
@@ -21302,28 +21414,28 @@ var WorkspaceContextProvider = ({
|
|
|
21302
21414
|
setLoading(false);
|
|
21303
21415
|
}
|
|
21304
21416
|
}, [client, workspaceId]);
|
|
21305
|
-
(0,
|
|
21417
|
+
(0, import_react74.useEffect)(() => {
|
|
21306
21418
|
if (workspaceId && typeof window !== "undefined") {
|
|
21307
21419
|
sessionStorage.setItem("workspaceId", workspaceId);
|
|
21308
21420
|
}
|
|
21309
21421
|
}, [workspaceId]);
|
|
21310
|
-
(0,
|
|
21422
|
+
(0, import_react74.useEffect)(() => {
|
|
21311
21423
|
if (projectId && typeof window !== "undefined") {
|
|
21312
21424
|
sessionStorage.setItem("projectId", projectId);
|
|
21313
21425
|
}
|
|
21314
21426
|
}, [projectId]);
|
|
21315
|
-
(0,
|
|
21427
|
+
(0, import_react74.useEffect)(() => {
|
|
21316
21428
|
refreshWorkspaces().catch((err) => {
|
|
21317
21429
|
console.warn("Failed to load workspaces:", err);
|
|
21318
21430
|
});
|
|
21319
21431
|
}, [refreshWorkspaces]);
|
|
21320
|
-
(0,
|
|
21432
|
+
(0, import_react74.useEffect)(() => {
|
|
21321
21433
|
if (workspaces.length > 0 && !workspaceId) {
|
|
21322
21434
|
const firstWorkspace = workspaces[0];
|
|
21323
21435
|
setWorkspaceId(firstWorkspace.id);
|
|
21324
21436
|
}
|
|
21325
21437
|
}, [workspaces, workspaceId]);
|
|
21326
|
-
(0,
|
|
21438
|
+
(0, import_react74.useEffect)(() => {
|
|
21327
21439
|
if (workspaceId) {
|
|
21328
21440
|
refreshProjects(workspaceId);
|
|
21329
21441
|
} else {
|
|
@@ -21331,7 +21443,7 @@ var WorkspaceContextProvider = ({
|
|
|
21331
21443
|
}
|
|
21332
21444
|
setProjectId(null);
|
|
21333
21445
|
}, [workspaceId, refreshProjects]);
|
|
21334
|
-
const createWorkspace = (0,
|
|
21446
|
+
const createWorkspace = (0, import_react74.useCallback)(async (data) => {
|
|
21335
21447
|
setLoading(true);
|
|
21336
21448
|
setError(null);
|
|
21337
21449
|
try {
|
|
@@ -21346,7 +21458,7 @@ var WorkspaceContextProvider = ({
|
|
|
21346
21458
|
setLoading(false);
|
|
21347
21459
|
}
|
|
21348
21460
|
}, [client, refreshWorkspaces]);
|
|
21349
|
-
const updateWorkspace = (0,
|
|
21461
|
+
const updateWorkspace = (0, import_react74.useCallback)(async (id, updates) => {
|
|
21350
21462
|
setLoading(true);
|
|
21351
21463
|
setError(null);
|
|
21352
21464
|
try {
|
|
@@ -21361,7 +21473,7 @@ var WorkspaceContextProvider = ({
|
|
|
21361
21473
|
setLoading(false);
|
|
21362
21474
|
}
|
|
21363
21475
|
}, [client, refreshWorkspaces]);
|
|
21364
|
-
const deleteWorkspace = (0,
|
|
21476
|
+
const deleteWorkspace = (0, import_react74.useCallback)(async (id) => {
|
|
21365
21477
|
setLoading(true);
|
|
21366
21478
|
setError(null);
|
|
21367
21479
|
try {
|
|
@@ -21378,7 +21490,7 @@ var WorkspaceContextProvider = ({
|
|
|
21378
21490
|
setLoading(false);
|
|
21379
21491
|
}
|
|
21380
21492
|
}, [client, workspaceId, refreshWorkspaces]);
|
|
21381
|
-
const createProject = (0,
|
|
21493
|
+
const createProject = (0, import_react74.useCallback)(async (wsId, data) => {
|
|
21382
21494
|
setLoading(true);
|
|
21383
21495
|
setError(null);
|
|
21384
21496
|
try {
|
|
@@ -21393,7 +21505,7 @@ var WorkspaceContextProvider = ({
|
|
|
21393
21505
|
setLoading(false);
|
|
21394
21506
|
}
|
|
21395
21507
|
}, [client, refreshProjects]);
|
|
21396
|
-
const updateProject = (0,
|
|
21508
|
+
const updateProject = (0, import_react74.useCallback)(async (wsId, id, updates) => {
|
|
21397
21509
|
setLoading(true);
|
|
21398
21510
|
setError(null);
|
|
21399
21511
|
try {
|
|
@@ -21408,7 +21520,7 @@ var WorkspaceContextProvider = ({
|
|
|
21408
21520
|
setLoading(false);
|
|
21409
21521
|
}
|
|
21410
21522
|
}, [client, refreshProjects]);
|
|
21411
|
-
const deleteProject = (0,
|
|
21523
|
+
const deleteProject = (0, import_react74.useCallback)(async (wsId, id) => {
|
|
21412
21524
|
setLoading(true);
|
|
21413
21525
|
setError(null);
|
|
21414
21526
|
try {
|
|
@@ -21425,7 +21537,7 @@ var WorkspaceContextProvider = ({
|
|
|
21425
21537
|
setLoading(false);
|
|
21426
21538
|
}
|
|
21427
21539
|
}, [client, projectId, refreshProjects]);
|
|
21428
|
-
const listPath = (0,
|
|
21540
|
+
const listPath = (0, import_react74.useCallback)(
|
|
21429
21541
|
async (path = "/", assistantId) => {
|
|
21430
21542
|
if (!workspaceId || !projectId) {
|
|
21431
21543
|
return [];
|
|
@@ -21444,7 +21556,7 @@ var WorkspaceContextProvider = ({
|
|
|
21444
21556
|
},
|
|
21445
21557
|
[client, workspaceId, projectId]
|
|
21446
21558
|
);
|
|
21447
|
-
const listPathByFolder = (0,
|
|
21559
|
+
const listPathByFolder = (0, import_react74.useCallback)(
|
|
21448
21560
|
async (folder, assistantId) => {
|
|
21449
21561
|
let normalizedPath = folder;
|
|
21450
21562
|
if (normalizedPath.startsWith("~/")) {
|
|
@@ -21457,7 +21569,7 @@ var WorkspaceContextProvider = ({
|
|
|
21457
21569
|
},
|
|
21458
21570
|
[listPath]
|
|
21459
21571
|
);
|
|
21460
|
-
const uploadFile = (0,
|
|
21572
|
+
const uploadFile = (0, import_react74.useCallback)(
|
|
21461
21573
|
async (path, file, assistantId) => {
|
|
21462
21574
|
if (!workspaceId || !projectId) {
|
|
21463
21575
|
throw new Error("Workspace and project must be selected before uploading files");
|
|
@@ -21477,7 +21589,7 @@ var WorkspaceContextProvider = ({
|
|
|
21477
21589
|
},
|
|
21478
21590
|
[client, workspaceId, projectId]
|
|
21479
21591
|
);
|
|
21480
|
-
const uploadFileToFolder = (0,
|
|
21592
|
+
const uploadFileToFolder = (0, import_react74.useCallback)(
|
|
21481
21593
|
async (folder, file, assistantId) => {
|
|
21482
21594
|
let normalizedFolder = folder;
|
|
21483
21595
|
if (normalizedFolder.startsWith("~/")) {
|
|
@@ -21487,7 +21599,7 @@ var WorkspaceContextProvider = ({
|
|
|
21487
21599
|
},
|
|
21488
21600
|
[uploadFile]
|
|
21489
21601
|
);
|
|
21490
|
-
const getFileViewUrl = (0,
|
|
21602
|
+
const getFileViewUrl = (0, import_react74.useCallback)(
|
|
21491
21603
|
(filePath, assistantId) => {
|
|
21492
21604
|
if (!workspaceId || !projectId) {
|
|
21493
21605
|
return "";
|
|
@@ -21539,17 +21651,17 @@ var WorkspaceContextProvider = ({
|
|
|
21539
21651
|
};
|
|
21540
21652
|
|
|
21541
21653
|
// src/components/Chat/DatabasePicker.tsx
|
|
21542
|
-
var
|
|
21654
|
+
var import_react75 = require("react");
|
|
21543
21655
|
var import_antd64 = require("antd");
|
|
21544
21656
|
var import_lucide_react15 = require("lucide-react");
|
|
21545
21657
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
21546
21658
|
var DatabasePicker = ({ senderRef, iconOnly }) => {
|
|
21547
|
-
const [modalOpen, setModalOpen] = (0,
|
|
21548
|
-
const [databases, setDatabases] = (0,
|
|
21549
|
-
const [loading, setLoading] = (0,
|
|
21550
|
-
const [selectedDatabases, setSelectedDatabases] = (0,
|
|
21659
|
+
const [modalOpen, setModalOpen] = (0, import_react75.useState)(false);
|
|
21660
|
+
const [databases, setDatabases] = (0, import_react75.useState)([]);
|
|
21661
|
+
const [loading, setLoading] = (0, import_react75.useState)(false);
|
|
21662
|
+
const [selectedDatabases, setSelectedDatabases] = (0, import_react75.useState)([]);
|
|
21551
21663
|
const { get } = useApi();
|
|
21552
|
-
const fetchedRef = (0,
|
|
21664
|
+
const fetchedRef = (0, import_react75.useRef)(false);
|
|
21553
21665
|
const loadDatabases = async () => {
|
|
21554
21666
|
setLoading(true);
|
|
21555
21667
|
try {
|
|
@@ -21689,17 +21801,17 @@ var DatabasePicker = ({ senderRef, iconOnly }) => {
|
|
|
21689
21801
|
};
|
|
21690
21802
|
|
|
21691
21803
|
// src/components/Chat/SkillPicker.tsx
|
|
21692
|
-
var
|
|
21804
|
+
var import_react76 = require("react");
|
|
21693
21805
|
var import_antd65 = require("antd");
|
|
21694
21806
|
var import_lucide_react16 = require("lucide-react");
|
|
21695
21807
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
21696
21808
|
var SkillPicker = ({ senderRef, iconOnly }) => {
|
|
21697
|
-
const [modalOpen, setModalOpen] = (0,
|
|
21698
|
-
const [skills, setSkills] = (0,
|
|
21699
|
-
const [loading, setLoading] = (0,
|
|
21700
|
-
const [selectedSkills, setSelectedSkills] = (0,
|
|
21809
|
+
const [modalOpen, setModalOpen] = (0, import_react76.useState)(false);
|
|
21810
|
+
const [skills, setSkills] = (0, import_react76.useState)([]);
|
|
21811
|
+
const [loading, setLoading] = (0, import_react76.useState)(false);
|
|
21812
|
+
const [selectedSkills, setSelectedSkills] = (0, import_react76.useState)([]);
|
|
21701
21813
|
const { get } = useApi();
|
|
21702
|
-
const fetchedRef = (0,
|
|
21814
|
+
const fetchedRef = (0, import_react76.useRef)(false);
|
|
21703
21815
|
const loadSkills = async () => {
|
|
21704
21816
|
setLoading(true);
|
|
21705
21817
|
try {
|
|
@@ -21839,16 +21951,16 @@ var SkillPicker = ({ senderRef, iconOnly }) => {
|
|
|
21839
21951
|
};
|
|
21840
21952
|
|
|
21841
21953
|
// src/components/Chat/AgentPicker.tsx
|
|
21842
|
-
var
|
|
21954
|
+
var import_react77 = require("react");
|
|
21843
21955
|
var import_antd66 = require("antd");
|
|
21844
21956
|
var import_lucide_react17 = require("lucide-react");
|
|
21845
21957
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
21846
21958
|
var AgentPicker = ({ senderRef, iconOnly }) => {
|
|
21847
|
-
const [modalOpen, setModalOpen] = (0,
|
|
21848
|
-
const [loading, setLoading] = (0,
|
|
21849
|
-
const [selectedAgent, setSelectedAgent] = (0,
|
|
21959
|
+
const [modalOpen, setModalOpen] = (0, import_react77.useState)(false);
|
|
21960
|
+
const [loading, setLoading] = (0, import_react77.useState)(false);
|
|
21961
|
+
const [selectedAgent, setSelectedAgent] = (0, import_react77.useState)(null);
|
|
21850
21962
|
const { assistants, currentAssistant, selectAssistant } = useAssistantContext();
|
|
21851
|
-
const fetchedRef = (0,
|
|
21963
|
+
const fetchedRef = (0, import_react77.useRef)(false);
|
|
21852
21964
|
const handleOpenModal = () => {
|
|
21853
21965
|
setSelectedAgent(currentAssistant?.id || null);
|
|
21854
21966
|
setModalOpen(true);
|
|
@@ -21955,7 +22067,7 @@ var AgentPicker = ({ senderRef, iconOnly }) => {
|
|
|
21955
22067
|
};
|
|
21956
22068
|
|
|
21957
22069
|
// src/components/Chat/MetricsDataSourcePicker.tsx
|
|
21958
|
-
var
|
|
22070
|
+
var import_react78 = require("react");
|
|
21959
22071
|
var import_antd67 = require("antd");
|
|
21960
22072
|
var import_lucide_react18 = require("lucide-react");
|
|
21961
22073
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
@@ -21964,13 +22076,13 @@ var MetricsDataSourcePicker = ({
|
|
|
21964
22076
|
senderRef,
|
|
21965
22077
|
iconOnly
|
|
21966
22078
|
}) => {
|
|
21967
|
-
const [modalOpen, setModalOpen] = (0,
|
|
21968
|
-
const [loading, setLoading] = (0,
|
|
21969
|
-
const [dataSources, setDataSources] = (0,
|
|
22079
|
+
const [modalOpen, setModalOpen] = (0, import_react78.useState)(false);
|
|
22080
|
+
const [loading, setLoading] = (0, import_react78.useState)(false);
|
|
22081
|
+
const [dataSources, setDataSources] = (0, import_react78.useState)([]);
|
|
21970
22082
|
const { config } = useLatticeChatShellContext();
|
|
21971
22083
|
const { customRunConfig, updateCustomRunConfig } = useConversationContext();
|
|
21972
22084
|
const { get } = useApi();
|
|
21973
|
-
const hasInitializedRef = (0,
|
|
22085
|
+
const hasInitializedRef = (0, import_react78.useRef)(false);
|
|
21974
22086
|
const loadDataSources = async () => {
|
|
21975
22087
|
setLoading(true);
|
|
21976
22088
|
try {
|
|
@@ -22044,7 +22156,7 @@ var MetricsDataSourcePicker = ({
|
|
|
22044
22156
|
console.error("Failed to save datasource to sessionStorage:", error);
|
|
22045
22157
|
}
|
|
22046
22158
|
};
|
|
22047
|
-
(0,
|
|
22159
|
+
(0, import_react78.useEffect)(() => {
|
|
22048
22160
|
if (hasInitializedRef.current) return;
|
|
22049
22161
|
hasInitializedRef.current = true;
|
|
22050
22162
|
loadDataSources().then(() => {
|
|
@@ -22295,7 +22407,7 @@ var MetricsDataSourcePicker = ({
|
|
|
22295
22407
|
};
|
|
22296
22408
|
|
|
22297
22409
|
// src/components/Chat/ModelSelector.tsx
|
|
22298
|
-
var
|
|
22410
|
+
var import_react79 = require("react");
|
|
22299
22411
|
var import_antd68 = require("antd");
|
|
22300
22412
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
22301
22413
|
var ModelSelector = ({
|
|
@@ -22304,22 +22416,22 @@ var ModelSelector = ({
|
|
|
22304
22416
|
defaultModelKey = "default",
|
|
22305
22417
|
style
|
|
22306
22418
|
}) => {
|
|
22307
|
-
const [models, setModels] = (0,
|
|
22308
|
-
const [isLoading, setIsLoading] = (0,
|
|
22309
|
-
const [internalValue, setInternalValue] = (0,
|
|
22310
|
-
const [dropdownOpen, setDropdownOpen] = (0,
|
|
22311
|
-
const [isHovered, setIsHovered] = (0,
|
|
22312
|
-
const hasFetchedRef = (0,
|
|
22313
|
-
const hasSetDefaultRef = (0,
|
|
22419
|
+
const [models, setModels] = (0, import_react79.useState)([]);
|
|
22420
|
+
const [isLoading, setIsLoading] = (0, import_react79.useState)(false);
|
|
22421
|
+
const [internalValue, setInternalValue] = (0, import_react79.useState)(null);
|
|
22422
|
+
const [dropdownOpen, setDropdownOpen] = (0, import_react79.useState)(false);
|
|
22423
|
+
const [isHovered, setIsHovered] = (0, import_react79.useState)(false);
|
|
22424
|
+
const hasFetchedRef = (0, import_react79.useRef)(false);
|
|
22425
|
+
const hasSetDefaultRef = (0, import_react79.useRef)(false);
|
|
22314
22426
|
const { get } = useApi();
|
|
22315
22427
|
const selectedModelConfig = value !== void 0 ? value : internalValue;
|
|
22316
|
-
const setSelectedModelConfig = (0,
|
|
22428
|
+
const setSelectedModelConfig = (0, import_react79.useCallback)((config) => {
|
|
22317
22429
|
if (value === void 0) {
|
|
22318
22430
|
setInternalValue(config);
|
|
22319
22431
|
}
|
|
22320
22432
|
onChange?.(config);
|
|
22321
22433
|
}, [value, onChange]);
|
|
22322
|
-
const fetchModels = (0,
|
|
22434
|
+
const fetchModels = (0, import_react79.useCallback)(async () => {
|
|
22323
22435
|
if (hasFetchedRef.current) return;
|
|
22324
22436
|
hasFetchedRef.current = true;
|
|
22325
22437
|
setIsLoading(true);
|
|
@@ -22340,7 +22452,7 @@ var ModelSelector = ({
|
|
|
22340
22452
|
setIsLoading(false);
|
|
22341
22453
|
}
|
|
22342
22454
|
}, [get, defaultModelKey]);
|
|
22343
|
-
(0,
|
|
22455
|
+
(0, import_react79.useEffect)(() => {
|
|
22344
22456
|
fetchModels();
|
|
22345
22457
|
}, [fetchModels]);
|
|
22346
22458
|
const handleChange = (modelKey) => {
|
|
@@ -22387,7 +22499,7 @@ var ModelSelector = ({
|
|
|
22387
22499
|
var import_icons35 = require("@ant-design/icons");
|
|
22388
22500
|
var import_x4 = require("@ant-design/x");
|
|
22389
22501
|
var import_antd69 = require("antd");
|
|
22390
|
-
var
|
|
22502
|
+
var import_react80 = require("react");
|
|
22391
22503
|
var import_lucide_react19 = require("lucide-react");
|
|
22392
22504
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
22393
22505
|
var categoryConfig = {
|
|
@@ -22472,12 +22584,12 @@ var SkillCategoryPrompts = ({
|
|
|
22472
22584
|
senderRef,
|
|
22473
22585
|
visible = true
|
|
22474
22586
|
}) => {
|
|
22475
|
-
const [skills, setSkills] = (0,
|
|
22476
|
-
const [loading, setLoading] = (0,
|
|
22477
|
-
const [showAll, setShowAll] = (0,
|
|
22587
|
+
const [skills, setSkills] = (0, import_react80.useState)([]);
|
|
22588
|
+
const [loading, setLoading] = (0, import_react80.useState)(false);
|
|
22589
|
+
const [showAll, setShowAll] = (0, import_react80.useState)(false);
|
|
22478
22590
|
const { get } = useApi();
|
|
22479
22591
|
const MAX_SIMPLE_ITEMS = 10;
|
|
22480
|
-
(0,
|
|
22592
|
+
(0, import_react80.useEffect)(() => {
|
|
22481
22593
|
const loadSkills = async () => {
|
|
22482
22594
|
setLoading(true);
|
|
22483
22595
|
try {
|
|
@@ -22495,7 +22607,7 @@ var SkillCategoryPrompts = ({
|
|
|
22495
22607
|
loadSkills();
|
|
22496
22608
|
}
|
|
22497
22609
|
}, [get, visible]);
|
|
22498
|
-
const groupedSkills = (0,
|
|
22610
|
+
const groupedSkills = (0, import_react80.useMemo)(() => {
|
|
22499
22611
|
const groups = {};
|
|
22500
22612
|
skills.forEach((skill) => {
|
|
22501
22613
|
const category = skill.metadata?.category || "global";
|
|
@@ -22650,7 +22762,7 @@ var SkillCategoryPrompts_default = SkillCategoryPrompts;
|
|
|
22650
22762
|
var import_icons36 = require("@ant-design/icons");
|
|
22651
22763
|
var import_x5 = require("@ant-design/x");
|
|
22652
22764
|
var import_antd70 = require("antd");
|
|
22653
|
-
var
|
|
22765
|
+
var import_react81 = require("react");
|
|
22654
22766
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
22655
22767
|
var defaultCategoryIcons = {
|
|
22656
22768
|
financial: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_icons36.DollarOutlined, {}),
|
|
@@ -22869,9 +22981,9 @@ var BusinessAnalysisPrompts = ({
|
|
|
22869
22981
|
simpleModeTitle = "Quick Analysis",
|
|
22870
22982
|
expandModeTitle = "Analysis Categories"
|
|
22871
22983
|
}) => {
|
|
22872
|
-
const [showAll, setShowAll] = (0,
|
|
22984
|
+
const [showAll, setShowAll] = (0, import_react81.useState)(false);
|
|
22873
22985
|
const { config } = useLatticeChatShellContext();
|
|
22874
|
-
const analysisData = (0,
|
|
22986
|
+
const analysisData = (0, import_react81.useMemo)(() => {
|
|
22875
22987
|
const customData = config.quickPromptsData;
|
|
22876
22988
|
if (customData && Array.isArray(customData) && customData.length > 0) {
|
|
22877
22989
|
return customData.map((category) => ({
|
|
@@ -22891,7 +23003,7 @@ var BusinessAnalysisPrompts = ({
|
|
|
22891
23003
|
color: defaultCategoryColors[category.key] || "#8C8C8C"
|
|
22892
23004
|
}));
|
|
22893
23005
|
}, [config.quickPromptsData]);
|
|
22894
|
-
const allItems = (0,
|
|
23006
|
+
const allItems = (0, import_react81.useMemo)(() => {
|
|
22895
23007
|
const items = [];
|
|
22896
23008
|
analysisData.forEach((category) => {
|
|
22897
23009
|
category.items.forEach((item) => {
|
|
@@ -23042,12 +23154,12 @@ var Chating = ({
|
|
|
23042
23154
|
initialMessage,
|
|
23043
23155
|
onInitialMessageSent
|
|
23044
23156
|
}) => {
|
|
23045
|
-
const [content, setContent] = (0,
|
|
23046
|
-
const [attachedFiles, setAttachedFiles] = (0,
|
|
23157
|
+
const [content, setContent] = (0, import_react82.useState)("");
|
|
23158
|
+
const [attachedFiles, setAttachedFiles] = (0, import_react82.useState)([]);
|
|
23047
23159
|
const { styles } = useStyle();
|
|
23048
|
-
const [headerOpen, setHeaderOpen] = (0,
|
|
23049
|
-
const attachmentsRef = (0,
|
|
23050
|
-
const senderRef =
|
|
23160
|
+
const [headerOpen, setHeaderOpen] = (0, import_react82.useState)(false);
|
|
23161
|
+
const attachmentsRef = (0, import_react82.useRef)(null);
|
|
23162
|
+
const senderRef = import_react82.default.useRef(null);
|
|
23051
23163
|
const {
|
|
23052
23164
|
assistantId,
|
|
23053
23165
|
threadId,
|
|
@@ -23070,8 +23182,8 @@ var Chating = ({
|
|
|
23070
23182
|
const hasPendingMessages = pendingMessages?.length > 0;
|
|
23071
23183
|
const isInputDisabled = interrupts && interrupts.length > 0;
|
|
23072
23184
|
const typingFrames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
23073
|
-
const [typingFrameIndex, setTypingFrameIndex] = (0,
|
|
23074
|
-
(0,
|
|
23185
|
+
const [typingFrameIndex, setTypingFrameIndex] = (0, import_react82.useState)(0);
|
|
23186
|
+
(0, import_react82.useEffect)(() => {
|
|
23075
23187
|
if (!isStreaming) return;
|
|
23076
23188
|
const interval = setInterval(() => {
|
|
23077
23189
|
setTypingFrameIndex((prev) => (prev + 1) % typingFrames.length);
|
|
@@ -23079,16 +23191,16 @@ var Chating = ({
|
|
|
23079
23191
|
return () => clearInterval(interval);
|
|
23080
23192
|
}, [isStreaming]);
|
|
23081
23193
|
const conversationContext = useConversationContext();
|
|
23082
|
-
const systemContextSentRef = (0,
|
|
23083
|
-
const initialMessageSentRef = (0,
|
|
23084
|
-
const prevLoadingRef = (0,
|
|
23085
|
-
(0,
|
|
23194
|
+
const systemContextSentRef = (0, import_react82.useRef)(false);
|
|
23195
|
+
const initialMessageSentRef = (0, import_react82.useRef)(false);
|
|
23196
|
+
const prevLoadingRef = (0, import_react82.useRef)(false);
|
|
23197
|
+
(0, import_react82.useEffect)(() => {
|
|
23086
23198
|
systemContextSentRef.current = false;
|
|
23087
23199
|
}, [threadId]);
|
|
23088
|
-
(0,
|
|
23200
|
+
(0, import_react82.useEffect)(() => {
|
|
23089
23201
|
initialMessageSentRef.current = false;
|
|
23090
23202
|
}, [threadId]);
|
|
23091
|
-
(0,
|
|
23203
|
+
(0, import_react82.useEffect)(() => {
|
|
23092
23204
|
const wasLoading = prevLoadingRef.current;
|
|
23093
23205
|
prevLoadingRef.current = isLoading;
|
|
23094
23206
|
if (wasLoading && !isLoading && initialMessage && threadId && !initialMessageSentRef.current) {
|
|
@@ -23100,16 +23212,16 @@ var Chating = ({
|
|
|
23100
23212
|
onInitialMessageSent?.();
|
|
23101
23213
|
}
|
|
23102
23214
|
}, [isLoading, initialMessage, threadId, sendMessage, onInitialMessageSent]);
|
|
23103
|
-
const [modelConfig, setModelConfig] = (0,
|
|
23104
|
-
const handleModelChange = (0,
|
|
23215
|
+
const [modelConfig, setModelConfig] = (0, import_react82.useState)(null);
|
|
23216
|
+
const handleModelChange = (0, import_react82.useCallback)((config2) => {
|
|
23105
23217
|
setModelConfig(config2);
|
|
23106
23218
|
if (config2) {
|
|
23107
23219
|
updateCustomRunConfig({ modelConfig: config2 });
|
|
23108
23220
|
}
|
|
23109
23221
|
}, [updateCustomRunConfig]);
|
|
23110
|
-
const [isEmptyState, setIsEmptyState] = (0,
|
|
23111
|
-
const [isTransitioning, setIsTransitioning] = (0,
|
|
23112
|
-
(0,
|
|
23222
|
+
const [isEmptyState, setIsEmptyState] = (0, import_react82.useState)(showEmptyState && messages.length === 0 && !pendingMessages?.length);
|
|
23223
|
+
const [isTransitioning, setIsTransitioning] = (0, import_react82.useState)(false);
|
|
23224
|
+
(0, import_react82.useEffect)(() => {
|
|
23113
23225
|
if (!showEmptyState) {
|
|
23114
23226
|
setIsEmptyState(false);
|
|
23115
23227
|
return;
|
|
@@ -23129,14 +23241,14 @@ var Chating = ({
|
|
|
23129
23241
|
const { baseURL } = config;
|
|
23130
23242
|
const user = useAuthOptional()?.user;
|
|
23131
23243
|
const displayUserName = user?.name || user?.email?.split("@")[0] || "there";
|
|
23132
|
-
const workspaceContext = (0,
|
|
23244
|
+
const workspaceContext = (0, import_react82.useContext)(WorkspaceContext);
|
|
23133
23245
|
const listPath = workspaceContext?.listPath ?? (async () => []);
|
|
23134
23246
|
const listPathByFolder = workspaceContext?.listPathByFolder ?? (async () => []);
|
|
23135
23247
|
const workspaceId = workspaceContext?.workspaceId ?? null;
|
|
23136
23248
|
const projectId = workspaceContext?.projectId ?? null;
|
|
23137
|
-
const [workspaceFiles, setWorkspaceFiles] = (0,
|
|
23138
|
-
const [suggestionsLoading, setSuggestionsLoading] = (0,
|
|
23139
|
-
const [suggestionsOpen, setSuggestionsOpen] = (0,
|
|
23249
|
+
const [workspaceFiles, setWorkspaceFiles] = (0, import_react82.useState)([]);
|
|
23250
|
+
const [suggestionsLoading, setSuggestionsLoading] = (0, import_react82.useState)(false);
|
|
23251
|
+
const [suggestionsOpen, setSuggestionsOpen] = (0, import_react82.useState)(false);
|
|
23140
23252
|
const getFileIcon3 = (filename) => {
|
|
23141
23253
|
const ext = filename.split(".").pop()?.toLowerCase();
|
|
23142
23254
|
const iconStyle = { fontSize: 16 };
|
|
@@ -23196,7 +23308,7 @@ var Chating = ({
|
|
|
23196
23308
|
setSuggestionsLoading(false);
|
|
23197
23309
|
}
|
|
23198
23310
|
};
|
|
23199
|
-
(0,
|
|
23311
|
+
(0, import_react82.useEffect)(() => {
|
|
23200
23312
|
regsiterElement("action_show_attachments_uploader", {
|
|
23201
23313
|
card_view: () => null,
|
|
23202
23314
|
action: (data) => {
|
|
@@ -23394,8 +23506,8 @@ ${nextContent}`;
|
|
|
23394
23506
|
...showRefreshButton ? [refreshButton] : [],
|
|
23395
23507
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ThreadManagementButtons, {}, "thread-buttons")
|
|
23396
23508
|
];
|
|
23397
|
-
const [skills, setSkills] = (0,
|
|
23398
|
-
const [skillsLoading, setSkillsLoading] = (0,
|
|
23509
|
+
const [skills, setSkills] = (0, import_react82.useState)([]);
|
|
23510
|
+
const [skillsLoading, setSkillsLoading] = (0, import_react82.useState)(false);
|
|
23399
23511
|
const { get: apiGet } = useApi();
|
|
23400
23512
|
const loadSkills = async () => {
|
|
23401
23513
|
if (skills.length > 0) return;
|
|
@@ -23419,7 +23531,7 @@ ${nextContent}`;
|
|
|
23419
23531
|
return isEmpty ? "Type / to see available skills, or @ to reference files" : void 0;
|
|
23420
23532
|
};
|
|
23421
23533
|
const renderSender = (isEmpty) => {
|
|
23422
|
-
const [suggestionMode, setSuggestionMode] = (0,
|
|
23534
|
+
const [suggestionMode, setSuggestionMode] = (0, import_react82.useState)(null);
|
|
23423
23535
|
const suggestionItems = suggestionMode === "skills" ? skills.map((skill) => ({
|
|
23424
23536
|
value: skill.name,
|
|
23425
23537
|
icon: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react20.BrainCircuit, { size: 14, style: { color: "#722ed1" } }),
|
|
@@ -23796,7 +23908,7 @@ var InternetSearchCard = ({
|
|
|
23796
23908
|
};
|
|
23797
23909
|
|
|
23798
23910
|
// src/components/GenUI/elements/schedule_viewer.tsx
|
|
23799
|
-
var
|
|
23911
|
+
var import_react83 = require("react");
|
|
23800
23912
|
var import_antd74 = require("antd");
|
|
23801
23913
|
var import_icons39 = require("@ant-design/icons");
|
|
23802
23914
|
var import_antd_style24 = require("antd-style");
|
|
@@ -23935,10 +24047,10 @@ var ScheduleViewer = ({ data }) => {
|
|
|
23935
24047
|
const { styles } = useStyles8();
|
|
23936
24048
|
const { threadId, assistantId, tasks: initialTasks, onRefresh } = data ?? {};
|
|
23937
24049
|
const client = useClient(assistantId || "");
|
|
23938
|
-
const [tasks, setTasks] = (0,
|
|
23939
|
-
const [loading, setLoading] = (0,
|
|
23940
|
-
const [actionLoading, setActionLoading] = (0,
|
|
23941
|
-
const handleRefresh = (0,
|
|
24050
|
+
const [tasks, setTasks] = (0, import_react83.useState)(initialTasks || []);
|
|
24051
|
+
const [loading, setLoading] = (0, import_react83.useState)(false);
|
|
24052
|
+
const [actionLoading, setActionLoading] = (0, import_react83.useState)(null);
|
|
24053
|
+
const handleRefresh = (0, import_react83.useCallback)(async () => {
|
|
23942
24054
|
if (!threadId) return;
|
|
23943
24055
|
setLoading(true);
|
|
23944
24056
|
try {
|
|
@@ -23952,7 +24064,7 @@ var ScheduleViewer = ({ data }) => {
|
|
|
23952
24064
|
setLoading(false);
|
|
23953
24065
|
}
|
|
23954
24066
|
}, [client, threadId, onRefresh]);
|
|
23955
|
-
const handleCancel = (0,
|
|
24067
|
+
const handleCancel = (0, import_react83.useCallback)(
|
|
23956
24068
|
async (taskId) => {
|
|
23957
24069
|
setActionLoading(taskId);
|
|
23958
24070
|
try {
|
|
@@ -23968,7 +24080,7 @@ var ScheduleViewer = ({ data }) => {
|
|
|
23968
24080
|
},
|
|
23969
24081
|
[client, handleRefresh]
|
|
23970
24082
|
);
|
|
23971
|
-
const handlePause = (0,
|
|
24083
|
+
const handlePause = (0, import_react83.useCallback)(
|
|
23972
24084
|
async (taskId) => {
|
|
23973
24085
|
setActionLoading(taskId);
|
|
23974
24086
|
try {
|
|
@@ -23984,7 +24096,7 @@ var ScheduleViewer = ({ data }) => {
|
|
|
23984
24096
|
},
|
|
23985
24097
|
[client, handleRefresh]
|
|
23986
24098
|
);
|
|
23987
|
-
const handleResume = (0,
|
|
24099
|
+
const handleResume = (0, import_react83.useCallback)(
|
|
23988
24100
|
async (taskId) => {
|
|
23989
24101
|
setActionLoading(taskId);
|
|
23990
24102
|
try {
|
|
@@ -24000,12 +24112,12 @@ var ScheduleViewer = ({ data }) => {
|
|
|
24000
24112
|
},
|
|
24001
24113
|
[client, handleRefresh]
|
|
24002
24114
|
);
|
|
24003
|
-
(0,
|
|
24115
|
+
(0, import_react83.useEffect)(() => {
|
|
24004
24116
|
if (threadId && (!initialTasks || initialTasks.length === 0)) {
|
|
24005
24117
|
handleRefresh();
|
|
24006
24118
|
}
|
|
24007
24119
|
}, [threadId]);
|
|
24008
|
-
(0,
|
|
24120
|
+
(0, import_react83.useEffect)(() => {
|
|
24009
24121
|
if (initialTasks) {
|
|
24010
24122
|
setTasks(initialTasks);
|
|
24011
24123
|
}
|
|
@@ -24473,13 +24585,13 @@ var TeamGraph = ({ data }) => {
|
|
|
24473
24585
|
var TeamGraph_default = TeamGraph;
|
|
24474
24586
|
|
|
24475
24587
|
// src/components/GenUI/elements/TeamWorkspace/index.tsx
|
|
24476
|
-
var
|
|
24588
|
+
var import_react91 = require("react");
|
|
24477
24589
|
var import_antd86 = require("antd");
|
|
24478
24590
|
var import_lucide_react28 = require("lucide-react");
|
|
24479
24591
|
var import_antd_style33 = require("antd-style");
|
|
24480
24592
|
|
|
24481
24593
|
// src/components/GenUI/elements/TeamWorkspace/TeamWorkspaceMenu.tsx
|
|
24482
|
-
var
|
|
24594
|
+
var import_react84 = __toESM(require("react"));
|
|
24483
24595
|
var import_lucide_react22 = require("lucide-react");
|
|
24484
24596
|
var import_antd78 = require("antd");
|
|
24485
24597
|
var import_antd_style25 = require("antd-style");
|
|
@@ -24665,7 +24777,7 @@ var TeamWorkspaceMenu = ({
|
|
|
24665
24777
|
onItemClick
|
|
24666
24778
|
}) => {
|
|
24667
24779
|
const { styles } = useStyles9();
|
|
24668
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
24780
|
+
const [isExpanded, setIsExpanded] = (0, import_react84.useState)(false);
|
|
24669
24781
|
const mainItems = items.filter((item) => !item.group);
|
|
24670
24782
|
const teammateItems = items.filter((item) => item.group === "Teammates");
|
|
24671
24783
|
const teamItems = items.filter((item) => item.group === "Team");
|
|
@@ -24693,7 +24805,7 @@ var TeamWorkspaceMenu = ({
|
|
|
24693
24805
|
if (showTooltip && !isExpanded) {
|
|
24694
24806
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_antd78.Tooltip, { title: item.name, placement: "right", children: content }, item.id);
|
|
24695
24807
|
}
|
|
24696
|
-
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
24808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_react84.default.Fragment, { children: content }, item.id);
|
|
24697
24809
|
};
|
|
24698
24810
|
const renderGroup = (groupItems, groupLabel, showDivider) => {
|
|
24699
24811
|
if (groupItems.length === 0) return null;
|
|
@@ -24739,13 +24851,13 @@ var import_lucide_react23 = require("lucide-react");
|
|
|
24739
24851
|
var import_antd_style26 = require("antd-style");
|
|
24740
24852
|
|
|
24741
24853
|
// src/components/GenUI/elements/TeamWorkspace/hooks/useTeamWorkspaceData.ts
|
|
24742
|
-
var
|
|
24854
|
+
var import_react85 = require("react");
|
|
24743
24855
|
function useTeamWorkspaceData(threadId, assistantId) {
|
|
24744
24856
|
const { agentState, isLoading, error, refresh } = useAgentState(threadId, assistantId, {
|
|
24745
24857
|
pollingInterval: 5e3,
|
|
24746
24858
|
autoStart: true
|
|
24747
24859
|
});
|
|
24748
|
-
const data = (0,
|
|
24860
|
+
const data = (0, import_react85.useMemo)(() => {
|
|
24749
24861
|
const team = agentState?.values?.team || null;
|
|
24750
24862
|
const tasks = agentState?.values?.tasks || [];
|
|
24751
24863
|
const mailbox = agentState?.values?.team_mailbox || [];
|
|
@@ -25134,13 +25246,13 @@ var TeamDashboard = ({
|
|
|
25134
25246
|
};
|
|
25135
25247
|
|
|
25136
25248
|
// src/components/GenUI/elements/TeamWorkspace/IssuesView.tsx
|
|
25137
|
-
var
|
|
25249
|
+
var import_react87 = require("react");
|
|
25138
25250
|
var import_antd81 = require("antd");
|
|
25139
25251
|
var import_lucide_react25 = require("lucide-react");
|
|
25140
25252
|
var import_antd_style28 = require("antd-style");
|
|
25141
25253
|
|
|
25142
25254
|
// src/components/GenUI/elements/TeamWorkspace/TaskDetailModal.tsx
|
|
25143
|
-
var
|
|
25255
|
+
var import_react86 = require("react");
|
|
25144
25256
|
var import_antd80 = require("antd");
|
|
25145
25257
|
var import_antd_style27 = require("antd-style");
|
|
25146
25258
|
var import_lucide_react24 = require("lucide-react");
|
|
@@ -25555,7 +25667,7 @@ var TaskDetailModal = ({
|
|
|
25555
25667
|
onClose
|
|
25556
25668
|
}) => {
|
|
25557
25669
|
const { styles } = useStyles11();
|
|
25558
|
-
const [activeTab, setActiveTab] = (0,
|
|
25670
|
+
const [activeTab, setActiveTab] = (0, import_react86.useState)("comments");
|
|
25559
25671
|
if (!task) return null;
|
|
25560
25672
|
const statusConfig2 = getStatusConfig2(task.status);
|
|
25561
25673
|
const tabItems = [
|
|
@@ -25981,7 +26093,7 @@ var formatDate2 = (timestamp) => {
|
|
|
25981
26093
|
});
|
|
25982
26094
|
};
|
|
25983
26095
|
var ListGroupComponent = ({ group, styles, defaultExpanded = true, onTaskClick }) => {
|
|
25984
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
26096
|
+
const [isExpanded, setIsExpanded] = (0, import_react87.useState)(defaultExpanded);
|
|
25985
26097
|
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: styles.listGroup, children: [
|
|
25986
26098
|
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(
|
|
25987
26099
|
"div",
|
|
@@ -26024,10 +26136,10 @@ var IssuesView = ({
|
|
|
26024
26136
|
teammates
|
|
26025
26137
|
}) => {
|
|
26026
26138
|
const { styles } = useStyles12();
|
|
26027
|
-
const [viewMode, setViewMode] = (0,
|
|
26028
|
-
const [selectedTask, setSelectedTask] = (0,
|
|
26029
|
-
const [modalVisible, setModalVisible] = (0,
|
|
26030
|
-
const listGroups = (0,
|
|
26139
|
+
const [viewMode, setViewMode] = (0, import_react87.useState)("list");
|
|
26140
|
+
const [selectedTask, setSelectedTask] = (0, import_react87.useState)(null);
|
|
26141
|
+
const [modalVisible, setModalVisible] = (0, import_react87.useState)(false);
|
|
26142
|
+
const listGroups = (0, import_react87.useMemo)(() => {
|
|
26031
26143
|
const groups = [
|
|
26032
26144
|
{
|
|
26033
26145
|
id: "pending",
|
|
@@ -26066,7 +26178,7 @@ var IssuesView = ({
|
|
|
26066
26178
|
});
|
|
26067
26179
|
return groups;
|
|
26068
26180
|
}, [tasks]);
|
|
26069
|
-
const tasksByStatus = (0,
|
|
26181
|
+
const tasksByStatus = (0, import_react87.useMemo)(() => {
|
|
26070
26182
|
const grouped = {
|
|
26071
26183
|
pending: [],
|
|
26072
26184
|
claimed: [],
|
|
@@ -26199,8 +26311,8 @@ var IssuesView = ({
|
|
|
26199
26311
|
};
|
|
26200
26312
|
|
|
26201
26313
|
// src/components/GenUI/elements/TeamWorkspace/TeamOrgCanvas.tsx
|
|
26202
|
-
var
|
|
26203
|
-
var
|
|
26314
|
+
var import_react88 = __toESM(require("react"));
|
|
26315
|
+
var import_react89 = require("@xyflow/react");
|
|
26204
26316
|
var import_style5 = require("@xyflow/react/dist/style.css");
|
|
26205
26317
|
var import_antd82 = require("antd");
|
|
26206
26318
|
var import_antd_style29 = require("antd-style");
|
|
@@ -26356,8 +26468,8 @@ var TeamOrgCanvasInner = ({
|
|
|
26356
26468
|
tasks
|
|
26357
26469
|
}) => {
|
|
26358
26470
|
const { styles } = useStyles13();
|
|
26359
|
-
const { fitView } = (0,
|
|
26360
|
-
const taskStatsByTeammate = (0,
|
|
26471
|
+
const { fitView } = (0, import_react89.useReactFlow)();
|
|
26472
|
+
const taskStatsByTeammate = (0, import_react88.useMemo)(() => {
|
|
26361
26473
|
const stats = {};
|
|
26362
26474
|
teammates.forEach((t) => {
|
|
26363
26475
|
stats[t.name] = { completed: 0, inProgress: 0, pending: 0 };
|
|
@@ -26375,7 +26487,7 @@ var TeamOrgCanvasInner = ({
|
|
|
26375
26487
|
});
|
|
26376
26488
|
return stats;
|
|
26377
26489
|
}, [teammates, tasks]);
|
|
26378
|
-
const { nodes, edges } = (0,
|
|
26490
|
+
const { nodes, edges } = (0, import_react88.useMemo)(() => {
|
|
26379
26491
|
const newNodes = [];
|
|
26380
26492
|
const newEdges = [];
|
|
26381
26493
|
const teamLeadId = team?.teamLeadId || "team_lead";
|
|
@@ -26430,9 +26542,9 @@ var TeamOrgCanvasInner = ({
|
|
|
26430
26542
|
});
|
|
26431
26543
|
return { nodes: newNodes, edges: newEdges };
|
|
26432
26544
|
}, [team, teammates, taskStatsByTeammate]);
|
|
26433
|
-
const [flowNodes, setNodes, onNodesChange] = (0,
|
|
26434
|
-
const [flowEdges, setEdges, onEdgesChange] = (0,
|
|
26435
|
-
|
|
26545
|
+
const [flowNodes, setNodes, onNodesChange] = (0, import_react89.useNodesState)(nodes);
|
|
26546
|
+
const [flowEdges, setEdges, onEdgesChange] = (0, import_react89.useEdgesState)(edges);
|
|
26547
|
+
import_react88.default.useEffect(() => {
|
|
26436
26548
|
setNodes(nodes);
|
|
26437
26549
|
setEdges(edges);
|
|
26438
26550
|
setTimeout(() => fitView({ padding: 0.2 }), 100);
|
|
@@ -26452,7 +26564,7 @@ var TeamOrgCanvasInner = ({
|
|
|
26452
26564
|
] }),
|
|
26453
26565
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: styles.canvas, children: [
|
|
26454
26566
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(
|
|
26455
|
-
|
|
26567
|
+
import_react89.ReactFlow,
|
|
26456
26568
|
{
|
|
26457
26569
|
nodes: flowNodes,
|
|
26458
26570
|
edges: flowEdges,
|
|
@@ -26462,8 +26574,8 @@ var TeamOrgCanvasInner = ({
|
|
|
26462
26574
|
fitView: true,
|
|
26463
26575
|
attributionPosition: "bottom-right",
|
|
26464
26576
|
children: [
|
|
26465
|
-
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
26466
|
-
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
26577
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react89.Background, { color: "#eee", gap: 20 }),
|
|
26578
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react89.Controls, {})
|
|
26467
26579
|
]
|
|
26468
26580
|
}
|
|
26469
26581
|
),
|
|
@@ -26503,7 +26615,7 @@ var TeamOrgCanvasInner = ({
|
|
|
26503
26615
|
] })
|
|
26504
26616
|
] });
|
|
26505
26617
|
};
|
|
26506
|
-
var TeamOrgCanvas = (props) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
26618
|
+
var TeamOrgCanvas = (props) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react89.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(TeamOrgCanvasInner, { ...props }) });
|
|
26507
26619
|
|
|
26508
26620
|
// src/components/GenUI/elements/TeamWorkspace/TeamMemberChat.tsx
|
|
26509
26621
|
var import_antd83 = require("antd");
|
|
@@ -26629,7 +26741,7 @@ var TeamMemberChat = ({
|
|
|
26629
26741
|
};
|
|
26630
26742
|
|
|
26631
26743
|
// src/components/GenUI/elements/MailboxPanel.tsx
|
|
26632
|
-
var
|
|
26744
|
+
var import_react90 = require("react");
|
|
26633
26745
|
var import_antd85 = require("antd");
|
|
26634
26746
|
var import_antd_style32 = require("antd-style");
|
|
26635
26747
|
var import_lucide_react27 = require("lucide-react");
|
|
@@ -27047,7 +27159,7 @@ var getMessagePreview = (content) => {
|
|
|
27047
27159
|
return firstLine.length > 80 ? firstLine.slice(0, 80) + "..." : firstLine;
|
|
27048
27160
|
};
|
|
27049
27161
|
var MessageGroupComponent = ({ group, styles, defaultExpanded = true, onMessageClick }) => {
|
|
27050
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
27162
|
+
const [isExpanded, setIsExpanded] = (0, import_react90.useState)(defaultExpanded);
|
|
27051
27163
|
return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: styles.listGroup, children: [
|
|
27052
27164
|
/* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
|
|
27053
27165
|
"div",
|
|
@@ -27102,10 +27214,10 @@ var MessageGroupComponent = ({ group, styles, defaultExpanded = true, onMessageC
|
|
|
27102
27214
|
};
|
|
27103
27215
|
var MailboxPanel = ({ data }) => {
|
|
27104
27216
|
const { styles } = useStyles16();
|
|
27105
|
-
const [selectedMessage, setSelectedMessage] = (0,
|
|
27106
|
-
const [modalVisible, setModalVisible] = (0,
|
|
27217
|
+
const [selectedMessage, setSelectedMessage] = (0, import_react90.useState)(null);
|
|
27218
|
+
const [modalVisible, setModalVisible] = (0, import_react90.useState)(false);
|
|
27107
27219
|
const { teamMailbox = [] } = data || {};
|
|
27108
|
-
const messageGroups = (0,
|
|
27220
|
+
const messageGroups = (0, import_react90.useMemo)(() => {
|
|
27109
27221
|
const groupsMap = /* @__PURE__ */ new Map();
|
|
27110
27222
|
teamMailbox.forEach((message23) => {
|
|
27111
27223
|
const sender = message23.from;
|
|
@@ -27233,8 +27345,8 @@ var TeamWorkspace = ({
|
|
|
27233
27345
|
isLoading,
|
|
27234
27346
|
refresh
|
|
27235
27347
|
} = useTeamWorkspaceData(parent_thread_id || null, assistantId);
|
|
27236
|
-
const [activeMenuId, setActiveMenuId] = (0,
|
|
27237
|
-
const menuItems = (0,
|
|
27348
|
+
const [activeMenuId, setActiveMenuId] = (0, import_react91.useState)("dashboard");
|
|
27349
|
+
const menuItems = (0, import_react91.useMemo)(() => {
|
|
27238
27350
|
const items = [
|
|
27239
27351
|
{
|
|
27240
27352
|
id: "dashboard",
|
|
@@ -27371,7 +27483,7 @@ var TeamWorkspace = ({
|
|
|
27371
27483
|
};
|
|
27372
27484
|
|
|
27373
27485
|
// src/components/GenUI/elements/TaskBoard.tsx
|
|
27374
|
-
var
|
|
27486
|
+
var import_react92 = require("react");
|
|
27375
27487
|
|
|
27376
27488
|
// src/components/GenUI/elements/TaskBoardCard.tsx
|
|
27377
27489
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
@@ -27650,7 +27762,7 @@ var TaskBoard = ({
|
|
|
27650
27762
|
const { tasks: contextTasks } = useAgentChat();
|
|
27651
27763
|
const { tasks: propTasks, onAddTask, teammates } = data || {};
|
|
27652
27764
|
const tasks = contextTasks || propTasks || [];
|
|
27653
|
-
const tasksByStatus = (0,
|
|
27765
|
+
const tasksByStatus = (0, import_react92.useMemo)(() => {
|
|
27654
27766
|
const grouped = {
|
|
27655
27767
|
pending: [],
|
|
27656
27768
|
in_progress: [],
|
|
@@ -27716,7 +27828,7 @@ var TaskBoard = ({
|
|
|
27716
27828
|
};
|
|
27717
27829
|
|
|
27718
27830
|
// src/components/GenUI/elements/Mailbox.tsx
|
|
27719
|
-
var
|
|
27831
|
+
var import_react93 = require("react");
|
|
27720
27832
|
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
27721
27833
|
var useStyle16 = () => {
|
|
27722
27834
|
return {
|
|
@@ -28002,17 +28114,17 @@ var renderMessageWithMentions = (content, mentions, styles) => {
|
|
|
28002
28114
|
var TeamChat = ({ data }) => {
|
|
28003
28115
|
const styles = useStyle16();
|
|
28004
28116
|
const { teamName, currentUser, teammates, messages, onSendMessage } = data || {};
|
|
28005
|
-
const [inputValue, setInputValue] = (0,
|
|
28006
|
-
const messagesEndRef = (0,
|
|
28007
|
-
const sortedMessages = (0,
|
|
28117
|
+
const [inputValue, setInputValue] = (0, import_react93.useState)("");
|
|
28118
|
+
const messagesEndRef = (0, import_react93.useRef)(null);
|
|
28119
|
+
const sortedMessages = (0, import_react93.useMemo)(() => {
|
|
28008
28120
|
return [...messages || []].sort(
|
|
28009
28121
|
(a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()
|
|
28010
28122
|
);
|
|
28011
28123
|
}, [messages]);
|
|
28012
|
-
const mentions = (0,
|
|
28124
|
+
const mentions = (0, import_react93.useMemo)(() => {
|
|
28013
28125
|
return teammates?.map((t) => t.name) || [];
|
|
28014
28126
|
}, [teammates]);
|
|
28015
|
-
(0,
|
|
28127
|
+
(0, import_react93.useEffect)(() => {
|
|
28016
28128
|
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
28017
28129
|
}, [sortedMessages]);
|
|
28018
28130
|
const handleSend = () => {
|
|
@@ -28181,12 +28293,12 @@ var TeamChat = ({ data }) => {
|
|
|
28181
28293
|
};
|
|
28182
28294
|
|
|
28183
28295
|
// src/components/GenUI/elements/ShowWidget.tsx
|
|
28184
|
-
var
|
|
28296
|
+
var import_react95 = require("react");
|
|
28185
28297
|
var import_antd87 = require("antd");
|
|
28186
28298
|
var import_icons42 = require("@ant-design/icons");
|
|
28187
28299
|
|
|
28188
28300
|
// src/streaming-html/StreamingHTMLRenderer.tsx
|
|
28189
|
-
var
|
|
28301
|
+
var import_react94 = __toESM(require("react"));
|
|
28190
28302
|
|
|
28191
28303
|
// src/streaming-html/show-widget-css-generator.ts
|
|
28192
28304
|
function generateShowWidgetCSS(tokens) {
|
|
@@ -28877,22 +28989,22 @@ var StreamingHTMLRenderer = ({
|
|
|
28877
28989
|
title,
|
|
28878
28990
|
loadingMessages
|
|
28879
28991
|
}) => {
|
|
28880
|
-
const iframeRef = (0,
|
|
28881
|
-
const containerRef = (0,
|
|
28882
|
-
const resizeObserverRef = (0,
|
|
28883
|
-
const prevHTMLRef = (0,
|
|
28884
|
-
const isReadyRef = (0,
|
|
28885
|
-
const pendingChunksRef = (0,
|
|
28886
|
-
const isCompleteRef = (0,
|
|
28887
|
-
const isScriptExecuted = (0,
|
|
28888
|
-
const [iframeHeight, setIframeHeight] =
|
|
28889
|
-
const [iframeWidth, setIframeWidth] =
|
|
28890
|
-
const [currentMessageIndex, setCurrentMessageIndex] = (0,
|
|
28891
|
-
const [showLoading, setShowLoading] = (0,
|
|
28892
|
-
(0,
|
|
28992
|
+
const iframeRef = (0, import_react94.useRef)(null);
|
|
28993
|
+
const containerRef = (0, import_react94.useRef)(null);
|
|
28994
|
+
const resizeObserverRef = (0, import_react94.useRef)(null);
|
|
28995
|
+
const prevHTMLRef = (0, import_react94.useRef)("");
|
|
28996
|
+
const isReadyRef = (0, import_react94.useRef)(false);
|
|
28997
|
+
const pendingChunksRef = (0, import_react94.useRef)([]);
|
|
28998
|
+
const isCompleteRef = (0, import_react94.useRef)(isComplete);
|
|
28999
|
+
const isScriptExecuted = (0, import_react94.useRef)(false);
|
|
29000
|
+
const [iframeHeight, setIframeHeight] = import_react94.default.useState(0);
|
|
29001
|
+
const [iframeWidth, setIframeWidth] = import_react94.default.useState(void 0);
|
|
29002
|
+
const [currentMessageIndex, setCurrentMessageIndex] = (0, import_react94.useState)(0);
|
|
29003
|
+
const [showLoading, setShowLoading] = (0, import_react94.useState)(true);
|
|
29004
|
+
(0, import_react94.useEffect)(() => {
|
|
28893
29005
|
isCompleteRef.current = isComplete;
|
|
28894
29006
|
}, [isComplete]);
|
|
28895
|
-
(0,
|
|
29007
|
+
(0, import_react94.useEffect)(() => {
|
|
28896
29008
|
if (iframeHeight > 0) {
|
|
28897
29009
|
setShowLoading(false);
|
|
28898
29010
|
return;
|
|
@@ -28917,7 +29029,7 @@ var StreamingHTMLRenderer = ({
|
|
|
28917
29029
|
}, 1500);
|
|
28918
29030
|
return () => clearInterval(interval);
|
|
28919
29031
|
}, [iframeHeight, loadingMessages]);
|
|
28920
|
-
const executeScripts = (0,
|
|
29032
|
+
const executeScripts = (0, import_react94.useCallback)(() => {
|
|
28921
29033
|
if (isScriptExecuted.current) {
|
|
28922
29034
|
console.log("[StreamingHTMLRenderer] scripts is executed");
|
|
28923
29035
|
return;
|
|
@@ -28944,7 +29056,7 @@ var StreamingHTMLRenderer = ({
|
|
|
28944
29056
|
onError?.(streamingError);
|
|
28945
29057
|
}
|
|
28946
29058
|
}, [onError]);
|
|
28947
|
-
const sendChunk = (0,
|
|
29059
|
+
const sendChunk = (0, import_react94.useCallback)((chunk) => {
|
|
28948
29060
|
const iframe = iframeRef.current;
|
|
28949
29061
|
if (!iframe || !iframe.contentWindow) {
|
|
28950
29062
|
return;
|
|
@@ -28968,7 +29080,7 @@ var StreamingHTMLRenderer = ({
|
|
|
28968
29080
|
onError?.(streamingError);
|
|
28969
29081
|
}
|
|
28970
29082
|
}, [onError]);
|
|
28971
|
-
(0,
|
|
29083
|
+
(0, import_react94.useEffect)(() => {
|
|
28972
29084
|
const handleMessage = (event) => {
|
|
28973
29085
|
const iframe = iframeRef.current;
|
|
28974
29086
|
if (!iframe || event.source !== iframe.contentWindow) {
|
|
@@ -29021,7 +29133,7 @@ var StreamingHTMLRenderer = ({
|
|
|
29021
29133
|
window.removeEventListener("message", handleMessage);
|
|
29022
29134
|
};
|
|
29023
29135
|
}, [onError, onPrompt, sendChunk, executeScripts]);
|
|
29024
|
-
(0,
|
|
29136
|
+
(0, import_react94.useEffect)(() => {
|
|
29025
29137
|
if (html === prevHTMLRef.current) {
|
|
29026
29138
|
return;
|
|
29027
29139
|
}
|
|
@@ -29032,12 +29144,12 @@ var StreamingHTMLRenderer = ({
|
|
|
29032
29144
|
sendChunk(newChunk);
|
|
29033
29145
|
}
|
|
29034
29146
|
}, [html, sendChunk]);
|
|
29035
|
-
(0,
|
|
29147
|
+
(0, import_react94.useEffect)(() => {
|
|
29036
29148
|
if (isComplete && isReadyRef.current) {
|
|
29037
29149
|
executeScripts();
|
|
29038
29150
|
}
|
|
29039
29151
|
}, [isComplete, executeScripts]);
|
|
29040
|
-
(0,
|
|
29152
|
+
(0, import_react94.useEffect)(() => {
|
|
29041
29153
|
const container = containerRef.current;
|
|
29042
29154
|
if (!container) return;
|
|
29043
29155
|
const antBubble = container.closest(".ant-bubble");
|
|
@@ -29063,7 +29175,7 @@ var StreamingHTMLRenderer = ({
|
|
|
29063
29175
|
resizeObserverRef.current = null;
|
|
29064
29176
|
};
|
|
29065
29177
|
}, []);
|
|
29066
|
-
(0,
|
|
29178
|
+
(0, import_react94.useEffect)(() => {
|
|
29067
29179
|
return () => {
|
|
29068
29180
|
isReadyRef.current = false;
|
|
29069
29181
|
pendingChunksRef.current = [];
|
|
@@ -29166,14 +29278,14 @@ var ShowWidget = ({
|
|
|
29166
29278
|
console.warn("Failed to parse tool response:", e);
|
|
29167
29279
|
}
|
|
29168
29280
|
}
|
|
29169
|
-
const sendPrompt = (0,
|
|
29281
|
+
const sendPrompt = (0, import_react95.useCallback)((text) => {
|
|
29170
29282
|
sendMessage({
|
|
29171
29283
|
input: {
|
|
29172
29284
|
message: text
|
|
29173
29285
|
}
|
|
29174
29286
|
});
|
|
29175
29287
|
}, [sendMessage]);
|
|
29176
|
-
const handleOpenInSideApp = (0,
|
|
29288
|
+
const handleOpenInSideApp = (0, import_react95.useCallback)(() => {
|
|
29177
29289
|
openSideApp({
|
|
29178
29290
|
component_key: "show_widget",
|
|
29179
29291
|
data: {
|
|
@@ -29242,14 +29354,14 @@ var ShowWidget = ({
|
|
|
29242
29354
|
};
|
|
29243
29355
|
|
|
29244
29356
|
// src/components/GenUI/elements/ShowWidgetApp.tsx
|
|
29245
|
-
var
|
|
29357
|
+
var import_react96 = require("react");
|
|
29246
29358
|
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
29247
29359
|
var ShowWidgetApp = ({
|
|
29248
29360
|
data
|
|
29249
29361
|
}) => {
|
|
29250
29362
|
const { widget_code, title } = data || {};
|
|
29251
29363
|
const { sendMessage } = useAgentChat();
|
|
29252
|
-
const sendPrompt = (0,
|
|
29364
|
+
const sendPrompt = (0, import_react96.useCallback)(
|
|
29253
29365
|
(text) => {
|
|
29254
29366
|
sendMessage({
|
|
29255
29367
|
input: {
|
|
@@ -29376,7 +29488,7 @@ var regsiterElement = (language, ElementMeta) => {
|
|
|
29376
29488
|
// src/components/Chat/SideAppViewBrowser.tsx
|
|
29377
29489
|
var import_antd88 = require("antd");
|
|
29378
29490
|
var import_antd_style34 = require("antd-style");
|
|
29379
|
-
var
|
|
29491
|
+
var import_react97 = require("react");
|
|
29380
29492
|
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
29381
29493
|
var useStyle17 = (0, import_antd_style34.createStyles)(({ token, css }) => {
|
|
29382
29494
|
return {
|
|
@@ -29577,11 +29689,11 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
29577
29689
|
const selectedCard = region === "side" ? sideAppSelectedCard : contextAppSelectedCard;
|
|
29578
29690
|
const closeApp = region === "side" ? closeSideApp : closeContentApp;
|
|
29579
29691
|
const openApp = region === "side" ? openSideApp : openContentApp;
|
|
29580
|
-
const [activeKey, setActiveKey] = (0,
|
|
29692
|
+
const [activeKey, setActiveKey] = (0, import_react97.useState)(
|
|
29581
29693
|
JSON.stringify(selectedCard)
|
|
29582
29694
|
);
|
|
29583
|
-
const [hoveredTab, setHoveredTab] = (0,
|
|
29584
|
-
const [items, setItems] = (0,
|
|
29695
|
+
const [hoveredTab, setHoveredTab] = (0, import_react97.useState)(null);
|
|
29696
|
+
const [items, setItems] = (0, import_react97.useState)([]);
|
|
29585
29697
|
const add = (key, label, children, componentKey) => {
|
|
29586
29698
|
const newPanes = [...items, { label, children, key, componentKey }];
|
|
29587
29699
|
setItems(newPanes);
|
|
@@ -29608,7 +29720,7 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
29608
29720
|
const switchTab = (key) => {
|
|
29609
29721
|
setActiveKey(key);
|
|
29610
29722
|
};
|
|
29611
|
-
(0,
|
|
29723
|
+
(0, import_react97.useEffect)(() => {
|
|
29612
29724
|
if (!selectedCard) return;
|
|
29613
29725
|
const key = JSON.stringify(selectedCard);
|
|
29614
29726
|
if (items.find((item) => item.key === key)) {
|
|
@@ -29664,7 +29776,7 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
29664
29776
|
),
|
|
29665
29777
|
onClick: () => switchTab(item.key)
|
|
29666
29778
|
}));
|
|
29667
|
-
const sideAppBrowserValue = (0,
|
|
29779
|
+
const sideAppBrowserValue = (0, import_react97.useMemo)(
|
|
29668
29780
|
() => ({ openApp }),
|
|
29669
29781
|
[openApp]
|
|
29670
29782
|
);
|
|
@@ -29717,7 +29829,7 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
29717
29829
|
};
|
|
29718
29830
|
|
|
29719
29831
|
// src/components/Chat/ProjectSelector.tsx
|
|
29720
|
-
var
|
|
29832
|
+
var import_react98 = require("react");
|
|
29721
29833
|
var import_antd89 = require("antd");
|
|
29722
29834
|
var import_antd_style35 = require("antd-style");
|
|
29723
29835
|
var import_lucide_react29 = require("lucide-react");
|
|
@@ -29953,34 +30065,34 @@ var ProjectSelector = ({
|
|
|
29953
30065
|
setProject,
|
|
29954
30066
|
createProject
|
|
29955
30067
|
} = useWorkspaceContext();
|
|
29956
|
-
const [isWorkspaceListOpen, setIsWorkspaceListOpen] = (0,
|
|
29957
|
-
const workspaceDropdownRef = (0,
|
|
29958
|
-
const [isProjectListOpen, setIsProjectListOpen] = (0,
|
|
29959
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
29960
|
-
const [projectName, setProjectName] = (0,
|
|
29961
|
-
const [validationError, setValidationError] = (0,
|
|
29962
|
-
const [isCreating, setIsCreating] = (0,
|
|
29963
|
-
const projectNameInputRef = (0,
|
|
29964
|
-
const currentProject = (0,
|
|
30068
|
+
const [isWorkspaceListOpen, setIsWorkspaceListOpen] = (0, import_react98.useState)(false);
|
|
30069
|
+
const workspaceDropdownRef = (0, import_react98.useRef)(null);
|
|
30070
|
+
const [isProjectListOpen, setIsProjectListOpen] = (0, import_react98.useState)(false);
|
|
30071
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react98.useState)(false);
|
|
30072
|
+
const [projectName, setProjectName] = (0, import_react98.useState)("");
|
|
30073
|
+
const [validationError, setValidationError] = (0, import_react98.useState)(null);
|
|
30074
|
+
const [isCreating, setIsCreating] = (0, import_react98.useState)(false);
|
|
30075
|
+
const projectNameInputRef = (0, import_react98.useRef)(null);
|
|
30076
|
+
const currentProject = (0, import_react98.useMemo)(() => {
|
|
29965
30077
|
return projects.find((p) => p.id === projectId);
|
|
29966
30078
|
}, [projects, projectId]);
|
|
29967
|
-
const currentWorkspace = (0,
|
|
30079
|
+
const currentWorkspace = (0, import_react98.useMemo)(() => {
|
|
29968
30080
|
return workspaces.find((w) => w.id === workspaceId);
|
|
29969
30081
|
}, [workspaces, workspaceId]);
|
|
29970
|
-
const handleSelectProject = (0,
|
|
30082
|
+
const handleSelectProject = (0, import_react98.useCallback)((selectedProjectId) => {
|
|
29971
30083
|
setProject(selectedProjectId);
|
|
29972
30084
|
setIsProjectListOpen(false);
|
|
29973
30085
|
}, [setProject]);
|
|
29974
|
-
const handleWorkspaceClick = (0,
|
|
30086
|
+
const handleWorkspaceClick = (0, import_react98.useCallback)(() => {
|
|
29975
30087
|
setProject(null);
|
|
29976
30088
|
}, [setProject]);
|
|
29977
|
-
const toggleProjectList = (0,
|
|
30089
|
+
const toggleProjectList = (0, import_react98.useCallback)(() => {
|
|
29978
30090
|
setIsProjectListOpen((prev) => !prev);
|
|
29979
30091
|
}, []);
|
|
29980
|
-
const toggleWorkspaceList = (0,
|
|
30092
|
+
const toggleWorkspaceList = (0, import_react98.useCallback)(() => {
|
|
29981
30093
|
setIsWorkspaceListOpen((prev) => !prev);
|
|
29982
30094
|
}, []);
|
|
29983
|
-
const validateProjectName = (0,
|
|
30095
|
+
const validateProjectName = (0, import_react98.useCallback)((name) => {
|
|
29984
30096
|
const trimmed = name.trim();
|
|
29985
30097
|
if (!trimmed) return "Project name is required";
|
|
29986
30098
|
if (trimmed.length > PROJECT_NAME_MAX_LENGTH) {
|
|
@@ -29988,7 +30100,7 @@ var ProjectSelector = ({
|
|
|
29988
30100
|
}
|
|
29989
30101
|
return null;
|
|
29990
30102
|
}, []);
|
|
29991
|
-
const handleOpenModal = (0,
|
|
30103
|
+
const handleOpenModal = (0, import_react98.useCallback)((e) => {
|
|
29992
30104
|
e.stopPropagation();
|
|
29993
30105
|
if (!workspaceId) {
|
|
29994
30106
|
import_antd89.message.warning("Please select a workspace first");
|
|
@@ -29999,7 +30111,7 @@ var ProjectSelector = ({
|
|
|
29999
30111
|
setIsModalOpen(true);
|
|
30000
30112
|
setTimeout(() => projectNameInputRef.current?.input?.focus(), 100);
|
|
30001
30113
|
}, [workspaceId]);
|
|
30002
|
-
const handleCloseModal = (0,
|
|
30114
|
+
const handleCloseModal = (0, import_react98.useCallback)(() => {
|
|
30003
30115
|
setIsModalOpen(false);
|
|
30004
30116
|
setProjectName("");
|
|
30005
30117
|
setValidationError(null);
|
|
@@ -30009,7 +30121,7 @@ var ProjectSelector = ({
|
|
|
30009
30121
|
setProjectName(value);
|
|
30010
30122
|
setValidationError(validateProjectName(value));
|
|
30011
30123
|
};
|
|
30012
|
-
const handleCreateProject = (0,
|
|
30124
|
+
const handleCreateProject = (0, import_react98.useCallback)(async () => {
|
|
30013
30125
|
if (!workspaceId) return;
|
|
30014
30126
|
const trimmed = projectName.trim();
|
|
30015
30127
|
const error = validateProjectName(trimmed);
|
|
@@ -30128,11 +30240,11 @@ var ProjectSelector = ({
|
|
|
30128
30240
|
};
|
|
30129
30241
|
|
|
30130
30242
|
// src/components/Chat/ToolPanelFiles.tsx
|
|
30131
|
-
var
|
|
30243
|
+
var import_react100 = require("react");
|
|
30132
30244
|
var import_antd91 = require("antd");
|
|
30133
30245
|
|
|
30134
30246
|
// src/components/Chat/FileDirectoryPanel.tsx
|
|
30135
|
-
var
|
|
30247
|
+
var import_react99 = __toESM(require("react"));
|
|
30136
30248
|
var import_antd90 = require("antd");
|
|
30137
30249
|
var import_lucide_react30 = require("lucide-react");
|
|
30138
30250
|
var import_antd_style36 = require("antd-style");
|
|
@@ -30364,7 +30476,7 @@ var FileDirectoryPanel = ({
|
|
|
30364
30476
|
onAssetClick
|
|
30365
30477
|
}) => {
|
|
30366
30478
|
const { styles } = useStyles19();
|
|
30367
|
-
const renderEntry =
|
|
30479
|
+
const renderEntry = import_react99.default.useCallback((entry, depth) => {
|
|
30368
30480
|
const entryName = getEntryName(entry);
|
|
30369
30481
|
if (entry.is_dir) {
|
|
30370
30482
|
const isExpanded = directoryExpanded[entry.path] || false;
|
|
@@ -30487,16 +30599,16 @@ var ToolPanelFiles = () => {
|
|
|
30487
30599
|
uploadFileToFolder
|
|
30488
30600
|
} = useWorkspaceContext();
|
|
30489
30601
|
const { currentAssistant } = useAssistantContext();
|
|
30490
|
-
const [folderEntries, setFolderEntries] = (0,
|
|
30491
|
-
const [folderLoading, setFolderLoading] = (0,
|
|
30492
|
-
const [directoryChildren, setDirectoryChildren] = (0,
|
|
30493
|
-
const [directoryLoading, setDirectoryLoading] = (0,
|
|
30494
|
-
const [directoryExpanded, setDirectoryExpanded] = (0,
|
|
30495
|
-
const [uploadingFolder, setUploadingFolder] = (0,
|
|
30496
|
-
const resourceFolders = (0,
|
|
30602
|
+
const [folderEntries, setFolderEntries] = (0, import_react100.useState)({});
|
|
30603
|
+
const [folderLoading, setFolderLoading] = (0, import_react100.useState)({});
|
|
30604
|
+
const [directoryChildren, setDirectoryChildren] = (0, import_react100.useState)({});
|
|
30605
|
+
const [directoryLoading, setDirectoryLoading] = (0, import_react100.useState)({});
|
|
30606
|
+
const [directoryExpanded, setDirectoryExpanded] = (0, import_react100.useState)({});
|
|
30607
|
+
const [uploadingFolder, setUploadingFolder] = (0, import_react100.useState)(null);
|
|
30608
|
+
const resourceFolders = (0, import_react100.useMemo)(() => {
|
|
30497
30609
|
return config.resourceFolders && config.resourceFolders.length > 0 ? config.resourceFolders : [{ name: "/", displayName: "Project Assets", allowUpload: true }];
|
|
30498
30610
|
}, [config.resourceFolders]);
|
|
30499
|
-
const loadAssetsForFolder = (0,
|
|
30611
|
+
const loadAssetsForFolder = (0, import_react100.useCallback)(
|
|
30500
30612
|
async (folder, clearSubdirectoryCache = true) => {
|
|
30501
30613
|
if (!workspaceId || !projectId) {
|
|
30502
30614
|
setFolderEntries((prev) => ({ ...prev, [folder.name]: [] }));
|
|
@@ -30536,7 +30648,7 @@ var ToolPanelFiles = () => {
|
|
|
30536
30648
|
},
|
|
30537
30649
|
[workspaceId, projectId, listPathByFolder, currentAssistant?.id]
|
|
30538
30650
|
);
|
|
30539
|
-
const handleToggleDirectory = (0,
|
|
30651
|
+
const handleToggleDirectory = (0, import_react100.useCallback)(async (path) => {
|
|
30540
30652
|
const isExpanded = directoryExpanded[path] || false;
|
|
30541
30653
|
if (isExpanded) {
|
|
30542
30654
|
setDirectoryExpanded((prev) => ({ ...prev, [path]: false }));
|
|
@@ -30554,12 +30666,12 @@ var ToolPanelFiles = () => {
|
|
|
30554
30666
|
setDirectoryLoading((prev) => ({ ...prev, [path]: false }));
|
|
30555
30667
|
}
|
|
30556
30668
|
}, [directoryExpanded, listPath, currentAssistant?.id]);
|
|
30557
|
-
(0,
|
|
30669
|
+
(0, import_react100.useEffect)(() => {
|
|
30558
30670
|
resourceFolders.forEach((folder) => {
|
|
30559
30671
|
void loadAssetsForFolder(folder, false);
|
|
30560
30672
|
});
|
|
30561
30673
|
}, [resourceFolders, loadAssetsForFolder]);
|
|
30562
|
-
const handleAssetClick = (0,
|
|
30674
|
+
const handleAssetClick = (0, import_react100.useCallback)((asset) => {
|
|
30563
30675
|
const fileUrl = getFileViewUrl(asset.path, currentAssistant?.id);
|
|
30564
30676
|
if (!fileUrl) {
|
|
30565
30677
|
import_antd91.message.warning("Please select a workspace and project first.");
|
|
@@ -30575,7 +30687,7 @@ var ToolPanelFiles = () => {
|
|
|
30575
30687
|
message: `Preview: ${asset.name || asset.path}`
|
|
30576
30688
|
});
|
|
30577
30689
|
}, [getFileViewUrl, openSideApp, currentAssistant?.id]);
|
|
30578
|
-
const handleUploadFolder = (0,
|
|
30690
|
+
const handleUploadFolder = (0, import_react100.useCallback)(async (folderName) => {
|
|
30579
30691
|
if (!workspaceId || !projectId) {
|
|
30580
30692
|
import_antd91.message.warning("Please select a workspace and project before uploading.");
|
|
30581
30693
|
return;
|
|
@@ -30755,7 +30867,7 @@ var LatticeChat = (props) => {
|
|
|
30755
30867
|
// src/components/Chat/AgentConversations.tsx
|
|
30756
30868
|
var import_x7 = require("@ant-design/x");
|
|
30757
30869
|
var import_antd93 = require("antd");
|
|
30758
|
-
var
|
|
30870
|
+
var import_react101 = require("react");
|
|
30759
30871
|
var import_jsx_runtime119 = require("react/jsx-runtime");
|
|
30760
30872
|
var AgentConversations = ({
|
|
30761
30873
|
enableThreadCreation = true,
|
|
@@ -30776,7 +30888,7 @@ var AgentConversations = ({
|
|
|
30776
30888
|
background: "transparent",
|
|
30777
30889
|
borderRadius: token.borderRadius
|
|
30778
30890
|
};
|
|
30779
|
-
const threadItems = (0,
|
|
30891
|
+
const threadItems = (0, import_react101.useMemo)(() => {
|
|
30780
30892
|
return threads || [];
|
|
30781
30893
|
}, [threads]);
|
|
30782
30894
|
const items = threadItems.map((thread2) => ({
|
|
@@ -30811,15 +30923,15 @@ var AgentConversations = ({
|
|
|
30811
30923
|
};
|
|
30812
30924
|
|
|
30813
30925
|
// src/components/Chat/LatticeChatView.tsx
|
|
30814
|
-
var
|
|
30926
|
+
var import_react104 = require("react");
|
|
30815
30927
|
|
|
30816
30928
|
// src/components/Chat/ChatSidebar.tsx
|
|
30817
|
-
var
|
|
30929
|
+
var import_react103 = require("react");
|
|
30818
30930
|
var import_antd95 = require("antd");
|
|
30819
30931
|
var import_lucide_react33 = require("lucide-react");
|
|
30820
30932
|
|
|
30821
30933
|
// src/components/Chat/ThreadHistoryMenuContent.tsx
|
|
30822
|
-
var
|
|
30934
|
+
var import_react102 = __toESM(require("react"));
|
|
30823
30935
|
var import_antd_style39 = require("antd-style");
|
|
30824
30936
|
var import_lucide_react32 = require("lucide-react");
|
|
30825
30937
|
var import_antd94 = require("antd");
|
|
@@ -30933,7 +31045,7 @@ var ThreadHistoryMenuContent = () => {
|
|
|
30933
31045
|
deleteThread,
|
|
30934
31046
|
isLoading
|
|
30935
31047
|
} = useConversationContext();
|
|
30936
|
-
const handleDeleteThread = (0,
|
|
31048
|
+
const handleDeleteThread = (0, import_react102.useCallback)(
|
|
30937
31049
|
async (e, threadIdToDelete) => {
|
|
30938
31050
|
e.stopPropagation();
|
|
30939
31051
|
import_antd94.Modal.confirm({
|
|
@@ -30954,7 +31066,7 @@ var ThreadHistoryMenuContent = () => {
|
|
|
30954
31066
|
},
|
|
30955
31067
|
[deleteThread]
|
|
30956
31068
|
);
|
|
30957
|
-
const sortedThreads =
|
|
31069
|
+
const sortedThreads = import_react102.default.useMemo(() => {
|
|
30958
31070
|
return [...threads].sort((a, b) => {
|
|
30959
31071
|
const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
|
|
30960
31072
|
const dateB = b.updatedAt ? new Date(b.updatedAt).getTime() : 0;
|
|
@@ -31046,8 +31158,8 @@ var ChatSidebar = ({
|
|
|
31046
31158
|
const { sideAppVisible, menuCollapsed, setMenuCollapsed } = useChatUIContext();
|
|
31047
31159
|
const { user, logout } = useAuth();
|
|
31048
31160
|
const { createThread } = useConversationContext();
|
|
31049
|
-
const [drawerStates, setDrawerStates] = (0,
|
|
31050
|
-
const [changePasswordOpen, setChangePasswordOpen] = (0,
|
|
31161
|
+
const [drawerStates, setDrawerStates] = (0, import_react103.useState)({});
|
|
31162
|
+
const [changePasswordOpen, setChangePasswordOpen] = (0, import_react103.useState)(false);
|
|
31051
31163
|
const {
|
|
31052
31164
|
sidebarMode,
|
|
31053
31165
|
sidebarShowToggle,
|
|
@@ -31056,11 +31168,11 @@ var ChatSidebar = ({
|
|
|
31056
31168
|
sidebarLogoIcon
|
|
31057
31169
|
} = config;
|
|
31058
31170
|
const isExpandedMode = sidebarMode === "expanded";
|
|
31059
|
-
const menuItems = (0,
|
|
31171
|
+
const menuItems = (0, import_react103.useMemo)(() => {
|
|
31060
31172
|
const items = customMenuItems.length > 0 ? [...customMenuItems] : [...DEFAULT_MENU_ITEMS];
|
|
31061
31173
|
return items.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
31062
31174
|
}, [customMenuItems]);
|
|
31063
|
-
const handleMenuClick = (0,
|
|
31175
|
+
const handleMenuClick = (0, import_react103.useCallback)(async (item) => {
|
|
31064
31176
|
if (item.builtin === "settings") {
|
|
31065
31177
|
setSettingsModalOpen(true);
|
|
31066
31178
|
onSettingsClick?.();
|
|
@@ -31083,17 +31195,17 @@ var ChatSidebar = ({
|
|
|
31083
31195
|
}
|
|
31084
31196
|
}
|
|
31085
31197
|
}, [onSettingsClick, setSettingsModalOpen, createThread, logout]);
|
|
31086
|
-
const handleCloseDrawer = (0,
|
|
31198
|
+
const handleCloseDrawer = (0, import_react103.useCallback)((itemId) => {
|
|
31087
31199
|
setDrawerStates((prev) => ({ ...prev, [itemId]: false }));
|
|
31088
31200
|
}, []);
|
|
31089
|
-
const handleNewAnalysis = (0,
|
|
31201
|
+
const handleNewAnalysis = (0, import_react103.useCallback)(async () => {
|
|
31090
31202
|
try {
|
|
31091
31203
|
await createThread("New Analysis");
|
|
31092
31204
|
} catch (error) {
|
|
31093
31205
|
console.error("Failed to create new thread:", error);
|
|
31094
31206
|
}
|
|
31095
31207
|
}, [createThread]);
|
|
31096
|
-
const renderDrawerContent = (0,
|
|
31208
|
+
const renderDrawerContent = (0, import_react103.useCallback)((item) => {
|
|
31097
31209
|
switch (item.builtin) {
|
|
31098
31210
|
case "thread-history":
|
|
31099
31211
|
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(ThreadHistoryMenuContent, {});
|
|
@@ -31275,7 +31387,7 @@ var ChatSidebar = ({
|
|
|
31275
31387
|
// src/components/Chat/LatticeChatView.tsx
|
|
31276
31388
|
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
31277
31389
|
var LatticeChatView = (props) => {
|
|
31278
|
-
const shellContext = (0,
|
|
31390
|
+
const shellContext = (0, import_react104.useContext)(LatticeChatShellContext);
|
|
31279
31391
|
const { showSideMenu, sideMenuItems } = shellContext.config;
|
|
31280
31392
|
const { assistantId, thread } = useConversationContext();
|
|
31281
31393
|
const { currentAssistant } = useAssistantContext();
|
|
@@ -31306,7 +31418,7 @@ var LatticeChatView = (props) => {
|
|
|
31306
31418
|
};
|
|
31307
31419
|
|
|
31308
31420
|
// src/components/Chat/SettingsModal.tsx
|
|
31309
|
-
var
|
|
31421
|
+
var import_react105 = require("react");
|
|
31310
31422
|
var import_antd96 = require("antd");
|
|
31311
31423
|
var import_icons44 = require("@ant-design/icons");
|
|
31312
31424
|
var import_antd_style40 = require("antd-style");
|
|
@@ -31672,7 +31784,7 @@ var SettingsModal = ({
|
|
|
31672
31784
|
}) => {
|
|
31673
31785
|
const { styles } = useStyles23();
|
|
31674
31786
|
const { config: shellConfig, updateConfigValue } = useLatticeChatShellContext();
|
|
31675
|
-
const [connections, setConnections] = (0,
|
|
31787
|
+
const [connections, setConnections] = (0, import_react105.useState)(() => {
|
|
31676
31788
|
if (typeof window !== "undefined") {
|
|
31677
31789
|
try {
|
|
31678
31790
|
const stored = localStorage.getItem("lattice_server_connections");
|
|
@@ -31695,21 +31807,21 @@ var SettingsModal = ({
|
|
|
31695
31807
|
}
|
|
31696
31808
|
return [];
|
|
31697
31809
|
});
|
|
31698
|
-
const [serverConfigs, setServerConfigs] = (0,
|
|
31699
|
-
const connectionsRef = (0,
|
|
31700
|
-
(0,
|
|
31810
|
+
const [serverConfigs, setServerConfigs] = (0, import_react105.useState)({});
|
|
31811
|
+
const connectionsRef = (0, import_react105.useRef)(connections);
|
|
31812
|
+
(0, import_react105.useEffect)(() => {
|
|
31701
31813
|
connectionsRef.current = connections;
|
|
31702
31814
|
}, [connections]);
|
|
31703
|
-
const [activeTabKey, setActiveTabKey] = (0,
|
|
31815
|
+
const [activeTabKey, setActiveTabKey] = (0, import_react105.useState)(
|
|
31704
31816
|
connections.length > 0 ? connections[0].id : ""
|
|
31705
31817
|
);
|
|
31706
|
-
const [activeMenu, setActiveMenu] = (0,
|
|
31707
|
-
const [loading, setLoading] = (0,
|
|
31708
|
-
const [showAddServerModal, setShowAddServerModal] = (0,
|
|
31709
|
-
const [newServerUrl, setNewServerUrl] = (0,
|
|
31710
|
-
const [newServerName, setNewServerName] = (0,
|
|
31711
|
-
const [newServerApiKey, setNewServerApiKey] = (0,
|
|
31712
|
-
const [addingServer, setAddingServer] = (0,
|
|
31818
|
+
const [activeMenu, setActiveMenu] = (0, import_react105.useState)("environment");
|
|
31819
|
+
const [loading, setLoading] = (0, import_react105.useState)(false);
|
|
31820
|
+
const [showAddServerModal, setShowAddServerModal] = (0, import_react105.useState)(false);
|
|
31821
|
+
const [newServerUrl, setNewServerUrl] = (0, import_react105.useState)("");
|
|
31822
|
+
const [newServerName, setNewServerName] = (0, import_react105.useState)("");
|
|
31823
|
+
const [newServerApiKey, setNewServerApiKey] = (0, import_react105.useState)("");
|
|
31824
|
+
const [addingServer, setAddingServer] = (0, import_react105.useState)(false);
|
|
31713
31825
|
const saveConnections = (newConnections) => {
|
|
31714
31826
|
setConnections(newConnections);
|
|
31715
31827
|
if (typeof window !== "undefined") {
|
|
@@ -31899,7 +32011,7 @@ var SettingsModal = ({
|
|
|
31899
32011
|
console.error("Failed to load models configuration:", error);
|
|
31900
32012
|
}
|
|
31901
32013
|
};
|
|
31902
|
-
(0,
|
|
32014
|
+
(0, import_react105.useEffect)(() => {
|
|
31903
32015
|
if (open && activeTabKey) {
|
|
31904
32016
|
initializeServerConfig(activeTabKey);
|
|
31905
32017
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
@@ -31908,7 +32020,7 @@ var SettingsModal = ({
|
|
|
31908
32020
|
}
|
|
31909
32021
|
}
|
|
31910
32022
|
}, [open, activeTabKey]);
|
|
31911
|
-
(0,
|
|
32023
|
+
(0, import_react105.useEffect)(() => {
|
|
31912
32024
|
if (open && activeTabKey) {
|
|
31913
32025
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
31914
32026
|
if (connection?.connected) {
|
|
@@ -32688,17 +32800,17 @@ var LatticeChatShell = (props) => {
|
|
|
32688
32800
|
};
|
|
32689
32801
|
|
|
32690
32802
|
// src/components/Chat/ChannelInstallationsDrawerContent.tsx
|
|
32691
|
-
var
|
|
32803
|
+
var import_react106 = require("react");
|
|
32692
32804
|
var import_antd97 = require("antd");
|
|
32693
32805
|
var import_lucide_react34 = require("lucide-react");
|
|
32694
32806
|
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
32695
32807
|
var { Text: Text47, Title: Title17 } = import_antd97.Typography;
|
|
32696
32808
|
var ChannelInstallationsDrawerContent = () => {
|
|
32697
32809
|
const { get, post, put, del } = useApi();
|
|
32698
|
-
const [installations, setInstallations] = (0,
|
|
32699
|
-
const [loading, setLoading] = (0,
|
|
32700
|
-
const [formModalOpen, setFormModalOpen] = (0,
|
|
32701
|
-
const [editingInstallation, setEditingInstallation] = (0,
|
|
32810
|
+
const [installations, setInstallations] = (0, import_react106.useState)([]);
|
|
32811
|
+
const [loading, setLoading] = (0, import_react106.useState)(false);
|
|
32812
|
+
const [formModalOpen, setFormModalOpen] = (0, import_react106.useState)(false);
|
|
32813
|
+
const [editingInstallation, setEditingInstallation] = (0, import_react106.useState)(null);
|
|
32702
32814
|
const loadInstallations = async () => {
|
|
32703
32815
|
setLoading(true);
|
|
32704
32816
|
try {
|
|
@@ -32719,7 +32831,7 @@ var ChannelInstallationsDrawerContent = () => {
|
|
|
32719
32831
|
setLoading(false);
|
|
32720
32832
|
}
|
|
32721
32833
|
};
|
|
32722
|
-
(0,
|
|
32834
|
+
(0, import_react106.useEffect)(() => {
|
|
32723
32835
|
loadInstallations();
|
|
32724
32836
|
}, []);
|
|
32725
32837
|
const handleDelete = async (installation) => {
|
|
@@ -32867,7 +32979,7 @@ var ChannelInstallationsDrawerContent = () => {
|
|
|
32867
32979
|
};
|
|
32868
32980
|
var LarkChannelInstallationFormModal = ({ installation, open, post, put, onCancel, onSave }) => {
|
|
32869
32981
|
const [form] = import_antd97.Form.useForm();
|
|
32870
|
-
(0,
|
|
32982
|
+
(0, import_react106.useEffect)(() => {
|
|
32871
32983
|
if (installation) {
|
|
32872
32984
|
const config = installation.config;
|
|
32873
32985
|
form.setFieldsValue({
|