@axiom-lattice/react-sdk 2.1.50 → 2.1.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +89 -1
- package/dist/index.d.ts +89 -1
- package/dist/index.js +1548 -431
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1502 -387
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -63,6 +63,7 @@ __export(index_exports, {
|
|
|
63
63
|
SkillCategoryPrompts: () => SkillCategoryPrompts_default,
|
|
64
64
|
SkillFlow: () => SkillFlow_default,
|
|
65
65
|
SkillNode: () => SkillNode_default,
|
|
66
|
+
StreamingHTMLRenderer: () => StreamingHTMLRenderer,
|
|
66
67
|
TenantSelector: () => TenantSelector,
|
|
67
68
|
UserProfile: () => UserProfile,
|
|
68
69
|
WorkspaceResourceManager: () => WorkspaceResourceManager,
|
|
@@ -72,6 +73,7 @@ __export(index_exports, {
|
|
|
72
73
|
axiomAntdThemeDark: () => axiomAntdThemeDark,
|
|
73
74
|
axiomTokens: () => axiomTokens,
|
|
74
75
|
colors: () => colors,
|
|
76
|
+
generateIframeSrcdoc: () => generateIframeSrcdoc,
|
|
75
77
|
generateLabelFromMessage: () => generateLabelFromMessage,
|
|
76
78
|
getAxiomAntdTheme: () => getAxiomAntdTheme,
|
|
77
79
|
getElement: () => getElement,
|
|
@@ -176,8 +178,8 @@ var AuthProvider = ({
|
|
|
176
178
|
onLoginSuccess?.(userData, tenantList || []);
|
|
177
179
|
return { requiresTenantSelection, hasTenants };
|
|
178
180
|
} catch (err) {
|
|
179
|
-
const
|
|
180
|
-
setError(
|
|
181
|
+
const message19 = err instanceof Error ? err.message : "Login failed";
|
|
182
|
+
setError(message19);
|
|
181
183
|
throw err;
|
|
182
184
|
} finally {
|
|
183
185
|
setIsLoading(false);
|
|
@@ -201,8 +203,8 @@ var AuthProvider = ({
|
|
|
201
203
|
}
|
|
202
204
|
return { message: data.message || "Registration successful!", token: data.data?.token };
|
|
203
205
|
} catch (err) {
|
|
204
|
-
const
|
|
205
|
-
setError(
|
|
206
|
+
const message19 = err instanceof Error ? err.message : "Registration failed";
|
|
207
|
+
setError(message19);
|
|
206
208
|
throw err;
|
|
207
209
|
} finally {
|
|
208
210
|
setIsLoading(false);
|
|
@@ -249,8 +251,8 @@ var AuthProvider = ({
|
|
|
249
251
|
}
|
|
250
252
|
onTenantSelected?.(tenantData);
|
|
251
253
|
} catch (err) {
|
|
252
|
-
const
|
|
253
|
-
setError(
|
|
254
|
+
const message19 = err instanceof Error ? err.message : "Failed to select tenant";
|
|
255
|
+
setError(message19);
|
|
254
256
|
throw err;
|
|
255
257
|
} finally {
|
|
256
258
|
setIsLoading(false);
|
|
@@ -289,8 +291,8 @@ var AuthProvider = ({
|
|
|
289
291
|
setTenants(tenantList);
|
|
290
292
|
sessionStorage.setItem("lattice_tenants", JSON.stringify(tenantList));
|
|
291
293
|
} catch (err) {
|
|
292
|
-
const
|
|
293
|
-
setError(
|
|
294
|
+
const message19 = err instanceof Error ? err.message : "Failed to fetch tenants";
|
|
295
|
+
setError(message19);
|
|
294
296
|
} finally {
|
|
295
297
|
setIsLoading(false);
|
|
296
298
|
}
|
|
@@ -320,8 +322,8 @@ var AuthProvider = ({
|
|
|
320
322
|
setUser(data);
|
|
321
323
|
sessionStorage.setItem("lattice_user", JSON.stringify(data));
|
|
322
324
|
} catch (err) {
|
|
323
|
-
const
|
|
324
|
-
setError(
|
|
325
|
+
const message19 = err instanceof Error ? err.message : "Failed to refresh user";
|
|
326
|
+
setError(message19);
|
|
325
327
|
} finally {
|
|
326
328
|
setIsLoading(false);
|
|
327
329
|
}
|
|
@@ -524,7 +526,7 @@ function useChat(threadId, assistantId, options = {}) {
|
|
|
524
526
|
stopStreamingRef.current = null;
|
|
525
527
|
}
|
|
526
528
|
const { input, command, streaming = true } = data;
|
|
527
|
-
const { message:
|
|
529
|
+
const { message: message19, files, ...rest } = input || {};
|
|
528
530
|
setState((prev) => ({
|
|
529
531
|
...prev,
|
|
530
532
|
isLoading: true,
|
|
@@ -533,7 +535,7 @@ function useChat(threadId, assistantId, options = {}) {
|
|
|
533
535
|
}));
|
|
534
536
|
const userMessage = {
|
|
535
537
|
id: Date.now().toString(),
|
|
536
|
-
content:
|
|
538
|
+
content: message19 || command?.resume?.message || "",
|
|
537
539
|
files,
|
|
538
540
|
role: "human"
|
|
539
541
|
};
|
|
@@ -1219,6 +1221,22 @@ var DEFAULT_MIDDLEWARE_TYPES = [
|
|
|
1219
1221
|
tools: [
|
|
1220
1222
|
{ id: "ask_user_to_clarify", name: "Ask User To Clarify", description: "Ask user clarifying questions with options" }
|
|
1221
1223
|
]
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
type: "widget",
|
|
1227
|
+
name: "Widget",
|
|
1228
|
+
description: "Enables the agent to render interactive HTML widgets and visualizations",
|
|
1229
|
+
schema: {
|
|
1230
|
+
type: "object",
|
|
1231
|
+
title: "Widget Configuration",
|
|
1232
|
+
description: "Configure widget rendering capabilities (zero configuration required)",
|
|
1233
|
+
properties: {}
|
|
1234
|
+
},
|
|
1235
|
+
defaultConfig: {},
|
|
1236
|
+
tools: [
|
|
1237
|
+
{ id: "load_guidelines", name: "Load Guidelines", description: "Load widget development guidelines for specific modules" },
|
|
1238
|
+
{ id: "show_widget", name: "Show Widget", description: "Render interactive HTML widgets or SVG diagrams" }
|
|
1239
|
+
]
|
|
1222
1240
|
}
|
|
1223
1241
|
];
|
|
1224
1242
|
var DEFAULT_CONFIG = {
|
|
@@ -1381,8 +1399,8 @@ function convertThreadToConversationThread(thread, label) {
|
|
|
1381
1399
|
function getThreadMetadata(label) {
|
|
1382
1400
|
return label ? { label } : {};
|
|
1383
1401
|
}
|
|
1384
|
-
function generateLabelFromMessage(
|
|
1385
|
-
const cleanMessage =
|
|
1402
|
+
function generateLabelFromMessage(message19) {
|
|
1403
|
+
const cleanMessage = message19.replace(/```attachments[\s\S]*?```/g, "").trim();
|
|
1386
1404
|
if (!cleanMessage) {
|
|
1387
1405
|
return "";
|
|
1388
1406
|
}
|
|
@@ -1796,7 +1814,7 @@ function AgentThreadProvider({
|
|
|
1796
1814
|
stopStreamingRef.current = null;
|
|
1797
1815
|
}
|
|
1798
1816
|
const { input, command, streaming = true } = data;
|
|
1799
|
-
const { message:
|
|
1817
|
+
const { message: message19, files, ...rest } = input || {};
|
|
1800
1818
|
setState((prev) => ({
|
|
1801
1819
|
...prev,
|
|
1802
1820
|
isLoading: true,
|
|
@@ -1805,7 +1823,7 @@ function AgentThreadProvider({
|
|
|
1805
1823
|
}));
|
|
1806
1824
|
const userMessage = {
|
|
1807
1825
|
id: Date.now().toString(),
|
|
1808
|
-
content:
|
|
1826
|
+
content: message19 || command?.resume?.message || "",
|
|
1809
1827
|
files,
|
|
1810
1828
|
role: "human"
|
|
1811
1829
|
};
|
|
@@ -1821,8 +1839,8 @@ function AgentThreadProvider({
|
|
|
1821
1839
|
messages: chunkMessageMerger.current.getMessages()
|
|
1822
1840
|
}));
|
|
1823
1841
|
const isFirstMessage = messageCountRef.current === 0;
|
|
1824
|
-
if (isFirstMessage &&
|
|
1825
|
-
const label = generateLabelFromMessage(
|
|
1842
|
+
if (isFirstMessage && message19 && conversationContext) {
|
|
1843
|
+
const label = generateLabelFromMessage(message19);
|
|
1826
1844
|
if (label) {
|
|
1827
1845
|
conversationContext.updateThread({
|
|
1828
1846
|
id: threadId,
|
|
@@ -3266,8 +3284,8 @@ function useTenants(options) {
|
|
|
3266
3284
|
const { data } = await response.json();
|
|
3267
3285
|
setTenants(data || []);
|
|
3268
3286
|
} catch (err) {
|
|
3269
|
-
const
|
|
3270
|
-
setError(
|
|
3287
|
+
const message19 = err instanceof Error ? err.message : "Failed to fetch tenants";
|
|
3288
|
+
setError(message19);
|
|
3271
3289
|
} finally {
|
|
3272
3290
|
setIsLoading(false);
|
|
3273
3291
|
}
|
|
@@ -3309,8 +3327,8 @@ function useUsers(options) {
|
|
|
3309
3327
|
const { data } = await response.json();
|
|
3310
3328
|
setUsers(data || []);
|
|
3311
3329
|
} catch (err) {
|
|
3312
|
-
const
|
|
3313
|
-
setError(
|
|
3330
|
+
const message19 = err instanceof Error ? err.message : "Failed to fetch users";
|
|
3331
|
+
setError(message19);
|
|
3314
3332
|
} finally {
|
|
3315
3333
|
setIsLoading(false);
|
|
3316
3334
|
}
|
|
@@ -3567,7 +3585,7 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
|
|
|
3567
3585
|
`,
|
|
3568
3586
|
chat: css`
|
|
3569
3587
|
width: 100%;
|
|
3570
|
-
max-width:
|
|
3588
|
+
max-width: 1400px;
|
|
3571
3589
|
box-sizing: border-box;
|
|
3572
3590
|
display: flex;
|
|
3573
3591
|
flex-direction: column;
|
|
@@ -4206,7 +4224,7 @@ var ColumnLayout = ({
|
|
|
4206
4224
|
};
|
|
4207
4225
|
|
|
4208
4226
|
// src/components/Chat/SideAppViewBrowser.tsx
|
|
4209
|
-
var
|
|
4227
|
+
var import_icons36 = require("@ant-design/icons");
|
|
4210
4228
|
|
|
4211
4229
|
// src/components/GenUI/elements/confirm_feedback.tsx
|
|
4212
4230
|
var import_antd11 = require("antd");
|
|
@@ -4271,7 +4289,7 @@ var import_icons2 = require("@ant-design/icons");
|
|
|
4271
4289
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
4272
4290
|
var { Text: Text3 } = import_antd4.Typography;
|
|
4273
4291
|
var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = true }) => {
|
|
4274
|
-
const { dataSource, message:
|
|
4292
|
+
const { dataSource, message: message19 } = data ?? {};
|
|
4275
4293
|
const [expandedRowKeys, setExpandedRowKeys] = (0, import_react16.useState)([]);
|
|
4276
4294
|
const { openSideApp } = useChatUIContext();
|
|
4277
4295
|
const processedData = dataSource?.map((item, index) => ({
|
|
@@ -4370,7 +4388,7 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
|
|
|
4370
4388
|
type: "text/csv;charset=utf-8;"
|
|
4371
4389
|
});
|
|
4372
4390
|
const link = document.createElement("a");
|
|
4373
|
-
const filename = `${
|
|
4391
|
+
const filename = `${message19 || "data"}_${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.csv`;
|
|
4374
4392
|
link.href = URL.createObjectURL(blob);
|
|
4375
4393
|
link.download = filename;
|
|
4376
4394
|
document.body.appendChild(link);
|
|
@@ -4391,7 +4409,7 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
|
|
|
4391
4409
|
tableLayout: "fixed",
|
|
4392
4410
|
style: { width: "100% !important" },
|
|
4393
4411
|
title: () => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_antd4.Flex, { justify: "space-between", align: "center", children: [
|
|
4394
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd4.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text3, { strong: true, style: { fontSize: 16 }, children:
|
|
4412
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd4.Space, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text3, { strong: true, style: { fontSize: 16 }, children: message19 || "" }) }),
|
|
4395
4413
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_antd4.Space, { children: [
|
|
4396
4414
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4397
4415
|
import_antd4.Button,
|
|
@@ -4413,8 +4431,8 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
|
|
|
4413
4431
|
onClick: () => {
|
|
4414
4432
|
openSideApp({
|
|
4415
4433
|
component_key: "generic_data_table",
|
|
4416
|
-
message:
|
|
4417
|
-
data: { dataSource, message:
|
|
4434
|
+
message: message19 || "",
|
|
4435
|
+
data: { dataSource, message: message19 }
|
|
4418
4436
|
});
|
|
4419
4437
|
},
|
|
4420
4438
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons2.ExpandAltOutlined, {})
|
|
@@ -5834,11 +5852,11 @@ var ConfirmFeedback = ({
|
|
|
5834
5852
|
data,
|
|
5835
5853
|
interactive = true
|
|
5836
5854
|
}) => {
|
|
5837
|
-
const { message:
|
|
5855
|
+
const { message: message19, type, config, feedback, options } = data ?? {};
|
|
5838
5856
|
const { sendMessage } = useAgentChat();
|
|
5839
5857
|
const [clicked, setClicked] = (0, import_react24.useState)(false);
|
|
5840
5858
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_antd11.Space, { direction: "vertical", style: { width: "100%" }, children: [
|
|
5841
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MDResponse, { content:
|
|
5859
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MDResponse, { content: message19 }),
|
|
5842
5860
|
options ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_antd11.Space, { style: { justifyContent: "flex-end", width: "100%" }, children: options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5843
5861
|
import_antd11.Button,
|
|
5844
5862
|
{
|
|
@@ -7865,7 +7883,7 @@ var import_ErrorBoundary = __toESM(require("antd/es/alert/ErrorBoundary"));
|
|
|
7865
7883
|
var import_react31 = require("react");
|
|
7866
7884
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
7867
7885
|
var LazyBubble = ({
|
|
7868
|
-
message:
|
|
7886
|
+
message: message19,
|
|
7869
7887
|
renderContent,
|
|
7870
7888
|
autoLoadRightPanel
|
|
7871
7889
|
}) => {
|
|
@@ -7896,10 +7914,10 @@ var LazyBubble = ({
|
|
|
7896
7914
|
autoLoadRightPanel?.();
|
|
7897
7915
|
}, []);
|
|
7898
7916
|
const getPlaceholder = () => {
|
|
7899
|
-
const estimatedHeight =
|
|
7917
|
+
const estimatedHeight = message19.content ? Math.min(100, message19.content.length / 5) : 100;
|
|
7900
7918
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { style: { height: `${estimatedHeight}px`, minHeight: "50px" } });
|
|
7901
7919
|
};
|
|
7902
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_ErrorBoundary.default, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(
|
|
7920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_ErrorBoundary.default, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message19) : getPlaceholder() }) });
|
|
7903
7921
|
};
|
|
7904
7922
|
var MemoizedBubbleList = (0, import_react31.memo)(
|
|
7905
7923
|
({
|
|
@@ -7930,8 +7948,8 @@ var MessageList = ({
|
|
|
7930
7948
|
messageLengthRef.current = messages?.length;
|
|
7931
7949
|
}
|
|
7932
7950
|
}, [messages?.length]);
|
|
7933
|
-
const renderContent = (0, import_react31.useCallback)((
|
|
7934
|
-
const { content } =
|
|
7951
|
+
const renderContent = (0, import_react31.useCallback)((message19) => {
|
|
7952
|
+
const { content } = message19;
|
|
7935
7953
|
try {
|
|
7936
7954
|
const json = JSON.parse(content);
|
|
7937
7955
|
if (json.action && json.message) {
|
|
@@ -7939,7 +7957,7 @@ var MessageList = ({
|
|
|
7939
7957
|
}
|
|
7940
7958
|
} catch (error) {
|
|
7941
7959
|
}
|
|
7942
|
-
const tool_calls_md =
|
|
7960
|
+
const tool_calls_md = message19.tool_calls?.map((tool_call) => {
|
|
7943
7961
|
return `\`\`\`tool_call
|
|
7944
7962
|
${JSON.stringify(tool_call)}
|
|
7945
7963
|
\`\`\``;
|
|
@@ -7948,17 +7966,17 @@ ${JSON.stringify(tool_call)}
|
|
|
7948
7966
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_antd24.Space, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MDResponse, { content: content_md }) });
|
|
7949
7967
|
}, []);
|
|
7950
7968
|
const items = (0, import_react31.useMemo)(
|
|
7951
|
-
() => messages.map((
|
|
7952
|
-
key:
|
|
7953
|
-
role:
|
|
7969
|
+
() => messages.map((message19, index) => ({
|
|
7970
|
+
key: message19.id,
|
|
7971
|
+
role: message19.role,
|
|
7954
7972
|
typing: false,
|
|
7955
7973
|
content: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7956
7974
|
LazyBubble,
|
|
7957
7975
|
{
|
|
7958
|
-
message:
|
|
7976
|
+
message: message19,
|
|
7959
7977
|
renderContent,
|
|
7960
7978
|
autoLoadRightPanel: () => {
|
|
7961
|
-
const { content, role: role2 } =
|
|
7979
|
+
const { content, role: role2 } = message19;
|
|
7962
7980
|
const isNewAddedMessage = messageLengthRef.current > 1 && messageLengthRef.current + 1 === messages.length;
|
|
7963
7981
|
if (index === messages.length - 1 && isNewAddedMessage && role2 === "ai") {
|
|
7964
7982
|
try {
|
|
@@ -22283,12 +22301,12 @@ var formatDate3 = (timestamp) => {
|
|
|
22283
22301
|
});
|
|
22284
22302
|
};
|
|
22285
22303
|
var MailboxDetailModal = ({
|
|
22286
|
-
message:
|
|
22304
|
+
message: message19,
|
|
22287
22305
|
visible,
|
|
22288
22306
|
onClose
|
|
22289
22307
|
}) => {
|
|
22290
22308
|
const { styles } = useStyles14();
|
|
22291
|
-
if (!
|
|
22309
|
+
if (!message19) return null;
|
|
22292
22310
|
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
22293
22311
|
import_antd71.Modal,
|
|
22294
22312
|
{
|
|
@@ -22311,12 +22329,12 @@ var MailboxDetailModal = ({
|
|
|
22311
22329
|
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: styles.modalContent, children: [
|
|
22312
22330
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: styles.header, children: [
|
|
22313
22331
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: styles.messageIcon, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_lucide_react22.Mail, { size: 20 }) }),
|
|
22314
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Text35, { className: styles.messageId, children:
|
|
22315
|
-
!
|
|
22332
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Text35, { className: styles.messageId, children: message19.id }),
|
|
22333
|
+
!message19.read && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_antd71.Tag, { color: "red", children: "Unread" })
|
|
22316
22334
|
] }),
|
|
22317
22335
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(Title11, { level: 4, className: styles.title, children: [
|
|
22318
22336
|
"Message from ",
|
|
22319
|
-
|
|
22337
|
+
message19.from
|
|
22320
22338
|
] }),
|
|
22321
22339
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: styles.metaSection, children: [
|
|
22322
22340
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: styles.metaItem, children: [
|
|
@@ -22326,11 +22344,11 @@ var MailboxDetailModal = ({
|
|
|
22326
22344
|
"div",
|
|
22327
22345
|
{
|
|
22328
22346
|
className: styles.avatar,
|
|
22329
|
-
style: { background: getAvatarColor7(
|
|
22330
|
-
children: getInitials7(
|
|
22347
|
+
style: { background: getAvatarColor7(message19.from) },
|
|
22348
|
+
children: getInitials7(message19.from)
|
|
22331
22349
|
}
|
|
22332
22350
|
),
|
|
22333
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { children:
|
|
22351
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { children: message19.from })
|
|
22334
22352
|
] })
|
|
22335
22353
|
] }),
|
|
22336
22354
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: styles.metaItem, children: [
|
|
@@ -22340,29 +22358,29 @@ var MailboxDetailModal = ({
|
|
|
22340
22358
|
"div",
|
|
22341
22359
|
{
|
|
22342
22360
|
className: styles.avatar,
|
|
22343
|
-
style: { background: getAvatarColor7(
|
|
22344
|
-
children: getInitials7(
|
|
22361
|
+
style: { background: getAvatarColor7(message19.to) },
|
|
22362
|
+
children: getInitials7(message19.to)
|
|
22345
22363
|
}
|
|
22346
22364
|
),
|
|
22347
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { children:
|
|
22365
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { children: message19.to })
|
|
22348
22366
|
] })
|
|
22349
22367
|
] }),
|
|
22350
22368
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: styles.metaItem, children: [
|
|
22351
22369
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Text35, { className: styles.metaLabel, children: "Time" }),
|
|
22352
22370
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: styles.metaValue, children: [
|
|
22353
22371
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_lucide_react22.Calendar, { size: 14 }),
|
|
22354
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { children: formatDate3(
|
|
22372
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { children: formatDate3(message19.timestamp) })
|
|
22355
22373
|
] })
|
|
22356
22374
|
] }),
|
|
22357
22375
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: styles.metaItem, children: [
|
|
22358
22376
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Text35, { className: styles.metaLabel, children: "Type" }),
|
|
22359
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: styles.metaValue, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_antd71.Tag, { color:
|
|
22377
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: styles.metaValue, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_antd71.Tag, { color: message19.type === "broadcast" ? "blue" : "default", children: message19.type }) })
|
|
22360
22378
|
] })
|
|
22361
22379
|
] }),
|
|
22362
22380
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_antd71.Divider, {}),
|
|
22363
22381
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: styles.contentSection, children: [
|
|
22364
22382
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Text35, { className: styles.contentLabel, children: "Message Content" }),
|
|
22365
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: styles.contentBox, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Paragraph2, { className: styles.messageContent, children:
|
|
22383
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: styles.contentBox, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Paragraph2, { className: styles.messageContent, children: message19.content }) })
|
|
22366
22384
|
] })
|
|
22367
22385
|
] })
|
|
22368
22386
|
}
|
|
@@ -22591,26 +22609,26 @@ var MessageGroupComponent = ({ group, styles, defaultExpanded = true, onMessageC
|
|
|
22591
22609
|
]
|
|
22592
22610
|
}
|
|
22593
22611
|
),
|
|
22594
|
-
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: styles.listGroupContent, children: group.messages.map((
|
|
22612
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: styles.listGroupContent, children: group.messages.map((message19) => /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
22595
22613
|
"div",
|
|
22596
22614
|
{
|
|
22597
|
-
className: `${styles.listItem} ${!
|
|
22598
|
-
onClick: () => onMessageClick(
|
|
22615
|
+
className: `${styles.listItem} ${!message19.read ? styles.listItemUnread : ""}`,
|
|
22616
|
+
onClick: () => onMessageClick(message19),
|
|
22599
22617
|
children: [
|
|
22600
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: styles.listItemIcon, children: !
|
|
22618
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: styles.listItemIcon, children: !message19.read ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: styles.unreadBadge }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react23.Circle, { size: 8, style: { color: "#d9d9d9" } }) }),
|
|
22601
22619
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: styles.listItemContent, children: [
|
|
22602
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: styles.listItemPreview, children: getMessagePreview(
|
|
22620
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: styles.listItemPreview, children: getMessagePreview(message19.content) }),
|
|
22603
22621
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("span", { className: styles.listItemMeta, children: [
|
|
22604
22622
|
"To: ",
|
|
22605
|
-
|
|
22623
|
+
message19.to,
|
|
22606
22624
|
" \u2022 ",
|
|
22607
|
-
|
|
22625
|
+
message19.type
|
|
22608
22626
|
] })
|
|
22609
22627
|
] }),
|
|
22610
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: styles.listItemRight, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: styles.listItemDate, children: formatDate4(
|
|
22628
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: styles.listItemRight, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: styles.listItemDate, children: formatDate4(message19.timestamp) }) })
|
|
22611
22629
|
]
|
|
22612
22630
|
},
|
|
22613
|
-
|
|
22631
|
+
message19.id
|
|
22614
22632
|
)) })
|
|
22615
22633
|
] });
|
|
22616
22634
|
};
|
|
@@ -22621,12 +22639,12 @@ var MailboxPanel = ({ data }) => {
|
|
|
22621
22639
|
const { teamMailbox = [] } = data || {};
|
|
22622
22640
|
const messageGroups = (0, import_react69.useMemo)(() => {
|
|
22623
22641
|
const groupsMap = /* @__PURE__ */ new Map();
|
|
22624
|
-
teamMailbox.forEach((
|
|
22625
|
-
const sender =
|
|
22642
|
+
teamMailbox.forEach((message19) => {
|
|
22643
|
+
const sender = message19.from;
|
|
22626
22644
|
if (!groupsMap.has(sender)) {
|
|
22627
22645
|
groupsMap.set(sender, []);
|
|
22628
22646
|
}
|
|
22629
|
-
groupsMap.get(sender).push(
|
|
22647
|
+
groupsMap.get(sender).push(message19);
|
|
22630
22648
|
});
|
|
22631
22649
|
const groups = Array.from(groupsMap.entries()).map(([sender, messages]) => ({
|
|
22632
22650
|
sender,
|
|
@@ -22643,8 +22661,8 @@ var MailboxPanel = ({ data }) => {
|
|
|
22643
22661
|
return groups;
|
|
22644
22662
|
}, [teamMailbox]);
|
|
22645
22663
|
const totalUnread = teamMailbox.filter((m) => !m.read).length;
|
|
22646
|
-
const handleMessageClick = (
|
|
22647
|
-
setSelectedMessage(
|
|
22664
|
+
const handleMessageClick = (message19) => {
|
|
22665
|
+
setSelectedMessage(message19);
|
|
22648
22666
|
setModalVisible(true);
|
|
22649
22667
|
};
|
|
22650
22668
|
const handleCloseModal = () => {
|
|
@@ -23694,6 +23712,1099 @@ var TeamChat = ({ data }) => {
|
|
|
23694
23712
|
] });
|
|
23695
23713
|
};
|
|
23696
23714
|
|
|
23715
|
+
// src/components/GenUI/elements/ShowWidget.tsx
|
|
23716
|
+
var import_react74 = require("react");
|
|
23717
|
+
var import_antd74 = require("antd");
|
|
23718
|
+
var import_icons35 = require("@ant-design/icons");
|
|
23719
|
+
|
|
23720
|
+
// src/streaming-html/StreamingHTMLRenderer.tsx
|
|
23721
|
+
var import_react73 = __toESM(require("react"));
|
|
23722
|
+
|
|
23723
|
+
// src/streaming-html/show-widget-css-generator.ts
|
|
23724
|
+
function generateShowWidgetCSS(tokens) {
|
|
23725
|
+
const { colors: colors3, radius: radius4, typography: typography3 } = tokens;
|
|
23726
|
+
return `
|
|
23727
|
+
:root {
|
|
23728
|
+
/* ============================================
|
|
23729
|
+
Background Colors (from Axiom tokens)
|
|
23730
|
+
============================================ */
|
|
23731
|
+
|
|
23732
|
+
--color-background-primary: ${colors3.light.surface};
|
|
23733
|
+
--color-background-secondary: ${colors3.light.surfaceHover};
|
|
23734
|
+
--color-background-tertiary: ${colors3.light.bg};
|
|
23735
|
+
|
|
23736
|
+
/* Semantic backgrounds - derived from functional colors */
|
|
23737
|
+
--color-background-info: ${colors3.info}1a;
|
|
23738
|
+
--color-background-danger: ${colors3.error}1a;
|
|
23739
|
+
--color-background-success: ${colors3.success}1a;
|
|
23740
|
+
--color-background-warning: ${colors3.warning}1a;
|
|
23741
|
+
|
|
23742
|
+
/* ============================================
|
|
23743
|
+
Text Colors (from Axiom tokens)
|
|
23744
|
+
============================================ */
|
|
23745
|
+
|
|
23746
|
+
--color-text-primary: ${colors3.light.text};
|
|
23747
|
+
--color-text-secondary: ${colors3.light.textSecondary};
|
|
23748
|
+
--color-text-tertiary: ${colors3.light.textMuted};
|
|
23749
|
+
|
|
23750
|
+
/* Semantic text - from functional colors */
|
|
23751
|
+
--color-text-info: ${colors3.info};
|
|
23752
|
+
--color-text-danger: ${colors3.error};
|
|
23753
|
+
--color-text-success: ${colors3.success};
|
|
23754
|
+
--color-text-warning: ${colors3.warning};
|
|
23755
|
+
|
|
23756
|
+
/* ============================================
|
|
23757
|
+
Border Colors (derived from Axiom tokens)
|
|
23758
|
+
============================================ */
|
|
23759
|
+
|
|
23760
|
+
--color-border-tertiary: ${colors3.light.border}99;
|
|
23761
|
+
--color-border-secondary: ${colors3.light.borderHover}b3;
|
|
23762
|
+
--color-border-primary: ${colors3.light.textMuted}cc;
|
|
23763
|
+
|
|
23764
|
+
/* Semantic borders */
|
|
23765
|
+
--color-border-info: ${colors3.info}80;
|
|
23766
|
+
--color-border-danger: ${colors3.error}80;
|
|
23767
|
+
--color-border-success: ${colors3.success}80;
|
|
23768
|
+
--color-border-warning: ${colors3.warning}80;
|
|
23769
|
+
|
|
23770
|
+
/* ============================================
|
|
23771
|
+
Typography (from Axiom tokens)
|
|
23772
|
+
============================================ */
|
|
23773
|
+
|
|
23774
|
+
--font-sans: ${typography3.fontFamily};
|
|
23775
|
+
--font-serif: Georgia, 'Times New Roman', serif;
|
|
23776
|
+
--font-mono: 'Fira Code', 'Monaco', 'Consolas', monospace;
|
|
23777
|
+
|
|
23778
|
+
/* ============================================
|
|
23779
|
+
Border Radius (from Axiom tokens, adjusted)
|
|
23780
|
+
============================================ */
|
|
23781
|
+
|
|
23782
|
+
--border-radius-md: ${radius4.md};
|
|
23783
|
+
--border-radius-lg: ${radius4.lg};
|
|
23784
|
+
--border-radius-xl: ${radius4.xl};
|
|
23785
|
+
|
|
23786
|
+
/* ============================================
|
|
23787
|
+
Color Ramps (9 ramps x 7 stops)
|
|
23788
|
+
Derived from Axiom primary and functional colors
|
|
23789
|
+
============================================ */
|
|
23790
|
+
|
|
23791
|
+
/* Purple - from Axiom primary indigo */
|
|
23792
|
+
--color-purple-50: ${colors3.primary[50]};
|
|
23793
|
+
--color-purple-100: ${colors3.primary[100]};
|
|
23794
|
+
--color-purple-200: ${colors3.primary[200]};
|
|
23795
|
+
--color-purple-400: ${colors3.primary[400]};
|
|
23796
|
+
--color-purple-600: ${colors3.primary[600]};
|
|
23797
|
+
--color-purple-800: ${colors3.primary[800]};
|
|
23798
|
+
--color-purple-900: ${colors3.primary[900]};
|
|
23799
|
+
|
|
23800
|
+
/* Teal - cool accent (complementary to primary) */
|
|
23801
|
+
--color-teal-50: #e1f5ee;
|
|
23802
|
+
--color-teal-100: #9fe1cb;
|
|
23803
|
+
--color-teal-200: #5dcaa5;
|
|
23804
|
+
--color-teal-400: #1d9e75;
|
|
23805
|
+
--color-teal-600: #0f6e56;
|
|
23806
|
+
--color-teal-800: #085041;
|
|
23807
|
+
--color-teal-900: #04342c;
|
|
23808
|
+
|
|
23809
|
+
/* Coral - warm accent */
|
|
23810
|
+
--color-coral-50: #faece7;
|
|
23811
|
+
--color-coral-100: #f5c4b3;
|
|
23812
|
+
--color-coral-200: #f0997b;
|
|
23813
|
+
--color-coral-400: #d85a30;
|
|
23814
|
+
--color-coral-600: #993c1d;
|
|
23815
|
+
--color-coral-800: #712b13;
|
|
23816
|
+
--color-coral-900: #4a1b0c;
|
|
23817
|
+
|
|
23818
|
+
/* Pink - soft accent */
|
|
23819
|
+
--color-pink-50: #fbeaf0;
|
|
23820
|
+
--color-pink-100: #f4c0d1;
|
|
23821
|
+
--color-pink-200: #ed93b1;
|
|
23822
|
+
--color-pink-400: #d4537e;
|
|
23823
|
+
--color-pink-600: #993556;
|
|
23824
|
+
--color-pink-800: #72243e;
|
|
23825
|
+
--color-pink-900: #4b1528;
|
|
23826
|
+
|
|
23827
|
+
/* Gray - neutral scale (derived from text colors) */
|
|
23828
|
+
--color-gray-50: #f1efe8;
|
|
23829
|
+
--color-gray-100: #d3d1c7;
|
|
23830
|
+
--color-gray-200: #b4b2a9;
|
|
23831
|
+
--color-gray-400: #888780;
|
|
23832
|
+
--color-gray-600: #5f5e5a;
|
|
23833
|
+
--color-gray-800: #444441;
|
|
23834
|
+
--color-gray-900: #2c2c2a;
|
|
23835
|
+
|
|
23836
|
+
/* Blue - from Axiom info color */
|
|
23837
|
+
--color-blue-50: #e6f1fb;
|
|
23838
|
+
--color-blue-100: #b5d4f4;
|
|
23839
|
+
--color-blue-200: #85b7eb;
|
|
23840
|
+
--color-blue-400: ${colors3.info};
|
|
23841
|
+
--color-blue-600: #185fa5;
|
|
23842
|
+
--color-blue-800: #0c447c;
|
|
23843
|
+
--color-blue-900: #042c53;
|
|
23844
|
+
|
|
23845
|
+
/* Green - from Axiom success color */
|
|
23846
|
+
--color-green-50: #eaf3de;
|
|
23847
|
+
--color-green-100: #c0dd97;
|
|
23848
|
+
--color-green-200: #97c459;
|
|
23849
|
+
--color-green-400: ${colors3.success};
|
|
23850
|
+
--color-green-600: #3b6d11;
|
|
23851
|
+
--color-green-800: #27500a;
|
|
23852
|
+
--color-green-900: #173404;
|
|
23853
|
+
|
|
23854
|
+
/* Amber - from Axiom warning color */
|
|
23855
|
+
--color-amber-50: #faeeda;
|
|
23856
|
+
--color-amber-100: #fac775;
|
|
23857
|
+
--color-amber-200: #ef9f27;
|
|
23858
|
+
--color-amber-400: ${colors3.warning};
|
|
23859
|
+
--color-amber-600: #854f0b;
|
|
23860
|
+
--color-amber-800: #633806;
|
|
23861
|
+
--color-amber-900: #412402;
|
|
23862
|
+
|
|
23863
|
+
/* Red - from Axiom error color */
|
|
23864
|
+
--color-red-50: #fcebeb;
|
|
23865
|
+
--color-red-100: #f7c1c1;
|
|
23866
|
+
--color-red-200: #f09595;
|
|
23867
|
+
--color-red-400: ${colors3.error};
|
|
23868
|
+
--color-red-600: #a32d2d;
|
|
23869
|
+
--color-red-800: #791f1f;
|
|
23870
|
+
--color-red-900: #501313;
|
|
23871
|
+
|
|
23872
|
+
/* Short Aliases */
|
|
23873
|
+
--p: var(--color-text-primary);
|
|
23874
|
+
--s: var(--color-text-secondary);
|
|
23875
|
+
--t: var(--color-text-tertiary);
|
|
23876
|
+
--bg2: var(--color-background-secondary);
|
|
23877
|
+
--b: var(--color-border-tertiary);
|
|
23878
|
+
}
|
|
23879
|
+
|
|
23880
|
+
/* Dark Mode - using Axiom dark tokens */
|
|
23881
|
+
@media (prefers-color-scheme: dark) {
|
|
23882
|
+
:root {
|
|
23883
|
+
--color-background-primary: ${colors3.dark.surface};
|
|
23884
|
+
--color-background-secondary: ${colors3.dark.surfaceHover};
|
|
23885
|
+
--color-background-tertiary: ${colors3.dark.bg};
|
|
23886
|
+
|
|
23887
|
+
--color-background-info: ${colors3.info}26;
|
|
23888
|
+
--color-background-danger: ${colors3.error}26;
|
|
23889
|
+
--color-background-success: ${colors3.success}26;
|
|
23890
|
+
--color-background-warning: ${colors3.warning}26;
|
|
23891
|
+
|
|
23892
|
+
--color-text-primary: ${colors3.dark.text};
|
|
23893
|
+
--color-text-secondary: ${colors3.dark.textSecondary};
|
|
23894
|
+
--color-text-tertiary: ${colors3.dark.textMuted};
|
|
23895
|
+
|
|
23896
|
+
--color-border-tertiary: ${colors3.dark.border}99;
|
|
23897
|
+
--color-border-secondary: ${colors3.dark.borderHover}b3;
|
|
23898
|
+
--color-border-primary: ${colors3.dark.textMuted}cc;
|
|
23899
|
+
--color-border-info: ${colors3.info}66;
|
|
23900
|
+
--color-border-danger: ${colors3.error}66;
|
|
23901
|
+
--color-border-success: ${colors3.success}66;
|
|
23902
|
+
--color-border-warning: ${colors3.warning}66;
|
|
23903
|
+
}
|
|
23904
|
+
}
|
|
23905
|
+
|
|
23906
|
+
/* Base Styles */
|
|
23907
|
+
html, body {
|
|
23908
|
+
margin: 0;
|
|
23909
|
+
padding: 0;
|
|
23910
|
+
font-family: var(--font-sans);
|
|
23911
|
+
color: var(--color-text-primary);
|
|
23912
|
+
background: transparent;
|
|
23913
|
+
overflow: hidden;
|
|
23914
|
+
width: fit-content;
|
|
23915
|
+
min-width: 100%;
|
|
23916
|
+
box-sizing: border-box;
|
|
23917
|
+
}
|
|
23918
|
+
|
|
23919
|
+
#root {
|
|
23920
|
+
overflow: hidden;
|
|
23921
|
+
width: fit-content;
|
|
23922
|
+
min-width: 100%;
|
|
23923
|
+
box-sizing: border-box;
|
|
23924
|
+
}
|
|
23925
|
+
|
|
23926
|
+
#root img, #root video, #root canvas, #root svg {
|
|
23927
|
+
max-width: 100%;
|
|
23928
|
+
height: 100%;
|
|
23929
|
+
}
|
|
23930
|
+
|
|
23931
|
+
/* SVG Text Classes */
|
|
23932
|
+
.t {
|
|
23933
|
+
font-family: var(--font-sans);
|
|
23934
|
+
font-size: 14px;
|
|
23935
|
+
font-weight: 400;
|
|
23936
|
+
fill: var(--color-text-primary);
|
|
23937
|
+
}
|
|
23938
|
+
|
|
23939
|
+
.ts {
|
|
23940
|
+
font-family: var(--font-sans);
|
|
23941
|
+
font-size: 12px;
|
|
23942
|
+
font-weight: 400;
|
|
23943
|
+
fill: var(--color-text-secondary);
|
|
23944
|
+
}
|
|
23945
|
+
|
|
23946
|
+
.th {
|
|
23947
|
+
font-family: var(--font-sans);
|
|
23948
|
+
font-size: 14px;
|
|
23949
|
+
font-weight: 500;
|
|
23950
|
+
fill: var(--color-text-primary);
|
|
23951
|
+
}
|
|
23952
|
+
|
|
23953
|
+
/* Box & Node Classes */
|
|
23954
|
+
.box {
|
|
23955
|
+
fill: var(--color-background-secondary);
|
|
23956
|
+
stroke: var(--color-border-tertiary);
|
|
23957
|
+
stroke-width: 0.5px;
|
|
23958
|
+
}
|
|
23959
|
+
|
|
23960
|
+
.node {
|
|
23961
|
+
cursor: pointer;
|
|
23962
|
+
}
|
|
23963
|
+
|
|
23964
|
+
.node:hover {
|
|
23965
|
+
opacity: 0.85;
|
|
23966
|
+
}
|
|
23967
|
+
|
|
23968
|
+
/* Arrow & Leader Lines */
|
|
23969
|
+
.arr {
|
|
23970
|
+
stroke: var(--color-text-tertiary);
|
|
23971
|
+
stroke-width: 1.5px;
|
|
23972
|
+
fill: none;
|
|
23973
|
+
}
|
|
23974
|
+
|
|
23975
|
+
.leader {
|
|
23976
|
+
stroke: var(--color-text-tertiary);
|
|
23977
|
+
stroke-width: 0.5px;
|
|
23978
|
+
stroke-dasharray: 4 2;
|
|
23979
|
+
fill: none;
|
|
23980
|
+
}
|
|
23981
|
+
|
|
23982
|
+
/* Color Ramp Classes for SVG */
|
|
23983
|
+
.c-purple { fill: var(--color-purple-200); stroke: var(--color-purple-600); }
|
|
23984
|
+
.c-purple .t, .c-purple .th { fill: var(--color-purple-800); }
|
|
23985
|
+
.c-purple .ts { fill: var(--color-purple-600); }
|
|
23986
|
+
|
|
23987
|
+
.c-teal { fill: var(--color-teal-200); stroke: var(--color-teal-600); }
|
|
23988
|
+
.c-teal .t, .c-teal .th { fill: var(--color-teal-800); }
|
|
23989
|
+
.c-teal .ts { fill: var(--color-teal-600); }
|
|
23990
|
+
|
|
23991
|
+
.c-coral { fill: var(--color-coral-200); stroke: var(--color-coral-600); }
|
|
23992
|
+
.c-coral .t, .c-coral .th { fill: var(--color-coral-800); }
|
|
23993
|
+
.c-coral .ts { fill: var(--color-coral-600); }
|
|
23994
|
+
|
|
23995
|
+
.c-pink { fill: var(--color-pink-200); stroke: var(--color-pink-600); }
|
|
23996
|
+
.c-pink .t, .c-pink .th { fill: var(--color-pink-800); }
|
|
23997
|
+
.c-pink .ts { fill: var(--color-pink-600); }
|
|
23998
|
+
|
|
23999
|
+
.c-gray { fill: var(--color-gray-200); stroke: var(--color-gray-600); }
|
|
24000
|
+
.c-gray .t, .c-gray .th { fill: var(--color-gray-800); }
|
|
24001
|
+
.c-gray .ts { fill: var(--color-gray-600); }
|
|
24002
|
+
|
|
24003
|
+
.c-blue { fill: var(--color-blue-200); stroke: var(--color-blue-600); }
|
|
24004
|
+
.c-blue .t, .c-blue .th { fill: var(--color-blue-800); }
|
|
24005
|
+
.c-blue .ts { fill: var(--color-blue-600); }
|
|
24006
|
+
|
|
24007
|
+
.c-green { fill: var(--color-green-200); stroke: var(--color-green-600); }
|
|
24008
|
+
.c-green .t, .c-green .th { fill: var(--color-green-800); }
|
|
24009
|
+
.c-green .ts { fill: var(--color-green-600); }
|
|
24010
|
+
|
|
24011
|
+
.c-amber { fill: var(--color-amber-200); stroke: var(--color-amber-600); }
|
|
24012
|
+
.c-amber .t, .c-amber .th { fill: var(--color-amber-800); }
|
|
24013
|
+
.c-amber .ts { fill: var(--color-amber-600); }
|
|
24014
|
+
|
|
24015
|
+
.c-red { fill: var(--color-red-200); stroke: var(--color-red-600); }
|
|
24016
|
+
.c-red .t, .c-red .th { fill: var(--color-red-800); }
|
|
24017
|
+
.c-red .ts { fill: var(--color-red-600); }
|
|
24018
|
+
|
|
24019
|
+
/* Dark Mode Color Ramps */
|
|
24020
|
+
@media (prefers-color-scheme: dark) {
|
|
24021
|
+
.c-purple { fill: var(--color-purple-800); stroke: var(--color-purple-200); }
|
|
24022
|
+
.c-purple .t, .c-purple .th { fill: var(--color-purple-100); }
|
|
24023
|
+
.c-purple .ts { fill: var(--color-purple-200); }
|
|
24024
|
+
|
|
24025
|
+
.c-teal { fill: var(--color-teal-800); stroke: var(--color-teal-200); }
|
|
24026
|
+
.c-teal .t, .c-teal .th { fill: var(--color-teal-100); }
|
|
24027
|
+
.c-teal .ts { fill: var(--color-teal-200); }
|
|
24028
|
+
|
|
24029
|
+
.c-coral { fill: var(--color-coral-800); stroke: var(--color-coral-200); }
|
|
24030
|
+
.c-coral .t, .c-coral .th { fill: var(--color-coral-100); }
|
|
24031
|
+
.c-coral .ts { fill: var(--color-coral-200); }
|
|
24032
|
+
|
|
24033
|
+
.c-pink { fill: var(--color-pink-800); stroke: var(--color-pink-200); }
|
|
24034
|
+
.c-pink .t, .c-pink .th { fill: var(--color-pink-100); }
|
|
24035
|
+
.c-pink .ts { fill: var(--color-pink-200); }
|
|
24036
|
+
|
|
24037
|
+
.c-gray { fill: var(--color-gray-800); stroke: var(--color-gray-200); }
|
|
24038
|
+
.c-gray .t, .c-gray .th { fill: var(--color-gray-100); }
|
|
24039
|
+
.c-gray .ts { fill: var(--color-gray-200); }
|
|
24040
|
+
|
|
24041
|
+
.c-blue { fill: var(--color-blue-800); stroke: var(--color-blue-200); }
|
|
24042
|
+
.c-blue .t, .c-blue .th { fill: var(--color-blue-100); }
|
|
24043
|
+
.c-blue .ts { fill: var(--color-blue-200); }
|
|
24044
|
+
|
|
24045
|
+
.c-green { fill: var(--color-green-800); stroke: var(--color-green-200); }
|
|
24046
|
+
.c-green .t, .c-green .th { fill: var(--color-green-100); }
|
|
24047
|
+
.c-green .ts { fill: var(--color-green-200); }
|
|
24048
|
+
|
|
24049
|
+
.c-amber { fill: var(--color-amber-800); stroke: var(--color-amber-200); }
|
|
24050
|
+
.c-amber .t, .c-amber .th { fill: var(--color-amber-100); }
|
|
24051
|
+
.c-amber .ts { fill: var(--color-amber-200); }
|
|
24052
|
+
|
|
24053
|
+
.c-red { fill: var(--color-red-800); stroke: var(--color-red-200); }
|
|
24054
|
+
.c-red .t, .c-red .th { fill: var(--color-red-100); }
|
|
24055
|
+
.c-red .ts { fill: var(--color-red-200); }
|
|
24056
|
+
}
|
|
24057
|
+
/* Pre-styled form elements */
|
|
24058
|
+
button {
|
|
24059
|
+
background: transparent;
|
|
24060
|
+
border: 0.5px solid var(--color-border-secondary);
|
|
24061
|
+
border-radius: var(--border-radius-md);
|
|
24062
|
+
color: var(--color-text-primary);
|
|
24063
|
+
padding: 6px 14px;
|
|
24064
|
+
font-size: 14px;
|
|
24065
|
+
cursor: pointer;
|
|
24066
|
+
font-family: var(--font-sans);
|
|
24067
|
+
}
|
|
24068
|
+
button:hover { background: var(--color-background-secondary); }
|
|
24069
|
+
button:active { transform: scale(0.98); }
|
|
24070
|
+
|
|
24071
|
+
input[type="range"] {
|
|
24072
|
+
-webkit-appearance: none;
|
|
24073
|
+
height: 4px;
|
|
24074
|
+
background: var(--color-border-secondary);
|
|
24075
|
+
border-radius: 2px;
|
|
24076
|
+
outline: none;
|
|
24077
|
+
}
|
|
24078
|
+
input[type="range"]::-webkit-slider-thumb {
|
|
24079
|
+
-webkit-appearance: none;
|
|
24080
|
+
width: 18px;
|
|
24081
|
+
height: 18px;
|
|
24082
|
+
border-radius: 50%;
|
|
24083
|
+
background: var(--color-text-primary);
|
|
24084
|
+
cursor: pointer;
|
|
24085
|
+
}
|
|
24086
|
+
|
|
24087
|
+
input[type="text"], input[type="number"], textarea, select {
|
|
24088
|
+
height: 36px;
|
|
24089
|
+
background: var(--color-background-primary);
|
|
24090
|
+
border: 0.5px solid var(--color-border-tertiary);
|
|
24091
|
+
border-radius: var(--border-radius-md);
|
|
24092
|
+
color: var(--color-text-primary);
|
|
24093
|
+
padding: 0 10px;
|
|
24094
|
+
font-size: 14px;
|
|
24095
|
+
font-family: var(--font-sans);
|
|
24096
|
+
outline: none;
|
|
24097
|
+
}
|
|
24098
|
+
input[type="text"]:hover, input[type="number"]:hover, textarea:hover, select:hover {
|
|
24099
|
+
border-color: var(--color-border-secondary);
|
|
24100
|
+
}
|
|
24101
|
+
input[type="text"]:focus, input[type="number"]:focus, textarea:focus, select:focus {
|
|
24102
|
+
border-color: var(--color-border-primary);
|
|
24103
|
+
box-shadow: 0 0 0 2px rgba(255,255,255,0.1);
|
|
24104
|
+
}
|
|
24105
|
+
`;
|
|
24106
|
+
}
|
|
24107
|
+
var showWidgetCSS = generateShowWidgetCSS(axiomTokens);
|
|
24108
|
+
|
|
24109
|
+
// src/streaming-html/IframeHTMLBridge.ts
|
|
24110
|
+
function generateIframeSrcdoc() {
|
|
24111
|
+
return `<!DOCTYPE html>
|
|
24112
|
+
<html>
|
|
24113
|
+
<head>
|
|
24114
|
+
<meta charset="UTF-8">
|
|
24115
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
24116
|
+
<style>
|
|
24117
|
+
*{box-sizing:border-box}
|
|
24118
|
+
body{margin:0;padding:1rem;font-family:system-ui,-apple-system,sans-serif;}
|
|
24119
|
+
svg { height:100%}
|
|
24120
|
+
@keyframes _fadeIn{from{opacity:0;transform:translateY(4px);}to{opacity:1;transform:none;}}
|
|
24121
|
+
|
|
24122
|
+
${showWidgetCSS}
|
|
24123
|
+
</style>
|
|
24124
|
+
<script>
|
|
24125
|
+
// Load morphdom from CDN with fallback
|
|
24126
|
+
(function() {
|
|
24127
|
+
if (typeof morphdom === 'undefined') {
|
|
24128
|
+
var script = document.createElement('script');
|
|
24129
|
+
script.src = 'https://cdn.jsdelivr.net/npm/morphdom@2.7.4/dist/morphdom-umd.min.js';
|
|
24130
|
+
script.onload = function() {
|
|
24131
|
+
window.parent.postMessage({ type: 'iframe-ready' }, '*');
|
|
24132
|
+
};
|
|
24133
|
+
script.onerror = function() {
|
|
24134
|
+
window.parent.postMessage({ type: 'iframe-error', error: 'Failed to load morphdom' }, '*');
|
|
24135
|
+
};
|
|
24136
|
+
document.head.appendChild(script);
|
|
24137
|
+
}
|
|
24138
|
+
})();
|
|
24139
|
+
</script>
|
|
24140
|
+
</head>
|
|
24141
|
+
<body>
|
|
24142
|
+
<div id="root"></div>
|
|
24143
|
+
<script>
|
|
24144
|
+
class TagBalancer {
|
|
24145
|
+
constructor() {
|
|
24146
|
+
this.voidElements = new Set([
|
|
24147
|
+
'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input',
|
|
24148
|
+
'link', 'meta', 'param', 'source', 'track', 'wbr'
|
|
24149
|
+
]);
|
|
24150
|
+
this.openTags = [];
|
|
24151
|
+
this.accumulatedHTML = '';
|
|
24152
|
+
}
|
|
24153
|
+
|
|
24154
|
+
parseChunk(chunk) {
|
|
24155
|
+
this.accumulatedHTML += chunk;
|
|
24156
|
+
|
|
24157
|
+
// Parse tags from chunk
|
|
24158
|
+
const tagRegex = /<\\/?([a-zA-Z][a-zA-Z0-9]*)[^>]*?>/g;
|
|
24159
|
+
let match;
|
|
24160
|
+
|
|
24161
|
+
while ((match = tagRegex.exec(chunk)) !== null) {
|
|
24162
|
+
const fullTag = match[0];
|
|
24163
|
+
const tagName = match[1].toLowerCase();
|
|
24164
|
+
const isClosing = fullTag.startsWith('</');
|
|
24165
|
+
const isSelfClosing = fullTag.endsWith('/>') || this.voidElements.has(tagName);
|
|
24166
|
+
|
|
24167
|
+
if (isSelfClosing) {
|
|
24168
|
+
// Void elements don't affect stack
|
|
24169
|
+
continue;
|
|
24170
|
+
}
|
|
24171
|
+
|
|
24172
|
+
if (isClosing) {
|
|
24173
|
+
// Remove matching open tag if present
|
|
24174
|
+
const idx = this.openTags.lastIndexOf(tagName);
|
|
24175
|
+
if (idx !== -1) {
|
|
24176
|
+
this.openTags.splice(idx, 1);
|
|
24177
|
+
}
|
|
24178
|
+
} else {
|
|
24179
|
+
// Opening tag - add to stack
|
|
24180
|
+
this.openTags.push(tagName);
|
|
24181
|
+
}
|
|
24182
|
+
}
|
|
24183
|
+
}
|
|
24184
|
+
|
|
24185
|
+
getAccumulatedHTML() {
|
|
24186
|
+
return this.accumulatedHTML;
|
|
24187
|
+
}
|
|
24188
|
+
|
|
24189
|
+
getStack() {
|
|
24190
|
+
return [...this.openTags];
|
|
24191
|
+
}
|
|
24192
|
+
}
|
|
24193
|
+
|
|
24194
|
+
const tagBalancer = new TagBalancer();
|
|
24195
|
+
const root = document.getElementById('root');
|
|
24196
|
+
let renderTimeout = null;
|
|
24197
|
+
|
|
24198
|
+
function preserveInputValues() {
|
|
24199
|
+
const inputs = document.querySelectorAll('input, textarea');
|
|
24200
|
+
const values = new Map();
|
|
24201
|
+
inputs.forEach((input, index) => {
|
|
24202
|
+
const key = input.tagName + '-' + index + '-' + (input.name || input.id || '');
|
|
24203
|
+
values.set(key, input.value);
|
|
24204
|
+
});
|
|
24205
|
+
return values;
|
|
24206
|
+
}
|
|
24207
|
+
|
|
24208
|
+
function restoreInputValues(values) {
|
|
24209
|
+
const inputs = document.querySelectorAll('input, textarea');
|
|
24210
|
+
inputs.forEach((input, index) => {
|
|
24211
|
+
const key = input.tagName + '-' + index + '-' + (input.name || input.id || '');
|
|
24212
|
+
if (values.has(key)) {
|
|
24213
|
+
input.value = values.get(key);
|
|
24214
|
+
}
|
|
24215
|
+
});
|
|
24216
|
+
}
|
|
24217
|
+
|
|
24218
|
+
function render() {
|
|
24219
|
+
try {
|
|
24220
|
+
const preservedValues = preserveInputValues();
|
|
24221
|
+
|
|
24222
|
+
// Build complete HTML with auto-closing tags
|
|
24223
|
+
const openTags = tagBalancer.getStack();
|
|
24224
|
+
const closingTags = openTags
|
|
24225
|
+
.slice()
|
|
24226
|
+
.reverse()
|
|
24227
|
+
.map(tag => '</' + tag + '>')
|
|
24228
|
+
.join('');
|
|
24229
|
+
const balancedHTML = tagBalancer.getAccumulatedHTML() + closingTags;
|
|
24230
|
+
|
|
24231
|
+
// Use morphdom to update DOM
|
|
24232
|
+
if (root) {
|
|
24233
|
+
const temp = document.createElement('div');
|
|
24234
|
+
temp.innerHTML = balancedHTML;
|
|
24235
|
+
|
|
24236
|
+
if (!root.firstChild) {
|
|
24237
|
+
root.innerHTML = balancedHTML;
|
|
24238
|
+
} else if (temp.firstChild) {
|
|
24239
|
+
morphdom(root, temp, {
|
|
24240
|
+
childrenOnly: true,
|
|
24241
|
+
onBeforeElUpdated: function(fromEl, toEl) {
|
|
24242
|
+
// Preserve input/textarea values
|
|
24243
|
+
if (fromEl.tagName === 'INPUT' || fromEl.tagName === 'TEXTAREA') {
|
|
24244
|
+
toEl.value = fromEl.value;
|
|
24245
|
+
}
|
|
24246
|
+
return true;
|
|
24247
|
+
},
|
|
24248
|
+
onNodeAdded: function(node) {
|
|
24249
|
+
// Add fade-in animation to newly added elements
|
|
24250
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
24251
|
+
node.style.animation = '_fadeIn 0.3s ease-out';
|
|
24252
|
+
}
|
|
24253
|
+
return node;
|
|
24254
|
+
}
|
|
24255
|
+
});
|
|
24256
|
+
}
|
|
24257
|
+
}
|
|
24258
|
+
|
|
24259
|
+
restoreInputValues(preservedValues);
|
|
24260
|
+
} catch (error) {
|
|
24261
|
+
console.error('[iframe] Render error:', error);
|
|
24262
|
+
parent.postMessage({ type: 'iframe-error', error: error.message }, '*');
|
|
24263
|
+
}
|
|
24264
|
+
}
|
|
24265
|
+
|
|
24266
|
+
function scheduleRender() {
|
|
24267
|
+
if (renderTimeout) {
|
|
24268
|
+
clearTimeout(renderTimeout);
|
|
24269
|
+
}
|
|
24270
|
+
renderTimeout = setTimeout(render, 50);
|
|
24271
|
+
}
|
|
24272
|
+
|
|
24273
|
+
function notifyHeight() {
|
|
24274
|
+
try {
|
|
24275
|
+
const height = document.body.scrollHeight;
|
|
24276
|
+
parent.postMessage({ type: 'iframe-height', height }, '*');
|
|
24277
|
+
} catch (error) {
|
|
24278
|
+
console.error('[iframe] Failed to notify height:', error);
|
|
24279
|
+
}
|
|
24280
|
+
}
|
|
24281
|
+
|
|
24282
|
+
function notifyWidth() {
|
|
24283
|
+
try {
|
|
24284
|
+
const width = document.body.scrollWidth;
|
|
24285
|
+
parent.postMessage({ type: 'iframe-width', width }, '*');
|
|
24286
|
+
} catch (error) {
|
|
24287
|
+
console.error('[iframe] Failed to notify width:', error);
|
|
24288
|
+
}
|
|
24289
|
+
}
|
|
24290
|
+
|
|
24291
|
+
function notifySize() {
|
|
24292
|
+
notifyHeight();
|
|
24293
|
+
notifyWidth();
|
|
24294
|
+
}
|
|
24295
|
+
|
|
24296
|
+
// Observe size changes
|
|
24297
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
24298
|
+
notifySize();
|
|
24299
|
+
});
|
|
24300
|
+
|
|
24301
|
+
if (root) {
|
|
24302
|
+
resizeObserver.observe(root);
|
|
24303
|
+
}
|
|
24304
|
+
|
|
24305
|
+
// Also notify on initial load
|
|
24306
|
+
window.addEventListener('load', notifySize);
|
|
24307
|
+
|
|
24308
|
+
function executeScripts() {
|
|
24309
|
+
try {
|
|
24310
|
+
const scripts = root.querySelectorAll('script');
|
|
24311
|
+
const executedScripts = new Set();
|
|
24312
|
+
|
|
24313
|
+
scripts.forEach((oldScript) => {
|
|
24314
|
+
// \u901A\u8FC7\u5185\u5BB9\u54C8\u5E0C\u907F\u514D\u91CD\u590D\u6267\u884C\u76F8\u540C\u811A\u672C
|
|
24315
|
+
const scriptKey = oldScript.src || oldScript.textContent;
|
|
24316
|
+
if (executedScripts.has(scriptKey)) {
|
|
24317
|
+
oldScript.remove();
|
|
24318
|
+
return;
|
|
24319
|
+
}
|
|
24320
|
+
executedScripts.add(scriptKey);
|
|
24321
|
+
|
|
24322
|
+
const newScript = document.createElement('script');
|
|
24323
|
+
|
|
24324
|
+
// Copy attributes
|
|
24325
|
+
Array.from(oldScript.attributes).forEach(attr => {
|
|
24326
|
+
newScript.setAttribute(attr.name, attr.value);
|
|
24327
|
+
});
|
|
24328
|
+
|
|
24329
|
+
// Copy content
|
|
24330
|
+
if (oldScript.src) {
|
|
24331
|
+
newScript.src = oldScript.src;
|
|
24332
|
+
} else {
|
|
24333
|
+
newScript.textContent = oldScript.textContent;
|
|
24334
|
+
}
|
|
24335
|
+
|
|
24336
|
+
// Replace old script with new one to execute it
|
|
24337
|
+
oldScript.parentNode.replaceChild(newScript, oldScript);
|
|
24338
|
+
});
|
|
24339
|
+
} catch (error) {
|
|
24340
|
+
console.error('[iframe] Script execution error:', error);
|
|
24341
|
+
parent.postMessage({ type: 'iframe-error', error: error.message }, '*');
|
|
24342
|
+
}
|
|
24343
|
+
}
|
|
24344
|
+
|
|
24345
|
+
// Listen for messages from parent
|
|
24346
|
+
window.addEventListener('message', function(event) {
|
|
24347
|
+
try {
|
|
24348
|
+
const message = event.data;
|
|
24349
|
+
|
|
24350
|
+
if (!message || typeof message !== 'object') {
|
|
24351
|
+
return;
|
|
24352
|
+
}
|
|
24353
|
+
|
|
24354
|
+
switch (message.type) {
|
|
24355
|
+
case 'stream-chunk':
|
|
24356
|
+
if (message.chunk) {
|
|
24357
|
+
tagBalancer.parseChunk(message.chunk);
|
|
24358
|
+
scheduleRender();
|
|
24359
|
+
}
|
|
24360
|
+
break;
|
|
24361
|
+
|
|
24362
|
+
case 'execute-scripts':
|
|
24363
|
+
// \u5EF6\u8FDF\u6267\u884C\u811A\u672C\uFF0C\u786E\u4FDD render \u5DF2\u5B8C\u6210
|
|
24364
|
+
setTimeout(() => {
|
|
24365
|
+
executeScripts();
|
|
24366
|
+
}, 100);
|
|
24367
|
+
break;
|
|
24368
|
+
}
|
|
24369
|
+
} catch (error) {
|
|
24370
|
+
parent.postMessage({ type: 'iframe-error', error: error.message }, '*');
|
|
24371
|
+
}
|
|
24372
|
+
});
|
|
24373
|
+
|
|
24374
|
+
// Global sendPrompt function for widgets to communicate with parent
|
|
24375
|
+
window.sendPrompt = function(text) {
|
|
24376
|
+
if (typeof text !== 'string') {
|
|
24377
|
+
console.error('[iframe] sendPrompt requires a string argument');
|
|
24378
|
+
return;
|
|
24379
|
+
}
|
|
24380
|
+
parent.postMessage({ type: 'widget-prompt', text: text }, '*');
|
|
24381
|
+
};
|
|
24382
|
+
|
|
24383
|
+
// Also expose openLink for opening URLs
|
|
24384
|
+
window.openLink = function(url) {
|
|
24385
|
+
if (typeof url !== 'string') {
|
|
24386
|
+
console.error('[iframe] openLink requires a string argument');
|
|
24387
|
+
return;
|
|
24388
|
+
}
|
|
24389
|
+
parent.postMessage({ type: 'widget-open-link', url: url }, '*');
|
|
24390
|
+
};
|
|
24391
|
+
|
|
24392
|
+
// Signal that iframe is ready (only if morphdom was already loaded)
|
|
24393
|
+
if (typeof morphdom !== 'undefined') {
|
|
24394
|
+
parent.postMessage({ type: 'iframe-ready' }, '*');
|
|
24395
|
+
}
|
|
24396
|
+
</script>
|
|
24397
|
+
</body>
|
|
24398
|
+
</html>`;
|
|
24399
|
+
}
|
|
24400
|
+
|
|
24401
|
+
// src/streaming-html/StreamingHTMLRenderer.tsx
|
|
24402
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
24403
|
+
var StreamingHTMLRenderer = ({
|
|
24404
|
+
html,
|
|
24405
|
+
className = "",
|
|
24406
|
+
isComplete = false,
|
|
24407
|
+
onError,
|
|
24408
|
+
onPrompt,
|
|
24409
|
+
title,
|
|
24410
|
+
loadingMessages
|
|
24411
|
+
}) => {
|
|
24412
|
+
const iframeRef = (0, import_react73.useRef)(null);
|
|
24413
|
+
const containerRef = (0, import_react73.useRef)(null);
|
|
24414
|
+
const resizeObserverRef = (0, import_react73.useRef)(null);
|
|
24415
|
+
const prevHTMLRef = (0, import_react73.useRef)("");
|
|
24416
|
+
const isReadyRef = (0, import_react73.useRef)(false);
|
|
24417
|
+
const pendingChunksRef = (0, import_react73.useRef)([]);
|
|
24418
|
+
const isCompleteRef = (0, import_react73.useRef)(isComplete);
|
|
24419
|
+
const isScriptExecuted = (0, import_react73.useRef)(false);
|
|
24420
|
+
const [iframeHeight, setIframeHeight] = import_react73.default.useState(0);
|
|
24421
|
+
const [iframeWidth, setIframeWidth] = import_react73.default.useState(void 0);
|
|
24422
|
+
const [currentMessageIndex, setCurrentMessageIndex] = (0, import_react73.useState)(0);
|
|
24423
|
+
const [showLoading, setShowLoading] = (0, import_react73.useState)(true);
|
|
24424
|
+
(0, import_react73.useEffect)(() => {
|
|
24425
|
+
isCompleteRef.current = isComplete;
|
|
24426
|
+
}, [isComplete]);
|
|
24427
|
+
(0, import_react73.useEffect)(() => {
|
|
24428
|
+
if (iframeHeight > 0) {
|
|
24429
|
+
setShowLoading(false);
|
|
24430
|
+
return;
|
|
24431
|
+
}
|
|
24432
|
+
if (!loadingMessages || loadingMessages.length === 0) {
|
|
24433
|
+
setShowLoading(false);
|
|
24434
|
+
return;
|
|
24435
|
+
}
|
|
24436
|
+
setShowLoading(true);
|
|
24437
|
+
if (loadingMessages.length === 1) {
|
|
24438
|
+
setCurrentMessageIndex(0);
|
|
24439
|
+
return;
|
|
24440
|
+
}
|
|
24441
|
+
const interval = setInterval(() => {
|
|
24442
|
+
setCurrentMessageIndex((prev) => {
|
|
24443
|
+
if (prev >= loadingMessages.length - 1) {
|
|
24444
|
+
clearInterval(interval);
|
|
24445
|
+
return prev;
|
|
24446
|
+
}
|
|
24447
|
+
return prev + 1;
|
|
24448
|
+
});
|
|
24449
|
+
}, 1500);
|
|
24450
|
+
return () => clearInterval(interval);
|
|
24451
|
+
}, [iframeHeight, loadingMessages]);
|
|
24452
|
+
const executeScripts = (0, import_react73.useCallback)(() => {
|
|
24453
|
+
if (isScriptExecuted.current) {
|
|
24454
|
+
console.log("[StreamingHTMLRenderer] scripts is executed");
|
|
24455
|
+
return;
|
|
24456
|
+
}
|
|
24457
|
+
console.log("[StreamingHTMLRenderer] Executing scripts...");
|
|
24458
|
+
const iframe = iframeRef.current;
|
|
24459
|
+
if (!iframe || !iframe.contentWindow) {
|
|
24460
|
+
console.log("[StreamingHTMLRenderer] No iframe or contentWindow");
|
|
24461
|
+
return;
|
|
24462
|
+
}
|
|
24463
|
+
try {
|
|
24464
|
+
console.log("[StreamingHTMLRenderer] Sending execute-scripts message");
|
|
24465
|
+
isScriptExecuted.current = true;
|
|
24466
|
+
iframe.contentWindow.postMessage(
|
|
24467
|
+
{ type: "execute-scripts" },
|
|
24468
|
+
"*"
|
|
24469
|
+
);
|
|
24470
|
+
} catch (error) {
|
|
24471
|
+
console.error("[StreamingHTMLRenderer] Failed to execute scripts:", error);
|
|
24472
|
+
const streamingError = {
|
|
24473
|
+
type: "POSTMESSAGE_ERROR",
|
|
24474
|
+
message: error instanceof Error ? error.message : "Failed to execute scripts in iframe"
|
|
24475
|
+
};
|
|
24476
|
+
onError?.(streamingError);
|
|
24477
|
+
}
|
|
24478
|
+
}, [onError]);
|
|
24479
|
+
const sendChunk = (0, import_react73.useCallback)((chunk) => {
|
|
24480
|
+
const iframe = iframeRef.current;
|
|
24481
|
+
if (!iframe || !iframe.contentWindow) {
|
|
24482
|
+
return;
|
|
24483
|
+
}
|
|
24484
|
+
if (!isReadyRef.current) {
|
|
24485
|
+
console.log("[StreamingHTMLRenderer] Iframe not ready, queueing chunk");
|
|
24486
|
+
pendingChunksRef.current.push(chunk);
|
|
24487
|
+
return;
|
|
24488
|
+
}
|
|
24489
|
+
try {
|
|
24490
|
+
iframe.contentWindow.postMessage(
|
|
24491
|
+
{ type: "stream-chunk", chunk },
|
|
24492
|
+
"*"
|
|
24493
|
+
);
|
|
24494
|
+
} catch (error) {
|
|
24495
|
+
console.error("[StreamingHTMLRenderer] Failed to send chunk:", error);
|
|
24496
|
+
const streamingError = {
|
|
24497
|
+
type: "POSTMESSAGE_ERROR",
|
|
24498
|
+
message: error instanceof Error ? error.message : "Failed to send chunk to iframe"
|
|
24499
|
+
};
|
|
24500
|
+
onError?.(streamingError);
|
|
24501
|
+
}
|
|
24502
|
+
}, [onError]);
|
|
24503
|
+
(0, import_react73.useEffect)(() => {
|
|
24504
|
+
const handleMessage = (event) => {
|
|
24505
|
+
const iframe = iframeRef.current;
|
|
24506
|
+
if (!iframe || event.source !== iframe.contentWindow) {
|
|
24507
|
+
return;
|
|
24508
|
+
}
|
|
24509
|
+
const message19 = event.data;
|
|
24510
|
+
if (!message19 || typeof message19 !== "object") {
|
|
24511
|
+
return;
|
|
24512
|
+
}
|
|
24513
|
+
switch (message19.type) {
|
|
24514
|
+
case "iframe-ready":
|
|
24515
|
+
console.log("[StreamingHTMLRenderer] Iframe ready");
|
|
24516
|
+
isReadyRef.current = true;
|
|
24517
|
+
while (pendingChunksRef.current.length > 0) {
|
|
24518
|
+
const chunk = pendingChunksRef.current.shift();
|
|
24519
|
+
if (chunk) {
|
|
24520
|
+
sendChunk(chunk);
|
|
24521
|
+
}
|
|
24522
|
+
}
|
|
24523
|
+
if (isCompleteRef.current) {
|
|
24524
|
+
executeScripts();
|
|
24525
|
+
}
|
|
24526
|
+
break;
|
|
24527
|
+
case "iframe-height":
|
|
24528
|
+
if (typeof message19.height === "number" && message19.height > 0) {
|
|
24529
|
+
setIframeHeight(message19.height);
|
|
24530
|
+
}
|
|
24531
|
+
break;
|
|
24532
|
+
case "iframe-error":
|
|
24533
|
+
const streamingError = {
|
|
24534
|
+
type: "RENDER_ERROR",
|
|
24535
|
+
message: message19.error || "Unknown iframe error"
|
|
24536
|
+
};
|
|
24537
|
+
onError?.(streamingError);
|
|
24538
|
+
break;
|
|
24539
|
+
case "widget-prompt":
|
|
24540
|
+
if (typeof message19.text === "string") {
|
|
24541
|
+
onPrompt?.(message19.text);
|
|
24542
|
+
}
|
|
24543
|
+
break;
|
|
24544
|
+
case "widget-open-link":
|
|
24545
|
+
if (typeof message19.url === "string") {
|
|
24546
|
+
window.open(message19.url, "_blank", "noopener,noreferrer");
|
|
24547
|
+
}
|
|
24548
|
+
break;
|
|
24549
|
+
}
|
|
24550
|
+
};
|
|
24551
|
+
window.addEventListener("message", handleMessage);
|
|
24552
|
+
return () => {
|
|
24553
|
+
window.removeEventListener("message", handleMessage);
|
|
24554
|
+
};
|
|
24555
|
+
}, [onError, onPrompt, sendChunk, executeScripts]);
|
|
24556
|
+
(0, import_react73.useEffect)(() => {
|
|
24557
|
+
if (html === prevHTMLRef.current) {
|
|
24558
|
+
return;
|
|
24559
|
+
}
|
|
24560
|
+
const prevLength = prevHTMLRef.current.length;
|
|
24561
|
+
const newChunk = html.slice(prevLength);
|
|
24562
|
+
prevHTMLRef.current = html;
|
|
24563
|
+
if (newChunk) {
|
|
24564
|
+
sendChunk(newChunk);
|
|
24565
|
+
}
|
|
24566
|
+
}, [html, sendChunk]);
|
|
24567
|
+
(0, import_react73.useEffect)(() => {
|
|
24568
|
+
if (isComplete && isReadyRef.current) {
|
|
24569
|
+
executeScripts();
|
|
24570
|
+
}
|
|
24571
|
+
}, [isComplete, executeScripts]);
|
|
24572
|
+
(0, import_react73.useEffect)(() => {
|
|
24573
|
+
const container = containerRef.current;
|
|
24574
|
+
if (!container) return;
|
|
24575
|
+
const antBubble = container.closest(".ant-bubble");
|
|
24576
|
+
if (!antBubble) {
|
|
24577
|
+
console.warn("[StreamingHTMLRenderer] .ant-bubble ancestor not found");
|
|
24578
|
+
return;
|
|
24579
|
+
}
|
|
24580
|
+
resizeObserverRef.current = new ResizeObserver((entries) => {
|
|
24581
|
+
for (const entry of entries) {
|
|
24582
|
+
const width = entry.contentRect.width;
|
|
24583
|
+
if (width > 0) {
|
|
24584
|
+
setIframeWidth(width);
|
|
24585
|
+
}
|
|
24586
|
+
}
|
|
24587
|
+
});
|
|
24588
|
+
resizeObserverRef.current.observe(antBubble);
|
|
24589
|
+
const initialWidth = antBubble.getBoundingClientRect().width;
|
|
24590
|
+
if (initialWidth > 0) {
|
|
24591
|
+
setIframeWidth(initialWidth);
|
|
24592
|
+
}
|
|
24593
|
+
return () => {
|
|
24594
|
+
resizeObserverRef.current?.disconnect();
|
|
24595
|
+
resizeObserverRef.current = null;
|
|
24596
|
+
};
|
|
24597
|
+
}, []);
|
|
24598
|
+
(0, import_react73.useEffect)(() => {
|
|
24599
|
+
return () => {
|
|
24600
|
+
isReadyRef.current = false;
|
|
24601
|
+
pendingChunksRef.current = [];
|
|
24602
|
+
prevHTMLRef.current = "";
|
|
24603
|
+
};
|
|
24604
|
+
}, []);
|
|
24605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
|
|
24606
|
+
"div",
|
|
24607
|
+
{
|
|
24608
|
+
ref: containerRef,
|
|
24609
|
+
className: `streaming-html-renderer ${className}`,
|
|
24610
|
+
style: { minHeight: "100px", position: "relative" },
|
|
24611
|
+
children: [
|
|
24612
|
+
showLoading && /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
|
|
24613
|
+
"div",
|
|
24614
|
+
{
|
|
24615
|
+
style: {
|
|
24616
|
+
position: "absolute",
|
|
24617
|
+
top: 0,
|
|
24618
|
+
left: 0,
|
|
24619
|
+
right: 0,
|
|
24620
|
+
bottom: 0,
|
|
24621
|
+
display: "flex",
|
|
24622
|
+
alignItems: "center",
|
|
24623
|
+
justifyContent: "center",
|
|
24624
|
+
borderRadius: radius.lg,
|
|
24625
|
+
background: `linear-gradient(90deg, ${colors.light.surfaceHover} 25%, ${colors.light.surface} 50%, ${colors.light.surfaceHover} 75%)`,
|
|
24626
|
+
backgroundSize: "200% 100%",
|
|
24627
|
+
animation: "shimmer 1.5s infinite",
|
|
24628
|
+
zIndex: 10
|
|
24629
|
+
},
|
|
24630
|
+
children: [
|
|
24631
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("style", { children: `
|
|
24632
|
+
@keyframes shimmer {
|
|
24633
|
+
0% { background-position: -200% 0; }
|
|
24634
|
+
100% { background-position: 200% 0; }
|
|
24635
|
+
}
|
|
24636
|
+
` }),
|
|
24637
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
24638
|
+
"span",
|
|
24639
|
+
{
|
|
24640
|
+
style: {
|
|
24641
|
+
fontSize: "14px",
|
|
24642
|
+
color: colors.light.textSecondary,
|
|
24643
|
+
textAlign: "center",
|
|
24644
|
+
padding: "0 16px"
|
|
24645
|
+
},
|
|
24646
|
+
children: loadingMessages?.[currentMessageIndex] || "Loading..."
|
|
24647
|
+
}
|
|
24648
|
+
)
|
|
24649
|
+
]
|
|
24650
|
+
}
|
|
24651
|
+
),
|
|
24652
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
24653
|
+
"iframe",
|
|
24654
|
+
{
|
|
24655
|
+
ref: iframeRef,
|
|
24656
|
+
srcDoc: generateIframeSrcdoc(),
|
|
24657
|
+
sandbox: "allow-scripts",
|
|
24658
|
+
style: {
|
|
24659
|
+
width: iframeWidth ? `${iframeWidth}px` : "100%",
|
|
24660
|
+
height: iframeHeight > 0 ? `${iframeHeight}px` : "100px",
|
|
24661
|
+
border: "none",
|
|
24662
|
+
display: "block",
|
|
24663
|
+
overflow: "hidden"
|
|
24664
|
+
},
|
|
24665
|
+
title
|
|
24666
|
+
}
|
|
24667
|
+
)
|
|
24668
|
+
]
|
|
24669
|
+
}
|
|
24670
|
+
);
|
|
24671
|
+
};
|
|
24672
|
+
var StreamingHTMLRenderer_default = StreamingHTMLRenderer;
|
|
24673
|
+
|
|
24674
|
+
// src/components/GenUI/elements/ShowWidget.tsx
|
|
24675
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
24676
|
+
var ShowWidget = ({
|
|
24677
|
+
data,
|
|
24678
|
+
component_key,
|
|
24679
|
+
interactive = true
|
|
24680
|
+
}) => {
|
|
24681
|
+
const toolCallData = data;
|
|
24682
|
+
const { title, loading_messages, widget_code } = toolCallData?.args || {};
|
|
24683
|
+
const { openSideApp } = useChatUIContext();
|
|
24684
|
+
const { sendMessage } = useAgentChat();
|
|
24685
|
+
if (!toolCallData) {
|
|
24686
|
+
return null;
|
|
24687
|
+
}
|
|
24688
|
+
let isComplete = false;
|
|
24689
|
+
let finalHTML = widget_code || "";
|
|
24690
|
+
if (toolCallData?.response) {
|
|
24691
|
+
try {
|
|
24692
|
+
const responseObj = JSON.parse(toolCallData.response);
|
|
24693
|
+
if (toolCallData.status === "success") {
|
|
24694
|
+
isComplete = true;
|
|
24695
|
+
finalHTML = responseObj.widget_code || widget_code || "";
|
|
24696
|
+
}
|
|
24697
|
+
} catch (e) {
|
|
24698
|
+
console.warn("Failed to parse tool response:", e);
|
|
24699
|
+
}
|
|
24700
|
+
}
|
|
24701
|
+
const sendPrompt = (0, import_react74.useCallback)((text) => {
|
|
24702
|
+
sendMessage({
|
|
24703
|
+
input: {
|
|
24704
|
+
message: text
|
|
24705
|
+
}
|
|
24706
|
+
});
|
|
24707
|
+
}, [sendMessage]);
|
|
24708
|
+
const handleOpenInSideApp = (0, import_react74.useCallback)(() => {
|
|
24709
|
+
openSideApp({
|
|
24710
|
+
component_key: "show_widget",
|
|
24711
|
+
data: {
|
|
24712
|
+
widget_code: finalHTML,
|
|
24713
|
+
title: title || "Widget"
|
|
24714
|
+
},
|
|
24715
|
+
message: title || "Widget"
|
|
24716
|
+
});
|
|
24717
|
+
}, [openSideApp, finalHTML, title]);
|
|
24718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { style: {
|
|
24719
|
+
display: "flex",
|
|
24720
|
+
flexDirection: "column",
|
|
24721
|
+
borderRadius: radius.lg,
|
|
24722
|
+
overflow: "hidden"
|
|
24723
|
+
}, children: [
|
|
24724
|
+
isComplete && /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
24725
|
+
"div",
|
|
24726
|
+
{
|
|
24727
|
+
style: {
|
|
24728
|
+
display: "flex",
|
|
24729
|
+
alignItems: "center",
|
|
24730
|
+
justifyContent: "center",
|
|
24731
|
+
padding: "8px 12px",
|
|
24732
|
+
position: "relative"
|
|
24733
|
+
},
|
|
24734
|
+
children: [
|
|
24735
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
24736
|
+
import_antd74.Typography.Text,
|
|
24737
|
+
{
|
|
24738
|
+
strong: true,
|
|
24739
|
+
style: {
|
|
24740
|
+
fontSize: "14px",
|
|
24741
|
+
color: colors.light.text
|
|
24742
|
+
},
|
|
24743
|
+
children: title || "Widget"
|
|
24744
|
+
}
|
|
24745
|
+
),
|
|
24746
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
24747
|
+
import_antd74.Button,
|
|
24748
|
+
{
|
|
24749
|
+
type: "text",
|
|
24750
|
+
size: "small",
|
|
24751
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_icons35.ExpandOutlined, {}),
|
|
24752
|
+
onClick: handleOpenInSideApp,
|
|
24753
|
+
style: {
|
|
24754
|
+
position: "absolute",
|
|
24755
|
+
right: 8
|
|
24756
|
+
},
|
|
24757
|
+
title: "Open in side app"
|
|
24758
|
+
}
|
|
24759
|
+
)
|
|
24760
|
+
]
|
|
24761
|
+
}
|
|
24762
|
+
),
|
|
24763
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { style: { position: "relative", flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
24764
|
+
StreamingHTMLRenderer_default,
|
|
24765
|
+
{
|
|
24766
|
+
html: finalHTML,
|
|
24767
|
+
isComplete,
|
|
24768
|
+
onError: (err) => console.error("Widget render error:", err),
|
|
24769
|
+
onPrompt: sendPrompt,
|
|
24770
|
+
loadingMessages: loading_messages
|
|
24771
|
+
}
|
|
24772
|
+
) })
|
|
24773
|
+
] });
|
|
24774
|
+
};
|
|
24775
|
+
|
|
24776
|
+
// src/components/GenUI/elements/ShowWidgetApp.tsx
|
|
24777
|
+
var import_react75 = require("react");
|
|
24778
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
24779
|
+
var ShowWidgetApp = ({
|
|
24780
|
+
data
|
|
24781
|
+
}) => {
|
|
24782
|
+
const { widget_code, title } = data || {};
|
|
24783
|
+
const { sendMessage } = useAgentChat();
|
|
24784
|
+
const sendPrompt = (0, import_react75.useCallback)(
|
|
24785
|
+
(text) => {
|
|
24786
|
+
sendMessage({
|
|
24787
|
+
input: {
|
|
24788
|
+
message: text
|
|
24789
|
+
}
|
|
24790
|
+
});
|
|
24791
|
+
},
|
|
24792
|
+
[sendMessage]
|
|
24793
|
+
);
|
|
24794
|
+
if (!widget_code) {
|
|
24795
|
+
return null;
|
|
24796
|
+
}
|
|
24797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { style: { padding: 24 }, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
24798
|
+
StreamingHTMLRenderer_default,
|
|
24799
|
+
{
|
|
24800
|
+
html: widget_code,
|
|
24801
|
+
isComplete: true,
|
|
24802
|
+
onError: (err) => console.error("Widget render error:", err),
|
|
24803
|
+
onPrompt: sendPrompt
|
|
24804
|
+
}
|
|
24805
|
+
) });
|
|
24806
|
+
};
|
|
24807
|
+
|
|
23697
24808
|
// src/components/GenUI/elements/builtIns.tsx
|
|
23698
24809
|
var elements = {
|
|
23699
24810
|
action_show_attachments_uploader: {
|
|
@@ -23774,6 +24885,10 @@ var elements = {
|
|
|
23774
24885
|
mailbox: {
|
|
23775
24886
|
card_view: TeamChat,
|
|
23776
24887
|
side_app_view: MailboxPanel
|
|
24888
|
+
},
|
|
24889
|
+
show_widget: {
|
|
24890
|
+
card_view: ShowWidget,
|
|
24891
|
+
side_app_view: ShowWidgetApp
|
|
23777
24892
|
}
|
|
23778
24893
|
};
|
|
23779
24894
|
|
|
@@ -23791,10 +24906,10 @@ var regsiterElement = (language, ElementMeta) => {
|
|
|
23791
24906
|
};
|
|
23792
24907
|
|
|
23793
24908
|
// src/components/Chat/SideAppViewBrowser.tsx
|
|
23794
|
-
var
|
|
24909
|
+
var import_antd75 = require("antd");
|
|
23795
24910
|
var import_antd_style28 = require("antd-style");
|
|
23796
|
-
var
|
|
23797
|
-
var
|
|
24911
|
+
var import_react76 = require("react");
|
|
24912
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
23798
24913
|
var useStyle12 = (0, import_antd_style28.createStyles)(({ token, css }) => {
|
|
23799
24914
|
return {
|
|
23800
24915
|
container: css`
|
|
@@ -23971,15 +25086,15 @@ var useStyle12 = (0, import_antd_style28.createStyles)(({ token, css }) => {
|
|
|
23971
25086
|
});
|
|
23972
25087
|
var EmptySideAppView = ({ component_key, data }) => {
|
|
23973
25088
|
if (data?.component) {
|
|
23974
|
-
return /* @__PURE__ */ (0,
|
|
25089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_jsx_runtime99.Fragment, { children: data.component });
|
|
23975
25090
|
}
|
|
23976
|
-
return /* @__PURE__ */ (0,
|
|
23977
|
-
/* @__PURE__ */ (0,
|
|
23978
|
-
/* @__PURE__ */ (0,
|
|
25091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { children: [
|
|
25092
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { children: "Component view not found" }),
|
|
25093
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("pre", { children: JSON.stringify({ component_key, data }, null, 2) })
|
|
23979
25094
|
] });
|
|
23980
25095
|
};
|
|
23981
25096
|
var getTabIcon = (componentKey) => {
|
|
23982
|
-
return /* @__PURE__ */ (0,
|
|
25097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_icons36.AppstoreOutlined, { style: { fontSize: 12, opacity: 0.6 } });
|
|
23983
25098
|
};
|
|
23984
25099
|
var SideAppViewBrowser = ({ region = "side" }) => {
|
|
23985
25100
|
const { styles } = useStyle12();
|
|
@@ -23991,11 +25106,11 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
23991
25106
|
} = useChatUIContext();
|
|
23992
25107
|
const selectedCard = region === "side" ? sideAppSelectedCard : contextAppSelectedCard;
|
|
23993
25108
|
const closeApp = region === "side" ? closeSideApp : closeContentApp;
|
|
23994
|
-
const [activeKey, setActiveKey] = (0,
|
|
25109
|
+
const [activeKey, setActiveKey] = (0, import_react76.useState)(
|
|
23995
25110
|
JSON.stringify(selectedCard)
|
|
23996
25111
|
);
|
|
23997
|
-
const [hoveredTab, setHoveredTab] = (0,
|
|
23998
|
-
const [items, setItems] = (0,
|
|
25112
|
+
const [hoveredTab, setHoveredTab] = (0, import_react76.useState)(null);
|
|
25113
|
+
const [items, setItems] = (0, import_react76.useState)([]);
|
|
23999
25114
|
const add = (key, label, children, componentKey) => {
|
|
24000
25115
|
const newPanes = [...items, { label, children, key, componentKey }];
|
|
24001
25116
|
setItems(newPanes);
|
|
@@ -24022,7 +25137,7 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
24022
25137
|
const switchTab = (key) => {
|
|
24023
25138
|
setActiveKey(key);
|
|
24024
25139
|
};
|
|
24025
|
-
(0,
|
|
25140
|
+
(0, import_react76.useEffect)(() => {
|
|
24026
25141
|
if (!selectedCard) return;
|
|
24027
25142
|
const key = JSON.stringify(selectedCard);
|
|
24028
25143
|
if (items.find((item) => item.key === key)) {
|
|
@@ -24037,7 +25152,7 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
24037
25152
|
add(
|
|
24038
25153
|
key,
|
|
24039
25154
|
selectedCard?.message || selectedCard?.data?.message || "Unnamed",
|
|
24040
|
-
/* @__PURE__ */ (0,
|
|
25155
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
24041
25156
|
SideAppView,
|
|
24042
25157
|
{
|
|
24043
25158
|
component_key: selectedCard?.component_key || "",
|
|
@@ -24051,7 +25166,7 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
24051
25166
|
const activeItem = items.find((item) => item.key === activeKey);
|
|
24052
25167
|
const dropdownItems = items.map((item) => ({
|
|
24053
25168
|
key: item.key,
|
|
24054
|
-
label: /* @__PURE__ */ (0,
|
|
25169
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
|
|
24055
25170
|
"div",
|
|
24056
25171
|
{
|
|
24057
25172
|
style: {
|
|
@@ -24062,9 +25177,9 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
24062
25177
|
},
|
|
24063
25178
|
children: [
|
|
24064
25179
|
getTabIcon(item.componentKey),
|
|
24065
|
-
/* @__PURE__ */ (0,
|
|
24066
|
-
/* @__PURE__ */ (0,
|
|
24067
|
-
|
|
25180
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { style: { flex: 1 }, children: item.label }),
|
|
25181
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
25182
|
+
import_icons36.CloseOutlined,
|
|
24068
25183
|
{
|
|
24069
25184
|
style: { fontSize: 10, opacity: 0.5 },
|
|
24070
25185
|
onClick: (e) => {
|
|
@@ -24078,9 +25193,9 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
24078
25193
|
),
|
|
24079
25194
|
onClick: () => switchTab(item.key)
|
|
24080
25195
|
}));
|
|
24081
|
-
return /* @__PURE__ */ (0,
|
|
24082
|
-
/* @__PURE__ */ (0,
|
|
24083
|
-
/* @__PURE__ */ (0,
|
|
25196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: styles.container, children: [
|
|
25197
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: styles.header, children: [
|
|
25198
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: styles.tabsStrip, children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_antd75.Tooltip, { title: item.label, placement: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
|
|
24084
25199
|
"div",
|
|
24085
25200
|
{
|
|
24086
25201
|
"data-tab-key": item.key,
|
|
@@ -24090,8 +25205,8 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
24090
25205
|
onMouseLeave: () => setHoveredTab(null),
|
|
24091
25206
|
children: [
|
|
24092
25207
|
getTabIcon(item.componentKey),
|
|
24093
|
-
/* @__PURE__ */ (0,
|
|
24094
|
-
/* @__PURE__ */ (0,
|
|
25208
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: styles.tabLabel, children: item.label }),
|
|
25209
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
24095
25210
|
"span",
|
|
24096
25211
|
{
|
|
24097
25212
|
className: `${styles.closeIndicator} ${hoveredTab === item.key || item.key === activeKey ? "always-visible" : ""}`,
|
|
@@ -24099,39 +25214,39 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
24099
25214
|
e.stopPropagation();
|
|
24100
25215
|
remove(item.key);
|
|
24101
25216
|
},
|
|
24102
|
-
children: /* @__PURE__ */ (0,
|
|
25217
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_icons36.CloseOutlined, { style: { fontSize: 10 } })
|
|
24103
25218
|
}
|
|
24104
25219
|
)
|
|
24105
25220
|
]
|
|
24106
25221
|
}
|
|
24107
25222
|
) }, item.key)) }),
|
|
24108
|
-
/* @__PURE__ */ (0,
|
|
24109
|
-
items.length > 0 && /* @__PURE__ */ (0,
|
|
24110
|
-
items.length > 1 && /* @__PURE__ */ (0,
|
|
24111
|
-
|
|
25223
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: styles.actions, children: [
|
|
25224
|
+
items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: styles.tabCounter, children: items.length }),
|
|
25225
|
+
items.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
25226
|
+
import_antd75.Dropdown,
|
|
24112
25227
|
{
|
|
24113
25228
|
menu: { items: dropdownItems },
|
|
24114
25229
|
placement: "bottomRight",
|
|
24115
25230
|
trigger: ["click"],
|
|
24116
|
-
children: /* @__PURE__ */ (0,
|
|
25231
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("button", { className: styles.actionBtn, title: "All tabs", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_icons36.MoreOutlined, {}) })
|
|
24117
25232
|
}
|
|
24118
25233
|
),
|
|
24119
|
-
/* @__PURE__ */ (0,
|
|
25234
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_antd75.Tooltip, { title: "Close", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("button", { className: styles.actionBtn, onClick: closeApp, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_icons36.CloseOutlined, {}) }) })
|
|
24120
25235
|
] })
|
|
24121
25236
|
] }),
|
|
24122
|
-
/* @__PURE__ */ (0,
|
|
24123
|
-
/* @__PURE__ */ (0,
|
|
24124
|
-
/* @__PURE__ */ (0,
|
|
25237
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: styles.content, children: activeItem ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: styles.contentWrapper, children: activeItem.children }, activeItem.key) : /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: styles.emptyState, children: [
|
|
25238
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_icons36.AppstoreOutlined, { className: "icon" }),
|
|
25239
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { children: "Select an app to start" })
|
|
24125
25240
|
] }) })
|
|
24126
25241
|
] });
|
|
24127
25242
|
};
|
|
24128
25243
|
|
|
24129
25244
|
// src/components/Chat/ProjectSelector.tsx
|
|
24130
|
-
var
|
|
24131
|
-
var
|
|
25245
|
+
var import_react77 = require("react");
|
|
25246
|
+
var import_antd76 = require("antd");
|
|
24132
25247
|
var import_antd_style29 = require("antd-style");
|
|
24133
25248
|
var import_lucide_react25 = require("lucide-react");
|
|
24134
|
-
var
|
|
25249
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
24135
25250
|
var PROJECT_NAME_MAX_LENGTH = 50;
|
|
24136
25251
|
var useStyles17 = (0, import_antd_style29.createStyles)(({ token, css }) => ({
|
|
24137
25252
|
container: css`
|
|
@@ -24361,34 +25476,34 @@ var ProjectSelector = () => {
|
|
|
24361
25476
|
setProject,
|
|
24362
25477
|
createProject
|
|
24363
25478
|
} = useWorkspaceContext();
|
|
24364
|
-
const [isWorkspaceListOpen, setIsWorkspaceListOpen] = (0,
|
|
24365
|
-
const workspaceDropdownRef = (0,
|
|
24366
|
-
const [isProjectListOpen, setIsProjectListOpen] = (0,
|
|
24367
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
24368
|
-
const [projectName, setProjectName] = (0,
|
|
24369
|
-
const [validationError, setValidationError] = (0,
|
|
24370
|
-
const [isCreating, setIsCreating] = (0,
|
|
24371
|
-
const projectNameInputRef = (0,
|
|
24372
|
-
const currentProject = (0,
|
|
25479
|
+
const [isWorkspaceListOpen, setIsWorkspaceListOpen] = (0, import_react77.useState)(false);
|
|
25480
|
+
const workspaceDropdownRef = (0, import_react77.useRef)(null);
|
|
25481
|
+
const [isProjectListOpen, setIsProjectListOpen] = (0, import_react77.useState)(false);
|
|
25482
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react77.useState)(false);
|
|
25483
|
+
const [projectName, setProjectName] = (0, import_react77.useState)("");
|
|
25484
|
+
const [validationError, setValidationError] = (0, import_react77.useState)(null);
|
|
25485
|
+
const [isCreating, setIsCreating] = (0, import_react77.useState)(false);
|
|
25486
|
+
const projectNameInputRef = (0, import_react77.useRef)(null);
|
|
25487
|
+
const currentProject = (0, import_react77.useMemo)(() => {
|
|
24373
25488
|
return projects.find((p) => p.id === projectId);
|
|
24374
25489
|
}, [projects, projectId]);
|
|
24375
|
-
const currentWorkspace = (0,
|
|
25490
|
+
const currentWorkspace = (0, import_react77.useMemo)(() => {
|
|
24376
25491
|
return workspaces.find((w) => w.id === workspaceId);
|
|
24377
25492
|
}, [workspaces, workspaceId]);
|
|
24378
|
-
const handleSelectProject = (0,
|
|
25493
|
+
const handleSelectProject = (0, import_react77.useCallback)((selectedProjectId) => {
|
|
24379
25494
|
setProject(selectedProjectId);
|
|
24380
25495
|
setIsProjectListOpen(false);
|
|
24381
25496
|
}, [setProject]);
|
|
24382
|
-
const handleWorkspaceClick = (0,
|
|
25497
|
+
const handleWorkspaceClick = (0, import_react77.useCallback)(() => {
|
|
24383
25498
|
setProject(null);
|
|
24384
25499
|
}, [setProject]);
|
|
24385
|
-
const toggleProjectList = (0,
|
|
25500
|
+
const toggleProjectList = (0, import_react77.useCallback)(() => {
|
|
24386
25501
|
setIsProjectListOpen((prev) => !prev);
|
|
24387
25502
|
}, []);
|
|
24388
|
-
const toggleWorkspaceList = (0,
|
|
25503
|
+
const toggleWorkspaceList = (0, import_react77.useCallback)(() => {
|
|
24389
25504
|
setIsWorkspaceListOpen((prev) => !prev);
|
|
24390
25505
|
}, []);
|
|
24391
|
-
const validateProjectName = (0,
|
|
25506
|
+
const validateProjectName = (0, import_react77.useCallback)((name) => {
|
|
24392
25507
|
const trimmed = name.trim();
|
|
24393
25508
|
if (!trimmed) return "Project name is required";
|
|
24394
25509
|
if (trimmed.length > PROJECT_NAME_MAX_LENGTH) {
|
|
@@ -24396,10 +25511,10 @@ var ProjectSelector = () => {
|
|
|
24396
25511
|
}
|
|
24397
25512
|
return null;
|
|
24398
25513
|
}, []);
|
|
24399
|
-
const handleOpenModal = (0,
|
|
25514
|
+
const handleOpenModal = (0, import_react77.useCallback)((e) => {
|
|
24400
25515
|
e.stopPropagation();
|
|
24401
25516
|
if (!workspaceId) {
|
|
24402
|
-
|
|
25517
|
+
import_antd76.message.warning("Please select a workspace first");
|
|
24403
25518
|
return;
|
|
24404
25519
|
}
|
|
24405
25520
|
setProjectName("");
|
|
@@ -24407,7 +25522,7 @@ var ProjectSelector = () => {
|
|
|
24407
25522
|
setIsModalOpen(true);
|
|
24408
25523
|
setTimeout(() => projectNameInputRef.current?.input?.focus(), 100);
|
|
24409
25524
|
}, [workspaceId]);
|
|
24410
|
-
const handleCloseModal = (0,
|
|
25525
|
+
const handleCloseModal = (0, import_react77.useCallback)(() => {
|
|
24411
25526
|
setIsModalOpen(false);
|
|
24412
25527
|
setProjectName("");
|
|
24413
25528
|
setValidationError(null);
|
|
@@ -24417,7 +25532,7 @@ var ProjectSelector = () => {
|
|
|
24417
25532
|
setProjectName(value);
|
|
24418
25533
|
setValidationError(validateProjectName(value));
|
|
24419
25534
|
};
|
|
24420
|
-
const handleCreateProject = (0,
|
|
25535
|
+
const handleCreateProject = (0, import_react77.useCallback)(async () => {
|
|
24421
25536
|
if (!workspaceId) return;
|
|
24422
25537
|
const trimmed = projectName.trim();
|
|
24423
25538
|
const error = validateProjectName(trimmed);
|
|
@@ -24433,7 +25548,7 @@ var ProjectSelector = () => {
|
|
|
24433
25548
|
setProjectName("");
|
|
24434
25549
|
setValidationError(null);
|
|
24435
25550
|
setProject(project.id);
|
|
24436
|
-
|
|
25551
|
+
import_antd76.message.success(`Project "${project.name}" created`);
|
|
24437
25552
|
} catch (err) {
|
|
24438
25553
|
const errMsg = err instanceof Error ? err.message : "Failed to create project";
|
|
24439
25554
|
setValidationError(errMsg);
|
|
@@ -24449,41 +25564,41 @@ var ProjectSelector = () => {
|
|
|
24449
25564
|
}
|
|
24450
25565
|
};
|
|
24451
25566
|
const isProjectNameValid = !validateProjectName(projectName.trim());
|
|
24452
|
-
return /* @__PURE__ */ (0,
|
|
24453
|
-
/* @__PURE__ */ (0,
|
|
24454
|
-
/* @__PURE__ */ (0,
|
|
25567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(import_jsx_runtime100.Fragment, { children: [
|
|
25568
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: styles.container, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: styles.selectorWrapper, children: [
|
|
25569
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { style: { position: "relative" }, ref: workspaceDropdownRef, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
24455
25570
|
"button",
|
|
24456
25571
|
{
|
|
24457
25572
|
className: styles.workspaceButton,
|
|
24458
25573
|
onClick: handleWorkspaceClick,
|
|
24459
25574
|
title: currentWorkspace?.name || "Select Workspace",
|
|
24460
|
-
children: /* @__PURE__ */ (0,
|
|
25575
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: styles.workspaceButtonIcon, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react25.Building2, { size: 16 }) })
|
|
24461
25576
|
}
|
|
24462
25577
|
) }),
|
|
24463
|
-
/* @__PURE__ */ (0,
|
|
24464
|
-
/* @__PURE__ */ (0,
|
|
24465
|
-
/* @__PURE__ */ (0,
|
|
24466
|
-
/* @__PURE__ */ (0,
|
|
24467
|
-
/* @__PURE__ */ (0,
|
|
25578
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { className: styles.divider, children: "/" }),
|
|
25579
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: styles.projectTrigger, onClick: toggleProjectList, children: [
|
|
25580
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: styles.projectTriggerIcon, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react25.Folder, { size: 16 }) }),
|
|
25581
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: styles.projectTriggerInfo, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: styles.projectTriggerName, children: currentProject?.name || "Select Project" }) }),
|
|
25582
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: `${styles.projectTriggerArrow} ${isProjectListOpen ? "expanded" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react25.ChevronDown, { size: 14 }) })
|
|
24468
25583
|
] }),
|
|
24469
|
-
isProjectListOpen && /* @__PURE__ */ (0,
|
|
24470
|
-
projects.map((project) => /* @__PURE__ */ (0,
|
|
25584
|
+
isProjectListOpen && /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: styles.projectDropdown, children: [
|
|
25585
|
+
projects.map((project) => /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
|
|
24471
25586
|
"div",
|
|
24472
25587
|
{
|
|
24473
25588
|
className: `${styles.projectDropdownItem} ${project.id === projectId ? "active" : ""}`,
|
|
24474
25589
|
onClick: () => handleSelectProject(project.id),
|
|
24475
25590
|
children: [
|
|
24476
|
-
/* @__PURE__ */ (0,
|
|
24477
|
-
/* @__PURE__ */ (0,
|
|
25591
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: styles.projectDropdownItemIcon, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react25.Folder, { size: 14 }) }),
|
|
25592
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: project.id === projectId ? styles.projectDropdownItemNameActive : styles.projectDropdownItemName, children: project.name })
|
|
24478
25593
|
]
|
|
24479
25594
|
},
|
|
24480
25595
|
project.id
|
|
24481
25596
|
)),
|
|
24482
|
-
projects.length === 0 && /* @__PURE__ */ (0,
|
|
25597
|
+
projects.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: styles.emptyState, children: "No projects" })
|
|
24483
25598
|
] })
|
|
24484
25599
|
] }) }),
|
|
24485
|
-
/* @__PURE__ */ (0,
|
|
24486
|
-
|
|
25600
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
|
|
25601
|
+
import_antd76.Modal,
|
|
24487
25602
|
{
|
|
24488
25603
|
title: "Create New Project",
|
|
24489
25604
|
open: isModalOpen,
|
|
@@ -24494,10 +25609,10 @@ var ProjectSelector = () => {
|
|
|
24494
25609
|
maskClosable: !isCreating,
|
|
24495
25610
|
keyboard: true,
|
|
24496
25611
|
closable: true,
|
|
24497
|
-
footer: /* @__PURE__ */ (0,
|
|
24498
|
-
/* @__PURE__ */ (0,
|
|
24499
|
-
/* @__PURE__ */ (0,
|
|
24500
|
-
|
|
25612
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: styles.modalFooter, children: [
|
|
25613
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_antd76.Button, { onClick: handleCloseModal, disabled: isCreating, children: "Cancel" }),
|
|
25614
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
25615
|
+
import_antd76.Button,
|
|
24501
25616
|
{
|
|
24502
25617
|
type: "primary",
|
|
24503
25618
|
onClick: handleCreateProject,
|
|
@@ -24508,8 +25623,8 @@ var ProjectSelector = () => {
|
|
|
24508
25623
|
)
|
|
24509
25624
|
] }),
|
|
24510
25625
|
children: [
|
|
24511
|
-
/* @__PURE__ */ (0,
|
|
24512
|
-
|
|
25626
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
25627
|
+
import_antd76.Input,
|
|
24513
25628
|
{
|
|
24514
25629
|
ref: projectNameInputRef,
|
|
24515
25630
|
value: projectName,
|
|
@@ -24520,7 +25635,7 @@ var ProjectSelector = () => {
|
|
|
24520
25635
|
status: validationError ? "error" : void 0
|
|
24521
25636
|
}
|
|
24522
25637
|
),
|
|
24523
|
-
validationError && /* @__PURE__ */ (0,
|
|
25638
|
+
validationError && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { style: { color: "#ff4d4f", fontSize: "12px", marginTop: "4px" }, children: validationError })
|
|
24524
25639
|
]
|
|
24525
25640
|
}
|
|
24526
25641
|
)
|
|
@@ -24528,13 +25643,13 @@ var ProjectSelector = () => {
|
|
|
24528
25643
|
};
|
|
24529
25644
|
|
|
24530
25645
|
// src/components/Chat/LatticeChat.tsx
|
|
24531
|
-
var
|
|
25646
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
24532
25647
|
var LatticeChat = (props) => {
|
|
24533
25648
|
const { assistant_id, thread_id = "", menu, header, ...chatingProps } = props;
|
|
24534
25649
|
const { config } = useLatticeChatShellContext();
|
|
24535
25650
|
const showWorkspaceSelector = config.enableWorkspace;
|
|
24536
|
-
const leftTop = showWorkspaceSelector ? /* @__PURE__ */ (0,
|
|
24537
|
-
return /* @__PURE__ */ (0,
|
|
25651
|
+
const leftTop = showWorkspaceSelector ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(ProjectSelector, {}) : null;
|
|
25652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
24538
25653
|
AgentThreadProvider,
|
|
24539
25654
|
{
|
|
24540
25655
|
assistantId: assistant_id,
|
|
@@ -24544,7 +25659,7 @@ var LatticeChat = (props) => {
|
|
|
24544
25659
|
enableReturnStateWhenStreamCompleted: true,
|
|
24545
25660
|
enableResumeStream: true
|
|
24546
25661
|
},
|
|
24547
|
-
children: /* @__PURE__ */ (0,
|
|
25662
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(ChatUIContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(
|
|
24548
25663
|
"div",
|
|
24549
25664
|
{
|
|
24550
25665
|
style: {
|
|
@@ -24555,13 +25670,13 @@ var LatticeChat = (props) => {
|
|
|
24555
25670
|
},
|
|
24556
25671
|
children: [
|
|
24557
25672
|
header,
|
|
24558
|
-
/* @__PURE__ */ (0,
|
|
25673
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
24559
25674
|
ColumnLayout,
|
|
24560
25675
|
{
|
|
24561
25676
|
menu,
|
|
24562
25677
|
header: leftTop,
|
|
24563
|
-
left: thread_id ? /* @__PURE__ */ (0,
|
|
24564
|
-
right: /* @__PURE__ */ (0,
|
|
25678
|
+
left: thread_id ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Chating, { ...chatingProps }) : /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { children: "Please create a conversation first" }),
|
|
25679
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(SideAppViewBrowser, {})
|
|
24565
25680
|
}
|
|
24566
25681
|
)
|
|
24567
25682
|
]
|
|
@@ -24573,14 +25688,14 @@ var LatticeChat = (props) => {
|
|
|
24573
25688
|
|
|
24574
25689
|
// src/components/Chat/AgentConversations.tsx
|
|
24575
25690
|
var import_x7 = require("@ant-design/x");
|
|
24576
|
-
var
|
|
24577
|
-
var
|
|
24578
|
-
var
|
|
25691
|
+
var import_antd77 = require("antd");
|
|
25692
|
+
var import_react78 = require("react");
|
|
25693
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
24579
25694
|
var AgentConversations = ({
|
|
24580
25695
|
enableThreadCreation = true,
|
|
24581
25696
|
enableThreadList = true
|
|
24582
25697
|
}) => {
|
|
24583
|
-
const { token } =
|
|
25698
|
+
const { token } = import_antd77.theme.useToken();
|
|
24584
25699
|
const { currentAssistant } = useAssistantContext();
|
|
24585
25700
|
const {
|
|
24586
25701
|
assistantId,
|
|
@@ -24595,7 +25710,7 @@ var AgentConversations = ({
|
|
|
24595
25710
|
background: "transparent",
|
|
24596
25711
|
borderRadius: token.borderRadius
|
|
24597
25712
|
};
|
|
24598
|
-
const threadItems = (0,
|
|
25713
|
+
const threadItems = (0, import_react78.useMemo)(() => {
|
|
24599
25714
|
return threads || [];
|
|
24600
25715
|
}, [threads]);
|
|
24601
25716
|
const items = threadItems.map((thread2) => ({
|
|
@@ -24614,7 +25729,7 @@ var AgentConversations = ({
|
|
|
24614
25729
|
const creation = enableThreadCreation ? {
|
|
24615
25730
|
onClick: newChatClick
|
|
24616
25731
|
} : void 0;
|
|
24617
|
-
return /* @__PURE__ */ (0,
|
|
25732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
24618
25733
|
import_x7.Conversations,
|
|
24619
25734
|
{
|
|
24620
25735
|
creation,
|
|
@@ -24630,19 +25745,19 @@ var AgentConversations = ({
|
|
|
24630
25745
|
};
|
|
24631
25746
|
|
|
24632
25747
|
// src/components/Chat/LatticeChatView.tsx
|
|
24633
|
-
var
|
|
25748
|
+
var import_react82 = require("react");
|
|
24634
25749
|
|
|
24635
25750
|
// src/components/Chat/ChatSidebar.tsx
|
|
24636
|
-
var
|
|
24637
|
-
var
|
|
25751
|
+
var import_react81 = require("react");
|
|
25752
|
+
var import_antd80 = require("antd");
|
|
24638
25753
|
var import_lucide_react28 = require("lucide-react");
|
|
24639
25754
|
|
|
24640
25755
|
// src/components/Chat/ProjectsMenuContent.tsx
|
|
24641
|
-
var
|
|
24642
|
-
var
|
|
25756
|
+
var import_react79 = require("react");
|
|
25757
|
+
var import_antd78 = require("antd");
|
|
24643
25758
|
var import_antd_style30 = require("antd-style");
|
|
24644
25759
|
var import_lucide_react26 = require("lucide-react");
|
|
24645
|
-
var
|
|
25760
|
+
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
24646
25761
|
var PROJECT_NAME_MAX_LENGTH2 = 50;
|
|
24647
25762
|
var useStyles18 = (0, import_antd_style30.createStyles)(({ token, css }) => ({
|
|
24648
25763
|
container: css`
|
|
@@ -25011,22 +26126,22 @@ var ProjectsMenuContent = () => {
|
|
|
25011
26126
|
getFileViewUrl,
|
|
25012
26127
|
uploadFileToFolder
|
|
25013
26128
|
} = useWorkspaceContext();
|
|
25014
|
-
const [folderAssets, setFolderAssets] = (0,
|
|
25015
|
-
const [folderLoading, setFolderLoading] = (0,
|
|
25016
|
-
const [isProjectListOpen, setIsProjectListOpen] = (0,
|
|
25017
|
-
const [uploadingFolder, setUploadingFolder] = (0,
|
|
25018
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
25019
|
-
const [projectName, setProjectName] = (0,
|
|
25020
|
-
const [validationError, setValidationError] = (0,
|
|
25021
|
-
const [isCreating, setIsCreating] = (0,
|
|
25022
|
-
const projectNameInputRef = (0,
|
|
25023
|
-
const resourceFolders = (0,
|
|
26129
|
+
const [folderAssets, setFolderAssets] = (0, import_react79.useState)({});
|
|
26130
|
+
const [folderLoading, setFolderLoading] = (0, import_react79.useState)({});
|
|
26131
|
+
const [isProjectListOpen, setIsProjectListOpen] = (0, import_react79.useState)(false);
|
|
26132
|
+
const [uploadingFolder, setUploadingFolder] = (0, import_react79.useState)(null);
|
|
26133
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react79.useState)(false);
|
|
26134
|
+
const [projectName, setProjectName] = (0, import_react79.useState)("");
|
|
26135
|
+
const [validationError, setValidationError] = (0, import_react79.useState)(null);
|
|
26136
|
+
const [isCreating, setIsCreating] = (0, import_react79.useState)(false);
|
|
26137
|
+
const projectNameInputRef = (0, import_react79.useRef)(null);
|
|
26138
|
+
const resourceFolders = (0, import_react79.useMemo)(() => {
|
|
25024
26139
|
return config.resourceFolders && config.resourceFolders.length > 0 ? config.resourceFolders : [{ name: "/", displayName: "Project Assets", allowUpload: true }];
|
|
25025
26140
|
}, [config.resourceFolders]);
|
|
25026
|
-
const currentProject = (0,
|
|
26141
|
+
const currentProject = (0, import_react79.useMemo)(() => {
|
|
25027
26142
|
return projects.find((p) => p.id === projectId);
|
|
25028
26143
|
}, [projects, projectId]);
|
|
25029
|
-
const loadAssetsForFolder = (0,
|
|
26144
|
+
const loadAssetsForFolder = (0, import_react79.useCallback)(async (folder) => {
|
|
25030
26145
|
if (!workspaceId || !projectId) {
|
|
25031
26146
|
setFolderAssets((prev) => ({ ...prev, [folder.name]: [] }));
|
|
25032
26147
|
return;
|
|
@@ -25042,19 +26157,19 @@ var ProjectsMenuContent = () => {
|
|
|
25042
26157
|
setFolderLoading((prev) => ({ ...prev, [folder.name]: false }));
|
|
25043
26158
|
}
|
|
25044
26159
|
}, [workspaceId, projectId, listPathByFolder]);
|
|
25045
|
-
(0,
|
|
26160
|
+
(0, import_react79.useEffect)(() => {
|
|
25046
26161
|
resourceFolders.forEach((folder) => {
|
|
25047
26162
|
loadAssetsForFolder(folder);
|
|
25048
26163
|
});
|
|
25049
26164
|
}, [workspaceId, projectId, loadAssetsForFolder, resourceFolders]);
|
|
25050
|
-
const handleSelectProject = (0,
|
|
26165
|
+
const handleSelectProject = (0, import_react79.useCallback)((selectedProjectId) => {
|
|
25051
26166
|
setProject(selectedProjectId);
|
|
25052
26167
|
setIsProjectListOpen(false);
|
|
25053
26168
|
}, [setProject]);
|
|
25054
|
-
const toggleProjectList = (0,
|
|
26169
|
+
const toggleProjectList = (0, import_react79.useCallback)(() => {
|
|
25055
26170
|
setIsProjectListOpen((prev) => !prev);
|
|
25056
26171
|
}, []);
|
|
25057
|
-
const validateProjectName = (0,
|
|
26172
|
+
const validateProjectName = (0, import_react79.useCallback)((name) => {
|
|
25058
26173
|
const trimmed = name.trim();
|
|
25059
26174
|
if (!trimmed) return "Project name is required";
|
|
25060
26175
|
if (trimmed.length > PROJECT_NAME_MAX_LENGTH2) {
|
|
@@ -25062,9 +26177,9 @@ var ProjectsMenuContent = () => {
|
|
|
25062
26177
|
}
|
|
25063
26178
|
return null;
|
|
25064
26179
|
}, []);
|
|
25065
|
-
const handleOpenModal = (0,
|
|
26180
|
+
const handleOpenModal = (0, import_react79.useCallback)(() => {
|
|
25066
26181
|
if (!workspaceId) {
|
|
25067
|
-
|
|
26182
|
+
import_antd78.message.warning("Please select a workspace first");
|
|
25068
26183
|
return;
|
|
25069
26184
|
}
|
|
25070
26185
|
setProjectName("");
|
|
@@ -25072,7 +26187,7 @@ var ProjectsMenuContent = () => {
|
|
|
25072
26187
|
setIsModalOpen(true);
|
|
25073
26188
|
setTimeout(() => projectNameInputRef.current?.input?.focus(), 100);
|
|
25074
26189
|
}, [workspaceId]);
|
|
25075
|
-
const handleCloseModal = (0,
|
|
26190
|
+
const handleCloseModal = (0, import_react79.useCallback)(() => {
|
|
25076
26191
|
setIsModalOpen(false);
|
|
25077
26192
|
setProjectName("");
|
|
25078
26193
|
setValidationError(null);
|
|
@@ -25082,7 +26197,7 @@ var ProjectsMenuContent = () => {
|
|
|
25082
26197
|
setProjectName(value);
|
|
25083
26198
|
setValidationError(validateProjectName(value));
|
|
25084
26199
|
};
|
|
25085
|
-
const handleCreateProject = (0,
|
|
26200
|
+
const handleCreateProject = (0, import_react79.useCallback)(async () => {
|
|
25086
26201
|
if (!workspaceId) return;
|
|
25087
26202
|
const trimmed = projectName.trim();
|
|
25088
26203
|
const error = validateProjectName(trimmed);
|
|
@@ -25098,7 +26213,7 @@ var ProjectsMenuContent = () => {
|
|
|
25098
26213
|
setProjectName("");
|
|
25099
26214
|
setValidationError(null);
|
|
25100
26215
|
setProject(project.id);
|
|
25101
|
-
|
|
26216
|
+
import_antd78.message.success(`Project "${project.name}" created`);
|
|
25102
26217
|
} catch (err) {
|
|
25103
26218
|
const errMsg = err instanceof Error ? err.message : "Failed to create project";
|
|
25104
26219
|
setValidationError(errMsg);
|
|
@@ -25116,7 +26231,7 @@ var ProjectsMenuContent = () => {
|
|
|
25116
26231
|
const isProjectNameValid = !validateProjectName(projectName.trim());
|
|
25117
26232
|
const handleUploadClick = async (folderName) => {
|
|
25118
26233
|
if (!workspaceId || !projectId) {
|
|
25119
|
-
|
|
26234
|
+
import_antd78.message.warning("Please select a workspace and project before uploading.");
|
|
25120
26235
|
return;
|
|
25121
26236
|
}
|
|
25122
26237
|
const input = document.createElement("input");
|
|
@@ -25130,14 +26245,14 @@ var ProjectsMenuContent = () => {
|
|
|
25130
26245
|
setUploadingFolder(folderName);
|
|
25131
26246
|
try {
|
|
25132
26247
|
await uploadFileToFolder(folderName, file);
|
|
25133
|
-
|
|
26248
|
+
import_antd78.message.success(`Uploaded "${file.name}" successfully`);
|
|
25134
26249
|
const folder = resourceFolders.find((f) => f.name === folderName);
|
|
25135
26250
|
if (folder) {
|
|
25136
26251
|
await loadAssetsForFolder(folder);
|
|
25137
26252
|
}
|
|
25138
26253
|
} catch (error) {
|
|
25139
26254
|
const errMsg = error instanceof Error ? error.message : "Failed to upload file";
|
|
25140
|
-
|
|
26255
|
+
import_antd78.message.error(errMsg);
|
|
25141
26256
|
} finally {
|
|
25142
26257
|
setUploadingFolder(null);
|
|
25143
26258
|
input.remove();
|
|
@@ -25148,7 +26263,7 @@ var ProjectsMenuContent = () => {
|
|
|
25148
26263
|
const handleAssetClick = (asset) => {
|
|
25149
26264
|
const fileUrl = getFileViewUrl(asset.path);
|
|
25150
26265
|
if (!fileUrl) {
|
|
25151
|
-
|
|
26266
|
+
import_antd78.message.warning("Please select a workspace and project first.");
|
|
25152
26267
|
return;
|
|
25153
26268
|
}
|
|
25154
26269
|
openSideApp({
|
|
@@ -25171,13 +26286,13 @@ var ProjectsMenuContent = () => {
|
|
|
25171
26286
|
const parts = path.split(/[/\\]/);
|
|
25172
26287
|
return parts[parts.length - 1];
|
|
25173
26288
|
};
|
|
25174
|
-
return /* @__PURE__ */ (0,
|
|
26289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: styles.container, children: [
|
|
25175
26290
|
resourceFolders.map((folder) => {
|
|
25176
26291
|
const assets = folderAssets[folder.name] || [];
|
|
25177
26292
|
const isLoading = folderLoading[folder.name] || false;
|
|
25178
|
-
return /* @__PURE__ */ (0,
|
|
25179
|
-
/* @__PURE__ */ (0,
|
|
25180
|
-
/* @__PURE__ */ (0,
|
|
26293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: styles.section, children: [
|
|
26294
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: styles.sectionHeader, children: [
|
|
26295
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
25181
26296
|
"span",
|
|
25182
26297
|
{
|
|
25183
26298
|
className: styles.sectionTitle,
|
|
@@ -25186,47 +26301,47 @@ var ProjectsMenuContent = () => {
|
|
|
25186
26301
|
children: folder.displayName || folder.name
|
|
25187
26302
|
}
|
|
25188
26303
|
),
|
|
25189
|
-
/* @__PURE__ */ (0,
|
|
26304
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: styles.badge, children: assets.length })
|
|
25190
26305
|
] }),
|
|
25191
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
25192
|
-
assets.map((asset) => /* @__PURE__ */ (0,
|
|
26306
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: styles.loading, children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_antd78.Spin, { size: "small" }) }) : /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: styles.assetList, children: [
|
|
26307
|
+
assets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
|
|
25193
26308
|
"div",
|
|
25194
26309
|
{
|
|
25195
26310
|
className: styles.assetItem,
|
|
25196
26311
|
onClick: () => handleAssetClick(asset),
|
|
25197
26312
|
title: getFileName(asset.name || asset.path),
|
|
25198
26313
|
children: [
|
|
25199
|
-
/* @__PURE__ */ (0,
|
|
25200
|
-
/* @__PURE__ */ (0,
|
|
25201
|
-
/* @__PURE__ */ (0,
|
|
25202
|
-
/* @__PURE__ */ (0,
|
|
26314
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: styles.assetIcon, children: getFileIcon2(getFileName(asset.name || asset.path)) }),
|
|
26315
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: styles.assetInfo, children: [
|
|
26316
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: styles.assetName, children: getFileName(asset.name || asset.path) }),
|
|
26317
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: styles.assetMeta, children: formatDate5(asset.modified_at) })
|
|
25203
26318
|
] })
|
|
25204
26319
|
]
|
|
25205
26320
|
},
|
|
25206
26321
|
asset.path
|
|
25207
26322
|
)),
|
|
25208
|
-
assets.length === 0 && /* @__PURE__ */ (0,
|
|
25209
|
-
folder.allowUpload && /* @__PURE__ */ (0,
|
|
26323
|
+
assets.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: styles.emptyState, children: "No files in this folder" }),
|
|
26324
|
+
folder.allowUpload && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
25210
26325
|
"button",
|
|
25211
26326
|
{
|
|
25212
26327
|
type: "button",
|
|
25213
26328
|
className: styles.uploadBtn,
|
|
25214
26329
|
onClick: () => handleUploadClick(folder.name),
|
|
25215
26330
|
disabled: !workspaceId || !projectId || uploadingFolder === folder.name,
|
|
25216
|
-
children: uploadingFolder === folder.name ? /* @__PURE__ */ (0,
|
|
25217
|
-
/* @__PURE__ */ (0,
|
|
25218
|
-
/* @__PURE__ */ (0,
|
|
25219
|
-
] }) : /* @__PURE__ */ (0,
|
|
25220
|
-
/* @__PURE__ */ (0,
|
|
25221
|
-
/* @__PURE__ */ (0,
|
|
26331
|
+
children: uploadingFolder === folder.name ? /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_jsx_runtime103.Fragment, { children: [
|
|
26332
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_antd78.Spin, { size: "small" }),
|
|
26333
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { children: "Uploading..." })
|
|
26334
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_jsx_runtime103.Fragment, { children: [
|
|
26335
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_lucide_react26.Upload, { size: 14 }),
|
|
26336
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { children: "Upload" })
|
|
25222
26337
|
] })
|
|
25223
26338
|
}
|
|
25224
26339
|
)
|
|
25225
26340
|
] })
|
|
25226
26341
|
] }, folder.name);
|
|
25227
26342
|
}),
|
|
25228
|
-
/* @__PURE__ */ (0,
|
|
25229
|
-
|
|
26343
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
|
|
26344
|
+
import_antd78.Modal,
|
|
25230
26345
|
{
|
|
25231
26346
|
title: "Create New Project",
|
|
25232
26347
|
open: isModalOpen,
|
|
@@ -25237,10 +26352,10 @@ var ProjectsMenuContent = () => {
|
|
|
25237
26352
|
maskClosable: !isCreating,
|
|
25238
26353
|
keyboard: true,
|
|
25239
26354
|
closable: true,
|
|
25240
|
-
footer: /* @__PURE__ */ (0,
|
|
25241
|
-
/* @__PURE__ */ (0,
|
|
25242
|
-
/* @__PURE__ */ (0,
|
|
25243
|
-
|
|
26355
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: styles.modalFooter, children: [
|
|
26356
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_antd78.Button, { onClick: handleCloseModal, disabled: isCreating, children: "Cancel" }),
|
|
26357
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
26358
|
+
import_antd78.Button,
|
|
25244
26359
|
{
|
|
25245
26360
|
type: "primary",
|
|
25246
26361
|
onClick: handleCreateProject,
|
|
@@ -25251,9 +26366,9 @@ var ProjectsMenuContent = () => {
|
|
|
25251
26366
|
)
|
|
25252
26367
|
] }),
|
|
25253
26368
|
children: [
|
|
25254
|
-
/* @__PURE__ */ (0,
|
|
25255
|
-
/* @__PURE__ */ (0,
|
|
25256
|
-
|
|
26369
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("label", { className: styles.formLabel, htmlFor: "project-name", children: "Project Name" }),
|
|
26370
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
26371
|
+
import_antd78.Input,
|
|
25257
26372
|
{
|
|
25258
26373
|
id: "project-name",
|
|
25259
26374
|
ref: projectNameInputRef,
|
|
@@ -25267,7 +26382,7 @@ var ProjectsMenuContent = () => {
|
|
|
25267
26382
|
disabled: isCreating
|
|
25268
26383
|
}
|
|
25269
26384
|
),
|
|
25270
|
-
validationError && /* @__PURE__ */ (0,
|
|
26385
|
+
validationError && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: styles.formError, role: "alert", children: validationError })
|
|
25271
26386
|
]
|
|
25272
26387
|
}
|
|
25273
26388
|
)
|
|
@@ -25275,11 +26390,11 @@ var ProjectsMenuContent = () => {
|
|
|
25275
26390
|
};
|
|
25276
26391
|
|
|
25277
26392
|
// src/components/Chat/ThreadHistoryMenuContent.tsx
|
|
25278
|
-
var
|
|
26393
|
+
var import_react80 = __toESM(require("react"));
|
|
25279
26394
|
var import_antd_style31 = require("antd-style");
|
|
25280
26395
|
var import_lucide_react27 = require("lucide-react");
|
|
25281
|
-
var
|
|
25282
|
-
var
|
|
26396
|
+
var import_antd79 = require("antd");
|
|
26397
|
+
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
25283
26398
|
var useStyles19 = (0, import_antd_style31.createStyles)(({ token, css }) => ({
|
|
25284
26399
|
container: css`
|
|
25285
26400
|
padding: 4px;
|
|
@@ -25389,10 +26504,10 @@ var ThreadHistoryMenuContent = () => {
|
|
|
25389
26504
|
deleteThread,
|
|
25390
26505
|
isLoading
|
|
25391
26506
|
} = useConversationContext();
|
|
25392
|
-
const handleDeleteThread = (0,
|
|
26507
|
+
const handleDeleteThread = (0, import_react80.useCallback)(
|
|
25393
26508
|
async (e, threadIdToDelete) => {
|
|
25394
26509
|
e.stopPropagation();
|
|
25395
|
-
|
|
26510
|
+
import_antd79.Modal.confirm({
|
|
25396
26511
|
title: "Delete Conversation",
|
|
25397
26512
|
content: "Are you sure you want to delete this conversation? This action cannot be undone.",
|
|
25398
26513
|
okText: "Delete",
|
|
@@ -25401,16 +26516,16 @@ var ThreadHistoryMenuContent = () => {
|
|
|
25401
26516
|
onOk: async () => {
|
|
25402
26517
|
try {
|
|
25403
26518
|
await deleteThread(threadIdToDelete);
|
|
25404
|
-
|
|
26519
|
+
import_antd79.message.success("Conversation deleted");
|
|
25405
26520
|
} catch (error) {
|
|
25406
|
-
|
|
26521
|
+
import_antd79.message.error("Failed to delete conversation");
|
|
25407
26522
|
}
|
|
25408
26523
|
}
|
|
25409
26524
|
});
|
|
25410
26525
|
},
|
|
25411
26526
|
[deleteThread]
|
|
25412
26527
|
);
|
|
25413
|
-
const sortedThreads =
|
|
26528
|
+
const sortedThreads = import_react80.default.useMemo(() => {
|
|
25414
26529
|
return [...threads].sort((a, b) => {
|
|
25415
26530
|
const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
|
|
25416
26531
|
const dateB = b.updatedAt ? new Date(b.updatedAt).getTime() : 0;
|
|
@@ -25418,30 +26533,30 @@ var ThreadHistoryMenuContent = () => {
|
|
|
25418
26533
|
});
|
|
25419
26534
|
}, [threads]);
|
|
25420
26535
|
if (isLoading) {
|
|
25421
|
-
return /* @__PURE__ */ (0,
|
|
26536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: styles.container, children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: styles.loading, children: "Loading conversations..." }) });
|
|
25422
26537
|
}
|
|
25423
|
-
return /* @__PURE__ */ (0,
|
|
26538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: styles.container, children: sortedThreads.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: styles.emptyState, children: "No conversations yet" }) : /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: styles.threadList, children: sortedThreads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(
|
|
25424
26539
|
"div",
|
|
25425
26540
|
{
|
|
25426
26541
|
className: `${styles.threadItem} ${thread.id === threadId ? "active" : ""}`,
|
|
25427
26542
|
onClick: () => selectThread(thread.id),
|
|
25428
26543
|
title: thread.label,
|
|
25429
26544
|
children: [
|
|
25430
|
-
/* @__PURE__ */ (0,
|
|
25431
|
-
/* @__PURE__ */ (0,
|
|
26545
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: styles.threadIcon, children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_lucide_react27.MessageSquare, { size: 14 }) }),
|
|
26546
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
25432
26547
|
"div",
|
|
25433
26548
|
{
|
|
25434
26549
|
className: thread.id === threadId ? styles.threadNameActive : styles.threadName,
|
|
25435
26550
|
children: thread.label
|
|
25436
26551
|
}
|
|
25437
26552
|
),
|
|
25438
|
-
/* @__PURE__ */ (0,
|
|
26553
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
25439
26554
|
"button",
|
|
25440
26555
|
{
|
|
25441
26556
|
className: styles.deleteBtn,
|
|
25442
26557
|
onClick: (e) => handleDeleteThread(e, thread.id),
|
|
25443
26558
|
title: "Delete conversation",
|
|
25444
|
-
children: /* @__PURE__ */ (0,
|
|
26559
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_lucide_react27.Trash2, { size: 12 })
|
|
25445
26560
|
}
|
|
25446
26561
|
)
|
|
25447
26562
|
]
|
|
@@ -25451,7 +26566,7 @@ var ThreadHistoryMenuContent = () => {
|
|
|
25451
26566
|
};
|
|
25452
26567
|
|
|
25453
26568
|
// src/components/Chat/ChatSidebar.tsx
|
|
25454
|
-
var
|
|
26569
|
+
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
25455
26570
|
var DRAWER_STYLES2 = {
|
|
25456
26571
|
wrapper: {
|
|
25457
26572
|
background: "transparent",
|
|
@@ -25477,7 +26592,7 @@ var DEFAULT_MENU_ITEMS = [
|
|
|
25477
26592
|
builtin: "new-analysis",
|
|
25478
26593
|
type: "action",
|
|
25479
26594
|
name: "New Analysis",
|
|
25480
|
-
icon: /* @__PURE__ */ (0,
|
|
26595
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_lucide_react28.PlusCircle, { size: 20 }),
|
|
25481
26596
|
order: 0
|
|
25482
26597
|
},
|
|
25483
26598
|
// Second: Thread History (inline drawer)
|
|
@@ -25486,13 +26601,13 @@ var DEFAULT_MENU_ITEMS = [
|
|
|
25486
26601
|
builtin: "thread-history",
|
|
25487
26602
|
type: "drawer",
|
|
25488
26603
|
name: "History",
|
|
25489
|
-
icon: /* @__PURE__ */ (0,
|
|
26604
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_lucide_react28.History, { size: 20 }),
|
|
25490
26605
|
order: 1,
|
|
25491
26606
|
title: "Conversation History",
|
|
25492
26607
|
width: 320,
|
|
25493
26608
|
inline: true,
|
|
25494
26609
|
inlineDefaultExpanded: false,
|
|
25495
|
-
content: /* @__PURE__ */ (0,
|
|
26610
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(ThreadHistoryMenuContent, {})
|
|
25496
26611
|
},
|
|
25497
26612
|
// Third: Projects (inline drawer)
|
|
25498
26613
|
{
|
|
@@ -25500,13 +26615,13 @@ var DEFAULT_MENU_ITEMS = [
|
|
|
25500
26615
|
builtin: "projects",
|
|
25501
26616
|
type: "drawer",
|
|
25502
26617
|
name: "Project Files",
|
|
25503
|
-
icon: /* @__PURE__ */ (0,
|
|
26618
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_lucide_react28.FolderOpen, {}),
|
|
25504
26619
|
order: 2,
|
|
25505
26620
|
title: "Project Files",
|
|
25506
26621
|
width: 320,
|
|
25507
26622
|
inline: true,
|
|
25508
26623
|
inlineDefaultExpanded: true,
|
|
25509
|
-
content: /* @__PURE__ */ (0,
|
|
26624
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(ProjectsMenuContent, {})
|
|
25510
26625
|
},
|
|
25511
26626
|
// Logout action
|
|
25512
26627
|
{
|
|
@@ -25514,7 +26629,7 @@ var DEFAULT_MENU_ITEMS = [
|
|
|
25514
26629
|
builtin: "logout",
|
|
25515
26630
|
type: "action",
|
|
25516
26631
|
name: "Logout",
|
|
25517
|
-
icon: /* @__PURE__ */ (0,
|
|
26632
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_lucide_react28.LogOut, { size: 20 }),
|
|
25518
26633
|
order: 1e3,
|
|
25519
26634
|
group: "Account"
|
|
25520
26635
|
}
|
|
@@ -25528,7 +26643,7 @@ var ChatSidebar = ({
|
|
|
25528
26643
|
const { sideAppVisible, menuCollapsed, setMenuCollapsed } = useChatUIContext();
|
|
25529
26644
|
const { logout } = useAuth();
|
|
25530
26645
|
const { createThread } = useConversationContext();
|
|
25531
|
-
const [drawerStates, setDrawerStates] = (0,
|
|
26646
|
+
const [drawerStates, setDrawerStates] = (0, import_react81.useState)({});
|
|
25532
26647
|
const {
|
|
25533
26648
|
sidebarMode,
|
|
25534
26649
|
sidebarShowToggle,
|
|
@@ -25537,14 +26652,14 @@ var ChatSidebar = ({
|
|
|
25537
26652
|
sidebarLogoIcon
|
|
25538
26653
|
} = config;
|
|
25539
26654
|
const isExpandedMode = sidebarMode === "expanded";
|
|
25540
|
-
const menuItems = (0,
|
|
26655
|
+
const menuItems = (0, import_react81.useMemo)(() => {
|
|
25541
26656
|
const items = [...DEFAULT_MENU_ITEMS];
|
|
25542
26657
|
for (const item of customMenuItems) {
|
|
25543
26658
|
items.push(item);
|
|
25544
26659
|
}
|
|
25545
26660
|
return items.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
25546
26661
|
}, [customMenuItems]);
|
|
25547
|
-
const handleMenuClick = (0,
|
|
26662
|
+
const handleMenuClick = (0, import_react81.useCallback)(async (item) => {
|
|
25548
26663
|
if (item.builtin === "settings") {
|
|
25549
26664
|
setSettingsModalOpen(true);
|
|
25550
26665
|
onSettingsClick?.();
|
|
@@ -25569,28 +26684,28 @@ var ChatSidebar = ({
|
|
|
25569
26684
|
}
|
|
25570
26685
|
}
|
|
25571
26686
|
}, [onSettingsClick, setSettingsModalOpen, createThread, logout]);
|
|
25572
|
-
const handleCloseDrawer = (0,
|
|
26687
|
+
const handleCloseDrawer = (0, import_react81.useCallback)((itemId) => {
|
|
25573
26688
|
setDrawerStates((prev) => ({ ...prev, [itemId]: false }));
|
|
25574
26689
|
}, []);
|
|
25575
|
-
const handleNewAnalysis = (0,
|
|
26690
|
+
const handleNewAnalysis = (0, import_react81.useCallback)(async () => {
|
|
25576
26691
|
try {
|
|
25577
26692
|
await createThread("New Analysis");
|
|
25578
26693
|
} catch (error) {
|
|
25579
26694
|
console.error("Failed to create new thread:", error);
|
|
25580
26695
|
}
|
|
25581
26696
|
}, [createThread]);
|
|
25582
|
-
const renderDrawerContent = (0,
|
|
26697
|
+
const renderDrawerContent = (0, import_react81.useCallback)((item) => {
|
|
25583
26698
|
switch (item.builtin) {
|
|
25584
26699
|
case "projects":
|
|
25585
|
-
return /* @__PURE__ */ (0,
|
|
26700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(ProjectsMenuContent, {});
|
|
25586
26701
|
case "thread-history":
|
|
25587
|
-
return /* @__PURE__ */ (0,
|
|
26702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(ThreadHistoryMenuContent, {});
|
|
25588
26703
|
default:
|
|
25589
26704
|
return item.content;
|
|
25590
26705
|
}
|
|
25591
26706
|
}, []);
|
|
25592
|
-
return /* @__PURE__ */ (0,
|
|
25593
|
-
/* @__PURE__ */ (0,
|
|
26707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [
|
|
26708
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
25594
26709
|
Menu,
|
|
25595
26710
|
{
|
|
25596
26711
|
items: menuItems,
|
|
@@ -25606,12 +26721,12 @@ var ChatSidebar = ({
|
|
|
25606
26721
|
onCollapsedChange: setMenuCollapsed
|
|
25607
26722
|
}
|
|
25608
26723
|
),
|
|
25609
|
-
menuItems.filter((item) => item.type === "drawer" && !item.inline).map((item) => /* @__PURE__ */ (0,
|
|
25610
|
-
|
|
26724
|
+
menuItems.filter((item) => item.type === "drawer" && !item.inline).map((item) => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
26725
|
+
import_antd80.Drawer,
|
|
25611
26726
|
{
|
|
25612
|
-
title: /* @__PURE__ */ (0,
|
|
25613
|
-
/* @__PURE__ */ (0,
|
|
25614
|
-
/* @__PURE__ */ (0,
|
|
26727
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" }, children: [
|
|
26728
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)("span", { style: { fontSize: 16, fontWeight: 600, textTransform: "uppercase", letterSpacing: 0.5 }, children: item.title || item.name }),
|
|
26729
|
+
/* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
25615
26730
|
"button",
|
|
25616
26731
|
{
|
|
25617
26732
|
onClick: () => handleCloseDrawer(item.id),
|
|
@@ -25626,7 +26741,7 @@ var ChatSidebar = ({
|
|
|
25626
26741
|
background: "rgba(255, 255, 255, 0.5)",
|
|
25627
26742
|
cursor: "pointer"
|
|
25628
26743
|
},
|
|
25629
|
-
children: /* @__PURE__ */ (0,
|
|
26744
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_lucide_react28.PanelLeftClose, { size: 24 })
|
|
25630
26745
|
}
|
|
25631
26746
|
)
|
|
25632
26747
|
] }),
|
|
@@ -25657,16 +26772,16 @@ var ChatSidebar = ({
|
|
|
25657
26772
|
};
|
|
25658
26773
|
|
|
25659
26774
|
// src/components/Chat/LatticeChatView.tsx
|
|
25660
|
-
var
|
|
26775
|
+
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
25661
26776
|
var LatticeChatView = (props) => {
|
|
25662
|
-
const shellContext = (0,
|
|
26777
|
+
const shellContext = (0, import_react82.useContext)(LatticeChatShellContext);
|
|
25663
26778
|
const { showSideMenu, sideMenuItems } = shellContext.config;
|
|
25664
26779
|
const { assistantId, thread } = useConversationContext();
|
|
25665
26780
|
const { currentAssistant } = useAssistantContext();
|
|
25666
26781
|
const {
|
|
25667
26782
|
config: { baseURL }
|
|
25668
26783
|
} = useLatticeChatShellContext();
|
|
25669
|
-
return assistantId && thread ? /* @__PURE__ */ (0,
|
|
26784
|
+
return assistantId && thread ? /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
25670
26785
|
AxiomLatticeProvider,
|
|
25671
26786
|
{
|
|
25672
26787
|
config: {
|
|
@@ -25675,14 +26790,14 @@ var LatticeChatView = (props) => {
|
|
|
25675
26790
|
assistantId,
|
|
25676
26791
|
transport: "sse"
|
|
25677
26792
|
},
|
|
25678
|
-
children: /* @__PURE__ */ (0,
|
|
26793
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
25679
26794
|
LatticeChat,
|
|
25680
26795
|
{
|
|
25681
26796
|
thread_id: thread?.id,
|
|
25682
26797
|
assistant_id: assistantId,
|
|
25683
26798
|
name: currentAssistant?.name,
|
|
25684
26799
|
description: currentAssistant?.description,
|
|
25685
|
-
menu: showSideMenu ? /* @__PURE__ */ (0,
|
|
26800
|
+
menu: showSideMenu ? /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(ChatSidebar, { customMenuItems: sideMenuItems }) : void 0
|
|
25686
26801
|
}
|
|
25687
26802
|
)
|
|
25688
26803
|
}
|
|
@@ -25690,13 +26805,13 @@ var LatticeChatView = (props) => {
|
|
|
25690
26805
|
};
|
|
25691
26806
|
|
|
25692
26807
|
// src/components/Chat/SettingsModal.tsx
|
|
25693
|
-
var
|
|
25694
|
-
var
|
|
25695
|
-
var
|
|
26808
|
+
var import_react83 = require("react");
|
|
26809
|
+
var import_antd81 = require("antd");
|
|
26810
|
+
var import_icons37 = require("@ant-design/icons");
|
|
25696
26811
|
var import_antd_style32 = require("antd-style");
|
|
25697
|
-
var
|
|
25698
|
-
var { Text: Text37, Title: Title13 } =
|
|
25699
|
-
var { TextArea: TextArea8 } =
|
|
26812
|
+
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
26813
|
+
var { Text: Text37, Title: Title13 } = import_antd81.Typography;
|
|
26814
|
+
var { TextArea: TextArea8 } = import_antd81.Input;
|
|
25700
26815
|
var useStyles20 = (0, import_antd_style32.createStyles)(({ token, css }) => ({
|
|
25701
26816
|
// settingsModal: css`
|
|
25702
26817
|
// .ant-modal {
|
|
@@ -26042,12 +27157,12 @@ var SETTINGS_MENU_ITEMS = [
|
|
|
26042
27157
|
{
|
|
26043
27158
|
key: "environment",
|
|
26044
27159
|
label: "Environment Variables",
|
|
26045
|
-
icon: /* @__PURE__ */ (0,
|
|
27160
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_icons37.EnvironmentOutlined, {})
|
|
26046
27161
|
},
|
|
26047
27162
|
{
|
|
26048
27163
|
key: "models",
|
|
26049
27164
|
label: "Model Configuration",
|
|
26050
|
-
icon: /* @__PURE__ */ (0,
|
|
27165
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_icons37.ApiOutlined, {})
|
|
26051
27166
|
}
|
|
26052
27167
|
];
|
|
26053
27168
|
var SettingsModal = ({
|
|
@@ -26056,7 +27171,7 @@ var SettingsModal = ({
|
|
|
26056
27171
|
}) => {
|
|
26057
27172
|
const { styles } = useStyles20();
|
|
26058
27173
|
const { config: shellConfig, updateConfigValue } = useLatticeChatShellContext();
|
|
26059
|
-
const [connections, setConnections] = (0,
|
|
27174
|
+
const [connections, setConnections] = (0, import_react83.useState)(() => {
|
|
26060
27175
|
if (typeof window !== "undefined") {
|
|
26061
27176
|
try {
|
|
26062
27177
|
const stored = localStorage.getItem("lattice_server_connections");
|
|
@@ -26079,21 +27194,21 @@ var SettingsModal = ({
|
|
|
26079
27194
|
}
|
|
26080
27195
|
return [];
|
|
26081
27196
|
});
|
|
26082
|
-
const [serverConfigs, setServerConfigs] = (0,
|
|
26083
|
-
const connectionsRef = (0,
|
|
26084
|
-
(0,
|
|
27197
|
+
const [serverConfigs, setServerConfigs] = (0, import_react83.useState)({});
|
|
27198
|
+
const connectionsRef = (0, import_react83.useRef)(connections);
|
|
27199
|
+
(0, import_react83.useEffect)(() => {
|
|
26085
27200
|
connectionsRef.current = connections;
|
|
26086
27201
|
}, [connections]);
|
|
26087
|
-
const [activeTabKey, setActiveTabKey] = (0,
|
|
27202
|
+
const [activeTabKey, setActiveTabKey] = (0, import_react83.useState)(
|
|
26088
27203
|
connections.length > 0 ? connections[0].id : ""
|
|
26089
27204
|
);
|
|
26090
|
-
const [activeMenu, setActiveMenu] = (0,
|
|
26091
|
-
const [loading, setLoading] = (0,
|
|
26092
|
-
const [showAddServerModal, setShowAddServerModal] = (0,
|
|
26093
|
-
const [newServerUrl, setNewServerUrl] = (0,
|
|
26094
|
-
const [newServerName, setNewServerName] = (0,
|
|
26095
|
-
const [newServerApiKey, setNewServerApiKey] = (0,
|
|
26096
|
-
const [addingServer, setAddingServer] = (0,
|
|
27205
|
+
const [activeMenu, setActiveMenu] = (0, import_react83.useState)("environment");
|
|
27206
|
+
const [loading, setLoading] = (0, import_react83.useState)(false);
|
|
27207
|
+
const [showAddServerModal, setShowAddServerModal] = (0, import_react83.useState)(false);
|
|
27208
|
+
const [newServerUrl, setNewServerUrl] = (0, import_react83.useState)("");
|
|
27209
|
+
const [newServerName, setNewServerName] = (0, import_react83.useState)("");
|
|
27210
|
+
const [newServerApiKey, setNewServerApiKey] = (0, import_react83.useState)("");
|
|
27211
|
+
const [addingServer, setAddingServer] = (0, import_react83.useState)(false);
|
|
26097
27212
|
const saveConnections = (newConnections) => {
|
|
26098
27213
|
setConnections(newConnections);
|
|
26099
27214
|
if (typeof window !== "undefined") {
|
|
@@ -26232,7 +27347,7 @@ var SettingsModal = ({
|
|
|
26232
27347
|
}
|
|
26233
27348
|
} catch (error) {
|
|
26234
27349
|
console.error("Failed to load configuration:", error);
|
|
26235
|
-
|
|
27350
|
+
import_antd81.message.error("Failed to load current configuration");
|
|
26236
27351
|
}
|
|
26237
27352
|
};
|
|
26238
27353
|
const loadModelsConfig = async (serverId) => {
|
|
@@ -26283,7 +27398,7 @@ var SettingsModal = ({
|
|
|
26283
27398
|
console.error("Failed to load models configuration:", error);
|
|
26284
27399
|
}
|
|
26285
27400
|
};
|
|
26286
|
-
(0,
|
|
27401
|
+
(0, import_react83.useEffect)(() => {
|
|
26287
27402
|
if (open && activeTabKey) {
|
|
26288
27403
|
initializeServerConfig(activeTabKey);
|
|
26289
27404
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
@@ -26292,7 +27407,7 @@ var SettingsModal = ({
|
|
|
26292
27407
|
}
|
|
26293
27408
|
}
|
|
26294
27409
|
}, [open, activeTabKey]);
|
|
26295
|
-
(0,
|
|
27410
|
+
(0, import_react83.useEffect)(() => {
|
|
26296
27411
|
if (open && activeTabKey) {
|
|
26297
27412
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
26298
27413
|
if (connection?.connected) {
|
|
@@ -26306,7 +27421,7 @@ var SettingsModal = ({
|
|
|
26306
27421
|
}, [open, activeTabKey, activeMenu]);
|
|
26307
27422
|
const handleAddServer = async () => {
|
|
26308
27423
|
if (!newServerUrl.trim()) {
|
|
26309
|
-
|
|
27424
|
+
import_antd81.message.error("Please enter a server URL");
|
|
26310
27425
|
return;
|
|
26311
27426
|
}
|
|
26312
27427
|
let normalizedUrl = newServerUrl.trim();
|
|
@@ -26332,7 +27447,7 @@ var SettingsModal = ({
|
|
|
26332
27447
|
setNewServerUrl("");
|
|
26333
27448
|
setNewServerName("");
|
|
26334
27449
|
setNewServerApiKey("");
|
|
26335
|
-
|
|
27450
|
+
import_antd81.notification.success({
|
|
26336
27451
|
message: "Added",
|
|
26337
27452
|
description: "Server added successfully"
|
|
26338
27453
|
});
|
|
@@ -26352,7 +27467,7 @@ var SettingsModal = ({
|
|
|
26352
27467
|
setActiveTabKey("");
|
|
26353
27468
|
}
|
|
26354
27469
|
}
|
|
26355
|
-
|
|
27470
|
+
import_antd81.notification.success({
|
|
26356
27471
|
message: "Deleted",
|
|
26357
27472
|
description: "Server deleted"
|
|
26358
27473
|
});
|
|
@@ -26369,12 +27484,12 @@ var SettingsModal = ({
|
|
|
26369
27484
|
const handleSave = async () => {
|
|
26370
27485
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
26371
27486
|
if (!connection || !connection.connected) {
|
|
26372
|
-
|
|
27487
|
+
import_antd81.message.error("Please connect to a server first");
|
|
26373
27488
|
return;
|
|
26374
27489
|
}
|
|
26375
27490
|
const url = connection.url;
|
|
26376
27491
|
if (!url) {
|
|
26377
|
-
|
|
27492
|
+
import_antd81.message.error("Please connect to a server first");
|
|
26378
27493
|
return;
|
|
26379
27494
|
}
|
|
26380
27495
|
try {
|
|
@@ -26438,26 +27553,26 @@ var SettingsModal = ({
|
|
|
26438
27553
|
const data = await response.json();
|
|
26439
27554
|
if (response.ok && data.success) {
|
|
26440
27555
|
if (data.requiresRestart && data.requiresRestart.length > 0) {
|
|
26441
|
-
|
|
27556
|
+
import_antd81.message.warning(
|
|
26442
27557
|
`Configuration saved. Please restart the server for ${data.requiresRestart.join(
|
|
26443
27558
|
", "
|
|
26444
27559
|
)} to take effect.`,
|
|
26445
27560
|
5
|
|
26446
27561
|
);
|
|
26447
27562
|
} else {
|
|
26448
|
-
|
|
27563
|
+
import_antd81.notification.success({
|
|
26449
27564
|
message: "Saved",
|
|
26450
27565
|
description: "Configuration saved and applied successfully"
|
|
26451
27566
|
});
|
|
26452
27567
|
}
|
|
26453
27568
|
if (data.warnings && data.warnings.length > 0) {
|
|
26454
27569
|
data.warnings.forEach((warning) => {
|
|
26455
|
-
|
|
27570
|
+
import_antd81.message.warning(warning, 5);
|
|
26456
27571
|
});
|
|
26457
27572
|
}
|
|
26458
27573
|
onClose();
|
|
26459
27574
|
} else {
|
|
26460
|
-
|
|
27575
|
+
import_antd81.message.error(data.error || "Failed to save configuration");
|
|
26461
27576
|
}
|
|
26462
27577
|
} else if (activeMenu === "models") {
|
|
26463
27578
|
const validModels = config.models.filter(
|
|
@@ -26476,18 +27591,18 @@ var SettingsModal = ({
|
|
|
26476
27591
|
});
|
|
26477
27592
|
const data = await response.json();
|
|
26478
27593
|
if (response.ok && data.success) {
|
|
26479
|
-
|
|
27594
|
+
import_antd81.notification.success({
|
|
26480
27595
|
message: "Saved",
|
|
26481
27596
|
description: "Model configuration saved and registered successfully"
|
|
26482
27597
|
});
|
|
26483
27598
|
onClose();
|
|
26484
27599
|
} else {
|
|
26485
|
-
|
|
27600
|
+
import_antd81.message.error(data.error || "Failed to save model configuration");
|
|
26486
27601
|
}
|
|
26487
27602
|
}
|
|
26488
27603
|
} catch (error) {
|
|
26489
27604
|
console.error("Failed to save configuration:", error);
|
|
26490
|
-
|
|
27605
|
+
import_antd81.message.error(error.message || "Failed to save configuration");
|
|
26491
27606
|
} finally {
|
|
26492
27607
|
setLoading(false);
|
|
26493
27608
|
}
|
|
@@ -26503,25 +27618,25 @@ var SettingsModal = ({
|
|
|
26503
27618
|
}
|
|
26504
27619
|
}));
|
|
26505
27620
|
};
|
|
26506
|
-
return /* @__PURE__ */ (0,
|
|
26507
|
-
/* @__PURE__ */ (0,
|
|
26508
|
-
|
|
27621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: styles.formContainer, children: [
|
|
27622
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27623
|
+
import_antd81.Alert,
|
|
26509
27624
|
{
|
|
26510
27625
|
message: "Configuration Effect",
|
|
26511
|
-
description: /* @__PURE__ */ (0,
|
|
26512
|
-
/* @__PURE__ */ (0,
|
|
26513
|
-
/* @__PURE__ */ (0,
|
|
26514
|
-
|
|
27626
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { children: [
|
|
27627
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { style: { marginBottom: 8 }, children: [
|
|
27628
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27629
|
+
import_icons37.CheckCircleOutlined,
|
|
26515
27630
|
{
|
|
26516
27631
|
style: { color: "#52c41a", marginRight: 8 }
|
|
26517
27632
|
}
|
|
26518
27633
|
),
|
|
26519
|
-
/* @__PURE__ */ (0,
|
|
27634
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("strong", { children: "Immediately effective:" }),
|
|
26520
27635
|
" QUEUE_SERVICE_TYPE, REDIS_URL, REDIS_PASSWORD, QUEUE_NAME"
|
|
26521
27636
|
] }),
|
|
26522
|
-
/* @__PURE__ */ (0,
|
|
26523
|
-
/* @__PURE__ */ (0,
|
|
26524
|
-
/* @__PURE__ */ (0,
|
|
27637
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { children: [
|
|
27638
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_icons37.ReloadOutlined, { style: { color: "#faad14", marginRight: 8 } }),
|
|
27639
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("strong", { children: "Requires restart:" }),
|
|
26525
27640
|
" PORT (server must be restarted to change port)"
|
|
26526
27641
|
] })
|
|
26527
27642
|
] }),
|
|
@@ -26530,8 +27645,8 @@ var SettingsModal = ({
|
|
|
26530
27645
|
className: styles.alertCard
|
|
26531
27646
|
}
|
|
26532
27647
|
),
|
|
26533
|
-
/* @__PURE__ */ (0,
|
|
26534
|
-
/* @__PURE__ */ (0,
|
|
27648
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { style: { marginBottom: 24 }, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { 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." }) }),
|
|
27649
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
26535
27650
|
TextArea8,
|
|
26536
27651
|
{
|
|
26537
27652
|
value: config.envText,
|
|
@@ -26608,10 +27723,10 @@ QUEUE_NAME=tasks`,
|
|
|
26608
27723
|
}));
|
|
26609
27724
|
}
|
|
26610
27725
|
};
|
|
26611
|
-
return /* @__PURE__ */ (0,
|
|
26612
|
-
/* @__PURE__ */ (0,
|
|
26613
|
-
config.models.map((model, index) => /* @__PURE__ */ (0,
|
|
26614
|
-
/* @__PURE__ */ (0,
|
|
27726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: styles.formContainer, children: [
|
|
27727
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { style: { marginBottom: 32 }, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { 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." }) }),
|
|
27728
|
+
config.models.map((model, index) => /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: styles.card, children: [
|
|
27729
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
|
|
26615
27730
|
"div",
|
|
26616
27731
|
{
|
|
26617
27732
|
style: {
|
|
@@ -26623,12 +27738,12 @@ QUEUE_NAME=tasks`,
|
|
|
26623
27738
|
borderBottom: "1px solid rgba(0, 0, 0, 0.06)"
|
|
26624
27739
|
},
|
|
26625
27740
|
children: [
|
|
26626
|
-
/* @__PURE__ */ (0,
|
|
26627
|
-
/* @__PURE__ */ (0,
|
|
27741
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { children: [
|
|
27742
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(Text37, { strong: true, style: { fontSize: 16 }, children: [
|
|
26628
27743
|
"Model ",
|
|
26629
27744
|
index + 1
|
|
26630
27745
|
] }),
|
|
26631
|
-
model.key && /* @__PURE__ */ (0,
|
|
27746
|
+
model.key && /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
|
|
26632
27747
|
Text37,
|
|
26633
27748
|
{
|
|
26634
27749
|
type: "secondary",
|
|
@@ -26641,8 +27756,8 @@ QUEUE_NAME=tasks`,
|
|
|
26641
27756
|
}
|
|
26642
27757
|
)
|
|
26643
27758
|
] }),
|
|
26644
|
-
config.models.length > 1 && /* @__PURE__ */ (0,
|
|
26645
|
-
|
|
27759
|
+
config.models.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27760
|
+
import_antd81.Button,
|
|
26646
27761
|
{
|
|
26647
27762
|
type: "text",
|
|
26648
27763
|
danger: true,
|
|
@@ -26658,11 +27773,11 @@ QUEUE_NAME=tasks`,
|
|
|
26658
27773
|
]
|
|
26659
27774
|
}
|
|
26660
27775
|
),
|
|
26661
|
-
/* @__PURE__ */ (0,
|
|
26662
|
-
/* @__PURE__ */ (0,
|
|
26663
|
-
/* @__PURE__ */ (0,
|
|
26664
|
-
/* @__PURE__ */ (0,
|
|
26665
|
-
|
|
27776
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_antd81.Space, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
27777
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { children: [
|
|
27778
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { className: styles.formLabel, children: "Key *" }),
|
|
27779
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27780
|
+
import_antd81.Input,
|
|
26666
27781
|
{
|
|
26667
27782
|
placeholder: "e.g., default, gpt-4, claude",
|
|
26668
27783
|
value: model.key,
|
|
@@ -26670,12 +27785,12 @@ QUEUE_NAME=tasks`,
|
|
|
26670
27785
|
style: { height: 40 }
|
|
26671
27786
|
}
|
|
26672
27787
|
),
|
|
26673
|
-
/* @__PURE__ */ (0,
|
|
27788
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { className: styles.formDescription, children: "Unique identifier for this model" })
|
|
26674
27789
|
] }),
|
|
26675
|
-
/* @__PURE__ */ (0,
|
|
26676
|
-
/* @__PURE__ */ (0,
|
|
26677
|
-
/* @__PURE__ */ (0,
|
|
26678
|
-
|
|
27790
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { children: [
|
|
27791
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { className: styles.formLabel, children: "Provider *" }),
|
|
27792
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27793
|
+
import_antd81.Select,
|
|
26679
27794
|
{
|
|
26680
27795
|
style: { width: "100%", height: 40 },
|
|
26681
27796
|
value: model.provider,
|
|
@@ -26690,10 +27805,10 @@ QUEUE_NAME=tasks`,
|
|
|
26690
27805
|
}
|
|
26691
27806
|
)
|
|
26692
27807
|
] }),
|
|
26693
|
-
/* @__PURE__ */ (0,
|
|
26694
|
-
/* @__PURE__ */ (0,
|
|
26695
|
-
/* @__PURE__ */ (0,
|
|
26696
|
-
|
|
27808
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { children: [
|
|
27809
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { className: styles.formLabel, children: "Model Name *" }),
|
|
27810
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27811
|
+
import_antd81.Input,
|
|
26697
27812
|
{
|
|
26698
27813
|
placeholder: "e.g., gpt-4, claude-3-opus, kimi-k2-250905",
|
|
26699
27814
|
value: model.model,
|
|
@@ -26702,10 +27817,10 @@ QUEUE_NAME=tasks`,
|
|
|
26702
27817
|
}
|
|
26703
27818
|
)
|
|
26704
27819
|
] }),
|
|
26705
|
-
/* @__PURE__ */ (0,
|
|
26706
|
-
/* @__PURE__ */ (0,
|
|
26707
|
-
/* @__PURE__ */ (0,
|
|
26708
|
-
|
|
27820
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { children: [
|
|
27821
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { className: styles.formLabel, children: "API Key" }),
|
|
27822
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27823
|
+
import_antd81.Input.Password,
|
|
26709
27824
|
{
|
|
26710
27825
|
placeholder: "Enter your API key",
|
|
26711
27826
|
value: model.apiKey,
|
|
@@ -26713,12 +27828,12 @@ QUEUE_NAME=tasks`,
|
|
|
26713
27828
|
style: { height: 40 }
|
|
26714
27829
|
}
|
|
26715
27830
|
),
|
|
26716
|
-
/* @__PURE__ */ (0,
|
|
27831
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { className: styles.formDescription, children: "API key for the model provider. Leave empty to use environment variable." })
|
|
26717
27832
|
] }),
|
|
26718
|
-
/* @__PURE__ */ (0,
|
|
26719
|
-
/* @__PURE__ */ (0,
|
|
26720
|
-
/* @__PURE__ */ (0,
|
|
26721
|
-
|
|
27833
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { children: [
|
|
27834
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { className: styles.formLabel, children: "Base URL" }),
|
|
27835
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27836
|
+
import_antd81.Input,
|
|
26722
27837
|
{
|
|
26723
27838
|
placeholder: "e.g., https://api.openai.com/v1",
|
|
26724
27839
|
value: model.baseURL,
|
|
@@ -26726,23 +27841,23 @@ QUEUE_NAME=tasks`,
|
|
|
26726
27841
|
style: { height: 40 }
|
|
26727
27842
|
}
|
|
26728
27843
|
),
|
|
26729
|
-
/* @__PURE__ */ (0,
|
|
27844
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { className: styles.formDescription, children: "Optional custom base URL for the API" })
|
|
26730
27845
|
] }),
|
|
26731
|
-
/* @__PURE__ */ (0,
|
|
26732
|
-
/* @__PURE__ */ (0,
|
|
26733
|
-
|
|
27846
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_antd81.Space, { children: [
|
|
27847
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27848
|
+
import_antd81.Switch,
|
|
26734
27849
|
{
|
|
26735
27850
|
checked: model.streaming,
|
|
26736
27851
|
onChange: (checked) => handleModelChange(index, "streaming", checked)
|
|
26737
27852
|
}
|
|
26738
27853
|
),
|
|
26739
|
-
/* @__PURE__ */ (0,
|
|
27854
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { children: "Enable Streaming" })
|
|
26740
27855
|
] }) }),
|
|
26741
|
-
/* @__PURE__ */ (0,
|
|
26742
|
-
/* @__PURE__ */ (0,
|
|
26743
|
-
/* @__PURE__ */ (0,
|
|
26744
|
-
/* @__PURE__ */ (0,
|
|
26745
|
-
|
|
27856
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { style: { display: "flex", gap: 20 }, children: [
|
|
27857
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { style: { flex: 1 }, children: [
|
|
27858
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { className: styles.formLabel, children: "Max Tokens" }),
|
|
27859
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27860
|
+
import_antd81.Input,
|
|
26746
27861
|
{
|
|
26747
27862
|
type: "number",
|
|
26748
27863
|
placeholder: "e.g., 4096",
|
|
@@ -26756,10 +27871,10 @@ QUEUE_NAME=tasks`,
|
|
|
26756
27871
|
}
|
|
26757
27872
|
)
|
|
26758
27873
|
] }),
|
|
26759
|
-
/* @__PURE__ */ (0,
|
|
26760
|
-
/* @__PURE__ */ (0,
|
|
26761
|
-
/* @__PURE__ */ (0,
|
|
26762
|
-
|
|
27874
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { style: { flex: 1 }, children: [
|
|
27875
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { className: styles.formLabel, children: "Temperature" }),
|
|
27876
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27877
|
+
import_antd81.Input,
|
|
26763
27878
|
{
|
|
26764
27879
|
type: "number",
|
|
26765
27880
|
step: "0.1",
|
|
@@ -26777,8 +27892,8 @@ QUEUE_NAME=tasks`,
|
|
|
26777
27892
|
] })
|
|
26778
27893
|
] })
|
|
26779
27894
|
] }, index)),
|
|
26780
|
-
/* @__PURE__ */ (0,
|
|
26781
|
-
|
|
27895
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27896
|
+
import_antd81.Button,
|
|
26782
27897
|
{
|
|
26783
27898
|
type: "dashed",
|
|
26784
27899
|
onClick: handleAddModel,
|
|
@@ -26805,9 +27920,9 @@ QUEUE_NAME=tasks`,
|
|
|
26805
27920
|
);
|
|
26806
27921
|
const currentConnection = connections.find((c) => c.id === activeTabKey);
|
|
26807
27922
|
const renderTabLabel = (connection) => {
|
|
26808
|
-
return /* @__PURE__ */ (0,
|
|
26809
|
-
/* @__PURE__ */ (0,
|
|
26810
|
-
|
|
27923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
27924
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27925
|
+
import_icons37.CloudServerOutlined,
|
|
26811
27926
|
{
|
|
26812
27927
|
style: {
|
|
26813
27928
|
marginRight: 8,
|
|
@@ -26815,15 +27930,15 @@ QUEUE_NAME=tasks`,
|
|
|
26815
27930
|
}
|
|
26816
27931
|
}
|
|
26817
27932
|
),
|
|
26818
|
-
/* @__PURE__ */ (0,
|
|
26819
|
-
connection.connected && /* @__PURE__ */ (0,
|
|
26820
|
-
|
|
27933
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { children: connection.name }),
|
|
27934
|
+
connection.connected && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27935
|
+
import_icons37.CheckCircleFilled,
|
|
26821
27936
|
{
|
|
26822
27937
|
style: { color: "#52c41a", fontSize: 12, marginLeft: 8 }
|
|
26823
27938
|
}
|
|
26824
27939
|
),
|
|
26825
|
-
connection.error && !connection.connecting && /* @__PURE__ */ (0,
|
|
26826
|
-
|
|
27940
|
+
connection.error && !connection.connecting && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27941
|
+
import_icons37.CloseCircleFilled,
|
|
26827
27942
|
{
|
|
26828
27943
|
style: { color: "#ff4d4f", fontSize: 12, marginLeft: 8 }
|
|
26829
27944
|
}
|
|
@@ -26833,35 +27948,35 @@ QUEUE_NAME=tasks`,
|
|
|
26833
27948
|
const tabItems = connections.map((connection) => ({
|
|
26834
27949
|
key: connection.id,
|
|
26835
27950
|
label: renderTabLabel(connection),
|
|
26836
|
-
children: /* @__PURE__ */ (0,
|
|
26837
|
-
/* @__PURE__ */ (0,
|
|
27951
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: styles.tabContent, children: connection.connected ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_jsx_runtime107.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { style: { display: "flex", height: "100%" }, children: [
|
|
27952
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: styles.sidebar, children: SETTINGS_MENU_ITEMS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
|
|
26838
27953
|
"div",
|
|
26839
27954
|
{
|
|
26840
27955
|
className: `${styles.menuItem} ${activeMenu === item.key ? "active" : ""}`,
|
|
26841
27956
|
onClick: () => setActiveMenu(item.key),
|
|
26842
27957
|
children: [
|
|
26843
|
-
/* @__PURE__ */ (0,
|
|
26844
|
-
/* @__PURE__ */ (0,
|
|
27958
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: styles.menuItemIcon, children: item.icon }),
|
|
27959
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: styles.menuItemText, children: item.label })
|
|
26845
27960
|
]
|
|
26846
27961
|
},
|
|
26847
27962
|
item.key
|
|
26848
27963
|
)) }),
|
|
26849
|
-
/* @__PURE__ */ (0,
|
|
26850
|
-
/* @__PURE__ */ (0,
|
|
26851
|
-
/* @__PURE__ */ (0,
|
|
26852
|
-
/* @__PURE__ */ (0,
|
|
26853
|
-
/* @__PURE__ */ (0,
|
|
27964
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: styles.content, children: [
|
|
27965
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: styles.contentHeader, children: [
|
|
27966
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: styles.contentHeaderLeft, children: [
|
|
27967
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Title13, { level: 3, className: styles.contentTitle, children: activeMenuItem?.label }),
|
|
27968
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(Text37, { className: styles.contentDescription, children: [
|
|
26854
27969
|
activeMenu === "environment" && "Manage environment variables for the gateway server",
|
|
26855
27970
|
activeMenu === "models" && "Configure and register model lattices for use by agents"
|
|
26856
27971
|
] })
|
|
26857
27972
|
] }),
|
|
26858
|
-
/* @__PURE__ */ (0,
|
|
26859
|
-
/* @__PURE__ */ (0,
|
|
26860
|
-
/* @__PURE__ */ (0,
|
|
26861
|
-
|
|
27973
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: styles.contentHeaderRight, children: [
|
|
27974
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_antd81.Button, { onClick: onClose, children: "Cancel" }),
|
|
27975
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
27976
|
+
import_antd81.Button,
|
|
26862
27977
|
{
|
|
26863
27978
|
type: "primary",
|
|
26864
|
-
icon: /* @__PURE__ */ (0,
|
|
27979
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_icons37.SaveOutlined, {}),
|
|
26865
27980
|
onClick: handleSave,
|
|
26866
27981
|
loading,
|
|
26867
27982
|
children: "Save Configuration"
|
|
@@ -26869,9 +27984,9 @@ QUEUE_NAME=tasks`,
|
|
|
26869
27984
|
)
|
|
26870
27985
|
] })
|
|
26871
27986
|
] }),
|
|
26872
|
-
/* @__PURE__ */ (0,
|
|
27987
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: styles.contentBody, children: renderContent(connection.id) })
|
|
26873
27988
|
] })
|
|
26874
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
27989
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
26875
27990
|
"div",
|
|
26876
27991
|
{
|
|
26877
27992
|
style: {
|
|
@@ -26883,17 +27998,17 @@ QUEUE_NAME=tasks`,
|
|
|
26883
27998
|
gap: 16,
|
|
26884
27999
|
padding: 48
|
|
26885
28000
|
},
|
|
26886
|
-
children: connection.connecting ? /* @__PURE__ */ (0,
|
|
26887
|
-
/* @__PURE__ */ (0,
|
|
26888
|
-
/* @__PURE__ */ (0,
|
|
26889
|
-
/* @__PURE__ */ (0,
|
|
28001
|
+
children: connection.connecting ? /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_jsx_runtime107.Fragment, { children: [
|
|
28002
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_icons37.LinkOutlined, { style: { fontSize: 64, color: "#1890ff" }, spin: true }),
|
|
28003
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Title13, { level: 4, children: "Connecting..." }),
|
|
28004
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(Text37, { type: "secondary", style: { textAlign: "center" }, children: [
|
|
26890
28005
|
"Connecting to ",
|
|
26891
28006
|
connection.url
|
|
26892
28007
|
] })
|
|
26893
|
-
] }) : /* @__PURE__ */ (0,
|
|
26894
|
-
/* @__PURE__ */ (0,
|
|
26895
|
-
/* @__PURE__ */ (0,
|
|
26896
|
-
/* @__PURE__ */ (0,
|
|
28008
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_jsx_runtime107.Fragment, { children: [
|
|
28009
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_icons37.LinkOutlined, { style: { fontSize: 64, color: "#d9d9d9" } }),
|
|
28010
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Title13, { level: 4, type: "secondary", children: connection.error || "Not Connected" }),
|
|
28011
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
26897
28012
|
Text37,
|
|
26898
28013
|
{
|
|
26899
28014
|
type: "secondary",
|
|
@@ -26901,11 +28016,11 @@ QUEUE_NAME=tasks`,
|
|
|
26901
28016
|
children: connection.error ? `Failed to connect to ${connection.url}. Please check the server URL and try again.` : `Click "Reconnect" to connect to ${connection.url}`
|
|
26902
28017
|
}
|
|
26903
28018
|
),
|
|
26904
|
-
/* @__PURE__ */ (0,
|
|
26905
|
-
|
|
28019
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
28020
|
+
import_antd81.Button,
|
|
26906
28021
|
{
|
|
26907
28022
|
type: "primary",
|
|
26908
|
-
icon: /* @__PURE__ */ (0,
|
|
28023
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_icons37.LinkOutlined, {}),
|
|
26909
28024
|
onClick: () => checkConnection(connection.id),
|
|
26910
28025
|
loading: connection.connecting,
|
|
26911
28026
|
style: { marginTop: 16 },
|
|
@@ -26917,9 +28032,9 @@ QUEUE_NAME=tasks`,
|
|
|
26917
28032
|
) }),
|
|
26918
28033
|
closable: connections.length > 1
|
|
26919
28034
|
}));
|
|
26920
|
-
return /* @__PURE__ */ (0,
|
|
26921
|
-
/* @__PURE__ */ (0,
|
|
26922
|
-
|
|
28035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_jsx_runtime107.Fragment, { children: [
|
|
28036
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
28037
|
+
import_antd81.Modal,
|
|
26923
28038
|
{
|
|
26924
28039
|
open,
|
|
26925
28040
|
onCancel: onClose,
|
|
@@ -26927,8 +28042,8 @@ QUEUE_NAME=tasks`,
|
|
|
26927
28042
|
width: "80%",
|
|
26928
28043
|
footer: null,
|
|
26929
28044
|
title: "Settings",
|
|
26930
|
-
children: /* @__PURE__ */ (0,
|
|
26931
|
-
|
|
28045
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
28046
|
+
import_antd81.Tabs,
|
|
26932
28047
|
{
|
|
26933
28048
|
activeKey: activeTabKey,
|
|
26934
28049
|
onChange: handleTabChange,
|
|
@@ -26941,7 +28056,7 @@ QUEUE_NAME=tasks`,
|
|
|
26941
28056
|
}
|
|
26942
28057
|
},
|
|
26943
28058
|
items: tabItems,
|
|
26944
|
-
addIcon: /* @__PURE__ */ (0,
|
|
28059
|
+
addIcon: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
|
|
26945
28060
|
"div",
|
|
26946
28061
|
{
|
|
26947
28062
|
style: {
|
|
@@ -26951,8 +28066,8 @@ QUEUE_NAME=tasks`,
|
|
|
26951
28066
|
padding: "4px 8px"
|
|
26952
28067
|
},
|
|
26953
28068
|
children: [
|
|
26954
|
-
/* @__PURE__ */ (0,
|
|
26955
|
-
/* @__PURE__ */ (0,
|
|
28069
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_icons37.PlusOutlined, {}),
|
|
28070
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { children: "Add Server" })
|
|
26956
28071
|
]
|
|
26957
28072
|
}
|
|
26958
28073
|
)
|
|
@@ -26960,8 +28075,8 @@ QUEUE_NAME=tasks`,
|
|
|
26960
28075
|
) })
|
|
26961
28076
|
}
|
|
26962
28077
|
),
|
|
26963
|
-
/* @__PURE__ */ (0,
|
|
26964
|
-
|
|
28078
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
28079
|
+
import_antd81.Modal,
|
|
26965
28080
|
{
|
|
26966
28081
|
title: "Add New Server",
|
|
26967
28082
|
open: showAddServerModal,
|
|
@@ -26974,11 +28089,11 @@ QUEUE_NAME=tasks`,
|
|
|
26974
28089
|
},
|
|
26975
28090
|
confirmLoading: addingServer,
|
|
26976
28091
|
className: styles.addServerModal,
|
|
26977
|
-
children: /* @__PURE__ */ (0,
|
|
26978
|
-
/* @__PURE__ */ (0,
|
|
26979
|
-
/* @__PURE__ */ (0,
|
|
26980
|
-
/* @__PURE__ */ (0,
|
|
26981
|
-
|
|
28092
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_antd81.Space, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
28093
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { children: [
|
|
28094
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server Name" }),
|
|
28095
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
28096
|
+
import_antd81.Input,
|
|
26982
28097
|
{
|
|
26983
28098
|
placeholder: "e.g., Production Server",
|
|
26984
28099
|
value: newServerName,
|
|
@@ -26986,12 +28101,12 @@ QUEUE_NAME=tasks`,
|
|
|
26986
28101
|
onPressEnter: handleAddServer
|
|
26987
28102
|
}
|
|
26988
28103
|
),
|
|
26989
|
-
/* @__PURE__ */ (0,
|
|
28104
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: Leave empty to use URL as name" })
|
|
26990
28105
|
] }),
|
|
26991
|
-
/* @__PURE__ */ (0,
|
|
26992
|
-
/* @__PURE__ */ (0,
|
|
26993
|
-
/* @__PURE__ */ (0,
|
|
26994
|
-
|
|
28106
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { children: [
|
|
28107
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server URL *" }),
|
|
28108
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
28109
|
+
import_antd81.Input,
|
|
26995
28110
|
{
|
|
26996
28111
|
placeholder: "e.g., http://localhost:4001",
|
|
26997
28112
|
value: newServerUrl,
|
|
@@ -26999,12 +28114,12 @@ QUEUE_NAME=tasks`,
|
|
|
26999
28114
|
onPressEnter: handleAddServer
|
|
27000
28115
|
}
|
|
27001
28116
|
),
|
|
27002
|
-
/* @__PURE__ */ (0,
|
|
28117
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Enter the full URL of the gateway server" })
|
|
27003
28118
|
] }),
|
|
27004
|
-
/* @__PURE__ */ (0,
|
|
27005
|
-
/* @__PURE__ */ (0,
|
|
27006
|
-
/* @__PURE__ */ (0,
|
|
27007
|
-
|
|
28119
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { children: [
|
|
28120
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { strong: true, style: { display: "block", marginBottom: 8 }, children: "API Key" }),
|
|
28121
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
28122
|
+
import_antd81.Input.Password,
|
|
27008
28123
|
{
|
|
27009
28124
|
placeholder: "Optional: Enter API key for authentication",
|
|
27010
28125
|
value: newServerApiKey,
|
|
@@ -27012,7 +28127,7 @@ QUEUE_NAME=tasks`,
|
|
|
27012
28127
|
onPressEnter: handleAddServer
|
|
27013
28128
|
}
|
|
27014
28129
|
),
|
|
27015
|
-
/* @__PURE__ */ (0,
|
|
28130
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text37, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: API key for server authentication" })
|
|
27016
28131
|
] })
|
|
27017
28132
|
] })
|
|
27018
28133
|
}
|
|
@@ -27021,10 +28136,10 @@ QUEUE_NAME=tasks`,
|
|
|
27021
28136
|
};
|
|
27022
28137
|
|
|
27023
28138
|
// src/components/Chat/AgentServerSetting.tsx
|
|
27024
|
-
var
|
|
28139
|
+
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
27025
28140
|
var AgentServerSetting = () => {
|
|
27026
28141
|
const { settingsModalOpen, setSettingsModalOpen } = useLatticeChatShellContext();
|
|
27027
|
-
return /* @__PURE__ */ (0,
|
|
28142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
27028
28143
|
SettingsModal,
|
|
27029
28144
|
{
|
|
27030
28145
|
open: settingsModalOpen,
|
|
@@ -27034,24 +28149,24 @@ var AgentServerSetting = () => {
|
|
|
27034
28149
|
};
|
|
27035
28150
|
|
|
27036
28151
|
// src/components/Chat/LatticeChatShell.tsx
|
|
27037
|
-
var
|
|
28152
|
+
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
27038
28153
|
var ShellContent = ({
|
|
27039
28154
|
initialAssistantId,
|
|
27040
28155
|
enableWorkspace
|
|
27041
28156
|
}) => {
|
|
27042
28157
|
const { currentTenant } = useAuth();
|
|
27043
|
-
return /* @__PURE__ */ (0,
|
|
27044
|
-
/* @__PURE__ */ (0,
|
|
27045
|
-
/* @__PURE__ */ (0,
|
|
27046
|
-
] }) : /* @__PURE__ */ (0,
|
|
27047
|
-
/* @__PURE__ */ (0,
|
|
27048
|
-
/* @__PURE__ */ (0,
|
|
28158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_jsx_runtime109.Fragment, { children: enableWorkspace ? /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(WorkspaceContextProvider, { children: [
|
|
28159
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(AssistantContextProvider, { autoLoad: true, initialAssistantId, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ConversationContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(LatticeChatView, {}) }) }),
|
|
28160
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(AgentServerSetting, {})
|
|
28161
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_jsx_runtime109.Fragment, { children: [
|
|
28162
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(AssistantContextProvider, { autoLoad: true, initialAssistantId, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ConversationContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(LatticeChatView, {}) }) }),
|
|
28163
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(AgentServerSetting, {})
|
|
27049
28164
|
] }) });
|
|
27050
28165
|
};
|
|
27051
28166
|
var LatticeChatShell = (props) => {
|
|
27052
28167
|
const { enableAssistantCreation, enableAssistantEditing, enableWorkspace: enableWorkspaceProp, ...restProps } = props;
|
|
27053
28168
|
const enableWorkspace = enableWorkspaceProp ?? restProps.initialConfig?.enableWorkspace ?? false;
|
|
27054
|
-
return /* @__PURE__ */ (0,
|
|
28169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
27055
28170
|
LatticeChatShellContextProvider,
|
|
27056
28171
|
{
|
|
27057
28172
|
initialConfig: {
|
|
@@ -27060,7 +28175,7 @@ var LatticeChatShell = (props) => {
|
|
|
27060
28175
|
enableWorkspace,
|
|
27061
28176
|
...restProps.initialConfig
|
|
27062
28177
|
},
|
|
27063
|
-
children: /* @__PURE__ */ (0,
|
|
28178
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
27064
28179
|
ShellContent,
|
|
27065
28180
|
{
|
|
27066
28181
|
initialAssistantId: restProps.initialConfig?.assistantId,
|
|
@@ -27104,6 +28219,7 @@ var LatticeChatShell = (props) => {
|
|
|
27104
28219
|
SkillCategoryPrompts,
|
|
27105
28220
|
SkillFlow,
|
|
27106
28221
|
SkillNode,
|
|
28222
|
+
StreamingHTMLRenderer,
|
|
27107
28223
|
TenantSelector,
|
|
27108
28224
|
UserProfile,
|
|
27109
28225
|
WorkspaceResourceManager,
|
|
@@ -27113,6 +28229,7 @@ var LatticeChatShell = (props) => {
|
|
|
27113
28229
|
axiomAntdThemeDark,
|
|
27114
28230
|
axiomTokens,
|
|
27115
28231
|
colors,
|
|
28232
|
+
generateIframeSrcdoc,
|
|
27116
28233
|
generateLabelFromMessage,
|
|
27117
28234
|
getAxiomAntdTheme,
|
|
27118
28235
|
getElement,
|