@axiom-lattice/react-sdk 2.1.12 → 2.1.13

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 CHANGED
@@ -198,7 +198,7 @@ function useChat(threadId, options = {}) {
198
198
  stopStreamingRef.current = null;
199
199
  }
200
200
  const { input, command, streaming = true } = data;
201
- const { message: message4, files, ...rest } = input || {};
201
+ const { message: message5, files, ...rest } = input || {};
202
202
  setState((prev) => ({
203
203
  ...prev,
204
204
  isLoading: true,
@@ -207,7 +207,7 @@ function useChat(threadId, options = {}) {
207
207
  }));
208
208
  const userMessage = {
209
209
  id: Date.now().toString(),
210
- content: message4 || command?.resume?.message || "",
210
+ content: message5 || command?.resume?.message || "",
211
211
  files,
212
212
  role: "human"
213
213
  };
@@ -536,7 +536,7 @@ function AgentThreadProvider({
536
536
  stopStreamingRef.current = null;
537
537
  }
538
538
  const { input, command, streaming = true } = data;
539
- const { message: message4, files, ...rest } = input || {};
539
+ const { message: message5, files, ...rest } = input || {};
540
540
  setState((prev) => ({
541
541
  ...prev,
542
542
  isLoading: true,
@@ -544,7 +544,7 @@ function AgentThreadProvider({
544
544
  }));
545
545
  const userMessage = {
546
546
  id: Date.now().toString(),
547
- content: message4 || command?.resume?.message || "",
547
+ content: message5 || command?.resume?.message || "",
548
548
  files,
549
549
  role: "human"
550
550
  };
@@ -1610,11 +1610,11 @@ var ConfirmFeedback = ({
1610
1610
  data,
1611
1611
  interactive = true
1612
1612
  }) => {
1613
- const { message: message4, type, config, feedback, options } = data ?? {};
1613
+ const { message: message5, type, config, feedback, options } = data ?? {};
1614
1614
  const { sendMessage } = useAgentChat();
1615
1615
  const [clicked, setClicked] = (0, import_react9.useState)(false);
1616
1616
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_antd.Space, { direction: "vertical", style: { width: "100%" }, children: [
1617
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MDResponse, { content: message4 }),
1617
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MDResponse, { content: message5 }),
1618
1618
  options ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_antd.Space, { style: { justifyContent: "flex-end", width: "100%" }, children: options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1619
1619
  import_antd.Button,
1620
1620
  {
@@ -1696,7 +1696,7 @@ var import_icons = require("@ant-design/icons");
1696
1696
  var import_jsx_runtime8 = require("react/jsx-runtime");
1697
1697
  var { Text: Text2 } = import_antd2.Typography;
1698
1698
  var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = true }) => {
1699
- const { dataSource, message: message4 } = data ?? {};
1699
+ const { dataSource, message: message5 } = data ?? {};
1700
1700
  const [expandedRowKeys, setExpandedRowKeys] = (0, import_react10.useState)([]);
1701
1701
  const { openSideApp } = useChatUIContext();
1702
1702
  const processedData = dataSource?.map((item, index) => ({
@@ -1780,7 +1780,7 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
1780
1780
  {
1781
1781
  size: "small",
1782
1782
  title: () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_antd2.Flex, { justify: "space-between", align: "center", children: [
1783
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd2.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text2, { strong: true, style: { fontSize: 16 }, children: message4 || "" }) }),
1783
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd2.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text2, { strong: true, style: { fontSize: 16 }, children: message5 || "" }) }),
1784
1784
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_antd2.Space, { children: [
1785
1785
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1786
1786
  import_antd2.Button,
@@ -1801,8 +1801,8 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
1801
1801
  onClick: () => {
1802
1802
  openSideApp({
1803
1803
  component_key: "generic_data_table",
1804
- message: message4 || "",
1805
- data: { dataSource, message: message4 }
1804
+ message: message5 || "",
1805
+ data: { dataSource, message: message5 }
1806
1806
  });
1807
1807
  },
1808
1808
  children: [
@@ -2707,7 +2707,7 @@ var AttachmentsCard = ({
2707
2707
  columns = 1,
2708
2708
  showDownloadButton = false
2709
2709
  }) => {
2710
- const { Text: Text11 } = import_antd8.Typography;
2710
+ const { Text: Text12 } = import_antd8.Typography;
2711
2711
  const [showAll, setShowAll] = (0, import_react12.useState)(false);
2712
2712
  const { openSideApp } = useChatUIContext();
2713
2713
  const getStyles = () => {
@@ -2782,7 +2782,7 @@ var AttachmentsCard = ({
2782
2782
  );
2783
2783
  };
2784
2784
  const renderFileDescription = (item) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_antd8.Space, { direction: "vertical", size: size === "small" ? 2 : 4, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_antd8.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2785
- Text11,
2785
+ Text12,
2786
2786
  {
2787
2787
  type: "secondary",
2788
2788
  style: {
@@ -2854,7 +2854,7 @@ var AttachmentsCard = ({
2854
2854
  }
2855
2855
  ),
2856
2856
  item.files && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { paddingLeft: "12px" }, children: [
2857
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Text11, { type: "secondary", style: { fontSize: "12px" }, children: [
2857
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Text12, { type: "secondary", style: { fontSize: "12px" }, children: [
2858
2858
  "\u5305\u542B\u6587\u4EF6(",
2859
2859
  item.files.length,
2860
2860
  ")"
@@ -3504,7 +3504,7 @@ var import_ErrorBoundary = __toESM(require("antd/es/alert/ErrorBoundary"));
3504
3504
  var import_react15 = require("react");
3505
3505
  var import_jsx_runtime23 = require("react/jsx-runtime");
3506
3506
  var LazyBubble = ({
3507
- message: message4,
3507
+ message: message5,
3508
3508
  renderContent,
3509
3509
  autoLoadRightPanel
3510
3510
  }) => {
@@ -3535,10 +3535,10 @@ var LazyBubble = ({
3535
3535
  autoLoadRightPanel?.();
3536
3536
  }, []);
3537
3537
  const getPlaceholder = () => {
3538
- const estimatedHeight = message4.content ? Math.min(100, message4.content.length / 5) : 100;
3538
+ const estimatedHeight = message5.content ? Math.min(100, message5.content.length / 5) : 100;
3539
3539
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { height: `${estimatedHeight}px`, minHeight: "50px" } });
3540
3540
  };
3541
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_ErrorBoundary.default, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message4) : getPlaceholder() }) });
3541
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_ErrorBoundary.default, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message5) : getPlaceholder() }) });
3542
3542
  };
3543
3543
  var MemoizedBubbleList = (0, import_react15.memo)(
3544
3544
  ({
@@ -3569,8 +3569,8 @@ var MessageList = ({
3569
3569
  messageLengthRef.current = messages?.length;
3570
3570
  }
3571
3571
  }, [messages?.length]);
3572
- const renderContent = (0, import_react15.useCallback)((message4) => {
3573
- const { content } = message4;
3572
+ const renderContent = (0, import_react15.useCallback)((message5) => {
3573
+ const { content } = message5;
3574
3574
  try {
3575
3575
  const json = JSON.parse(content);
3576
3576
  if (json.action && json.message) {
@@ -3578,7 +3578,7 @@ var MessageList = ({
3578
3578
  }
3579
3579
  } catch (error) {
3580
3580
  }
3581
- const tool_calls_md = message4.tool_calls?.map((tool_call) => {
3581
+ const tool_calls_md = message5.tool_calls?.map((tool_call) => {
3582
3582
  return `\`\`\`tool_call
3583
3583
  ${JSON.stringify(tool_call)}
3584
3584
  \`\`\``;
@@ -3587,17 +3587,17 @@ ${JSON.stringify(tool_call)}
3587
3587
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_antd14.Space, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MDResponse, { content: content_md }) });
3588
3588
  }, []);
3589
3589
  const items = (0, import_react15.useMemo)(
3590
- () => messages.map((message4, index) => ({
3591
- key: message4.id,
3592
- role: message4.role,
3590
+ () => messages.map((message5, index) => ({
3591
+ key: message5.id,
3592
+ role: message5.role,
3593
3593
  typing: false,
3594
3594
  content: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3595
3595
  LazyBubble,
3596
3596
  {
3597
- message: message4,
3597
+ message: message5,
3598
3598
  renderContent,
3599
3599
  autoLoadRightPanel: () => {
3600
- const { content, role: role2 } = message4;
3600
+ const { content, role: role2 } = message5;
3601
3601
  const isNewAddedMessage = messageLengthRef.current > 1 && messageLengthRef.current + 1 === messages.length;
3602
3602
  if (index === messages.length - 1 && isNewAddedMessage && role2 === "ai") {
3603
3603
  try {
@@ -5102,8 +5102,9 @@ var AgentConversations = () => {
5102
5102
  };
5103
5103
 
5104
5104
  // src/components/Chat/ChatSidebar.tsx
5105
- var import_antd24 = require("antd");
5106
- var import_icons13 = require("@ant-design/icons");
5105
+ var import_react24 = require("react");
5106
+ var import_antd25 = require("antd");
5107
+ var import_icons14 = require("@ant-design/icons");
5107
5108
 
5108
5109
  // src/components/Chat/AssistantList.tsx
5109
5110
  var import_x6 = require("@ant-design/x");
@@ -5117,38 +5118,1352 @@ var AssistantList = () => {
5117
5118
  background: "transparent",
5118
5119
  borderRadius: token.borderRadius
5119
5120
  };
5120
- const items = assistants.map((assistant) => ({
5121
- key: assistant.id,
5122
- label: assistant.name,
5123
- icon: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5124
- import_antd23.Avatar,
5121
+ const items = assistants.map((assistant) => ({
5122
+ key: assistant.id,
5123
+ label: assistant.name,
5124
+ icon: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5125
+ import_antd23.Avatar,
5126
+ {
5127
+ size: "small",
5128
+ style: {
5129
+ backgroundColor: token.colorFillSecondary,
5130
+ color: token.colorText
5131
+ },
5132
+ children: assistant.name.charAt(0).toUpperCase()
5133
+ }
5134
+ )
5135
+ }));
5136
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5137
+ import_x6.Conversations,
5138
+ {
5139
+ items,
5140
+ activeKey: currentAssistant?.id,
5141
+ style,
5142
+ onActiveChange: (key) => {
5143
+ selectAssistant(key);
5144
+ }
5145
+ }
5146
+ );
5147
+ };
5148
+
5149
+ // src/components/Chat/ChatSidebar.tsx
5150
+ var import_antd_style11 = require("antd-style");
5151
+
5152
+ // src/components/Chat/SettingsModal.tsx
5153
+ var import_react23 = require("react");
5154
+ var import_antd24 = require("antd");
5155
+ var import_icons13 = require("@ant-design/icons");
5156
+ var import_antd_style10 = require("antd-style");
5157
+ var import_jsx_runtime37 = require("react/jsx-runtime");
5158
+ var { Text: Text11, Title: Title2 } = import_antd24.Typography;
5159
+ var { TextArea } = import_antd24.Input;
5160
+ var useStyles3 = (0, import_antd_style10.createStyles)(({ token, css }) => ({
5161
+ // settingsModal: css`
5162
+ // .ant-modal {
5163
+ // max-width: 100vw !important;
5164
+ // width: 100vw !important;
5165
+ // margin: 0 !important;
5166
+ // top: 0 !important;
5167
+ // padding-bottom: 0 !important;
5168
+ // }
5169
+ // .ant-modal-content {
5170
+ // padding: 0;
5171
+ // height: 100vh;
5172
+ // max-height: 100vh;
5173
+ // border-radius: 0;
5174
+ // overflow: hidden;
5175
+ // width: 100%;
5176
+ // }
5177
+ // .ant-modal-body {
5178
+ // padding: 0;
5179
+ // height: 100%;
5180
+ // display: flex;
5181
+ // overflow: hidden;
5182
+ // width: 100%;
5183
+ // }
5184
+ // `,
5185
+ tabsContainer: css`
5186
+ height: 100vh;
5187
+ display: flex;
5188
+ flex-direction: column;
5189
+ overflow: hidden;
5190
+
5191
+ .ant-tabs {
5192
+ height: 100%;
5193
+ display: flex;
5194
+ flex-direction: column;
5195
+ }
5196
+
5197
+ .ant-tabs-content-holder {
5198
+ flex: 1;
5199
+ overflow: hidden;
5200
+ }
5201
+
5202
+ .ant-tabs-content {
5203
+ height: 100%;
5204
+ }
5205
+
5206
+ .ant-tabs-tabpane {
5207
+ height: 100%;
5208
+ overflow: hidden;
5209
+ }
5210
+
5211
+ .ant-tabs-nav {
5212
+ margin: 0;
5213
+ padding: 0 ${token.paddingLG}px;
5214
+ background: ${token.colorBgContainer};
5215
+ border-bottom: 1px solid ${token.colorBorder};
5216
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
5217
+ }
5218
+
5219
+ .ant-tabs-tab {
5220
+ padding: ${token.paddingMD}px ${token.paddingLG}px;
5221
+ margin: ${token.paddingSM}px ${token.marginXS}px 0 0;
5222
+ border-radius: ${token.borderRadius}px ${token.borderRadius}px 0 0;
5223
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
5224
+
5225
+ &:hover {
5226
+ background: ${token.colorFillTertiary};
5227
+ }
5228
+
5229
+ &.ant-tabs-tab-active {
5230
+ background: ${token.colorBgContainer};
5231
+ border-bottom-color: ${token.colorBgContainer};
5232
+ }
5233
+ }
5234
+ `,
5235
+ tabContent: css`
5236
+ height: 100%;
5237
+ display: flex;
5238
+ flex-direction: column;
5239
+ overflow: hidden;
5240
+ background: linear-gradient(
5241
+ 135deg,
5242
+ ${token.colorBgLayout} 0%,
5243
+ ${token.colorFillQuaternary} 100%
5244
+ );
5245
+ `,
5246
+ sidebar: css`
5247
+ width: 280px;
5248
+ background: linear-gradient(
5249
+ 180deg,
5250
+ ${token.colorBgContainer} 0%,
5251
+ ${token.colorFillQuaternary} 100%
5252
+ );
5253
+ border-right: 1px solid ${token.colorBorder};
5254
+ display: flex;
5255
+ flex-direction: column;
5256
+ overflow-y: auto;
5257
+ flex-shrink: 0;
5258
+ box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
5259
+
5260
+ /* Custom scrollbar */
5261
+ &::-webkit-scrollbar {
5262
+ width: 8px;
5263
+ }
5264
+
5265
+ &::-webkit-scrollbar-track {
5266
+ background: transparent;
5267
+ }
5268
+
5269
+ &::-webkit-scrollbar-thumb {
5270
+ background: ${token.colorBorder};
5271
+ border-radius: 4px;
5272
+ transition: background 0.2s;
5273
+
5274
+ &:hover {
5275
+ background: ${token.colorBorderSecondary};
5276
+ }
5277
+ }
5278
+ `,
5279
+ sidebarHeader: css`
5280
+ padding: ${token.paddingXL}px ${token.paddingLG}px;
5281
+ border-bottom: 1px solid ${token.colorBorder};
5282
+ background: linear-gradient(
5283
+ 135deg,
5284
+ ${token.colorPrimaryBg} 0%,
5285
+ ${token.colorBgContainer} 100%
5286
+ );
5287
+ position: sticky;
5288
+ top: 0;
5289
+ z-index: 10;
5290
+ backdrop-filter: blur(10px);
5291
+ `,
5292
+ sidebarTitle: css`
5293
+ font-size: ${token.fontSizeXL}px;
5294
+ font-weight: 700;
5295
+ background: linear-gradient(
5296
+ 135deg,
5297
+ ${token.colorPrimary} 0%,
5298
+ ${token.colorPrimaryHover} 100%
5299
+ );
5300
+ -webkit-background-clip: text;
5301
+ -webkit-text-fill-color: transparent;
5302
+ background-clip: text;
5303
+ margin: 0;
5304
+ letter-spacing: -0.5px;
5305
+ `,
5306
+ menuItem: css`
5307
+ padding: ${token.paddingMD}px ${token.paddingLG}px;
5308
+ margin: ${token.marginXS}px ${token.paddingSM}px;
5309
+ cursor: pointer;
5310
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
5311
+ border-radius: ${token.borderRadiusLG}px;
5312
+ display: flex;
5313
+ align-items: center;
5314
+ gap: ${token.marginMD}px;
5315
+ position: relative;
5316
+ overflow: hidden;
5317
+
5318
+ &::before {
5319
+ content: "";
5320
+ position: absolute;
5321
+ left: 0;
5322
+ top: 0;
5323
+ bottom: 0;
5324
+ width: 3px;
5325
+ background: ${token.colorPrimary};
5326
+ transform: scaleY(0);
5327
+ transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
5328
+ border-radius: 0 2px 2px 0;
5329
+ }
5330
+
5331
+ &:hover {
5332
+ background: ${token.colorFillTertiary};
5333
+ transform: translateX(4px);
5334
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
5335
+ }
5336
+
5337
+ &.active {
5338
+ background: linear-gradient(
5339
+ 135deg,
5340
+ ${token.colorPrimaryBg} 0%,
5341
+ ${token.colorFillTertiary} 100%
5342
+ );
5343
+ color: ${token.colorPrimary};
5344
+ box-shadow: 0 4px 12px rgba(24, 144, 255, 0.15);
5345
+ transform: translateX(4px);
5346
+
5347
+ &::before {
5348
+ transform: scaleY(1);
5349
+ }
5350
+
5351
+ .menuItemIcon {
5352
+ transform: scale(1.1);
5353
+ }
5354
+ }
5355
+ `,
5356
+ menuItemIcon: css`
5357
+ font-size: 18px;
5358
+ transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
5359
+ display: flex;
5360
+ align-items: center;
5361
+ justify-content: center;
5362
+ width: 24px;
5363
+ height: 24px;
5364
+ `,
5365
+ menuItemText: css`
5366
+ font-size: ${token.fontSize}px;
5367
+ font-weight: 600;
5368
+ letter-spacing: 0.2px;
5369
+ `,
5370
+ content: css`
5371
+ flex: 1;
5372
+ display: flex;
5373
+ flex-direction: column;
5374
+ overflow: hidden;
5375
+ width: 100%;
5376
+ min-width: 0;
5377
+ `,
5378
+ contentHeader: css`
5379
+ padding: ${token.paddingLG}px ${token.paddingXL * 2}px;
5380
+ background: ${token.colorBgContainer};
5381
+ border-bottom: 1px solid ${token.colorBorder};
5382
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
5383
+ position: sticky;
5384
+ top: 0;
5385
+ z-index: 5;
5386
+ backdrop-filter: blur(10px);
5387
+ display: flex;
5388
+ justify-content: space-between;
5389
+ align-items: center;
5390
+ gap: ${token.marginLG}px;
5391
+ `,
5392
+ contentHeaderLeft: css`
5393
+ flex: 1;
5394
+ `,
5395
+ contentHeaderRight: css`
5396
+ display: flex;
5397
+ gap: ${token.marginMD}px;
5398
+ flex-shrink: 0;
5399
+ `,
5400
+ contentTitle: css`
5401
+ font-size: ${token.fontSizeHeading3}px;
5402
+ font-weight: 700;
5403
+ color: ${token.colorTextHeading};
5404
+ margin: 0 0 ${token.marginSM}px 0;
5405
+ letter-spacing: -0.5px;
5406
+ `,
5407
+ contentDescription: css`
5408
+ color: ${token.colorTextSecondary};
5409
+ font-size: ${token.fontSize}px;
5410
+ margin: 0;
5411
+ line-height: 1.6;
5412
+ `,
5413
+ contentBody: css`
5414
+ flex: 1;
5415
+ overflow-y: auto;
5416
+ padding: ${token.paddingXL * 2}px ${token.paddingXL * 2}px;
5417
+ background: transparent;
5418
+
5419
+ /* Custom scrollbar */
5420
+ &::-webkit-scrollbar {
5421
+ width: 8px;
5422
+ }
5423
+
5424
+ &::-webkit-scrollbar-track {
5425
+ background: transparent;
5426
+ }
5427
+
5428
+ &::-webkit-scrollbar-thumb {
5429
+ background: ${token.colorBorder};
5430
+ border-radius: 4px;
5431
+ transition: background 0.2s;
5432
+
5433
+ &:hover {
5434
+ background: ${token.colorBorderSecondary};
5435
+ }
5436
+ }
5437
+ `,
5438
+ formContainer: css`
5439
+ width: 100%;
5440
+ max-width: 100%;
5441
+ `,
5442
+ formLabel: css`
5443
+ font-weight: 600;
5444
+ color: ${token.colorTextHeading};
5445
+ margin-bottom: ${token.marginMD}px;
5446
+ display: block;
5447
+ font-size: ${token.fontSize}px;
5448
+ `,
5449
+ formDescription: css`
5450
+ color: ${token.colorTextSecondary};
5451
+ font-size: ${token.fontSizeSM}px;
5452
+ margin-top: ${token.marginSM}px;
5453
+ line-height: 1.6;
5454
+ `,
5455
+ card: css`
5456
+ background: ${token.colorBgContainer};
5457
+ border: 1px solid ${token.colorBorder};
5458
+ border-radius: ${token.borderRadiusLG}px;
5459
+ padding: ${token.paddingXL}px;
5460
+ margin-bottom: ${token.marginLG}px;
5461
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
5462
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
5463
+
5464
+ &:hover {
5465
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
5466
+ transform: translateY(-2px);
5467
+ border-color: ${token.colorPrimary};
5468
+ }
5469
+ `,
5470
+ alertCard: css`
5471
+ border-radius: ${token.borderRadiusLG}px;
5472
+ margin-bottom: ${token.marginLG}px;
5473
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
5474
+ border: 1px solid ${token.colorBorder};
5475
+ `,
5476
+ textArea: css`
5477
+ border-radius: ${token.borderRadius}px;
5478
+ border: 1px solid ${token.colorBorder};
5479
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
5480
+
5481
+ &:hover {
5482
+ border-color: ${token.colorPrimaryHover};
5483
+ }
5484
+
5485
+ &:focus {
5486
+ border-color: ${token.colorPrimary};
5487
+ box-shadow: 0 0 0 2px ${token.colorPrimaryBg};
5488
+ }
5489
+ `,
5490
+ connectionStatus: css`
5491
+ display: flex;
5492
+ align-items: center;
5493
+ gap: ${token.marginXS}px;
5494
+ margin-left: ${token.marginSM}px;
5495
+ `,
5496
+ addServerModal: css`
5497
+ .ant-modal-body {
5498
+ padding: ${token.paddingXL}px;
5499
+ }
5500
+ `
5501
+ }));
5502
+ var SETTINGS_MENU_ITEMS = [
5503
+ {
5504
+ key: "environment",
5505
+ label: "Environment Variables",
5506
+ icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons13.EnvironmentOutlined, {})
5507
+ },
5508
+ {
5509
+ key: "models",
5510
+ label: "Model Configuration",
5511
+ icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons13.ApiOutlined, {})
5512
+ }
5513
+ ];
5514
+ var SettingsModal = ({
5515
+ open,
5516
+ onClose
5517
+ }) => {
5518
+ const { styles } = useStyles3();
5519
+ const { config: shellConfig, updateConfigValue } = useLatticeChatShellContext();
5520
+ const [connections, setConnections] = (0, import_react23.useState)(() => {
5521
+ if (typeof window !== "undefined") {
5522
+ try {
5523
+ const stored = localStorage.getItem("lattice_server_connections");
5524
+ if (stored) {
5525
+ const parsed = JSON.parse(stored);
5526
+ return parsed;
5527
+ }
5528
+ } catch (error) {
5529
+ console.warn("Failed to load connections from localStorage:", error);
5530
+ }
5531
+ }
5532
+ if (shellConfig.baseURL) {
5533
+ return [
5534
+ {
5535
+ id: "default",
5536
+ name: "Default",
5537
+ url: shellConfig.baseURL
5538
+ }
5539
+ ];
5540
+ }
5541
+ return [];
5542
+ });
5543
+ const [serverConfigs, setServerConfigs] = (0, import_react23.useState)({});
5544
+ const connectionsRef = (0, import_react23.useRef)(connections);
5545
+ (0, import_react23.useEffect)(() => {
5546
+ connectionsRef.current = connections;
5547
+ }, [connections]);
5548
+ const [activeTabKey, setActiveTabKey] = (0, import_react23.useState)(
5549
+ connections.length > 0 ? connections[0].id : ""
5550
+ );
5551
+ const [activeMenu, setActiveMenu] = (0, import_react23.useState)("environment");
5552
+ const [loading, setLoading] = (0, import_react23.useState)(false);
5553
+ const [showAddServerModal, setShowAddServerModal] = (0, import_react23.useState)(false);
5554
+ const [newServerUrl, setNewServerUrl] = (0, import_react23.useState)("");
5555
+ const [newServerName, setNewServerName] = (0, import_react23.useState)("");
5556
+ const [newServerApiKey, setNewServerApiKey] = (0, import_react23.useState)("");
5557
+ const [addingServer, setAddingServer] = (0, import_react23.useState)(false);
5558
+ const saveConnections = (newConnections) => {
5559
+ setConnections(newConnections);
5560
+ if (typeof window !== "undefined") {
5561
+ try {
5562
+ localStorage.setItem(
5563
+ "lattice_server_connections",
5564
+ JSON.stringify(newConnections)
5565
+ );
5566
+ } catch (error) {
5567
+ console.warn("Failed to save connections to localStorage:", error);
5568
+ }
5569
+ }
5570
+ };
5571
+ const initializeServerConfig = (serverId) => {
5572
+ if (!serverConfigs[serverId]) {
5573
+ setServerConfigs((prev) => ({
5574
+ ...prev,
5575
+ [serverId]: {
5576
+ envText: "",
5577
+ models: [
5578
+ {
5579
+ key: "",
5580
+ model: "",
5581
+ provider: "openai",
5582
+ streaming: false,
5583
+ apiKey: "",
5584
+ baseURL: ""
5585
+ }
5586
+ ]
5587
+ }
5588
+ }));
5589
+ }
5590
+ };
5591
+ const checkConnection = async (serverId) => {
5592
+ const connection = connectionsRef.current.find((c) => c.id === serverId);
5593
+ if (!connection) return;
5594
+ const url = connection.url;
5595
+ if (!url) {
5596
+ updateConnectionStatus(serverId, { connected: false });
5597
+ return;
5598
+ }
5599
+ try {
5600
+ updateConnectionStatus(serverId, { connecting: true, error: "" });
5601
+ const controller = new AbortController();
5602
+ const timeoutId = setTimeout(() => controller.abort(), 5e3);
5603
+ const headers = {};
5604
+ if (connection.apiKey) {
5605
+ headers["Authorization"] = `Bearer ${connection.apiKey}`;
5606
+ }
5607
+ const response = await fetch(`${url}/api/config`, {
5608
+ method: "GET",
5609
+ signal: controller.signal,
5610
+ headers
5611
+ });
5612
+ clearTimeout(timeoutId);
5613
+ if (response.ok) {
5614
+ updateConnectionStatus(serverId, {
5615
+ connected: true,
5616
+ connecting: false,
5617
+ error: ""
5618
+ });
5619
+ if (url !== shellConfig.baseURL) {
5620
+ updateConfigValue("baseURL", url);
5621
+ }
5622
+ } else {
5623
+ updateConnectionStatus(serverId, {
5624
+ connected: false,
5625
+ connecting: false,
5626
+ error: "Server returned an error"
5627
+ });
5628
+ }
5629
+ } catch (error) {
5630
+ if (error.name === "AbortError") {
5631
+ updateConnectionStatus(serverId, {
5632
+ connected: false,
5633
+ connecting: false,
5634
+ error: "Connection timeout"
5635
+ });
5636
+ } else {
5637
+ updateConnectionStatus(serverId, {
5638
+ connected: false,
5639
+ connecting: false,
5640
+ error: error.message || "Failed to connect to server"
5641
+ });
5642
+ }
5643
+ }
5644
+ };
5645
+ const updateConnectionStatus = (serverId, updates) => {
5646
+ setConnections(
5647
+ (prev) => prev.map(
5648
+ (conn) => conn.id === serverId ? { ...conn, ...updates } : conn
5649
+ )
5650
+ );
5651
+ };
5652
+ const loadCurrentConfig = async (serverId) => {
5653
+ const connection = connectionsRef.current.find((c) => c.id === serverId);
5654
+ if (!connection || !connection.connected) return;
5655
+ const url = connection.url;
5656
+ if (!url) return;
5657
+ try {
5658
+ const headers = {};
5659
+ if (connection.apiKey) {
5660
+ headers["Authorization"] = `Bearer ${connection.apiKey}`;
5661
+ }
5662
+ const response = await fetch(`${url}/api/config`, {
5663
+ headers
5664
+ });
5665
+ if (response.ok) {
5666
+ const data = await response.json();
5667
+ if (data.success && data.data) {
5668
+ const lines = [];
5669
+ const configData = data.data;
5670
+ if (configData.port !== void 0) {
5671
+ lines.push(`PORT=${configData.port}`);
5672
+ }
5673
+ if (configData.queueServiceType) {
5674
+ lines.push(`QUEUE_SERVICE_TYPE=${configData.queueServiceType}`);
5675
+ }
5676
+ if (configData.redisUrl) {
5677
+ lines.push(`REDIS_URL=${configData.redisUrl}`);
5678
+ }
5679
+ if (configData.redisPassword) {
5680
+ lines.push(`REDIS_PASSWORD=`);
5681
+ }
5682
+ if (configData.queueName) {
5683
+ lines.push(`QUEUE_NAME=${configData.queueName}`);
5684
+ }
5685
+ setServerConfigs((prev) => ({
5686
+ ...prev,
5687
+ [serverId]: {
5688
+ ...prev[serverId],
5689
+ envText: lines.join("\n")
5690
+ }
5691
+ }));
5692
+ }
5693
+ }
5694
+ } catch (error) {
5695
+ console.error("Failed to load configuration:", error);
5696
+ import_antd24.message.error("Failed to load current configuration");
5697
+ }
5698
+ };
5699
+ const loadModelsConfig = async (serverId) => {
5700
+ const connection = connectionsRef.current.find((c) => c.id === serverId);
5701
+ if (!connection || !connection.connected) return;
5702
+ const url = connection.url;
5703
+ if (!url) return;
5704
+ try {
5705
+ const headers = {};
5706
+ if (connection.apiKey) {
5707
+ headers["Authorization"] = `Bearer ${connection.apiKey}`;
5708
+ }
5709
+ const response = await fetch(`${url}/api/models`, {
5710
+ headers
5711
+ });
5712
+ if (response.ok) {
5713
+ const data = await response.json();
5714
+ if (data.success && data.data && Array.isArray(data.data)) {
5715
+ if (data.data.length > 0) {
5716
+ setServerConfigs((prev) => ({
5717
+ ...prev,
5718
+ [serverId]: {
5719
+ ...prev[serverId],
5720
+ models: data.data
5721
+ }
5722
+ }));
5723
+ } else {
5724
+ setServerConfigs((prev) => ({
5725
+ ...prev,
5726
+ [serverId]: {
5727
+ ...prev[serverId],
5728
+ models: [
5729
+ {
5730
+ key: "",
5731
+ model: "",
5732
+ provider: "openai",
5733
+ streaming: false,
5734
+ apiKey: "",
5735
+ baseURL: ""
5736
+ }
5737
+ ]
5738
+ }
5739
+ }));
5740
+ }
5741
+ }
5742
+ }
5743
+ } catch (error) {
5744
+ console.error("Failed to load models configuration:", error);
5745
+ }
5746
+ };
5747
+ (0, import_react23.useEffect)(() => {
5748
+ if (open && activeTabKey) {
5749
+ initializeServerConfig(activeTabKey);
5750
+ const connection = connections.find((c) => c.id === activeTabKey);
5751
+ if (connection && !connection.connected && !connection.connecting) {
5752
+ checkConnection(activeTabKey);
5753
+ }
5754
+ }
5755
+ }, [open, activeTabKey]);
5756
+ (0, import_react23.useEffect)(() => {
5757
+ if (open && activeTabKey) {
5758
+ const connection = connections.find((c) => c.id === activeTabKey);
5759
+ if (connection?.connected) {
5760
+ if (activeMenu === "environment") {
5761
+ loadCurrentConfig(activeTabKey);
5762
+ } else if (activeMenu === "models") {
5763
+ loadModelsConfig(activeTabKey);
5764
+ }
5765
+ }
5766
+ }
5767
+ }, [open, activeTabKey, activeMenu]);
5768
+ const handleAddServer = async () => {
5769
+ if (!newServerUrl.trim()) {
5770
+ import_antd24.message.error("Please enter a server URL");
5771
+ return;
5772
+ }
5773
+ let normalizedUrl = newServerUrl.trim();
5774
+ if (!normalizedUrl.startsWith("http://") && !normalizedUrl.startsWith("https://")) {
5775
+ normalizedUrl = `http://${normalizedUrl}`;
5776
+ }
5777
+ const serverName = newServerName.trim() || normalizedUrl.replace(/^https?:\/\//, "");
5778
+ const newConnection = {
5779
+ id: `conn_${Date.now()}`,
5780
+ name: serverName,
5781
+ url: normalizedUrl,
5782
+ apiKey: newServerApiKey.trim() || void 0,
5783
+ connected: false
5784
+ };
5785
+ setAddingServer(true);
5786
+ const newConnections = [...connections, newConnection];
5787
+ saveConnections(newConnections);
5788
+ setActiveTabKey(newConnection.id);
5789
+ initializeServerConfig(newConnection.id);
5790
+ await checkConnection(newConnection.id);
5791
+ setAddingServer(false);
5792
+ setShowAddServerModal(false);
5793
+ setNewServerUrl("");
5794
+ setNewServerName("");
5795
+ setNewServerApiKey("");
5796
+ import_antd24.message.success("Server added successfully");
5797
+ };
5798
+ const handleDeleteServer = (serverId) => {
5799
+ const newConnections = connections.filter((c) => c.id !== serverId);
5800
+ saveConnections(newConnections);
5801
+ setServerConfigs((prev) => {
5802
+ const newConfigs = { ...prev };
5803
+ delete newConfigs[serverId];
5804
+ return newConfigs;
5805
+ });
5806
+ if (activeTabKey === serverId) {
5807
+ if (newConnections.length > 0) {
5808
+ setActiveTabKey(newConnections[0].id);
5809
+ } else {
5810
+ setActiveTabKey("");
5811
+ }
5812
+ }
5813
+ import_antd24.message.success("Server deleted");
5814
+ };
5815
+ const handleSave = async () => {
5816
+ const connection = connections.find((c) => c.id === activeTabKey);
5817
+ if (!connection || !connection.connected) {
5818
+ import_antd24.message.error("Please connect to a server first");
5819
+ return;
5820
+ }
5821
+ const url = connection.url;
5822
+ if (!url) {
5823
+ import_antd24.message.error("Please connect to a server first");
5824
+ return;
5825
+ }
5826
+ try {
5827
+ setLoading(true);
5828
+ const config = serverConfigs[activeTabKey];
5829
+ if (activeMenu === "environment") {
5830
+ const configObj = {};
5831
+ const lines = config.envText.split("\n");
5832
+ for (const line of lines) {
5833
+ const trimmedLine = line.trim();
5834
+ if (!trimmedLine || trimmedLine.startsWith("#")) {
5835
+ continue;
5836
+ }
5837
+ const equalIndex = trimmedLine.indexOf("=");
5838
+ if (equalIndex === -1) {
5839
+ continue;
5840
+ }
5841
+ const key = trimmedLine.substring(0, equalIndex).trim();
5842
+ const value = trimmedLine.substring(equalIndex + 1).trim();
5843
+ if (!key) {
5844
+ continue;
5845
+ }
5846
+ const upperKey = key.toUpperCase();
5847
+ if (upperKey === "PORT") {
5848
+ if (value) {
5849
+ configObj.port = Number(value);
5850
+ }
5851
+ } else if (upperKey === "QUEUE_SERVICE_TYPE") {
5852
+ if (value) {
5853
+ configObj.queueServiceType = value;
5854
+ }
5855
+ } else if (upperKey === "REDIS_URL") {
5856
+ if (value) {
5857
+ configObj.redisUrl = value;
5858
+ }
5859
+ } else if (upperKey === "REDIS_PASSWORD") {
5860
+ if (value) {
5861
+ configObj.redisPassword = value;
5862
+ }
5863
+ } else if (upperKey === "QUEUE_NAME") {
5864
+ if (value) {
5865
+ configObj.queueName = value;
5866
+ }
5867
+ } else {
5868
+ if (value) {
5869
+ configObj[key] = value;
5870
+ }
5871
+ }
5872
+ }
5873
+ const headers = {
5874
+ "Content-Type": "application/json"
5875
+ };
5876
+ if (connection.apiKey) {
5877
+ headers["Authorization"] = `Bearer ${connection.apiKey}`;
5878
+ }
5879
+ const response = await fetch(`${url}/api/config`, {
5880
+ method: "PUT",
5881
+ headers,
5882
+ body: JSON.stringify({ config: configObj })
5883
+ });
5884
+ const data = await response.json();
5885
+ if (response.ok && data.success) {
5886
+ if (data.requiresRestart && data.requiresRestart.length > 0) {
5887
+ import_antd24.message.warning(
5888
+ `Configuration saved. Please restart the server for ${data.requiresRestart.join(
5889
+ ", "
5890
+ )} to take effect.`,
5891
+ 5
5892
+ );
5893
+ } else {
5894
+ import_antd24.message.success("Configuration saved and applied successfully");
5895
+ }
5896
+ if (data.warnings && data.warnings.length > 0) {
5897
+ data.warnings.forEach((warning) => {
5898
+ import_antd24.message.warning(warning, 5);
5899
+ });
5900
+ }
5901
+ onClose();
5902
+ } else {
5903
+ import_antd24.message.error(data.error || "Failed to save configuration");
5904
+ }
5905
+ } else if (activeMenu === "models") {
5906
+ const validModels = config.models.filter(
5907
+ (m) => m.key && m.model && m.provider
5908
+ );
5909
+ const headers = {
5910
+ "Content-Type": "application/json"
5911
+ };
5912
+ if (connection.apiKey) {
5913
+ headers["Authorization"] = `Bearer ${connection.apiKey}`;
5914
+ }
5915
+ const response = await fetch(`${url}/api/models`, {
5916
+ method: "PUT",
5917
+ headers,
5918
+ body: JSON.stringify({ models: validModels })
5919
+ });
5920
+ const data = await response.json();
5921
+ if (response.ok && data.success) {
5922
+ import_antd24.message.success(
5923
+ "Model configuration saved and registered successfully"
5924
+ );
5925
+ onClose();
5926
+ } else {
5927
+ import_antd24.message.error(data.error || "Failed to save model configuration");
5928
+ }
5929
+ }
5930
+ } catch (error) {
5931
+ console.error("Failed to save configuration:", error);
5932
+ import_antd24.message.error(error.message || "Failed to save configuration");
5933
+ } finally {
5934
+ setLoading(false);
5935
+ }
5936
+ };
5937
+ const renderEnvironmentSettings = (serverId) => {
5938
+ const config = serverConfigs[serverId] || { envText: "", models: [] };
5939
+ const setEnvText = (text) => {
5940
+ setServerConfigs((prev) => ({
5941
+ ...prev,
5942
+ [serverId]: {
5943
+ ...prev[serverId],
5944
+ envText: text
5945
+ }
5946
+ }));
5947
+ };
5948
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: styles.formContainer, children: [
5949
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5950
+ import_antd24.Alert,
5951
+ {
5952
+ message: "Configuration Effect",
5953
+ description: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
5954
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { style: { marginBottom: 8 }, children: [
5955
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5956
+ import_icons13.CheckCircleOutlined,
5957
+ {
5958
+ style: { color: "#52c41a", marginRight: 8 }
5959
+ }
5960
+ ),
5961
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: "Immediately effective:" }),
5962
+ " QUEUE_SERVICE_TYPE, REDIS_URL, REDIS_PASSWORD, QUEUE_NAME"
5963
+ ] }),
5964
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
5965
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons13.ReloadOutlined, { style: { color: "#faad14", marginRight: 8 } }),
5966
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: "Requires restart:" }),
5967
+ " PORT (server must be restarted to change port)"
5968
+ ] })
5969
+ ] }),
5970
+ type: "info",
5971
+ showIcon: true,
5972
+ className: styles.alertCard
5973
+ }
5974
+ ),
5975
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { style: { marginBottom: 24 }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { type: "secondary", style: { fontSize: 14, lineHeight: 1.6 }, children: "Configure environment variables in .env format (key=value). One variable per line. Leave password fields empty to keep current values." }) }),
5976
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5977
+ TextArea,
5978
+ {
5979
+ value: config.envText,
5980
+ onChange: (e) => setEnvText(e.target.value),
5981
+ placeholder: `PORT=4001
5982
+ QUEUE_SERVICE_TYPE=redis
5983
+ REDIS_URL=redis://localhost:6379
5984
+ REDIS_PASSWORD=
5985
+ QUEUE_NAME=tasks`,
5986
+ rows: 18,
5987
+ className: styles.textArea,
5988
+ style: {
5989
+ fontFamily: "SF Mono, Monaco, Inconsolata, Roboto Mono, monospace",
5990
+ fontSize: 13,
5991
+ padding: "16px",
5992
+ lineHeight: 1.6
5993
+ }
5994
+ }
5995
+ )
5996
+ ] });
5997
+ };
5998
+ const renderModelSettings = (serverId) => {
5999
+ const config = serverConfigs[serverId] || {
6000
+ envText: "",
6001
+ models: [
6002
+ {
6003
+ key: "",
6004
+ model: "",
6005
+ provider: "openai",
6006
+ streaming: false,
6007
+ apiKey: "",
6008
+ baseURL: ""
6009
+ }
6010
+ ]
6011
+ };
6012
+ const handleModelChange = (index, field, value) => {
6013
+ const newModels = [...config.models];
6014
+ newModels[index] = { ...newModels[index], [field]: value };
6015
+ setServerConfigs((prev) => ({
6016
+ ...prev,
6017
+ [serverId]: {
6018
+ ...prev[serverId],
6019
+ models: newModels
6020
+ }
6021
+ }));
6022
+ };
6023
+ const handleAddModel = () => {
6024
+ setServerConfigs((prev) => ({
6025
+ ...prev,
6026
+ [serverId]: {
6027
+ ...prev[serverId],
6028
+ models: [
6029
+ ...config.models,
6030
+ {
6031
+ key: "",
6032
+ model: "",
6033
+ provider: "openai",
6034
+ streaming: false,
6035
+ apiKey: "",
6036
+ baseURL: ""
6037
+ }
6038
+ ]
6039
+ }
6040
+ }));
6041
+ };
6042
+ const handleRemoveModel = (index) => {
6043
+ if (config.models.length > 1) {
6044
+ setServerConfigs((prev) => ({
6045
+ ...prev,
6046
+ [serverId]: {
6047
+ ...prev[serverId],
6048
+ models: config.models.filter((_, i) => i !== index)
6049
+ }
6050
+ }));
6051
+ }
6052
+ };
6053
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: styles.formContainer, children: [
6054
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { style: { marginBottom: 32 }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { type: "secondary", style: { fontSize: 14, lineHeight: 1.6 }, children: "Configure model lattices. Each model will be registered with the provided key and can be used by agents." }) }),
6055
+ config.models.map((model, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: styles.card, children: [
6056
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
6057
+ "div",
6058
+ {
6059
+ style: {
6060
+ display: "flex",
6061
+ justifyContent: "space-between",
6062
+ alignItems: "center",
6063
+ marginBottom: 24,
6064
+ paddingBottom: 20,
6065
+ borderBottom: "1px solid rgba(0, 0, 0, 0.06)"
6066
+ },
6067
+ children: [
6068
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
6069
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Text11, { strong: true, style: { fontSize: 16 }, children: [
6070
+ "Model ",
6071
+ index + 1
6072
+ ] }),
6073
+ model.key && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
6074
+ Text11,
6075
+ {
6076
+ type: "secondary",
6077
+ style: { marginLeft: 8, fontSize: 12 },
6078
+ children: [
6079
+ "(",
6080
+ model.key,
6081
+ ")"
6082
+ ]
6083
+ }
6084
+ )
6085
+ ] }),
6086
+ config.models.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6087
+ import_antd24.Button,
6088
+ {
6089
+ type: "text",
6090
+ danger: true,
6091
+ size: "small",
6092
+ onClick: () => handleRemoveModel(index),
6093
+ style: {
6094
+ borderRadius: 6,
6095
+ transition: "all 0.2s"
6096
+ },
6097
+ children: "Remove"
6098
+ }
6099
+ )
6100
+ ]
6101
+ }
6102
+ ),
6103
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_antd24.Space, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
6104
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
6105
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { className: styles.formLabel, children: "Key *" }),
6106
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6107
+ import_antd24.Input,
6108
+ {
6109
+ placeholder: "e.g., default, gpt-4, claude",
6110
+ value: model.key,
6111
+ onChange: (e) => handleModelChange(index, "key", e.target.value),
6112
+ style: { height: 40 }
6113
+ }
6114
+ ),
6115
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { className: styles.formDescription, children: "Unique identifier for this model" })
6116
+ ] }),
6117
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
6118
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { className: styles.formLabel, children: "Provider *" }),
6119
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6120
+ import_antd24.Select,
6121
+ {
6122
+ style: { width: "100%", height: 40 },
6123
+ value: model.provider,
6124
+ onChange: (value) => handleModelChange(index, "provider", value),
6125
+ options: [
6126
+ { label: "OpenAI", value: "openai" },
6127
+ { label: "Azure", value: "azure" },
6128
+ { label: "DeepSeek", value: "deepseek" },
6129
+ { label: "SiliconCloud", value: "siliconcloud" },
6130
+ { label: "VolcEngine", value: "volcengine" }
6131
+ ]
6132
+ }
6133
+ )
6134
+ ] }),
6135
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
6136
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { className: styles.formLabel, children: "Model Name *" }),
6137
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6138
+ import_antd24.Input,
6139
+ {
6140
+ placeholder: "e.g., gpt-4, claude-3-opus, kimi-k2-250905",
6141
+ value: model.model,
6142
+ onChange: (e) => handleModelChange(index, "model", e.target.value),
6143
+ style: { height: 40 }
6144
+ }
6145
+ )
6146
+ ] }),
6147
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
6148
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { className: styles.formLabel, children: "API Key" }),
6149
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6150
+ import_antd24.Input.Password,
6151
+ {
6152
+ placeholder: "Enter your API key",
6153
+ value: model.apiKey,
6154
+ onChange: (e) => handleModelChange(index, "apiKey", e.target.value),
6155
+ style: { height: 40 }
6156
+ }
6157
+ ),
6158
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { className: styles.formDescription, children: "API key for the model provider. Leave empty to use environment variable." })
6159
+ ] }),
6160
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
6161
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { className: styles.formLabel, children: "Base URL" }),
6162
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6163
+ import_antd24.Input,
6164
+ {
6165
+ placeholder: "e.g., https://api.openai.com/v1",
6166
+ value: model.baseURL,
6167
+ onChange: (e) => handleModelChange(index, "baseURL", e.target.value),
6168
+ style: { height: 40 }
6169
+ }
6170
+ ),
6171
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { className: styles.formDescription, children: "Optional custom base URL for the API" })
6172
+ ] }),
6173
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_antd24.Space, { children: [
6174
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6175
+ import_antd24.Switch,
6176
+ {
6177
+ checked: model.streaming,
6178
+ onChange: (checked) => handleModelChange(index, "streaming", checked)
6179
+ }
6180
+ ),
6181
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { children: "Enable Streaming" })
6182
+ ] }) }),
6183
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { style: { display: "flex", gap: 20 }, children: [
6184
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { style: { flex: 1 }, children: [
6185
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { className: styles.formLabel, children: "Max Tokens" }),
6186
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6187
+ import_antd24.Input,
6188
+ {
6189
+ type: "number",
6190
+ placeholder: "e.g., 4096",
6191
+ value: model.maxTokens,
6192
+ onChange: (e) => handleModelChange(
6193
+ index,
6194
+ "maxTokens",
6195
+ e.target.value ? Number(e.target.value) : void 0
6196
+ ),
6197
+ style: { height: 40 }
6198
+ }
6199
+ )
6200
+ ] }),
6201
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { style: { flex: 1 }, children: [
6202
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { className: styles.formLabel, children: "Temperature" }),
6203
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6204
+ import_antd24.Input,
6205
+ {
6206
+ type: "number",
6207
+ step: "0.1",
6208
+ placeholder: "e.g., 0.7",
6209
+ value: model.temperature,
6210
+ onChange: (e) => handleModelChange(
6211
+ index,
6212
+ "temperature",
6213
+ e.target.value ? Number(e.target.value) : void 0
6214
+ ),
6215
+ style: { height: 40 }
6216
+ }
6217
+ )
6218
+ ] })
6219
+ ] })
6220
+ ] })
6221
+ ] }, index)),
6222
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6223
+ import_antd24.Button,
6224
+ {
6225
+ type: "dashed",
6226
+ onClick: handleAddModel,
6227
+ block: true,
6228
+ size: "large",
6229
+ style: { marginTop: 24, height: 48 },
6230
+ children: "+ Add Model"
6231
+ }
6232
+ )
6233
+ ] });
6234
+ };
6235
+ const renderContent = (serverId) => {
6236
+ switch (activeMenu) {
6237
+ case "environment":
6238
+ return renderEnvironmentSettings(serverId);
6239
+ case "models":
6240
+ return renderModelSettings(serverId);
6241
+ default:
6242
+ return null;
6243
+ }
6244
+ };
6245
+ const activeMenuItem = SETTINGS_MENU_ITEMS.find(
6246
+ (item) => item.key === activeMenu
6247
+ );
6248
+ const currentConnection = connections.find((c) => c.id === activeTabKey);
6249
+ const renderTabLabel = (connection) => {
6250
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [
6251
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6252
+ import_icons13.CloudServerOutlined,
6253
+ {
6254
+ style: {
6255
+ marginRight: 8,
6256
+ color: connection.connected ? "#52c41a" : connection.connecting ? "#1890ff" : "#d9d9d9"
6257
+ }
6258
+ }
6259
+ ),
6260
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: connection.name }),
6261
+ connection.connected && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6262
+ import_icons13.CheckCircleFilled,
6263
+ {
6264
+ style: { color: "#52c41a", fontSize: 12, marginLeft: 8 }
6265
+ }
6266
+ ),
6267
+ connection.error && !connection.connecting && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6268
+ import_icons13.CloseCircleFilled,
6269
+ {
6270
+ style: { color: "#ff4d4f", fontSize: 12, marginLeft: 8 }
6271
+ }
6272
+ )
6273
+ ] });
6274
+ };
6275
+ const tabItems = connections.map((connection) => ({
6276
+ key: connection.id,
6277
+ label: renderTabLabel(connection),
6278
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: styles.tabContent, children: connection.connected ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { style: { display: "flex", height: "100%" }, children: [
6279
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: styles.sidebar, children: SETTINGS_MENU_ITEMS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
6280
+ "div",
6281
+ {
6282
+ className: `${styles.menuItem} ${activeMenu === item.key ? "active" : ""}`,
6283
+ onClick: () => setActiveMenu(item.key),
6284
+ children: [
6285
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: styles.menuItemIcon, children: item.icon }),
6286
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: styles.menuItemText, children: item.label })
6287
+ ]
6288
+ },
6289
+ item.key
6290
+ )) }),
6291
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: styles.content, children: [
6292
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: styles.contentHeader, children: [
6293
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: styles.contentHeaderLeft, children: [
6294
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Title2, { level: 3, className: styles.contentTitle, children: activeMenuItem?.label }),
6295
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Text11, { className: styles.contentDescription, children: [
6296
+ activeMenu === "environment" && "Manage environment variables for the gateway server",
6297
+ activeMenu === "models" && "Configure and register model lattices for use by agents"
6298
+ ] })
6299
+ ] }),
6300
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: styles.contentHeaderRight, children: [
6301
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_antd24.Button, { onClick: onClose, children: "Cancel" }),
6302
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6303
+ import_antd24.Button,
6304
+ {
6305
+ type: "primary",
6306
+ icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons13.SaveOutlined, {}),
6307
+ onClick: handleSave,
6308
+ loading,
6309
+ children: "Save Configuration"
6310
+ }
6311
+ )
6312
+ ] })
6313
+ ] }),
6314
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: styles.contentBody, children: renderContent(connection.id) })
6315
+ ] })
6316
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6317
+ "div",
5125
6318
  {
5126
- size: "small",
5127
6319
  style: {
5128
- backgroundColor: token.colorFillSecondary,
5129
- color: token.colorText
6320
+ flex: 1,
6321
+ display: "flex",
6322
+ alignItems: "center",
6323
+ justifyContent: "center",
6324
+ flexDirection: "column",
6325
+ gap: 16,
6326
+ padding: 48
5130
6327
  },
5131
- children: assistant.name.charAt(0).toUpperCase()
6328
+ children: connection.connecting ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
6329
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons13.LinkOutlined, { style: { fontSize: 64, color: "#1890ff" }, spin: true }),
6330
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Title2, { level: 4, children: "Connecting..." }),
6331
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Text11, { type: "secondary", style: { textAlign: "center" }, children: [
6332
+ "Connecting to ",
6333
+ connection.url
6334
+ ] })
6335
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
6336
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons13.LinkOutlined, { style: { fontSize: 64, color: "#d9d9d9" } }),
6337
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Title2, { level: 4, type: "secondary", children: connection.error || "Not Connected" }),
6338
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6339
+ Text11,
6340
+ {
6341
+ type: "secondary",
6342
+ style: { textAlign: "center", maxWidth: 400 },
6343
+ children: connection.error ? `Failed to connect to ${connection.url}. Please check the server URL and try again.` : `Click "Reconnect" to connect to ${connection.url}`
6344
+ }
6345
+ ),
6346
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6347
+ import_antd24.Button,
6348
+ {
6349
+ type: "primary",
6350
+ icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons13.LinkOutlined, {}),
6351
+ onClick: () => checkConnection(connection.id),
6352
+ loading: connection.connecting,
6353
+ style: { marginTop: 16 },
6354
+ children: "Reconnect"
6355
+ }
6356
+ )
6357
+ ] })
5132
6358
  }
5133
- )
6359
+ ) }),
6360
+ closable: connections.length > 1
5134
6361
  }));
5135
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5136
- import_x6.Conversations,
5137
- {
5138
- items,
5139
- activeKey: currentAssistant?.id,
5140
- style,
5141
- onActiveChange: (key) => {
5142
- selectAssistant(key);
6362
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
6363
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6364
+ import_antd24.Drawer,
6365
+ {
6366
+ open,
6367
+ onClose,
6368
+ footer: null,
6369
+ width: "100%",
6370
+ title: "Settings",
6371
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6372
+ import_antd24.Tabs,
6373
+ {
6374
+ activeKey: activeTabKey,
6375
+ onChange: setActiveTabKey,
6376
+ type: "editable-card",
6377
+ onEdit: (targetKey, action) => {
6378
+ if (action === "add") {
6379
+ setShowAddServerModal(true);
6380
+ } else if (action === "remove") {
6381
+ handleDeleteServer(targetKey);
6382
+ }
6383
+ },
6384
+ items: tabItems,
6385
+ addIcon: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
6386
+ "div",
6387
+ {
6388
+ style: {
6389
+ display: "flex",
6390
+ alignItems: "center",
6391
+ gap: 4,
6392
+ padding: "4px 8px"
6393
+ },
6394
+ children: [
6395
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons13.PlusOutlined, {}),
6396
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "Add Server" })
6397
+ ]
6398
+ }
6399
+ )
6400
+ }
6401
+ ) })
5143
6402
  }
5144
- }
5145
- );
6403
+ ),
6404
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6405
+ import_antd24.Modal,
6406
+ {
6407
+ title: "Add New Server",
6408
+ open: showAddServerModal,
6409
+ onOk: handleAddServer,
6410
+ onCancel: () => {
6411
+ setShowAddServerModal(false);
6412
+ setNewServerUrl("");
6413
+ setNewServerName("");
6414
+ setNewServerApiKey("");
6415
+ },
6416
+ confirmLoading: addingServer,
6417
+ className: styles.addServerModal,
6418
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_antd24.Space, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
6419
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
6420
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server Name" }),
6421
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6422
+ import_antd24.Input,
6423
+ {
6424
+ placeholder: "e.g., Production Server",
6425
+ value: newServerName,
6426
+ onChange: (e) => setNewServerName(e.target.value),
6427
+ onPressEnter: handleAddServer
6428
+ }
6429
+ ),
6430
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: Leave empty to use URL as name" })
6431
+ ] }),
6432
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
6433
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server URL *" }),
6434
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6435
+ import_antd24.Input,
6436
+ {
6437
+ placeholder: "e.g., http://localhost:4001",
6438
+ value: newServerUrl,
6439
+ onChange: (e) => setNewServerUrl(e.target.value),
6440
+ onPressEnter: handleAddServer
6441
+ }
6442
+ ),
6443
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Enter the full URL of the gateway server" })
6444
+ ] }),
6445
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { children: [
6446
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { strong: true, style: { display: "block", marginBottom: 8 }, children: "API Key" }),
6447
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6448
+ import_antd24.Input.Password,
6449
+ {
6450
+ placeholder: "Optional: Enter API key for authentication",
6451
+ value: newServerApiKey,
6452
+ onChange: (e) => setNewServerApiKey(e.target.value),
6453
+ onPressEnter: handleAddServer
6454
+ }
6455
+ ),
6456
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text11, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: API key for server authentication" })
6457
+ ] })
6458
+ ] })
6459
+ }
6460
+ )
6461
+ ] });
5146
6462
  };
5147
6463
 
5148
6464
  // src/components/Chat/ChatSidebar.tsx
5149
- var import_antd_style10 = require("antd-style");
5150
- var import_jsx_runtime37 = require("react/jsx-runtime");
5151
- var useStyles3 = (0, import_antd_style10.createStyles)(({ token, css }) => ({
6465
+ var import_jsx_runtime38 = require("react/jsx-runtime");
6466
+ var useStyles4 = (0, import_antd_style11.createStyles)(({ token, css }) => ({
5152
6467
  sidebar: css`
5153
6468
  display: flex;
5154
6469
  flex-direction: column;
@@ -5264,60 +6579,71 @@ var ChatSidebar = ({
5264
6579
  onSettingsClick,
5265
6580
  defaultCollapsed = false
5266
6581
  }) => {
5267
- const { styles } = useStyles3();
6582
+ const { styles } = useStyles4();
5268
6583
  const { setMenuCollapsed, menuCollapsed } = useChatUIContext();
6584
+ const [settingsModalOpen, setSettingsModalOpen] = (0, import_react24.useState)(false);
5269
6585
  const handleToggleCollapse = () => {
5270
6586
  setMenuCollapsed(!menuCollapsed);
5271
6587
  };
5272
6588
  const handleSettingsClick = () => {
6589
+ setSettingsModalOpen(true);
5273
6590
  onSettingsClick?.();
5274
6591
  };
5275
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: styles.sidebar, children: [
5276
- !menuCollapsed && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: styles.content, children: [
5277
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: styles.section, children: [
5278
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: styles.sectionTitle, children: "Assistants" }),
5279
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AssistantList, {})
6592
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
6593
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: styles.sidebar, children: [
6594
+ !menuCollapsed && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: styles.content, children: [
6595
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: styles.section, children: [
6596
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: styles.sectionTitle, children: "Assistants" }),
6597
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AssistantList, {})
6598
+ ] }),
6599
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_antd25.Divider, { className: styles.divider }),
6600
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: styles.section, children: [
6601
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: styles.sectionTitle, children: "Threads" }),
6602
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AgentConversations, {})
6603
+ ] })
5280
6604
  ] }),
5281
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_antd24.Divider, { className: styles.divider }),
5282
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: styles.section, children: [
5283
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: styles.sectionTitle, children: "Threads" }),
5284
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AgentConversations, {})
6605
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: styles.footer, children: [
6606
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6607
+ "button",
6608
+ {
6609
+ className: styles.actionButton,
6610
+ onClick: handleToggleCollapse,
6611
+ title: menuCollapsed ? "Expand sidebar" : "Collapse sidebar",
6612
+ "aria-label": menuCollapsed ? "Expand sidebar" : "Collapse sidebar",
6613
+ children: menuCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_icons14.MenuUnfoldOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_icons14.MenuFoldOutlined, {})
6614
+ }
6615
+ ),
6616
+ !menuCollapsed && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6617
+ "button",
6618
+ {
6619
+ className: styles.actionButton,
6620
+ onClick: handleSettingsClick,
6621
+ title: "Settings",
6622
+ "aria-label": "Settings",
6623
+ children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_icons14.SettingOutlined, {})
6624
+ }
6625
+ )
5285
6626
  ] })
5286
6627
  ] }),
5287
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: styles.footer, children: [
5288
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5289
- "button",
5290
- {
5291
- className: styles.actionButton,
5292
- onClick: handleToggleCollapse,
5293
- title: menuCollapsed ? "Expand sidebar" : "Collapse sidebar",
5294
- "aria-label": menuCollapsed ? "Expand sidebar" : "Collapse sidebar",
5295
- children: menuCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons13.MenuUnfoldOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons13.MenuFoldOutlined, {})
5296
- }
5297
- ),
5298
- !menuCollapsed && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5299
- "button",
5300
- {
5301
- className: styles.actionButton,
5302
- onClick: handleSettingsClick,
5303
- title: "Settings",
5304
- "aria-label": "Settings",
5305
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons13.SettingOutlined, {})
5306
- }
5307
- )
5308
- ] })
6628
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6629
+ SettingsModal,
6630
+ {
6631
+ open: settingsModalOpen,
6632
+ onClose: () => setSettingsModalOpen(false)
6633
+ }
6634
+ )
5309
6635
  ] });
5310
6636
  };
5311
6637
 
5312
6638
  // src/components/Chat/LatticeChatView.tsx
5313
- var import_jsx_runtime38 = require("react/jsx-runtime");
6639
+ var import_jsx_runtime39 = require("react/jsx-runtime");
5314
6640
  var LatticeChatView = (props) => {
5315
6641
  const { assistantId, thread } = useConversationContext();
5316
6642
  const { currentAssistant } = useAssistantContext();
5317
6643
  const {
5318
6644
  config: { baseURL }
5319
6645
  } = useLatticeChatShellContext();
5320
- return assistantId && thread ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6646
+ return assistantId && thread ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5321
6647
  AxiomLatticeProvider,
5322
6648
  {
5323
6649
  config: {
@@ -5326,14 +6652,14 @@ var LatticeChatView = (props) => {
5326
6652
  assistantId,
5327
6653
  transport: "sse"
5328
6654
  },
5329
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6655
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5330
6656
  LatticeChat,
5331
6657
  {
5332
6658
  thread_id: thread?.id,
5333
6659
  assistant_id: assistantId,
5334
6660
  name: currentAssistant?.name,
5335
6661
  description: currentAssistant?.description,
5336
- menu: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChatSidebar, {})
6662
+ menu: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChatSidebar, {})
5337
6663
  }
5338
6664
  )
5339
6665
  }
@@ -5341,9 +6667,9 @@ var LatticeChatView = (props) => {
5341
6667
  };
5342
6668
 
5343
6669
  // src/components/Chat/LatticeChatShell.tsx
5344
- var import_jsx_runtime39 = require("react/jsx-runtime");
6670
+ var import_jsx_runtime40 = require("react/jsx-runtime");
5345
6671
  var LatticeChatShell = (props) => {
5346
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(LatticeChatShellContextProvider, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AssistantContextProvider, { autoLoad: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ConversationContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(LatticeChatView, {}) }) }) });
6672
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(LatticeChatShellContextProvider, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AssistantContextProvider, { autoLoad: true, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ConversationContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(LatticeChatView, {}) }) }) });
5347
6673
  };
5348
6674
  // Annotate the CommonJS export names for ESM import in node:
5349
6675
  0 && (module.exports = {