@axiom-lattice/react-sdk 2.1.89 → 2.1.91
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 +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +1729 -800
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1733 -793
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -91,8 +91,8 @@ var AuthProvider = ({
|
|
|
91
91
|
onLoginSuccess?.(userData, tenantList || []);
|
|
92
92
|
return { requiresTenantSelection, hasTenants };
|
|
93
93
|
} catch (err) {
|
|
94
|
-
const
|
|
95
|
-
setError(
|
|
94
|
+
const message26 = err instanceof Error ? err.message : "Login failed";
|
|
95
|
+
setError(message26);
|
|
96
96
|
throw err;
|
|
97
97
|
} finally {
|
|
98
98
|
setIsLoading(false);
|
|
@@ -116,8 +116,8 @@ var AuthProvider = ({
|
|
|
116
116
|
}
|
|
117
117
|
return { message: data.message || "Registration successful!", token: data.data?.token };
|
|
118
118
|
} catch (err) {
|
|
119
|
-
const
|
|
120
|
-
setError(
|
|
119
|
+
const message26 = err instanceof Error ? err.message : "Registration failed";
|
|
120
|
+
setError(message26);
|
|
121
121
|
throw err;
|
|
122
122
|
} finally {
|
|
123
123
|
setIsLoading(false);
|
|
@@ -171,8 +171,8 @@ var AuthProvider = ({
|
|
|
171
171
|
}
|
|
172
172
|
onTenantSelected?.(tenantData);
|
|
173
173
|
} catch (err) {
|
|
174
|
-
const
|
|
175
|
-
setError(
|
|
174
|
+
const message26 = err instanceof Error ? err.message : "Failed to select tenant";
|
|
175
|
+
setError(message26);
|
|
176
176
|
throw err;
|
|
177
177
|
} finally {
|
|
178
178
|
setIsLoading(false);
|
|
@@ -211,8 +211,8 @@ var AuthProvider = ({
|
|
|
211
211
|
setTenants(tenantList);
|
|
212
212
|
sessionStorage.setItem("lattice_tenants", JSON.stringify(tenantList));
|
|
213
213
|
} catch (err) {
|
|
214
|
-
const
|
|
215
|
-
setError(
|
|
214
|
+
const message26 = err instanceof Error ? err.message : "Failed to fetch tenants";
|
|
215
|
+
setError(message26);
|
|
216
216
|
} finally {
|
|
217
217
|
setIsLoading(false);
|
|
218
218
|
}
|
|
@@ -242,8 +242,8 @@ var AuthProvider = ({
|
|
|
242
242
|
setUser(data);
|
|
243
243
|
sessionStorage.setItem("lattice_user", JSON.stringify(data));
|
|
244
244
|
} catch (err) {
|
|
245
|
-
const
|
|
246
|
-
setError(
|
|
245
|
+
const message26 = err instanceof Error ? err.message : "Failed to refresh user";
|
|
246
|
+
setError(message26);
|
|
247
247
|
} finally {
|
|
248
248
|
setIsLoading(false);
|
|
249
249
|
}
|
|
@@ -279,8 +279,8 @@ var AuthProvider = ({
|
|
|
279
279
|
const result = await response.json();
|
|
280
280
|
return result;
|
|
281
281
|
} catch (err) {
|
|
282
|
-
const
|
|
283
|
-
setError(
|
|
282
|
+
const message26 = err instanceof Error ? err.message : "Failed to change password";
|
|
283
|
+
setError(message26);
|
|
284
284
|
throw err;
|
|
285
285
|
} finally {
|
|
286
286
|
setIsLoading(false);
|
|
@@ -494,7 +494,7 @@ function useChat(threadId, assistantId, options = {}) {
|
|
|
494
494
|
throw new Error("Thread ID is required to send messages");
|
|
495
495
|
}
|
|
496
496
|
const { input, command, streaming = true } = data;
|
|
497
|
-
const { message:
|
|
497
|
+
const { message: message26, files, ...rest } = input || {};
|
|
498
498
|
setState((prev) => ({
|
|
499
499
|
...prev,
|
|
500
500
|
isLoading: true,
|
|
@@ -503,7 +503,7 @@ function useChat(threadId, assistantId, options = {}) {
|
|
|
503
503
|
}));
|
|
504
504
|
const userMessage = {
|
|
505
505
|
id: uuidv4(),
|
|
506
|
-
content:
|
|
506
|
+
content: message26 || command?.resume?.message || "",
|
|
507
507
|
files,
|
|
508
508
|
role: "human"
|
|
509
509
|
};
|
|
@@ -756,6 +756,7 @@ var AssistantContext = createContext3({
|
|
|
756
756
|
currentAssistant: null,
|
|
757
757
|
isLoading: false,
|
|
758
758
|
error: null,
|
|
759
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
759
760
|
listAssistants: async () => {
|
|
760
761
|
},
|
|
761
762
|
getAssistant: async () => {
|
|
@@ -767,12 +768,16 @@ var AssistantContext = createContext3({
|
|
|
767
768
|
updateAssistant: async () => {
|
|
768
769
|
throw new Error("Not implemented");
|
|
769
770
|
},
|
|
771
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
770
772
|
deleteAssistant: async () => {
|
|
771
773
|
},
|
|
774
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
772
775
|
selectAssistant: async () => {
|
|
773
776
|
},
|
|
777
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
774
778
|
clearCurrentAssistant: () => {
|
|
775
779
|
},
|
|
780
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
776
781
|
refresh: async () => {
|
|
777
782
|
}
|
|
778
783
|
});
|
|
@@ -1388,13 +1393,17 @@ var DEFAULT_CONFIG = {
|
|
|
1388
1393
|
};
|
|
1389
1394
|
var LatticeChatShellContext = createContext4({
|
|
1390
1395
|
config: DEFAULT_CONFIG,
|
|
1396
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1391
1397
|
updateConfig: () => {
|
|
1392
1398
|
},
|
|
1399
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1393
1400
|
updateConfigValue: () => {
|
|
1394
1401
|
},
|
|
1402
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1395
1403
|
resetConfig: () => {
|
|
1396
1404
|
},
|
|
1397
1405
|
settingsModalOpen: false,
|
|
1406
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1398
1407
|
setSettingsModalOpen: () => {
|
|
1399
1408
|
}
|
|
1400
1409
|
});
|
|
@@ -1491,24 +1500,31 @@ var ConversationContext = createContext5({
|
|
|
1491
1500
|
threads: [],
|
|
1492
1501
|
isLoading: false,
|
|
1493
1502
|
error: null,
|
|
1503
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1494
1504
|
setThread: () => {
|
|
1495
1505
|
},
|
|
1506
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1496
1507
|
selectThread: () => {
|
|
1497
1508
|
},
|
|
1498
1509
|
createThread: async () => {
|
|
1499
1510
|
throw new Error("Not implemented");
|
|
1500
1511
|
},
|
|
1501
1512
|
listThreads: async () => [],
|
|
1513
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1502
1514
|
updateThread: async () => {
|
|
1503
1515
|
},
|
|
1504
1516
|
getThreadById: () => null,
|
|
1517
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1505
1518
|
deleteThread: async () => {
|
|
1506
1519
|
},
|
|
1520
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1507
1521
|
clearThread: () => {
|
|
1508
1522
|
},
|
|
1523
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1509
1524
|
refresh: async () => {
|
|
1510
1525
|
},
|
|
1511
1526
|
customRunConfig: {},
|
|
1527
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1512
1528
|
updateCustomRunConfig: () => {
|
|
1513
1529
|
}
|
|
1514
1530
|
});
|
|
@@ -1523,8 +1539,8 @@ function convertThreadToConversationThread(thread, label) {
|
|
|
1523
1539
|
function getThreadMetadata(label) {
|
|
1524
1540
|
return label ? { label } : {};
|
|
1525
1541
|
}
|
|
1526
|
-
function generateLabelFromMessage(
|
|
1527
|
-
const cleanMessage =
|
|
1542
|
+
function generateLabelFromMessage(message26) {
|
|
1543
|
+
const cleanMessage = message26.replace(/```attachments[\s\S]*?```/g, "").trim();
|
|
1528
1544
|
if (!cleanMessage) {
|
|
1529
1545
|
return "";
|
|
1530
1546
|
}
|
|
@@ -1538,7 +1554,8 @@ var ConversationContextProvider = ({
|
|
|
1538
1554
|
}) => {
|
|
1539
1555
|
const { currentAssistant } = useAssistantContext();
|
|
1540
1556
|
const assistantId = currentAssistant?.id || null;
|
|
1541
|
-
const
|
|
1557
|
+
const _unused = useLatticeChatShellContext();
|
|
1558
|
+
void _unused;
|
|
1542
1559
|
const client = useClient(assistantId || "");
|
|
1543
1560
|
const [threads, setThreads] = useState6([]);
|
|
1544
1561
|
const [threadId, setThreadId] = useState6(null);
|
|
@@ -1885,7 +1902,7 @@ function AgentThreadProvider({
|
|
|
1885
1902
|
if (currentCreatedAt) {
|
|
1886
1903
|
lastAgentStateCreatedAtRef.current = currentCreatedAt;
|
|
1887
1904
|
}
|
|
1888
|
-
|
|
1905
|
+
const needUpdateFields = {};
|
|
1889
1906
|
needUpdateFields.agentState = agentState;
|
|
1890
1907
|
needUpdateFields.interrupts = agentState?.tasks?.flatMap((task) => {
|
|
1891
1908
|
return task.interrupts.map((interrupt) => {
|
|
@@ -1996,7 +2013,7 @@ function AgentThreadProvider({
|
|
|
1996
2013
|
throw new Error("Thread ID is required to send messages");
|
|
1997
2014
|
}
|
|
1998
2015
|
const { input, command, streaming = true, mode } = data;
|
|
1999
|
-
const { message:
|
|
2016
|
+
const { message: message26, files, ...rest } = input || {};
|
|
2000
2017
|
setState((prev) => ({
|
|
2001
2018
|
...prev,
|
|
2002
2019
|
isLoading: true,
|
|
@@ -2005,7 +2022,7 @@ function AgentThreadProvider({
|
|
|
2005
2022
|
}));
|
|
2006
2023
|
const userMessage = {
|
|
2007
2024
|
id: uuidv42(),
|
|
2008
|
-
content:
|
|
2025
|
+
content: message26 || command?.resume?.message || "",
|
|
2009
2026
|
files,
|
|
2010
2027
|
role: "human"
|
|
2011
2028
|
};
|
|
@@ -2023,8 +2040,8 @@ function AgentThreadProvider({
|
|
|
2023
2040
|
]
|
|
2024
2041
|
}));
|
|
2025
2042
|
const isFirstMessage = messageCountRef.current === 0;
|
|
2026
|
-
if (isFirstMessage &&
|
|
2027
|
-
const label = generateLabelFromMessage(
|
|
2043
|
+
if (isFirstMessage && message26 && conversationContext) {
|
|
2044
|
+
const label = generateLabelFromMessage(message26);
|
|
2028
2045
|
if (label) {
|
|
2029
2046
|
conversationContext.updateThread({
|
|
2030
2047
|
id: threadId,
|
|
@@ -2046,6 +2063,7 @@ function AgentThreadProvider({
|
|
|
2046
2063
|
mode,
|
|
2047
2064
|
...rest
|
|
2048
2065
|
},
|
|
2066
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2049
2067
|
() => {
|
|
2050
2068
|
},
|
|
2051
2069
|
// Empty handler - resumeStream will handle chunks
|
|
@@ -2238,7 +2256,7 @@ function AgentThreadProvider({
|
|
|
2238
2256
|
if (currentCreatedAt) {
|
|
2239
2257
|
lastAgentStateCreatedAtRef.current = currentCreatedAt;
|
|
2240
2258
|
}
|
|
2241
|
-
|
|
2259
|
+
const needUpdateFields = {};
|
|
2242
2260
|
needUpdateFields.agentState = agentState;
|
|
2243
2261
|
needUpdateFields.todos = agentState?.values?.todos;
|
|
2244
2262
|
needUpdateFields.tasks = agentState?.values?.tasks;
|
|
@@ -3920,8 +3938,8 @@ function useTenants(options) {
|
|
|
3920
3938
|
const { data } = await response.json();
|
|
3921
3939
|
setTenants(data || []);
|
|
3922
3940
|
} catch (err) {
|
|
3923
|
-
const
|
|
3924
|
-
setError(
|
|
3941
|
+
const message26 = err instanceof Error ? err.message : "Failed to fetch tenants";
|
|
3942
|
+
setError(message26);
|
|
3925
3943
|
} finally {
|
|
3926
3944
|
setIsLoading(false);
|
|
3927
3945
|
}
|
|
@@ -3963,8 +3981,8 @@ function useUsers(options) {
|
|
|
3963
3981
|
const { data } = await response.json();
|
|
3964
3982
|
setUsers(data || []);
|
|
3965
3983
|
} catch (err) {
|
|
3966
|
-
const
|
|
3967
|
-
setError(
|
|
3984
|
+
const message26 = err instanceof Error ? err.message : "Failed to fetch users";
|
|
3985
|
+
setError(message26);
|
|
3968
3986
|
} finally {
|
|
3969
3987
|
setIsLoading(false);
|
|
3970
3988
|
}
|
|
@@ -4201,25 +4219,25 @@ var FilePanelToggle = () => {
|
|
|
4201
4219
|
};
|
|
4202
4220
|
|
|
4203
4221
|
// src/components/Chat/PinToMenuButton.tsx
|
|
4204
|
-
import
|
|
4205
|
-
import { Button as
|
|
4222
|
+
import React72, { useState as useState79, useEffect as useEffect55, useCallback as useCallback41 } from "react";
|
|
4223
|
+
import { Button as Button57, Input as Input18, Modal as Modal22, Tooltip as Tooltip26, message as message20 } from "antd";
|
|
4206
4224
|
import { Pin } from "lucide-react";
|
|
4207
4225
|
|
|
4208
4226
|
// src/context/WorkspaceContext.tsx
|
|
4209
|
-
import
|
|
4227
|
+
import React71, {
|
|
4210
4228
|
createContext as createContext9,
|
|
4211
4229
|
useContext as useContext11,
|
|
4212
|
-
useState as
|
|
4213
|
-
useCallback as
|
|
4214
|
-
useEffect as
|
|
4215
|
-
useRef as
|
|
4230
|
+
useState as useState78,
|
|
4231
|
+
useCallback as useCallback40,
|
|
4232
|
+
useEffect as useEffect54,
|
|
4233
|
+
useRef as useRef29
|
|
4216
4234
|
} from "react";
|
|
4217
4235
|
import { WorkspaceClient, Client as Client3 } from "@axiom-lattice/client-sdk";
|
|
4218
4236
|
|
|
4219
4237
|
// src/components/Chat/WorkspaceResourceManager.tsx
|
|
4220
|
-
import { useMemo as
|
|
4238
|
+
import { useMemo as useMemo35, useEffect as useEffect53, useRef as useRef28, useState as useState77 } from "react";
|
|
4221
4239
|
import { FolderOpen as FolderOpen3, Activity as Activity4, Database as Database7, Plug as Plug2, Bot as Bot5, Wrench as Wrench2, Zap as Zap2, LogOut as LogOut3, Building2 as Building23, Key, Share2, History, Inbox as Inbox3, FlaskConical as FlaskConical3 } from "lucide-react";
|
|
4222
|
-
import { Modal as
|
|
4240
|
+
import { Modal as Modal21, Avatar as Avatar12, Popover as Popover3, Button as Button56 } from "antd";
|
|
4223
4241
|
|
|
4224
4242
|
// src/components/Chat/ColumnLayout.tsx
|
|
4225
4243
|
import { PanelLeft, X } from "lucide-react";
|
|
@@ -13445,11 +13463,11 @@ var ConfirmFeedback = ({
|
|
|
13445
13463
|
data,
|
|
13446
13464
|
interactive = true
|
|
13447
13465
|
}) => {
|
|
13448
|
-
const { message:
|
|
13466
|
+
const { message: message26, type, config, feedback, options } = data ?? {};
|
|
13449
13467
|
const { sendMessage } = useAgentChat();
|
|
13450
13468
|
const [clicked, setClicked] = useState36(false);
|
|
13451
13469
|
return /* @__PURE__ */ jsxs22(Space9, { direction: "vertical", style: { width: "100%" }, children: [
|
|
13452
|
-
/* @__PURE__ */ jsx31(MDResponse, { content:
|
|
13470
|
+
/* @__PURE__ */ jsx31(MDResponse, { content: message26 }),
|
|
13453
13471
|
options ? /* @__PURE__ */ jsx31(Space9, { style: { justifyContent: "flex-end", width: "100%" }, children: options?.map((option) => /* @__PURE__ */ jsx31(
|
|
13454
13472
|
Button17,
|
|
13455
13473
|
{
|
|
@@ -13772,7 +13790,7 @@ var useSideAppOpener = () => {
|
|
|
13772
13790
|
import { jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
13773
13791
|
var { Text: Text16 } = Typography16;
|
|
13774
13792
|
var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = true }) => {
|
|
13775
|
-
const { dataSource, message:
|
|
13793
|
+
const { dataSource, message: message26 } = data ?? {};
|
|
13776
13794
|
const [expandedRowKeys, setExpandedRowKeys] = useState38([]);
|
|
13777
13795
|
const openSideApp = useSideAppOpener();
|
|
13778
13796
|
const processedData = dataSource?.map((item, index) => ({
|
|
@@ -13871,7 +13889,7 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
|
|
|
13871
13889
|
type: "text/csv;charset=utf-8;"
|
|
13872
13890
|
});
|
|
13873
13891
|
const link = document.createElement("a");
|
|
13874
|
-
const filename = `${
|
|
13892
|
+
const filename = `${message26 || "data"}_${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.csv`;
|
|
13875
13893
|
link.href = URL.createObjectURL(blob);
|
|
13876
13894
|
link.download = filename;
|
|
13877
13895
|
document.body.appendChild(link);
|
|
@@ -13892,7 +13910,7 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
|
|
|
13892
13910
|
tableLayout: "fixed",
|
|
13893
13911
|
style: { width: "100% !important" },
|
|
13894
13912
|
title: () => /* @__PURE__ */ jsxs24(Flex, { justify: "space-between", align: "center", children: [
|
|
13895
|
-
/* @__PURE__ */ jsx33(Space11, { children: /* @__PURE__ */ jsx33(Text16, { strong: true, style: { fontSize: 16 }, children:
|
|
13913
|
+
/* @__PURE__ */ jsx33(Space11, { children: /* @__PURE__ */ jsx33(Text16, { strong: true, style: { fontSize: 16 }, children: message26 || "" }) }),
|
|
13896
13914
|
/* @__PURE__ */ jsxs24(Space11, { children: [
|
|
13897
13915
|
/* @__PURE__ */ jsx33(
|
|
13898
13916
|
Button19,
|
|
@@ -13914,8 +13932,8 @@ var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = t
|
|
|
13914
13932
|
onClick: () => {
|
|
13915
13933
|
openSideApp({
|
|
13916
13934
|
component_key: "generic_data_table",
|
|
13917
|
-
message:
|
|
13918
|
-
data: { dataSource, message:
|
|
13935
|
+
message: message26 || "",
|
|
13936
|
+
data: { dataSource, message: message26 }
|
|
13919
13937
|
});
|
|
13920
13938
|
},
|
|
13921
13939
|
children: /* @__PURE__ */ jsx33(ExpandAltOutlined, {})
|
|
@@ -15336,7 +15354,7 @@ var AttachmentsCard = ({
|
|
|
15336
15354
|
const { config } = useLatticeChatShellContext();
|
|
15337
15355
|
const baseURL = config.baseURL;
|
|
15338
15356
|
const fileBaseURL = `${baseURL}/api/assistants/${assistantId}/threads/${threadId}/sandbox/downloadfile?path=`;
|
|
15339
|
-
const { Text:
|
|
15357
|
+
const { Text: Text52 } = Typography21;
|
|
15340
15358
|
const [showAll, setShowAll] = useState42(false);
|
|
15341
15359
|
const openSideApp = useSideAppOpener();
|
|
15342
15360
|
const getStyles = () => {
|
|
@@ -15410,7 +15428,7 @@ var AttachmentsCard = ({
|
|
|
15410
15428
|
);
|
|
15411
15429
|
};
|
|
15412
15430
|
const renderFileDescription = (item) => /* @__PURE__ */ jsx43(Space16, { direction: "vertical", size: size === "small" ? 2 : 4, children: /* @__PURE__ */ jsx43(Space16, { children: /* @__PURE__ */ jsx43(
|
|
15413
|
-
|
|
15431
|
+
Text52,
|
|
15414
15432
|
{
|
|
15415
15433
|
type: "secondary",
|
|
15416
15434
|
style: {
|
|
@@ -15484,7 +15502,7 @@ var AttachmentsCard = ({
|
|
|
15484
15502
|
}
|
|
15485
15503
|
),
|
|
15486
15504
|
item.files && /* @__PURE__ */ jsxs31("div", { style: { paddingLeft: "12px" }, children: [
|
|
15487
|
-
/* @__PURE__ */ jsxs31(
|
|
15505
|
+
/* @__PURE__ */ jsxs31(Text52, { type: "secondary", style: { fontSize: "12px" }, children: [
|
|
15488
15506
|
"Contains ",
|
|
15489
15507
|
item.files.length,
|
|
15490
15508
|
" file(s)"
|
|
@@ -16323,7 +16341,7 @@ import {
|
|
|
16323
16341
|
} from "react";
|
|
16324
16342
|
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
16325
16343
|
var LazyBubble = ({
|
|
16326
|
-
message:
|
|
16344
|
+
message: message26,
|
|
16327
16345
|
renderContent,
|
|
16328
16346
|
autoLoadRightPanel
|
|
16329
16347
|
}) => {
|
|
@@ -16354,10 +16372,10 @@ var LazyBubble = ({
|
|
|
16354
16372
|
autoLoadRightPanel?.();
|
|
16355
16373
|
}, []);
|
|
16356
16374
|
const getPlaceholder = () => {
|
|
16357
|
-
const estimatedHeight =
|
|
16375
|
+
const estimatedHeight = message26.content ? Math.min(100, message26.content.length / 5) : 100;
|
|
16358
16376
|
return /* @__PURE__ */ jsx52("div", { style: { height: `${estimatedHeight}px`, minHeight: "50px" } });
|
|
16359
16377
|
};
|
|
16360
|
-
return /* @__PURE__ */ jsx52(ErrorBoundary, { children: /* @__PURE__ */ jsx52("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(
|
|
16378
|
+
return /* @__PURE__ */ jsx52(ErrorBoundary, { children: /* @__PURE__ */ jsx52("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message26) : getPlaceholder() }) });
|
|
16361
16379
|
};
|
|
16362
16380
|
var MemoizedBubbleList = memo(
|
|
16363
16381
|
({
|
|
@@ -16388,8 +16406,8 @@ var MessageList = ({
|
|
|
16388
16406
|
messageLengthRef.current = messages?.length;
|
|
16389
16407
|
}
|
|
16390
16408
|
}, [messages?.length]);
|
|
16391
|
-
const renderContent = useCallback24((
|
|
16392
|
-
const { content } =
|
|
16409
|
+
const renderContent = useCallback24((message26) => {
|
|
16410
|
+
const { content } = message26;
|
|
16393
16411
|
try {
|
|
16394
16412
|
const json = JSON.parse(content);
|
|
16395
16413
|
if (json.action && json.message) {
|
|
@@ -16397,7 +16415,7 @@ var MessageList = ({
|
|
|
16397
16415
|
}
|
|
16398
16416
|
} catch (error) {
|
|
16399
16417
|
}
|
|
16400
|
-
const tool_calls_md =
|
|
16418
|
+
const tool_calls_md = message26.tool_calls?.map((tool_call) => {
|
|
16401
16419
|
return `\`\`\`tool_call
|
|
16402
16420
|
${JSON.stringify(tool_call)}
|
|
16403
16421
|
\`\`\``;
|
|
@@ -16406,17 +16424,17 @@ ${JSON.stringify(tool_call)}
|
|
|
16406
16424
|
return /* @__PURE__ */ jsx52(Space19, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ jsx52(MDResponse, { content: content_md }) });
|
|
16407
16425
|
}, []);
|
|
16408
16426
|
const items = useMemo11(
|
|
16409
|
-
() => messages.map((
|
|
16410
|
-
key:
|
|
16411
|
-
role:
|
|
16427
|
+
() => messages.map((message26, index) => ({
|
|
16428
|
+
key: message26.id,
|
|
16429
|
+
role: message26.role,
|
|
16412
16430
|
typing: false,
|
|
16413
16431
|
content: /* @__PURE__ */ jsx52(
|
|
16414
16432
|
LazyBubble,
|
|
16415
16433
|
{
|
|
16416
|
-
message:
|
|
16434
|
+
message: message26,
|
|
16417
16435
|
renderContent,
|
|
16418
16436
|
autoLoadRightPanel: () => {
|
|
16419
|
-
const { content, role: role2 } =
|
|
16437
|
+
const { content, role: role2 } = message26;
|
|
16420
16438
|
const isNewAddedMessage = messageLengthRef.current > 1 && messageLengthRef.current + 1 === messages.length;
|
|
16421
16439
|
if (index === messages.length - 1 && isNewAddedMessage && role2 === "ai") {
|
|
16422
16440
|
try {
|
|
@@ -16764,7 +16782,7 @@ import { Space as Space22 } from "antd";
|
|
|
16764
16782
|
// src/components/Chat/TodoProgress.tsx
|
|
16765
16783
|
import { Popover, Tooltip as Tooltip6, Progress } from "antd";
|
|
16766
16784
|
import { jsx as jsx55, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
16767
|
-
var TodoProgress = (
|
|
16785
|
+
var TodoProgress = (_props) => {
|
|
16768
16786
|
const { openSideApp } = useChatUIContext();
|
|
16769
16787
|
const { todos } = useAgentChat();
|
|
16770
16788
|
if (!todos || todos.length === 0) {
|
|
@@ -16920,7 +16938,7 @@ var TodoProgress = ({}) => {
|
|
|
16920
16938
|
// src/components/Chat/TaskProgress.tsx
|
|
16921
16939
|
import { Tooltip as Tooltip7, Progress as Progress2 } from "antd";
|
|
16922
16940
|
import { jsx as jsx56, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
16923
|
-
var TaskProgress = (
|
|
16941
|
+
var TaskProgress = (_props) => {
|
|
16924
16942
|
const { tasks } = useAgentChat();
|
|
16925
16943
|
const { openSideApp } = useChatUIContext();
|
|
16926
16944
|
if (!tasks || tasks.length === 0) {
|
|
@@ -17083,7 +17101,7 @@ var ProgressTracker = () => {
|
|
|
17083
17101
|
import { Tooltip as Tooltip8, Button as Button30 } from "antd";
|
|
17084
17102
|
import { FileDoneOutlined } from "@ant-design/icons";
|
|
17085
17103
|
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
17086
|
-
var FileExplorerButton = (
|
|
17104
|
+
var FileExplorerButton = (_props) => {
|
|
17087
17105
|
const { agentState } = useAgentChat();
|
|
17088
17106
|
const { openSideApp } = useChatUIContext();
|
|
17089
17107
|
const files = agentState?.values?.files || [];
|
|
@@ -22903,12 +22921,12 @@ var formatDate3 = (timestamp) => {
|
|
|
22903
22921
|
});
|
|
22904
22922
|
};
|
|
22905
22923
|
var MailboxDetailModal = ({
|
|
22906
|
-
message:
|
|
22924
|
+
message: message26,
|
|
22907
22925
|
visible,
|
|
22908
22926
|
onClose
|
|
22909
22927
|
}) => {
|
|
22910
22928
|
const { styles } = useStyles14();
|
|
22911
|
-
if (!
|
|
22929
|
+
if (!message26) return null;
|
|
22912
22930
|
return /* @__PURE__ */ jsx86(
|
|
22913
22931
|
Modal15,
|
|
22914
22932
|
{
|
|
@@ -22931,12 +22949,12 @@ var MailboxDetailModal = ({
|
|
|
22931
22949
|
children: /* @__PURE__ */ jsxs63("div", { className: styles.modalContent, children: [
|
|
22932
22950
|
/* @__PURE__ */ jsxs63("div", { className: styles.header, children: [
|
|
22933
22951
|
/* @__PURE__ */ jsx86("div", { className: styles.messageIcon, children: /* @__PURE__ */ jsx86(Mail2, { size: 20 }) }),
|
|
22934
|
-
/* @__PURE__ */ jsx86(Text35, { className: styles.messageId, children:
|
|
22935
|
-
!
|
|
22952
|
+
/* @__PURE__ */ jsx86(Text35, { className: styles.messageId, children: message26.id }),
|
|
22953
|
+
!message26.read && /* @__PURE__ */ jsx86(Tag20, { color: "red", children: "Unread" })
|
|
22936
22954
|
] }),
|
|
22937
22955
|
/* @__PURE__ */ jsxs63(Title11, { level: 4, className: styles.title, children: [
|
|
22938
22956
|
"Message from ",
|
|
22939
|
-
|
|
22957
|
+
message26.from
|
|
22940
22958
|
] }),
|
|
22941
22959
|
/* @__PURE__ */ jsxs63("div", { className: styles.metaSection, children: [
|
|
22942
22960
|
/* @__PURE__ */ jsxs63("div", { className: styles.metaItem, children: [
|
|
@@ -22946,11 +22964,11 @@ var MailboxDetailModal = ({
|
|
|
22946
22964
|
"div",
|
|
22947
22965
|
{
|
|
22948
22966
|
className: styles.avatar,
|
|
22949
|
-
style: { background: getAvatarColor7(
|
|
22950
|
-
children: getInitials7(
|
|
22967
|
+
style: { background: getAvatarColor7(message26.from) },
|
|
22968
|
+
children: getInitials7(message26.from)
|
|
22951
22969
|
}
|
|
22952
22970
|
),
|
|
22953
|
-
/* @__PURE__ */ jsx86("span", { children:
|
|
22971
|
+
/* @__PURE__ */ jsx86("span", { children: message26.from })
|
|
22954
22972
|
] })
|
|
22955
22973
|
] }),
|
|
22956
22974
|
/* @__PURE__ */ jsxs63("div", { className: styles.metaItem, children: [
|
|
@@ -22960,29 +22978,29 @@ var MailboxDetailModal = ({
|
|
|
22960
22978
|
"div",
|
|
22961
22979
|
{
|
|
22962
22980
|
className: styles.avatar,
|
|
22963
|
-
style: { background: getAvatarColor7(
|
|
22964
|
-
children: getInitials7(
|
|
22981
|
+
style: { background: getAvatarColor7(message26.to) },
|
|
22982
|
+
children: getInitials7(message26.to)
|
|
22965
22983
|
}
|
|
22966
22984
|
),
|
|
22967
|
-
/* @__PURE__ */ jsx86("span", { children:
|
|
22985
|
+
/* @__PURE__ */ jsx86("span", { children: message26.to })
|
|
22968
22986
|
] })
|
|
22969
22987
|
] }),
|
|
22970
22988
|
/* @__PURE__ */ jsxs63("div", { className: styles.metaItem, children: [
|
|
22971
22989
|
/* @__PURE__ */ jsx86(Text35, { className: styles.metaLabel, children: "Time" }),
|
|
22972
22990
|
/* @__PURE__ */ jsxs63("div", { className: styles.metaValue, children: [
|
|
22973
22991
|
/* @__PURE__ */ jsx86(Calendar2, { size: 14 }),
|
|
22974
|
-
/* @__PURE__ */ jsx86("span", { children: formatDate3(
|
|
22992
|
+
/* @__PURE__ */ jsx86("span", { children: formatDate3(message26.timestamp) })
|
|
22975
22993
|
] })
|
|
22976
22994
|
] }),
|
|
22977
22995
|
/* @__PURE__ */ jsxs63("div", { className: styles.metaItem, children: [
|
|
22978
22996
|
/* @__PURE__ */ jsx86(Text35, { className: styles.metaLabel, children: "Type" }),
|
|
22979
|
-
/* @__PURE__ */ jsx86("div", { className: styles.metaValue, children: /* @__PURE__ */ jsx86(Tag20, { color:
|
|
22997
|
+
/* @__PURE__ */ jsx86("div", { className: styles.metaValue, children: /* @__PURE__ */ jsx86(Tag20, { color: message26.type === "broadcast" ? "blue" : "default", children: message26.type }) })
|
|
22980
22998
|
] })
|
|
22981
22999
|
] }),
|
|
22982
23000
|
/* @__PURE__ */ jsx86(Divider8, {}),
|
|
22983
23001
|
/* @__PURE__ */ jsxs63("div", { className: styles.contentSection, children: [
|
|
22984
23002
|
/* @__PURE__ */ jsx86(Text35, { className: styles.contentLabel, children: "Message Content" }),
|
|
22985
|
-
/* @__PURE__ */ jsx86("div", { className: styles.contentBox, children: /* @__PURE__ */ jsx86(Paragraph2, { className: styles.messageContent, children:
|
|
23003
|
+
/* @__PURE__ */ jsx86("div", { className: styles.contentBox, children: /* @__PURE__ */ jsx86(Paragraph2, { className: styles.messageContent, children: message26.content }) })
|
|
22986
23004
|
] })
|
|
22987
23005
|
] })
|
|
22988
23006
|
}
|
|
@@ -23211,26 +23229,26 @@ var MessageGroupComponent = ({ group, styles, defaultExpanded = true, onMessageC
|
|
|
23211
23229
|
]
|
|
23212
23230
|
}
|
|
23213
23231
|
),
|
|
23214
|
-
isExpanded && /* @__PURE__ */ jsx87("div", { className: styles.listGroupContent, children: group.messages.map((
|
|
23232
|
+
isExpanded && /* @__PURE__ */ jsx87("div", { className: styles.listGroupContent, children: group.messages.map((message26) => /* @__PURE__ */ jsxs64(
|
|
23215
23233
|
"div",
|
|
23216
23234
|
{
|
|
23217
|
-
className: `${styles.listItem} ${!
|
|
23218
|
-
onClick: () => onMessageClick(
|
|
23235
|
+
className: `${styles.listItem} ${!message26.read ? styles.listItemUnread : ""}`,
|
|
23236
|
+
onClick: () => onMessageClick(message26),
|
|
23219
23237
|
children: [
|
|
23220
|
-
/* @__PURE__ */ jsx87("div", { className: styles.listItemIcon, children: !
|
|
23238
|
+
/* @__PURE__ */ jsx87("div", { className: styles.listItemIcon, children: !message26.read ? /* @__PURE__ */ jsx87("div", { className: styles.unreadBadge }) : /* @__PURE__ */ jsx87(Circle2, { size: 8, style: { color: "#d9d9d9" } }) }),
|
|
23221
23239
|
/* @__PURE__ */ jsxs64("div", { className: styles.listItemContent, children: [
|
|
23222
|
-
/* @__PURE__ */ jsx87("span", { className: styles.listItemPreview, children: getMessagePreview(
|
|
23240
|
+
/* @__PURE__ */ jsx87("span", { className: styles.listItemPreview, children: getMessagePreview(message26.content) }),
|
|
23223
23241
|
/* @__PURE__ */ jsxs64("span", { className: styles.listItemMeta, children: [
|
|
23224
23242
|
"To: ",
|
|
23225
|
-
|
|
23243
|
+
message26.to,
|
|
23226
23244
|
" \u2022 ",
|
|
23227
|
-
|
|
23245
|
+
message26.type
|
|
23228
23246
|
] })
|
|
23229
23247
|
] }),
|
|
23230
|
-
/* @__PURE__ */ jsx87("div", { className: styles.listItemRight, children: /* @__PURE__ */ jsx87("span", { className: styles.listItemDate, children: formatDate4(
|
|
23248
|
+
/* @__PURE__ */ jsx87("div", { className: styles.listItemRight, children: /* @__PURE__ */ jsx87("span", { className: styles.listItemDate, children: formatDate4(message26.timestamp) }) })
|
|
23231
23249
|
]
|
|
23232
23250
|
},
|
|
23233
|
-
|
|
23251
|
+
message26.id
|
|
23234
23252
|
)) })
|
|
23235
23253
|
] });
|
|
23236
23254
|
};
|
|
@@ -23241,12 +23259,12 @@ var MailboxPanel = ({ data }) => {
|
|
|
23241
23259
|
const { teamMailbox = [] } = data || {};
|
|
23242
23260
|
const messageGroups = useMemo17(() => {
|
|
23243
23261
|
const groupsMap = /* @__PURE__ */ new Map();
|
|
23244
|
-
teamMailbox.forEach((
|
|
23245
|
-
const sender =
|
|
23262
|
+
teamMailbox.forEach((message26) => {
|
|
23263
|
+
const sender = message26.from;
|
|
23246
23264
|
if (!groupsMap.has(sender)) {
|
|
23247
23265
|
groupsMap.set(sender, []);
|
|
23248
23266
|
}
|
|
23249
|
-
groupsMap.get(sender).push(
|
|
23267
|
+
groupsMap.get(sender).push(message26);
|
|
23250
23268
|
});
|
|
23251
23269
|
const groups = Array.from(groupsMap.entries()).map(([sender, messages]) => ({
|
|
23252
23270
|
sender,
|
|
@@ -23263,8 +23281,8 @@ var MailboxPanel = ({ data }) => {
|
|
|
23263
23281
|
return groups;
|
|
23264
23282
|
}, [teamMailbox]);
|
|
23265
23283
|
const totalUnread = teamMailbox.filter((m) => !m.read).length;
|
|
23266
|
-
const handleMessageClick = (
|
|
23267
|
-
setSelectedMessage(
|
|
23284
|
+
const handleMessageClick = (message26) => {
|
|
23285
|
+
setSelectedMessage(message26);
|
|
23268
23286
|
setModalVisible(true);
|
|
23269
23287
|
};
|
|
23270
23288
|
const handleCloseModal = () => {
|
|
@@ -25108,11 +25126,11 @@ var StreamingHTMLRenderer = ({
|
|
|
25108
25126
|
if (!iframe || event.source !== iframe.contentWindow) {
|
|
25109
25127
|
return;
|
|
25110
25128
|
}
|
|
25111
|
-
const
|
|
25112
|
-
if (!
|
|
25129
|
+
const message26 = event.data;
|
|
25130
|
+
if (!message26 || typeof message26 !== "object") {
|
|
25113
25131
|
return;
|
|
25114
25132
|
}
|
|
25115
|
-
switch (
|
|
25133
|
+
switch (message26.type) {
|
|
25116
25134
|
case "iframe-ready":
|
|
25117
25135
|
console.log("[StreamingHTMLRenderer] Iframe ready");
|
|
25118
25136
|
isReadyRef.current = true;
|
|
@@ -25127,25 +25145,26 @@ var StreamingHTMLRenderer = ({
|
|
|
25127
25145
|
}
|
|
25128
25146
|
break;
|
|
25129
25147
|
case "iframe-height":
|
|
25130
|
-
if (typeof
|
|
25131
|
-
setIframeHeight(
|
|
25148
|
+
if (typeof message26.height === "number" && message26.height > 0) {
|
|
25149
|
+
setIframeHeight(message26.height);
|
|
25132
25150
|
}
|
|
25133
25151
|
break;
|
|
25134
|
-
case "iframe-error":
|
|
25152
|
+
case "iframe-error": {
|
|
25135
25153
|
const streamingError = {
|
|
25136
25154
|
type: "RENDER_ERROR",
|
|
25137
|
-
message:
|
|
25155
|
+
message: message26.error || "Unknown iframe error"
|
|
25138
25156
|
};
|
|
25139
25157
|
onError?.(streamingError);
|
|
25140
25158
|
break;
|
|
25159
|
+
}
|
|
25141
25160
|
case "widget-prompt":
|
|
25142
|
-
if (typeof
|
|
25143
|
-
onPrompt?.(
|
|
25161
|
+
if (typeof message26.text === "string") {
|
|
25162
|
+
onPrompt?.(message26.text);
|
|
25144
25163
|
}
|
|
25145
25164
|
break;
|
|
25146
25165
|
case "widget-open-link":
|
|
25147
|
-
if (typeof
|
|
25148
|
-
window.open(
|
|
25166
|
+
if (typeof message26.url === "string") {
|
|
25167
|
+
window.open(message26.url, "_blank", "noopener,noreferrer");
|
|
25149
25168
|
}
|
|
25150
25169
|
break;
|
|
25151
25170
|
}
|
|
@@ -25517,7 +25536,7 @@ import { jsx as jsx95 } from "react/jsx-runtime";
|
|
|
25517
25536
|
var ReactInfographic = (props) => {
|
|
25518
25537
|
const { children } = props;
|
|
25519
25538
|
const $container = useRef21(null);
|
|
25520
|
-
|
|
25539
|
+
const infographicInstance = useRef21(null);
|
|
25521
25540
|
useEffect41(() => {
|
|
25522
25541
|
if ($container.current) {
|
|
25523
25542
|
infographicInstance.current = new Infographic({
|
|
@@ -28262,8 +28281,8 @@ var TopologyRuntimeView = () => {
|
|
|
28262
28281
|
setRuns((prev) => prev.filter((r) => r.id !== runId));
|
|
28263
28282
|
setSelectedRun((prev) => prev?.id === runId ? null : prev);
|
|
28264
28283
|
} catch (err) {
|
|
28265
|
-
const
|
|
28266
|
-
setError(
|
|
28284
|
+
const message26 = err instanceof Error ? err.message : "Failed to delete run";
|
|
28285
|
+
setError(message26);
|
|
28267
28286
|
}
|
|
28268
28287
|
}, [del]);
|
|
28269
28288
|
const refreshRuns = useCallback36(async () => {
|
|
@@ -28700,7 +28719,7 @@ var CreateWorkflowModal = ({
|
|
|
28700
28719
|
const values = await form.validateFields();
|
|
28701
28720
|
const purpose = (values.purpose || "").trim();
|
|
28702
28721
|
const name = extractName(purpose);
|
|
28703
|
-
const id = `wf-${shortHash(purpose)}`;
|
|
28722
|
+
const id = `wf-${shortHash(purpose + Date.now())}`;
|
|
28704
28723
|
const graphDefinition = type === "workflow" ? {
|
|
28705
28724
|
key: id,
|
|
28706
28725
|
name,
|
|
@@ -28844,7 +28863,7 @@ var MIDDLEWARE_COLORS = {
|
|
|
28844
28863
|
};
|
|
28845
28864
|
var DEFAULT_MW_COLOR = { bg: "rgba(107,114,128,0.08)", text: "#4b5563", border: "rgba(107,114,128,0.2)" };
|
|
28846
28865
|
function getToolAcronym(name) {
|
|
28847
|
-
const parts = name.split(/[_
|
|
28866
|
+
const parts = name.split(/[_-]+/).filter(Boolean);
|
|
28848
28867
|
if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
|
|
28849
28868
|
return parts.map((p) => p[0]).join("").toUpperCase().slice(0, 2);
|
|
28850
28869
|
}
|
|
@@ -30898,10 +30917,10 @@ var EvalPanel = () => {
|
|
|
30898
30917
|
};
|
|
30899
30918
|
|
|
30900
30919
|
// src/components/Chat/PersonalAssistantPage.tsx
|
|
30901
|
-
import { useEffect as
|
|
30902
|
-
import { Card as Card29, Button as
|
|
30903
|
-
import { createStyles as
|
|
30904
|
-
import { Bot as Bot4, Sparkles as Sparkles3, ArrowRight as ArrowRight4, ArrowLeft as ArrowLeft3, Smile, Zap, Heart, Lightbulb, Edit3, MoreHorizontal, Trash2 as
|
|
30920
|
+
import { useEffect as useEffect51, useState as useState75, useCallback as useCallback39, useRef as useRef27 } from "react";
|
|
30921
|
+
import { Card as Card29, Button as Button55, Input as Input17, Typography as Typography60, message as message19, Dropdown as Dropdown3, Modal as Modal20 } from "antd";
|
|
30922
|
+
import { createStyles as createStyles36 } from "antd-style";
|
|
30923
|
+
import { Bot as Bot4, Sparkles as Sparkles3, ArrowRight as ArrowRight4, ArrowLeft as ArrowLeft3, Smile, Zap, Heart, Lightbulb, Edit3, MoreHorizontal, Link2 as Link23, Trash2 as Trash29 } from "lucide-react";
|
|
30905
30924
|
import { Client as Client2 } from "@axiom-lattice/client-sdk";
|
|
30906
30925
|
|
|
30907
30926
|
// src/components/Chat/LatticeAgentWorkspace.tsx
|
|
@@ -30913,10 +30932,911 @@ var LatticeAgentWorkspace = ({
|
|
|
30913
30932
|
...chatProps
|
|
30914
30933
|
}) => /* @__PURE__ */ jsx117(WorkspaceContextProvider, { workspaceId, projectId, children: /* @__PURE__ */ jsx117(AssistantContextProvider, { autoLoad: true, initialAssistantId: assistant_id, children: /* @__PURE__ */ jsx117(LatticeChat, { showProjectSelector: false, assistant_id, ...chatProps }) }) });
|
|
30915
30934
|
|
|
30916
|
-
// src/components/Chat/
|
|
30935
|
+
// src/components/Chat/PersonalAssistantChannelModal.tsx
|
|
30936
|
+
import { useEffect as useEffect50, useState as useState74, useCallback as useCallback38, useMemo as useMemo32, useRef as useRef26 } from "react";
|
|
30937
|
+
import {
|
|
30938
|
+
Button as Button54,
|
|
30939
|
+
Form as Form9,
|
|
30940
|
+
Input as Input16,
|
|
30941
|
+
Modal as Modal19,
|
|
30942
|
+
Popconfirm as Popconfirm11,
|
|
30943
|
+
Spin as Spin20,
|
|
30944
|
+
Switch as Switch4,
|
|
30945
|
+
Typography as Typography59,
|
|
30946
|
+
message as message18,
|
|
30947
|
+
Select as Select8,
|
|
30948
|
+
QRCode
|
|
30949
|
+
} from "antd";
|
|
30950
|
+
import { createStyles as createStyles35 } from "antd-style";
|
|
30951
|
+
import { Trash2 as Trash28, X as X2, Link2 as Link22, User as User6, UserPlus } from "lucide-react";
|
|
30917
30952
|
import { Fragment as Fragment23, jsx as jsx118, jsxs as jsxs85 } from "react/jsx-runtime";
|
|
30918
|
-
var {
|
|
30953
|
+
var { Text: Text48 } = Typography59;
|
|
30954
|
+
var AVATAR_COLORS = [
|
|
30955
|
+
"var(--color-primary, #6366f1)",
|
|
30956
|
+
"var(--color-success, #22c55e)",
|
|
30957
|
+
"var(--color-warning, #f59e0b)",
|
|
30958
|
+
"var(--color-error, #ef4444)"
|
|
30959
|
+
];
|
|
30960
|
+
var CHANNEL_LABEL_MAP = {
|
|
30961
|
+
lark: "Feishu / Lark",
|
|
30962
|
+
wechat: "WeChat / \u5FAE\u4FE1"
|
|
30963
|
+
};
|
|
30964
|
+
var channelOptions = [
|
|
30965
|
+
{ value: "lark", label: "Feishu / Lark" },
|
|
30966
|
+
{ value: "wechat", label: "WeChat / \u5FAE\u4FE1" }
|
|
30967
|
+
];
|
|
30919
30968
|
var useStyles19 = createStyles35(({ css, token }) => ({
|
|
30969
|
+
body: css`
|
|
30970
|
+
display: flex;
|
|
30971
|
+
height: 460px;
|
|
30972
|
+
`,
|
|
30973
|
+
leftPanel: css`
|
|
30974
|
+
width: 240px;
|
|
30975
|
+
flex-shrink: 0;
|
|
30976
|
+
display: flex;
|
|
30977
|
+
flex-direction: column;
|
|
30978
|
+
overflow: hidden;
|
|
30979
|
+
`,
|
|
30980
|
+
leftHeader: css`
|
|
30981
|
+
padding: 14px 16px 10px;
|
|
30982
|
+
flex-shrink: 0;
|
|
30983
|
+
`,
|
|
30984
|
+
leftHeaderText: css`
|
|
30985
|
+
font-size: 12px;
|
|
30986
|
+
font-weight: 600;
|
|
30987
|
+
color: ${token.colorTextSecondary};
|
|
30988
|
+
text-transform: uppercase;
|
|
30989
|
+
letter-spacing: 0.5px;
|
|
30990
|
+
`,
|
|
30991
|
+
channelList: css`
|
|
30992
|
+
flex: 1;
|
|
30993
|
+
overflow-y: auto;
|
|
30994
|
+
padding: 0 8px;
|
|
30995
|
+
`,
|
|
30996
|
+
channelItem: css`
|
|
30997
|
+
display: flex;
|
|
30998
|
+
align-items: center;
|
|
30999
|
+
gap: 10px;
|
|
31000
|
+
padding: 10px 12px;
|
|
31001
|
+
border-radius: 10px;
|
|
31002
|
+
cursor: pointer;
|
|
31003
|
+
transition: background 0.15s;
|
|
31004
|
+
margin-bottom: 2px;
|
|
31005
|
+
position: relative;
|
|
31006
|
+
&:hover {
|
|
31007
|
+
background: ${token.colorBgTextHover};
|
|
31008
|
+
}
|
|
31009
|
+
`,
|
|
31010
|
+
channelItemSelected: css`
|
|
31011
|
+
background: ${token.colorPrimaryBg};
|
|
31012
|
+
&::before {
|
|
31013
|
+
content: '';
|
|
31014
|
+
position: absolute;
|
|
31015
|
+
left: 0;
|
|
31016
|
+
top: 50%;
|
|
31017
|
+
transform: translateY(-50%);
|
|
31018
|
+
width: 3px;
|
|
31019
|
+
height: 28px;
|
|
31020
|
+
background: ${token.colorPrimary};
|
|
31021
|
+
border-radius: 0 3px 3px 0;
|
|
31022
|
+
}
|
|
31023
|
+
`,
|
|
31024
|
+
channelAvatar: css`
|
|
31025
|
+
width: 36px;
|
|
31026
|
+
height: 36px;
|
|
31027
|
+
border-radius: 50%;
|
|
31028
|
+
color: #fff;
|
|
31029
|
+
display: flex;
|
|
31030
|
+
align-items: center;
|
|
31031
|
+
justify-content: center;
|
|
31032
|
+
font-size: 16px;
|
|
31033
|
+
font-weight: 600;
|
|
31034
|
+
flex-shrink: 0;
|
|
31035
|
+
`,
|
|
31036
|
+
channelInfo: css`
|
|
31037
|
+
flex: 1;
|
|
31038
|
+
min-width: 0;
|
|
31039
|
+
`,
|
|
31040
|
+
channelName: css`
|
|
31041
|
+
font-size: 13px;
|
|
31042
|
+
font-weight: 500;
|
|
31043
|
+
color: ${token.colorText};
|
|
31044
|
+
overflow: hidden;
|
|
31045
|
+
text-overflow: ellipsis;
|
|
31046
|
+
white-space: nowrap;
|
|
31047
|
+
`,
|
|
31048
|
+
channelType: css`
|
|
31049
|
+
font-size: 11px;
|
|
31050
|
+
color: ${token.colorTextTertiary};
|
|
31051
|
+
`,
|
|
31052
|
+
channelDisabled: css`
|
|
31053
|
+
opacity: 0.45;
|
|
31054
|
+
`,
|
|
31055
|
+
statusDot: css`
|
|
31056
|
+
width: 8px;
|
|
31057
|
+
height: 8px;
|
|
31058
|
+
border-radius: 50%;
|
|
31059
|
+
flex-shrink: 0;
|
|
31060
|
+
margin-left: auto;
|
|
31061
|
+
transition: background 0.2s;
|
|
31062
|
+
`,
|
|
31063
|
+
addChannelBtn: css`
|
|
31064
|
+
margin: 8px;
|
|
31065
|
+
flex-shrink: 0;
|
|
31066
|
+
`,
|
|
31067
|
+
rightPanel: css`
|
|
31068
|
+
flex: 1;
|
|
31069
|
+
display: flex;
|
|
31070
|
+
flex-direction: column;
|
|
31071
|
+
overflow: hidden;
|
|
31072
|
+
`,
|
|
31073
|
+
rightBody: css`
|
|
31074
|
+
flex: 1;
|
|
31075
|
+
padding: 20px 24px;
|
|
31076
|
+
overflow-y: auto;
|
|
31077
|
+
`,
|
|
31078
|
+
emptyState: css`
|
|
31079
|
+
display: flex;
|
|
31080
|
+
flex-direction: column;
|
|
31081
|
+
align-items: center;
|
|
31082
|
+
justify-content: center;
|
|
31083
|
+
height: 100%;
|
|
31084
|
+
text-align: center;
|
|
31085
|
+
`,
|
|
31086
|
+
formSectionTitle: css`
|
|
31087
|
+
font-size: 14px;
|
|
31088
|
+
font-weight: 600;
|
|
31089
|
+
margin-bottom: 16px;
|
|
31090
|
+
`,
|
|
31091
|
+
bindingSection: css`
|
|
31092
|
+
margin-top: 20px;
|
|
31093
|
+
padding: 14px;
|
|
31094
|
+
border: 1px dashed ${token.colorBorder};
|
|
31095
|
+
border-radius: ${token.borderRadius}px;
|
|
31096
|
+
background: ${token.colorBgLayout};
|
|
31097
|
+
`,
|
|
31098
|
+
bindingHeader: css`
|
|
31099
|
+
font-size: 13px;
|
|
31100
|
+
font-weight: 600;
|
|
31101
|
+
margin-bottom: 4px;
|
|
31102
|
+
`,
|
|
31103
|
+
bindingHint: css`
|
|
31104
|
+
font-size: 12px;
|
|
31105
|
+
color: ${token.colorTextTertiary};
|
|
31106
|
+
margin-bottom: 10px;
|
|
31107
|
+
`,
|
|
31108
|
+
contactItem: css`
|
|
31109
|
+
display: flex;
|
|
31110
|
+
align-items: center;
|
|
31111
|
+
gap: 10px;
|
|
31112
|
+
padding: 8px 10px;
|
|
31113
|
+
border-radius: 8px;
|
|
31114
|
+
transition: background 0.15s;
|
|
31115
|
+
&:hover {
|
|
31116
|
+
background: ${token.colorBgTextHover};
|
|
31117
|
+
}
|
|
31118
|
+
`,
|
|
31119
|
+
contactAvatar: css`
|
|
31120
|
+
width: 32px;
|
|
31121
|
+
height: 32px;
|
|
31122
|
+
border-radius: 50%;
|
|
31123
|
+
background: ${token.colorFill};
|
|
31124
|
+
color: ${token.colorTextSecondary};
|
|
31125
|
+
display: flex;
|
|
31126
|
+
align-items: center;
|
|
31127
|
+
justify-content: center;
|
|
31128
|
+
flex-shrink: 0;
|
|
31129
|
+
`,
|
|
31130
|
+
contactInfo: css`
|
|
31131
|
+
flex: 1;
|
|
31132
|
+
min-width: 0;
|
|
31133
|
+
`,
|
|
31134
|
+
contactName: css`
|
|
31135
|
+
font-size: 13px;
|
|
31136
|
+
color: ${token.colorText};
|
|
31137
|
+
`,
|
|
31138
|
+
contactId: css`
|
|
31139
|
+
font-size: 11px;
|
|
31140
|
+
color: ${token.colorTextTertiary};
|
|
31141
|
+
`,
|
|
31142
|
+
addBindingRow: css`
|
|
31143
|
+
display: flex;
|
|
31144
|
+
gap: 8px;
|
|
31145
|
+
align-items: center;
|
|
31146
|
+
margin-top: 8px;
|
|
31147
|
+
`,
|
|
31148
|
+
footer: css`
|
|
31149
|
+
display: flex;
|
|
31150
|
+
justify-content: space-between;
|
|
31151
|
+
align-items: center;
|
|
31152
|
+
padding: 12px 24px;
|
|
31153
|
+
border-top: 1px solid ${token.colorBorderSecondary};
|
|
31154
|
+
flex-shrink: 0;
|
|
31155
|
+
`
|
|
31156
|
+
}));
|
|
31157
|
+
var PersonalAssistantChannelModal = ({
|
|
31158
|
+
assistantId,
|
|
31159
|
+
open,
|
|
31160
|
+
onClose
|
|
31161
|
+
}) => {
|
|
31162
|
+
const { styles, cx } = useStyles19();
|
|
31163
|
+
const { get, post, put, del } = useApi();
|
|
31164
|
+
const { personalAssistant } = useAuth();
|
|
31165
|
+
const projectId = personalAssistant?.projectId || "default";
|
|
31166
|
+
const workspaceId = personalAssistant?.workspaceId || "default";
|
|
31167
|
+
const [loading, setLoading] = useState74(false);
|
|
31168
|
+
const [installations, setInstallations] = useState74([]);
|
|
31169
|
+
const [selectedId, setSelectedId] = useState74(null);
|
|
31170
|
+
const [formMode, setFormMode] = useState74("view");
|
|
31171
|
+
const [selectedChannel, setSelectedChannel] = useState74("lark");
|
|
31172
|
+
const [form] = Form9.useForm();
|
|
31173
|
+
const [allowOthers, setAllowOthers] = useState74(true);
|
|
31174
|
+
const [saving, setSaving] = useState74(false);
|
|
31175
|
+
const [togglingId, setTogglingId] = useState74(null);
|
|
31176
|
+
const [bindings, setBindings] = useState74([]);
|
|
31177
|
+
const [bindingsLoading, setBindingsLoading] = useState74(false);
|
|
31178
|
+
const [bindingForm] = Form9.useForm();
|
|
31179
|
+
const [addingBinding, setAddingBinding] = useState74(false);
|
|
31180
|
+
const [qrLoading, setQrLoading] = useState74(false);
|
|
31181
|
+
const [qrCodeUrl, setQrCodeUrl] = useState74(null);
|
|
31182
|
+
const [qrStatus, setQrStatus] = useState74("idle");
|
|
31183
|
+
const qrCodeRef = useRef26(null);
|
|
31184
|
+
const qrPollRef = useRef26(null);
|
|
31185
|
+
const clearQrPoll = useCallback38(() => {
|
|
31186
|
+
if (qrPollRef.current) {
|
|
31187
|
+
clearInterval(qrPollRef.current);
|
|
31188
|
+
qrPollRef.current = null;
|
|
31189
|
+
}
|
|
31190
|
+
}, []);
|
|
31191
|
+
const resetQrState = useCallback38(() => {
|
|
31192
|
+
clearQrPoll();
|
|
31193
|
+
setQrLoading(false);
|
|
31194
|
+
setQrCodeUrl(null);
|
|
31195
|
+
setQrStatus("idle");
|
|
31196
|
+
qrCodeRef.current = null;
|
|
31197
|
+
}, [clearQrPoll]);
|
|
31198
|
+
const fetchQrCode = useCallback38(async () => {
|
|
31199
|
+
setQrLoading(true);
|
|
31200
|
+
setQrStatus("loading");
|
|
31201
|
+
setQrCodeUrl(null);
|
|
31202
|
+
try {
|
|
31203
|
+
const res = await get(
|
|
31204
|
+
"/api/channels/wechat/setup/qrcode"
|
|
31205
|
+
);
|
|
31206
|
+
if (res.success && res.data) {
|
|
31207
|
+
qrCodeRef.current = res.data.qrcode;
|
|
31208
|
+
setQrCodeUrl(res.data.qrcodeImgUrl);
|
|
31209
|
+
setQrStatus("wait");
|
|
31210
|
+
clearQrPoll();
|
|
31211
|
+
qrPollRef.current = setInterval(async () => {
|
|
31212
|
+
try {
|
|
31213
|
+
const statusRes = await get(`/api/channels/wechat/setup/status?qrcode=${encodeURIComponent(qrCodeRef.current)}`);
|
|
31214
|
+
if (statusRes.success && statusRes.data) {
|
|
31215
|
+
const s = statusRes.data.status;
|
|
31216
|
+
if (s === "confirmed" && statusRes.data.botToken) {
|
|
31217
|
+
setQrStatus("confirmed");
|
|
31218
|
+
clearQrPoll();
|
|
31219
|
+
form.setFieldsValue({
|
|
31220
|
+
botToken: statusRes.data.botToken,
|
|
31221
|
+
uin: statusRes.data.uin
|
|
31222
|
+
});
|
|
31223
|
+
message18.success("WeChat login confirmed!");
|
|
31224
|
+
} else if (s === "expired") {
|
|
31225
|
+
setQrStatus("expired");
|
|
31226
|
+
clearQrPoll();
|
|
31227
|
+
} else if (s === "scaned") {
|
|
31228
|
+
setQrStatus("scaned");
|
|
31229
|
+
} else if (s === "wait") {
|
|
31230
|
+
setQrStatus("wait");
|
|
31231
|
+
}
|
|
31232
|
+
}
|
|
31233
|
+
} catch {
|
|
31234
|
+
}
|
|
31235
|
+
}, 2e3);
|
|
31236
|
+
} else {
|
|
31237
|
+
setQrStatus("error");
|
|
31238
|
+
message18.error("Failed to get QR code");
|
|
31239
|
+
}
|
|
31240
|
+
} catch {
|
|
31241
|
+
setQrStatus("error");
|
|
31242
|
+
message18.error("Failed to get QR code");
|
|
31243
|
+
} finally {
|
|
31244
|
+
setQrLoading(false);
|
|
31245
|
+
}
|
|
31246
|
+
}, [get, clearQrPoll, form]);
|
|
31247
|
+
useEffect50(() => {
|
|
31248
|
+
return () => {
|
|
31249
|
+
if (qrPollRef.current) clearInterval(qrPollRef.current);
|
|
31250
|
+
};
|
|
31251
|
+
}, []);
|
|
31252
|
+
const loadInstallations = useCallback38(async () => {
|
|
31253
|
+
setLoading(true);
|
|
31254
|
+
try {
|
|
31255
|
+
const res = await get("/api/channel-installations");
|
|
31256
|
+
if (res.success) {
|
|
31257
|
+
setInstallations(res.data?.records ?? []);
|
|
31258
|
+
} else {
|
|
31259
|
+
message18.error(res.message || "Failed to load channel installations");
|
|
31260
|
+
}
|
|
31261
|
+
} catch {
|
|
31262
|
+
message18.error("Failed to load channel installations");
|
|
31263
|
+
} finally {
|
|
31264
|
+
setLoading(false);
|
|
31265
|
+
}
|
|
31266
|
+
}, [get]);
|
|
31267
|
+
const loadBindings = useCallback38(async (installationId) => {
|
|
31268
|
+
setBindingsLoading(true);
|
|
31269
|
+
try {
|
|
31270
|
+
const res = await get(`/api/channel-bindings?channelInstallationId=${installationId}`);
|
|
31271
|
+
if (res.success) {
|
|
31272
|
+
setBindings(res.data?.records ?? []);
|
|
31273
|
+
} else {
|
|
31274
|
+
message18.error(res.message || "Failed to load bindings");
|
|
31275
|
+
}
|
|
31276
|
+
} catch (error) {
|
|
31277
|
+
console.error("Failed to load bindings:", error);
|
|
31278
|
+
message18.error("Failed to load bindings");
|
|
31279
|
+
} finally {
|
|
31280
|
+
setBindingsLoading(false);
|
|
31281
|
+
}
|
|
31282
|
+
}, [get]);
|
|
31283
|
+
useEffect50(() => {
|
|
31284
|
+
if (open) {
|
|
31285
|
+
loadInstallations();
|
|
31286
|
+
resetState();
|
|
31287
|
+
}
|
|
31288
|
+
}, [open, loadInstallations]);
|
|
31289
|
+
const resetState = () => {
|
|
31290
|
+
setSelectedId(null);
|
|
31291
|
+
setFormMode("view");
|
|
31292
|
+
setSelectedChannel("lark");
|
|
31293
|
+
form.resetFields();
|
|
31294
|
+
bindingForm.resetFields();
|
|
31295
|
+
setBindings([]);
|
|
31296
|
+
setAllowOthers(true);
|
|
31297
|
+
setAddingBinding(false);
|
|
31298
|
+
resetQrState();
|
|
31299
|
+
};
|
|
31300
|
+
const handleToggleEnabled = async (installation) => {
|
|
31301
|
+
const newEnabled = !installation.enabled;
|
|
31302
|
+
setTogglingId(installation.id);
|
|
31303
|
+
try {
|
|
31304
|
+
const res = await put(
|
|
31305
|
+
`/api/channel-installations/${installation.id}`,
|
|
31306
|
+
{ enabled: newEnabled }
|
|
31307
|
+
);
|
|
31308
|
+
if (res.success) {
|
|
31309
|
+
setInstallations(
|
|
31310
|
+
(prev) => prev.map((i) => i.id === installation.id ? { ...i, enabled: newEnabled } : i)
|
|
31311
|
+
);
|
|
31312
|
+
message18.success(newEnabled ? "Channel enabled" : "Channel disabled");
|
|
31313
|
+
} else {
|
|
31314
|
+
message18.error(res.message || "Failed to toggle channel");
|
|
31315
|
+
}
|
|
31316
|
+
} catch {
|
|
31317
|
+
message18.error("Failed to toggle channel");
|
|
31318
|
+
} finally {
|
|
31319
|
+
setTogglingId(null);
|
|
31320
|
+
}
|
|
31321
|
+
};
|
|
31322
|
+
const selectChannel = (installation) => {
|
|
31323
|
+
setSelectedId(installation.id);
|
|
31324
|
+
setFormMode("edit");
|
|
31325
|
+
setSelectedChannel(installation.channel);
|
|
31326
|
+
setAllowOthers(!installation.rejectWhenNoBinding);
|
|
31327
|
+
if (installation.channel === "lark") {
|
|
31328
|
+
form.setFieldsValue({
|
|
31329
|
+
name: installation.name,
|
|
31330
|
+
appId: installation.config.appId,
|
|
31331
|
+
appSecret: installation.config.appSecret,
|
|
31332
|
+
verificationToken: installation.config.verificationToken,
|
|
31333
|
+
encryptKey: installation.config.encryptKey
|
|
31334
|
+
});
|
|
31335
|
+
} else if (installation.channel === "wechat") {
|
|
31336
|
+
form.setFieldsValue({
|
|
31337
|
+
name: installation.name,
|
|
31338
|
+
botToken: installation.config.botToken,
|
|
31339
|
+
uin: installation.config.uin
|
|
31340
|
+
});
|
|
31341
|
+
}
|
|
31342
|
+
loadBindings(installation.id);
|
|
31343
|
+
};
|
|
31344
|
+
const openCreateForm = () => {
|
|
31345
|
+
setSelectedId(null);
|
|
31346
|
+
setFormMode("create");
|
|
31347
|
+
setSelectedChannel("lark");
|
|
31348
|
+
setBindings([]);
|
|
31349
|
+
setAllowOthers(true);
|
|
31350
|
+
form.resetFields();
|
|
31351
|
+
bindingForm.resetFields();
|
|
31352
|
+
setAddingBinding(false);
|
|
31353
|
+
resetQrState();
|
|
31354
|
+
};
|
|
31355
|
+
const cancelForm = () => {
|
|
31356
|
+
if (formMode === "edit") {
|
|
31357
|
+
setSelectedId(null);
|
|
31358
|
+
}
|
|
31359
|
+
setFormMode("view");
|
|
31360
|
+
setBindings([]);
|
|
31361
|
+
form.resetFields();
|
|
31362
|
+
bindingForm.resetFields();
|
|
31363
|
+
setAddingBinding(false);
|
|
31364
|
+
resetQrState();
|
|
31365
|
+
};
|
|
31366
|
+
const handleAddBinding = async () => {
|
|
31367
|
+
if (!selectedId) return;
|
|
31368
|
+
setAddingBinding(true);
|
|
31369
|
+
try {
|
|
31370
|
+
const values = await bindingForm.validateFields();
|
|
31371
|
+
const res = await post(
|
|
31372
|
+
"/api/channel-bindings",
|
|
31373
|
+
{
|
|
31374
|
+
channel: selectedChannel,
|
|
31375
|
+
channelInstallationId: selectedId,
|
|
31376
|
+
senderId: values.senderId,
|
|
31377
|
+
agentId: assistantId,
|
|
31378
|
+
senderDisplayName: values.senderDisplayName || void 0,
|
|
31379
|
+
workspaceId,
|
|
31380
|
+
projectId
|
|
31381
|
+
}
|
|
31382
|
+
);
|
|
31383
|
+
if (res.success && res.data) {
|
|
31384
|
+
setBindings((prev) => [...prev, res.data]);
|
|
31385
|
+
bindingForm.resetFields();
|
|
31386
|
+
message18.success("Binding added");
|
|
31387
|
+
} else {
|
|
31388
|
+
message18.error(res.message || "Failed to add binding");
|
|
31389
|
+
}
|
|
31390
|
+
} catch (error) {
|
|
31391
|
+
console.error("Failed to add binding:", error);
|
|
31392
|
+
message18.error("Failed to add binding");
|
|
31393
|
+
} finally {
|
|
31394
|
+
setAddingBinding(false);
|
|
31395
|
+
}
|
|
31396
|
+
};
|
|
31397
|
+
const handleDeleteBinding = async (bindingId) => {
|
|
31398
|
+
try {
|
|
31399
|
+
const res = await del(`/api/channel-bindings/${bindingId}`);
|
|
31400
|
+
if (res.success) {
|
|
31401
|
+
setBindings((prev) => prev.filter((b) => b.id !== bindingId));
|
|
31402
|
+
message18.success("Binding removed");
|
|
31403
|
+
} else {
|
|
31404
|
+
message18.error(res.message || "Failed to remove binding");
|
|
31405
|
+
}
|
|
31406
|
+
} catch {
|
|
31407
|
+
message18.error("Failed to remove binding");
|
|
31408
|
+
}
|
|
31409
|
+
};
|
|
31410
|
+
const handleSave = async () => {
|
|
31411
|
+
try {
|
|
31412
|
+
const values = await form.validateFields();
|
|
31413
|
+
setSaving(true);
|
|
31414
|
+
const config = selectedChannel === "lark" ? {
|
|
31415
|
+
appId: values.appId,
|
|
31416
|
+
appSecret: values.appSecret,
|
|
31417
|
+
verificationToken: values.verificationToken,
|
|
31418
|
+
encryptKey: values.encryptKey,
|
|
31419
|
+
assistantId
|
|
31420
|
+
} : {
|
|
31421
|
+
botToken: values.botToken,
|
|
31422
|
+
uin: values.uin
|
|
31423
|
+
};
|
|
31424
|
+
if (formMode === "edit" && selectedId) {
|
|
31425
|
+
const res = await put(
|
|
31426
|
+
`/api/channel-installations/${selectedId}`,
|
|
31427
|
+
{
|
|
31428
|
+
name: values.name,
|
|
31429
|
+
config,
|
|
31430
|
+
rejectWhenNoBinding: !allowOthers,
|
|
31431
|
+
fallbackAgentId: assistantId
|
|
31432
|
+
}
|
|
31433
|
+
);
|
|
31434
|
+
if (res.success) {
|
|
31435
|
+
message18.success("Installation updated");
|
|
31436
|
+
cancelForm();
|
|
31437
|
+
loadInstallations();
|
|
31438
|
+
} else {
|
|
31439
|
+
message18.error(res.message || "Failed to update installation");
|
|
31440
|
+
}
|
|
31441
|
+
} else {
|
|
31442
|
+
const res = await post(
|
|
31443
|
+
"/api/channel-installations",
|
|
31444
|
+
{
|
|
31445
|
+
channel: "lark",
|
|
31446
|
+
name: values.name,
|
|
31447
|
+
config,
|
|
31448
|
+
rejectWhenNoBinding: !allowOthers,
|
|
31449
|
+
fallbackAgentId: assistantId
|
|
31450
|
+
}
|
|
31451
|
+
);
|
|
31452
|
+
if (res.success && res.data) {
|
|
31453
|
+
message18.success("Installation created");
|
|
31454
|
+
if (!allowOthers) {
|
|
31455
|
+
setSelectedId(res.data.id);
|
|
31456
|
+
setFormMode("edit");
|
|
31457
|
+
setBindings([]);
|
|
31458
|
+
message18.info("Now add users who can access this channel");
|
|
31459
|
+
} else {
|
|
31460
|
+
cancelForm();
|
|
31461
|
+
loadInstallations();
|
|
31462
|
+
}
|
|
31463
|
+
} else {
|
|
31464
|
+
message18.error(res.message || "Failed to create installation");
|
|
31465
|
+
}
|
|
31466
|
+
}
|
|
31467
|
+
} catch (error) {
|
|
31468
|
+
console.error("Failed to save installation:", error);
|
|
31469
|
+
message18.error("Failed to save installation");
|
|
31470
|
+
} finally {
|
|
31471
|
+
setSaving(false);
|
|
31472
|
+
}
|
|
31473
|
+
};
|
|
31474
|
+
const handleDelete = async () => {
|
|
31475
|
+
if (!selectedId) return;
|
|
31476
|
+
try {
|
|
31477
|
+
const res = await del(
|
|
31478
|
+
`/api/channel-installations/${selectedId}`
|
|
31479
|
+
);
|
|
31480
|
+
if (res.success) {
|
|
31481
|
+
message18.success("Installation deleted");
|
|
31482
|
+
cancelForm();
|
|
31483
|
+
loadInstallations();
|
|
31484
|
+
} else {
|
|
31485
|
+
message18.error(res.message || "Failed to delete installation");
|
|
31486
|
+
}
|
|
31487
|
+
} catch {
|
|
31488
|
+
message18.error("Failed to delete installation");
|
|
31489
|
+
}
|
|
31490
|
+
};
|
|
31491
|
+
const selectedInstallation = useMemo32(
|
|
31492
|
+
() => installations.find((i) => i.id === selectedId),
|
|
31493
|
+
[installations, selectedId]
|
|
31494
|
+
);
|
|
31495
|
+
const getAvatarColor10 = (index) => AVATAR_COLORS[index % AVATAR_COLORS.length];
|
|
31496
|
+
const renderLeftPanel = () => /* @__PURE__ */ jsxs85("div", { className: styles.leftPanel, children: [
|
|
31497
|
+
/* @__PURE__ */ jsx118("div", { className: styles.leftHeader, children: /* @__PURE__ */ jsx118("span", { className: styles.leftHeaderText, children: "Channels" }) }),
|
|
31498
|
+
/* @__PURE__ */ jsxs85("div", { className: styles.channelList, children: [
|
|
31499
|
+
installations.map((inst, idx) => {
|
|
31500
|
+
const isSelected = selectedId === inst.id && formMode === "edit";
|
|
31501
|
+
const avatarColor = getAvatarColor10(idx);
|
|
31502
|
+
const initial = (inst.name || (inst.channel === "wechat" ? "WeChat Bot" : "Feishu Bot")).charAt(0).toUpperCase();
|
|
31503
|
+
return /* @__PURE__ */ jsxs85(
|
|
31504
|
+
"div",
|
|
31505
|
+
{
|
|
31506
|
+
className: cx(
|
|
31507
|
+
styles.channelItem,
|
|
31508
|
+
isSelected && styles.channelItemSelected,
|
|
31509
|
+
!inst.enabled && styles.channelDisabled
|
|
31510
|
+
),
|
|
31511
|
+
onClick: () => selectChannel(inst),
|
|
31512
|
+
children: [
|
|
31513
|
+
/* @__PURE__ */ jsx118(
|
|
31514
|
+
"div",
|
|
31515
|
+
{
|
|
31516
|
+
className: styles.channelAvatar,
|
|
31517
|
+
style: { background: avatarColor },
|
|
31518
|
+
children: initial
|
|
31519
|
+
}
|
|
31520
|
+
),
|
|
31521
|
+
/* @__PURE__ */ jsxs85("div", { className: styles.channelInfo, children: [
|
|
31522
|
+
/* @__PURE__ */ jsx118("div", { className: styles.channelName, children: inst.name || (inst.channel === "wechat" ? "WeChat Bot" : "Feishu Bot") }),
|
|
31523
|
+
/* @__PURE__ */ jsx118("div", { className: styles.channelType, children: CHANNEL_LABEL_MAP[inst.channel] || inst.channel })
|
|
31524
|
+
] }),
|
|
31525
|
+
/* @__PURE__ */ jsx118(
|
|
31526
|
+
"div",
|
|
31527
|
+
{
|
|
31528
|
+
className: styles.statusDot,
|
|
31529
|
+
style: {
|
|
31530
|
+
background: togglingId === inst.id ? "var(--color-warning, #f59e0b)" : inst.enabled ? "var(--color-success, #22c55e)" : "var(--color-border, #d9d9d9)"
|
|
31531
|
+
}
|
|
31532
|
+
}
|
|
31533
|
+
)
|
|
31534
|
+
]
|
|
31535
|
+
},
|
|
31536
|
+
inst.id
|
|
31537
|
+
);
|
|
31538
|
+
}),
|
|
31539
|
+
installations.length === 0 && !loading && /* @__PURE__ */ jsx118("div", { style: { padding: "24px 12px", textAlign: "center" }, children: /* @__PURE__ */ jsx118(Text48, { type: "secondary", style: { fontSize: 12 }, children: "No channels yet" }) })
|
|
31540
|
+
] }),
|
|
31541
|
+
/* @__PURE__ */ jsx118("div", { className: styles.addChannelBtn, children: /* @__PURE__ */ jsx118(
|
|
31542
|
+
Button54,
|
|
31543
|
+
{
|
|
31544
|
+
block: true,
|
|
31545
|
+
icon: /* @__PURE__ */ jsx118(Link22, { size: 14 }),
|
|
31546
|
+
onClick: openCreateForm,
|
|
31547
|
+
children: "Connect"
|
|
31548
|
+
}
|
|
31549
|
+
) })
|
|
31550
|
+
] });
|
|
31551
|
+
const renderRightContent = () => {
|
|
31552
|
+
if (formMode === "view" && !selectedId) {
|
|
31553
|
+
return /* @__PURE__ */ jsxs85("div", { className: styles.emptyState, children: [
|
|
31554
|
+
/* @__PURE__ */ jsx118(Link22, { size: 40, style: { opacity: 0.25, marginBottom: 16 } }),
|
|
31555
|
+
/* @__PURE__ */ jsx118(Text48, { style: { fontSize: 14, color: "var(--color-text-secondary, #666)" }, children: "Select a channel from the left or add a new one" })
|
|
31556
|
+
] });
|
|
31557
|
+
}
|
|
31558
|
+
const isEdit = formMode === "edit" && selectedId !== null;
|
|
31559
|
+
return /* @__PURE__ */ jsxs85("div", { className: styles.rightBody, children: [
|
|
31560
|
+
/* @__PURE__ */ jsx118("div", { className: styles.formSectionTitle, children: isEdit ? "Edit Channel" : "New Channel" }),
|
|
31561
|
+
/* @__PURE__ */ jsxs85(Form9, { form, layout: "vertical", children: [
|
|
31562
|
+
/* @__PURE__ */ jsx118(Form9.Item, { label: "Channel Type", children: /* @__PURE__ */ jsx118(
|
|
31563
|
+
Select8,
|
|
31564
|
+
{
|
|
31565
|
+
options: channelOptions,
|
|
31566
|
+
value: selectedChannel,
|
|
31567
|
+
onChange: (val) => {
|
|
31568
|
+
setSelectedChannel(val);
|
|
31569
|
+
form.resetFields();
|
|
31570
|
+
},
|
|
31571
|
+
disabled: isEdit
|
|
31572
|
+
}
|
|
31573
|
+
) }),
|
|
31574
|
+
selectedChannel === "lark" && /* @__PURE__ */ jsxs85(Fragment23, { children: [
|
|
31575
|
+
/* @__PURE__ */ jsx118(Form9.Item, { name: "name", label: "Display Name", children: /* @__PURE__ */ jsx118(Input16, { placeholder: "e.g. My Feishu Bot" }) }),
|
|
31576
|
+
/* @__PURE__ */ jsx118(
|
|
31577
|
+
Form9.Item,
|
|
31578
|
+
{
|
|
31579
|
+
name: "appId",
|
|
31580
|
+
label: "App ID",
|
|
31581
|
+
rules: [{ required: true, message: "App ID is required" }],
|
|
31582
|
+
children: /* @__PURE__ */ jsx118(Input16, { placeholder: "cli_xxxxxx" })
|
|
31583
|
+
}
|
|
31584
|
+
),
|
|
31585
|
+
/* @__PURE__ */ jsx118(
|
|
31586
|
+
Form9.Item,
|
|
31587
|
+
{
|
|
31588
|
+
name: "appSecret",
|
|
31589
|
+
label: "App Secret",
|
|
31590
|
+
rules: [{ required: true, message: "App Secret is required" }],
|
|
31591
|
+
children: /* @__PURE__ */ jsx118(Input16.Password, { placeholder: "Your app secret" })
|
|
31592
|
+
}
|
|
31593
|
+
),
|
|
31594
|
+
/* @__PURE__ */ jsx118(Form9.Item, { name: "verificationToken", label: "Verification Token", children: /* @__PURE__ */ jsx118(Input16, { placeholder: "Optional" }) }),
|
|
31595
|
+
/* @__PURE__ */ jsx118(Form9.Item, { name: "encryptKey", label: "Encrypt Key", children: /* @__PURE__ */ jsx118(Input16, { placeholder: "Optional" }) })
|
|
31596
|
+
] }),
|
|
31597
|
+
selectedChannel === "wechat" && /* @__PURE__ */ jsxs85(Fragment23, { children: [
|
|
31598
|
+
/* @__PURE__ */ jsx118(Form9.Item, { name: "name", label: "Display Name", children: /* @__PURE__ */ jsx118(Input16, { placeholder: "e.g. My WeChat Bot" }) }),
|
|
31599
|
+
!isEdit && /* @__PURE__ */ jsxs85(
|
|
31600
|
+
"div",
|
|
31601
|
+
{
|
|
31602
|
+
style: {
|
|
31603
|
+
marginBottom: 16,
|
|
31604
|
+
padding: 16,
|
|
31605
|
+
background: "var(--color-fill-tertiary, #f5f5f5)",
|
|
31606
|
+
borderRadius: 12,
|
|
31607
|
+
textAlign: "center"
|
|
31608
|
+
},
|
|
31609
|
+
children: [
|
|
31610
|
+
qrStatus === "idle" && /* @__PURE__ */ jsxs85(Fragment23, { children: [
|
|
31611
|
+
/* @__PURE__ */ jsx118(Text48, { type: "secondary", style: { fontSize: 12, display: "block", marginBottom: 12 }, children: "Scan the QR code with WeChat to get a bot token" }),
|
|
31612
|
+
/* @__PURE__ */ jsx118(
|
|
31613
|
+
Button54,
|
|
31614
|
+
{
|
|
31615
|
+
type: "primary",
|
|
31616
|
+
icon: /* @__PURE__ */ jsx118(Link22, { size: 14 }),
|
|
31617
|
+
loading: qrLoading,
|
|
31618
|
+
onClick: fetchQrCode,
|
|
31619
|
+
children: "Get QR Code"
|
|
31620
|
+
}
|
|
31621
|
+
)
|
|
31622
|
+
] }),
|
|
31623
|
+
qrStatus === "loading" && /* @__PURE__ */ jsxs85("div", { style: { padding: "20px 0" }, children: [
|
|
31624
|
+
/* @__PURE__ */ jsx118(Spin20, {}),
|
|
31625
|
+
/* @__PURE__ */ jsx118(Text48, { type: "secondary", style: { display: "block", marginTop: 8, fontSize: 12 }, children: "Generating QR code..." })
|
|
31626
|
+
] }),
|
|
31627
|
+
(qrStatus === "wait" || qrStatus === "scaned") && qrCodeUrl && /* @__PURE__ */ jsxs85("div", { children: [
|
|
31628
|
+
/* @__PURE__ */ jsx118(QRCode, { value: qrCodeUrl, size: 180 }),
|
|
31629
|
+
/* @__PURE__ */ jsx118(
|
|
31630
|
+
Text48,
|
|
31631
|
+
{
|
|
31632
|
+
strong: true,
|
|
31633
|
+
style: {
|
|
31634
|
+
display: "block",
|
|
31635
|
+
fontSize: 13,
|
|
31636
|
+
marginTop: 12,
|
|
31637
|
+
color: qrStatus === "scaned" ? "var(--color-success, #22c55e)" : void 0
|
|
31638
|
+
},
|
|
31639
|
+
children: qrStatus === "scaned" ? "Scanned! Confirm on your phone..." : "Scan with WeChat"
|
|
31640
|
+
}
|
|
31641
|
+
),
|
|
31642
|
+
/* @__PURE__ */ jsx118(Text48, { type: "secondary", style: { fontSize: 11, marginTop: 4, display: "block" }, children: "QR expires in 5 minutes" })
|
|
31643
|
+
] }),
|
|
31644
|
+
qrStatus === "confirmed" && /* @__PURE__ */ jsxs85("div", { style: { padding: "12px 0" }, children: [
|
|
31645
|
+
/* @__PURE__ */ jsx118(Text48, { strong: true, style: { fontSize: 14, color: "var(--color-success, #22c55e)", display: "block" }, children: "Login confirmed!" }),
|
|
31646
|
+
/* @__PURE__ */ jsx118(Text48, { type: "secondary", style: { fontSize: 12 }, children: "Bot token has been filled automatically" })
|
|
31647
|
+
] }),
|
|
31648
|
+
qrStatus === "expired" && /* @__PURE__ */ jsxs85("div", { children: [
|
|
31649
|
+
/* @__PURE__ */ jsx118(Text48, { type: "secondary", style: { fontSize: 12, display: "block", marginBottom: 8 }, children: "QR code expired. Get a new one." }),
|
|
31650
|
+
/* @__PURE__ */ jsx118(
|
|
31651
|
+
Button54,
|
|
31652
|
+
{
|
|
31653
|
+
size: "small",
|
|
31654
|
+
loading: qrLoading,
|
|
31655
|
+
onClick: fetchQrCode,
|
|
31656
|
+
children: "Retry"
|
|
31657
|
+
}
|
|
31658
|
+
)
|
|
31659
|
+
] }),
|
|
31660
|
+
qrStatus === "error" && /* @__PURE__ */ jsxs85("div", { children: [
|
|
31661
|
+
/* @__PURE__ */ jsx118(Text48, { type: "danger", style: { fontSize: 12, display: "block", marginBottom: 8 }, children: "Failed to load QR code" }),
|
|
31662
|
+
/* @__PURE__ */ jsx118(
|
|
31663
|
+
Button54,
|
|
31664
|
+
{
|
|
31665
|
+
size: "small",
|
|
31666
|
+
loading: qrLoading,
|
|
31667
|
+
onClick: fetchQrCode,
|
|
31668
|
+
children: "Retry"
|
|
31669
|
+
}
|
|
31670
|
+
)
|
|
31671
|
+
] })
|
|
31672
|
+
]
|
|
31673
|
+
}
|
|
31674
|
+
),
|
|
31675
|
+
/* @__PURE__ */ jsx118(
|
|
31676
|
+
Form9.Item,
|
|
31677
|
+
{
|
|
31678
|
+
name: "botToken",
|
|
31679
|
+
label: "Bot Token",
|
|
31680
|
+
rules: [{ required: true, message: "Bot Token is required" }],
|
|
31681
|
+
children: /* @__PURE__ */ jsx118(
|
|
31682
|
+
Input16.Password,
|
|
31683
|
+
{
|
|
31684
|
+
placeholder: "Auto-filled after QR scan",
|
|
31685
|
+
disabled: isEdit
|
|
31686
|
+
}
|
|
31687
|
+
)
|
|
31688
|
+
}
|
|
31689
|
+
),
|
|
31690
|
+
/* @__PURE__ */ jsx118(Form9.Item, { name: "uin", label: "UIN", children: /* @__PURE__ */ jsx118(Input16, { placeholder: "Auto-filled from QR login", disabled: true }) })
|
|
31691
|
+
] }),
|
|
31692
|
+
isEdit && selectedInstallation && /* @__PURE__ */ jsxs85("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 16 }, children: [
|
|
31693
|
+
/* @__PURE__ */ jsxs85("div", { children: [
|
|
31694
|
+
/* @__PURE__ */ jsx118(Text48, { strong: true, style: { fontSize: 14 }, children: "Enabled" }),
|
|
31695
|
+
/* @__PURE__ */ jsx118("br", {}),
|
|
31696
|
+
/* @__PURE__ */ jsx118(Text48, { type: "secondary", style: { fontSize: 12 }, children: selectedInstallation.enabled ? "Listener service is active" : "Listener service is stopped" })
|
|
31697
|
+
] }),
|
|
31698
|
+
/* @__PURE__ */ jsx118(
|
|
31699
|
+
Switch4,
|
|
31700
|
+
{
|
|
31701
|
+
checked: selectedInstallation.enabled,
|
|
31702
|
+
loading: togglingId === selectedInstallation.id,
|
|
31703
|
+
onChange: () => handleToggleEnabled(selectedInstallation)
|
|
31704
|
+
}
|
|
31705
|
+
)
|
|
31706
|
+
] }),
|
|
31707
|
+
/* @__PURE__ */ jsxs85("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 16 }, children: [
|
|
31708
|
+
/* @__PURE__ */ jsxs85("div", { children: [
|
|
31709
|
+
/* @__PURE__ */ jsx118(Text48, { strong: true, style: { fontSize: 14 }, children: "Anyone can message" }),
|
|
31710
|
+
/* @__PURE__ */ jsx118("br", {}),
|
|
31711
|
+
/* @__PURE__ */ jsx118(Text48, { type: "secondary", style: { fontSize: 12 }, children: "When enabled, anyone with access to this channel can chat with your assistant" })
|
|
31712
|
+
] }),
|
|
31713
|
+
/* @__PURE__ */ jsx118(Switch4, { checked: allowOthers, onChange: setAllowOthers })
|
|
31714
|
+
] })
|
|
31715
|
+
] }),
|
|
31716
|
+
!allowOthers && isEdit && /* @__PURE__ */ jsxs85("div", { className: styles.bindingSection, children: [
|
|
31717
|
+
/* @__PURE__ */ jsx118("div", { className: styles.bindingHeader, children: "Who can chat" }),
|
|
31718
|
+
/* @__PURE__ */ jsx118("div", { className: styles.bindingHint, children: "Only people you add here can message your assistant" }),
|
|
31719
|
+
bindingsLoading ? /* @__PURE__ */ jsx118(Spin20, { size: "small", style: { display: "block", margin: "12px 0" } }) : bindings.length === 0 ? /* @__PURE__ */ jsx118(Text48, { type: "secondary", style: { fontSize: 12 }, children: "No contacts added yet" }) : /* @__PURE__ */ jsx118("div", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: bindings.map((b) => /* @__PURE__ */ jsxs85("div", { className: styles.contactItem, children: [
|
|
31720
|
+
/* @__PURE__ */ jsx118("div", { className: styles.contactAvatar, children: /* @__PURE__ */ jsx118(User6, { size: 14 }) }),
|
|
31721
|
+
/* @__PURE__ */ jsxs85("div", { className: styles.contactInfo, children: [
|
|
31722
|
+
/* @__PURE__ */ jsx118("div", { className: styles.contactName, children: b.senderDisplayName || b.senderId }),
|
|
31723
|
+
b.senderDisplayName && /* @__PURE__ */ jsx118("div", { className: styles.contactId, children: b.senderId })
|
|
31724
|
+
] }),
|
|
31725
|
+
/* @__PURE__ */ jsx118(
|
|
31726
|
+
Button54,
|
|
31727
|
+
{
|
|
31728
|
+
type: "text",
|
|
31729
|
+
size: "small",
|
|
31730
|
+
danger: true,
|
|
31731
|
+
icon: /* @__PURE__ */ jsx118(X2, { size: 12 }),
|
|
31732
|
+
onClick: () => handleDeleteBinding(b.id)
|
|
31733
|
+
}
|
|
31734
|
+
)
|
|
31735
|
+
] }, b.id)) }),
|
|
31736
|
+
addingBinding ? /* @__PURE__ */ jsxs85("div", { className: styles.addBindingRow, children: [
|
|
31737
|
+
/* @__PURE__ */ jsxs85(
|
|
31738
|
+
Form9,
|
|
31739
|
+
{
|
|
31740
|
+
form: bindingForm,
|
|
31741
|
+
layout: "inline",
|
|
31742
|
+
style: { flex: 1, display: "flex", gap: 8 },
|
|
31743
|
+
children: [
|
|
31744
|
+
/* @__PURE__ */ jsx118(
|
|
31745
|
+
Form9.Item,
|
|
31746
|
+
{
|
|
31747
|
+
name: "senderId",
|
|
31748
|
+
rules: [{ required: true, message: "Required" }],
|
|
31749
|
+
style: { flex: 1, marginBottom: 0 },
|
|
31750
|
+
children: /* @__PURE__ */ jsx118(Input16, { size: "small", placeholder: "Feishu Open ID" })
|
|
31751
|
+
}
|
|
31752
|
+
),
|
|
31753
|
+
/* @__PURE__ */ jsx118(
|
|
31754
|
+
Form9.Item,
|
|
31755
|
+
{
|
|
31756
|
+
name: "senderDisplayName",
|
|
31757
|
+
style: { flex: 1, marginBottom: 0 },
|
|
31758
|
+
children: /* @__PURE__ */ jsx118(Input16, { size: "small", placeholder: "Display name (optional)" })
|
|
31759
|
+
}
|
|
31760
|
+
)
|
|
31761
|
+
]
|
|
31762
|
+
}
|
|
31763
|
+
),
|
|
31764
|
+
/* @__PURE__ */ jsx118(Button54, { size: "small", type: "primary", onClick: handleAddBinding, children: "Add" }),
|
|
31765
|
+
/* @__PURE__ */ jsx118(
|
|
31766
|
+
Button54,
|
|
31767
|
+
{
|
|
31768
|
+
size: "small",
|
|
31769
|
+
onClick: () => {
|
|
31770
|
+
setAddingBinding(false);
|
|
31771
|
+
bindingForm.resetFields();
|
|
31772
|
+
},
|
|
31773
|
+
children: "Cancel"
|
|
31774
|
+
}
|
|
31775
|
+
)
|
|
31776
|
+
] }) : /* @__PURE__ */ jsx118(
|
|
31777
|
+
Button54,
|
|
31778
|
+
{
|
|
31779
|
+
type: "dashed",
|
|
31780
|
+
size: "small",
|
|
31781
|
+
icon: /* @__PURE__ */ jsx118(UserPlus, { size: 12 }),
|
|
31782
|
+
onClick: () => setAddingBinding(true),
|
|
31783
|
+
style: { marginTop: 8 },
|
|
31784
|
+
children: "Add Contact"
|
|
31785
|
+
}
|
|
31786
|
+
)
|
|
31787
|
+
] }),
|
|
31788
|
+
!allowOthers && !isEdit && /* @__PURE__ */ jsx118("div", { className: styles.bindingSection, children: /* @__PURE__ */ jsx118(Text48, { type: "secondary", style: { fontSize: 12 }, children: "Once saved, come back here to add the people you'd like to chat with." }) })
|
|
31789
|
+
] });
|
|
31790
|
+
};
|
|
31791
|
+
const renderFooter = () => {
|
|
31792
|
+
if (formMode === "view") return null;
|
|
31793
|
+
const isEdit = formMode === "edit" && selectedId !== null;
|
|
31794
|
+
return /* @__PURE__ */ jsxs85("div", { className: styles.footer, children: [
|
|
31795
|
+
/* @__PURE__ */ jsx118("div", { children: isEdit && /* @__PURE__ */ jsx118(
|
|
31796
|
+
Popconfirm11,
|
|
31797
|
+
{
|
|
31798
|
+
title: "Remove this channel?",
|
|
31799
|
+
description: "All bindings for this installation will also be lost.",
|
|
31800
|
+
onConfirm: handleDelete,
|
|
31801
|
+
okText: "Delete",
|
|
31802
|
+
okType: "danger",
|
|
31803
|
+
cancelText: "Cancel",
|
|
31804
|
+
children: /* @__PURE__ */ jsx118(Button54, { danger: true, icon: /* @__PURE__ */ jsx118(Trash28, { size: 14 }), children: "Delete" })
|
|
31805
|
+
}
|
|
31806
|
+
) }),
|
|
31807
|
+
/* @__PURE__ */ jsxs85("div", { style: { display: "flex", gap: 8 }, children: [
|
|
31808
|
+
/* @__PURE__ */ jsx118(Button54, { onClick: cancelForm, children: "Cancel" }),
|
|
31809
|
+
/* @__PURE__ */ jsx118(Button54, { type: "primary", loading: saving, onClick: handleSave, children: isEdit ? "Save" : "Create" })
|
|
31810
|
+
] })
|
|
31811
|
+
] });
|
|
31812
|
+
};
|
|
31813
|
+
return /* @__PURE__ */ jsx118(
|
|
31814
|
+
Modal19,
|
|
31815
|
+
{
|
|
31816
|
+
title: /* @__PURE__ */ jsxs85("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
31817
|
+
/* @__PURE__ */ jsx118(Link22, { size: 18 }),
|
|
31818
|
+
/* @__PURE__ */ jsx118("span", { children: "Connect Channels" })
|
|
31819
|
+
] }),
|
|
31820
|
+
open,
|
|
31821
|
+
onCancel: onClose,
|
|
31822
|
+
footer: renderFooter(),
|
|
31823
|
+
width: 720,
|
|
31824
|
+
destroyOnClose: true,
|
|
31825
|
+
styles: {
|
|
31826
|
+
body: { padding: 0 }
|
|
31827
|
+
},
|
|
31828
|
+
children: loading ? /* @__PURE__ */ jsx118("div", { style: { display: "flex", justifyContent: "center", padding: 48, height: 460 }, children: /* @__PURE__ */ jsx118(Spin20, {}) }) : /* @__PURE__ */ jsxs85("div", { className: styles.body, children: [
|
|
31829
|
+
renderLeftPanel(),
|
|
31830
|
+
/* @__PURE__ */ jsx118("div", { className: styles.rightPanel, children: renderRightContent() })
|
|
31831
|
+
] })
|
|
31832
|
+
}
|
|
31833
|
+
);
|
|
31834
|
+
};
|
|
31835
|
+
|
|
31836
|
+
// src/components/Chat/PersonalAssistantPage.tsx
|
|
31837
|
+
import { Fragment as Fragment24, jsx as jsx119, jsxs as jsxs86 } from "react/jsx-runtime";
|
|
31838
|
+
var { Title: Title16, Text: Text49, Paragraph: Paragraph4 } = Typography60;
|
|
31839
|
+
var useStyles20 = createStyles36(({ css, token }) => ({
|
|
30920
31840
|
container: css` display: flex; flex-direction: column; height: 100%; padding: 24px; overflow-y: auto; `,
|
|
30921
31841
|
setupWrap: css` max-width: 520px; margin: 30px auto 0; `,
|
|
30922
31842
|
card: css` border-radius: ${token.borderRadiusLG}px; `,
|
|
@@ -30952,11 +31872,11 @@ var useStyles19 = createStyles35(({ css, token }) => ({
|
|
|
30952
31872
|
chatFill: css` flex: 1; min-height: 0; `
|
|
30953
31873
|
}));
|
|
30954
31874
|
var PERSONALITIES = [
|
|
30955
|
-
{ key: "warm_caring", icon: /* @__PURE__ */
|
|
30956
|
-
{ key: "witty_playful", icon: /* @__PURE__ */
|
|
30957
|
-
{ key: "energetic_motivator", icon: /* @__PURE__ */
|
|
30958
|
-
{ key: "wise_mentor", icon: /* @__PURE__ */
|
|
30959
|
-
{ key: "custom", icon: /* @__PURE__ */
|
|
31875
|
+
{ key: "warm_caring", icon: /* @__PURE__ */ jsx119(Heart, { size: 20 }), bg: "#fef2f2", fg: "#ef4444", title: "Warm & Caring", desc: "Gentle, patient, emotionally supportive \u2014 like a close friend who always has your back." },
|
|
31876
|
+
{ key: "witty_playful", icon: /* @__PURE__ */ jsx119(Smile, { size: 20 }), bg: "#fefce8", fg: "#eab308", title: "Witty & Playful", desc: "Quick with a joke, a little mischievous, keeps things light." },
|
|
31877
|
+
{ key: "energetic_motivator", icon: /* @__PURE__ */ jsx119(Zap, { size: 20 }), bg: "#eff6ff", fg: "#3b82f6", title: "Energetic Motivator", desc: "High-energy hype machine. Celebrates wins, never lets you give up." },
|
|
31878
|
+
{ key: "wise_mentor", icon: /* @__PURE__ */ jsx119(Lightbulb, { size: 20 }), bg: "#f5f3ff", fg: "#8b5cf6", title: "Wise Mentor", desc: "Calm, thoughtful, insightful. Asks the right questions." },
|
|
31879
|
+
{ key: "custom", icon: /* @__PURE__ */ jsx119(Edit3, { size: 20 }), bg: "#f5f5f5", fg: "#737373", title: "Custom", desc: "Describe your own \u2014 a mix or something completely unique." }
|
|
30960
31880
|
];
|
|
30961
31881
|
var PERSONALITY_MAP = {
|
|
30962
31882
|
warm_caring: "\u4F60\u662F\u4E00\u4E2A\u6E29\u6696\u3001\u8D34\u5FC3\u7684\u966A\u4F34\u8005\u3002\u4F60\u8BF4\u8BDD\u6E29\u67D4\uFF0C\u6709\u8010\u5FC3\uFF0C\u5584\u4E8E\u503E\u542C\u3002\u4F60\u7684\u5B58\u5728\u5C31\u50CF\u4E00\u676F\u70ED\u8336\u2014\u2014\u5B89\u9759\u5730\u966A\u4F34\uFF0C\u4F46\u603B\u662F\u5728\u90A3\u91CC\u3002",
|
|
@@ -30965,23 +31885,24 @@ var PERSONALITY_MAP = {
|
|
|
30965
31885
|
wise_mentor: "\u4F60\u51B7\u9759\u3001\u6DF1\u601D\u3001\u6709\u6D1E\u5BDF\u529B\u3002\u4F60\u901A\u8FC7\u63D0\u95EE\u5F15\u5BFC\u7528\u6237\u81EA\u5DF1\u53D1\u73B0\u3002\u4F60\u770B\u91CD\u6210\u957F\u548C\u53CD\u601D\uFF0C\u98CE\u683C\u6C89\u7A33\u4F46\u4E0D\u51B7\u6F20\u3002"
|
|
30966
31886
|
};
|
|
30967
31887
|
var PersonalAssistantPage = () => {
|
|
30968
|
-
const { styles } =
|
|
31888
|
+
const { styles } = useStyles20();
|
|
30969
31889
|
const { get, post, del } = useApi();
|
|
30970
31890
|
const { personalAssistant, setPersonalAssistant } = useAuth();
|
|
30971
31891
|
const auth = useAuthOptional();
|
|
30972
31892
|
const userName = auth?.user?.name || auth?.user?.email?.split("@")[0];
|
|
30973
|
-
const [creating, setCreating] =
|
|
30974
|
-
const [chatMode, setChatMode] =
|
|
30975
|
-
const [threadId, setThreadId] =
|
|
30976
|
-
const [step, setStep] =
|
|
30977
|
-
const [name, setName] =
|
|
30978
|
-
const [personalityKey, setPersonalityKey] =
|
|
30979
|
-
const [customPersonality, setCustomPersonality] =
|
|
31893
|
+
const [creating, setCreating] = useState75(false);
|
|
31894
|
+
const [chatMode, setChatMode] = useState75(false);
|
|
31895
|
+
const [threadId, setThreadId] = useState75("");
|
|
31896
|
+
const [step, setStep] = useState75(0);
|
|
31897
|
+
const [name, setName] = useState75("");
|
|
31898
|
+
const [personalityKey, setPersonalityKey] = useState75(null);
|
|
31899
|
+
const [customPersonality, setCustomPersonality] = useState75("");
|
|
31900
|
+
const [channelModalOpen, setChannelModalOpen] = useState75(false);
|
|
30980
31901
|
const personalityText = personalityKey === "custom" ? customPersonality : personalityKey ? PERSONALITY_MAP[personalityKey] : "";
|
|
30981
31902
|
const assistantId = personalAssistant?.assistantId || null;
|
|
30982
31903
|
const projectId = personalAssistant?.projectId || "default";
|
|
30983
31904
|
const workspaceId = personalAssistant?.workspaceId || "default";
|
|
30984
|
-
const handleCreate =
|
|
31905
|
+
const handleCreate = useCallback39(async () => {
|
|
30985
31906
|
if (!name.trim()) return;
|
|
30986
31907
|
try {
|
|
30987
31908
|
setCreating(true);
|
|
@@ -30990,19 +31911,19 @@ var PersonalAssistantPage = () => {
|
|
|
30990
31911
|
{ name: name.trim(), personality: personalityText }
|
|
30991
31912
|
);
|
|
30992
31913
|
if (!b.success) {
|
|
30993
|
-
|
|
31914
|
+
message19.error(b.message);
|
|
30994
31915
|
return;
|
|
30995
31916
|
}
|
|
30996
31917
|
const info = { assistantId: b.data.id, projectId: b.data.projectId, workspaceId: b.data.workspaceId || "default" };
|
|
30997
31918
|
setPersonalAssistant(info);
|
|
30998
|
-
|
|
31919
|
+
message19.success("Done!");
|
|
30999
31920
|
} catch {
|
|
31000
|
-
|
|
31921
|
+
message19.error("Network error");
|
|
31001
31922
|
} finally {
|
|
31002
31923
|
setCreating(false);
|
|
31003
31924
|
}
|
|
31004
31925
|
}, [name, personalityText, post]);
|
|
31005
|
-
const resolveThread =
|
|
31926
|
+
const resolveThread = useCallback39(async (assistantId2) => {
|
|
31006
31927
|
Client2.setWorkspaceContext(workspaceId || void 0, projectId || void 0);
|
|
31007
31928
|
const day = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
31008
31929
|
const list = await get(
|
|
@@ -31016,8 +31937,8 @@ var PersonalAssistantPage = () => {
|
|
|
31016
31937
|
);
|
|
31017
31938
|
return created.data.id;
|
|
31018
31939
|
}, [get, post, workspaceId, projectId]);
|
|
31019
|
-
const lastDate =
|
|
31020
|
-
|
|
31940
|
+
const lastDate = useRef27("");
|
|
31941
|
+
useEffect51(() => {
|
|
31021
31942
|
if (!assistantId) return;
|
|
31022
31943
|
let timer;
|
|
31023
31944
|
const enter = () => {
|
|
@@ -31038,8 +31959,8 @@ var PersonalAssistantPage = () => {
|
|
|
31038
31959
|
enter();
|
|
31039
31960
|
return () => clearTimeout(timer);
|
|
31040
31961
|
}, [assistantId, resolveThread]);
|
|
31041
|
-
const handleDelete =
|
|
31042
|
-
|
|
31962
|
+
const handleDelete = useCallback39(async () => {
|
|
31963
|
+
Modal20.confirm({
|
|
31043
31964
|
title: "Delete your personal assistant?",
|
|
31044
31965
|
content: "This will permanently delete your assistant, all chat history, and your personal project. This action cannot be undone.",
|
|
31045
31966
|
okText: "Delete Everything",
|
|
@@ -31054,62 +31975,80 @@ var PersonalAssistantPage = () => {
|
|
|
31054
31975
|
setName("");
|
|
31055
31976
|
setPersonalityKey(null);
|
|
31056
31977
|
setCustomPersonality("");
|
|
31057
|
-
|
|
31978
|
+
message19.success("Personal assistant deleted");
|
|
31058
31979
|
} catch {
|
|
31059
|
-
|
|
31980
|
+
message19.error("Network error");
|
|
31060
31981
|
}
|
|
31061
31982
|
}
|
|
31062
31983
|
});
|
|
31063
31984
|
}, [del, setPersonalAssistant]);
|
|
31064
31985
|
const moreItems = [
|
|
31065
|
-
{ key: "delete", icon: /* @__PURE__ */
|
|
31986
|
+
{ key: "delete", icon: /* @__PURE__ */ jsx119(Trash29, { size: 16 }), label: "Delete", danger: true, onClick: handleDelete }
|
|
31066
31987
|
];
|
|
31067
31988
|
if (chatMode && assistantId && threadId) {
|
|
31068
|
-
return /* @__PURE__ */
|
|
31069
|
-
|
|
31070
|
-
|
|
31071
|
-
|
|
31072
|
-
|
|
31073
|
-
|
|
31074
|
-
|
|
31075
|
-
|
|
31076
|
-
|
|
31077
|
-
/* @__PURE__ */
|
|
31078
|
-
|
|
31079
|
-
|
|
31989
|
+
return /* @__PURE__ */ jsxs86(Fragment24, { children: [
|
|
31990
|
+
/* @__PURE__ */ jsx119(
|
|
31991
|
+
LatticeAgentWorkspace,
|
|
31992
|
+
{
|
|
31993
|
+
assistant_id: assistantId,
|
|
31994
|
+
thread_id: threadId,
|
|
31995
|
+
workspaceId,
|
|
31996
|
+
projectId,
|
|
31997
|
+
menu: null,
|
|
31998
|
+
emptyPlaceholder: /* @__PURE__ */ jsxs86("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", height: "100%", color: "#999", gap: 8 }, children: [
|
|
31999
|
+
/* @__PURE__ */ jsxs86(Text49, { type: "secondary", style: { fontSize: 16 }, children: [
|
|
32000
|
+
"Today is ",
|
|
32001
|
+
(/* @__PURE__ */ new Date()).toLocaleDateString("en-US", { weekday: "long", month: "long", day: "numeric", year: "numeric" })
|
|
32002
|
+
] }),
|
|
32003
|
+
/* @__PURE__ */ jsx119(Text49, { type: "secondary", children: "What can I help you with?" })
|
|
31080
32004
|
] }),
|
|
31081
|
-
/* @__PURE__ */
|
|
31082
|
-
|
|
31083
|
-
|
|
31084
|
-
|
|
31085
|
-
|
|
31086
|
-
|
|
31087
|
-
|
|
31088
|
-
|
|
31089
|
-
|
|
31090
|
-
|
|
31091
|
-
|
|
31092
|
-
|
|
31093
|
-
|
|
31094
|
-
|
|
31095
|
-
|
|
31096
|
-
|
|
31097
|
-
|
|
31098
|
-
|
|
31099
|
-
|
|
31100
|
-
|
|
31101
|
-
|
|
32005
|
+
emptyStateGreeting: /* @__PURE__ */ jsxs86(Fragment24, { children: [
|
|
32006
|
+
"Hey",
|
|
32007
|
+
userName ? /* @__PURE__ */ jsxs86(Fragment24, { children: [
|
|
32008
|
+
", ",
|
|
32009
|
+
/* @__PURE__ */ jsx119("span", { style: { color: "#6366f1", fontWeight: 600 }, children: userName })
|
|
32010
|
+
] }) : ""
|
|
32011
|
+
] }),
|
|
32012
|
+
emptyStateQuestion: `Today is ${(/* @__PURE__ */ new Date()).toLocaleDateString("en-US", { weekday: "long", month: "long", day: "numeric", year: "numeric" })} \u2014 What can I help you with?`,
|
|
32013
|
+
showSkillPrompts: false,
|
|
32014
|
+
showQuickAnalysis: false,
|
|
32015
|
+
showDatabaseSlot: false,
|
|
32016
|
+
showSkillSlot: false,
|
|
32017
|
+
showAgentSlot: false,
|
|
32018
|
+
headerRight: /* @__PURE__ */ jsxs86(Fragment24, { children: [
|
|
32019
|
+
/* @__PURE__ */ jsx119(
|
|
32020
|
+
HeaderIconButton,
|
|
32021
|
+
{
|
|
32022
|
+
ariaLabel: "Channel settings",
|
|
32023
|
+
icon: /* @__PURE__ */ jsx119(Link23, { size: 16 }),
|
|
32024
|
+
onClick: () => setChannelModalOpen(true)
|
|
32025
|
+
}
|
|
32026
|
+
),
|
|
32027
|
+
/* @__PURE__ */ jsx119(FilePanelToggle, {}),
|
|
32028
|
+
/* @__PURE__ */ jsx119(Dropdown3, { menu: { items: moreItems }, trigger: ["click"], placement: "bottomRight", children: /* @__PURE__ */ jsx119(Button55, { type: "text", icon: /* @__PURE__ */ jsx119(MoreHorizontal, { size: 18 }) }) })
|
|
32029
|
+
] })
|
|
32030
|
+
}
|
|
32031
|
+
),
|
|
32032
|
+
/* @__PURE__ */ jsx119(
|
|
32033
|
+
PersonalAssistantChannelModal,
|
|
32034
|
+
{
|
|
32035
|
+
assistantId,
|
|
32036
|
+
open: channelModalOpen,
|
|
32037
|
+
onClose: () => setChannelModalOpen(false)
|
|
32038
|
+
}
|
|
32039
|
+
)
|
|
32040
|
+
] });
|
|
31102
32041
|
}
|
|
31103
32042
|
const can0 = name.trim().length > 0;
|
|
31104
32043
|
const can1 = personalityKey !== null && (personalityKey !== "custom" || customPersonality.trim().length > 0);
|
|
31105
|
-
return /* @__PURE__ */
|
|
31106
|
-
/* @__PURE__ */
|
|
31107
|
-
step === 0 && /* @__PURE__ */
|
|
31108
|
-
/* @__PURE__ */
|
|
31109
|
-
/* @__PURE__ */
|
|
31110
|
-
/* @__PURE__ */
|
|
31111
|
-
/* @__PURE__ */
|
|
31112
|
-
|
|
32044
|
+
return /* @__PURE__ */ jsx119("div", { className: styles.container, children: /* @__PURE__ */ jsxs86("div", { className: styles.setupWrap, children: [
|
|
32045
|
+
/* @__PURE__ */ jsx119("div", { className: styles.stepIndicator, children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx119("div", { className: `${styles.stepDot} ${i === step ? styles.stepDotActive : i < step ? styles.stepDotDone : styles.stepDotPending}` }, i)) }),
|
|
32046
|
+
step === 0 && /* @__PURE__ */ jsxs86(Card29, { className: styles.card, children: [
|
|
32047
|
+
/* @__PURE__ */ jsx119("div", { className: styles.avatar, children: /* @__PURE__ */ jsx119(Sparkles3, { size: 26 }) }),
|
|
32048
|
+
/* @__PURE__ */ jsx119(Title16, { level: 3, style: { textAlign: "center", margin: "0 0 4px" }, children: "What would you like to call them?" }),
|
|
32049
|
+
/* @__PURE__ */ jsx119(Paragraph4, { type: "secondary", style: { textAlign: "center", margin: "0 0 24px" }, children: "This is the name you'll use every day \u2014 your go-to nickname for your AI sidekick." }),
|
|
32050
|
+
/* @__PURE__ */ jsx119(
|
|
32051
|
+
Input17,
|
|
31113
32052
|
{
|
|
31114
32053
|
size: "large",
|
|
31115
32054
|
placeholder: 'e.g. "Jarvis", "Buddy"',
|
|
@@ -31120,13 +32059,13 @@ var PersonalAssistantPage = () => {
|
|
|
31120
32059
|
style: { marginBottom: 20 }
|
|
31121
32060
|
}
|
|
31122
32061
|
),
|
|
31123
|
-
/* @__PURE__ */
|
|
32062
|
+
/* @__PURE__ */ jsx119(Button55, { type: "primary", block: true, size: "large", disabled: !can0, onClick: () => setStep(1), icon: /* @__PURE__ */ jsx119(ArrowRight4, { size: 18 }), children: "Next" })
|
|
31124
32063
|
] }),
|
|
31125
|
-
step === 1 && /* @__PURE__ */
|
|
31126
|
-
/* @__PURE__ */
|
|
31127
|
-
/* @__PURE__ */
|
|
31128
|
-
/* @__PURE__ */
|
|
31129
|
-
/* @__PURE__ */
|
|
32064
|
+
step === 1 && /* @__PURE__ */ jsxs86(Card29, { className: styles.card, children: [
|
|
32065
|
+
/* @__PURE__ */ jsx119("div", { className: styles.avatar, children: /* @__PURE__ */ jsx119(Smile, { size: 26 }) }),
|
|
32066
|
+
/* @__PURE__ */ jsx119(Title16, { level: 3, style: { textAlign: "center", margin: "0 0 4px" }, children: "What's their vibe?" }),
|
|
32067
|
+
/* @__PURE__ */ jsx119(Paragraph4, { type: "secondary", style: { textAlign: "center", margin: "0 0 20px" }, children: "Pick the personality that feels right. This shapes how they talk and support you." }),
|
|
32068
|
+
/* @__PURE__ */ jsx119("div", { className: styles.personalityGrid, children: PERSONALITIES.map((p) => /* @__PURE__ */ jsxs86(
|
|
31130
32069
|
"div",
|
|
31131
32070
|
{
|
|
31132
32071
|
className: `${styles.personalityOption} ${personalityKey === p.key ? styles.personalityOptionSelected : ""}`,
|
|
@@ -31135,17 +32074,17 @@ var PersonalAssistantPage = () => {
|
|
|
31135
32074
|
if (p.key !== "custom") setCustomPersonality("");
|
|
31136
32075
|
},
|
|
31137
32076
|
children: [
|
|
31138
|
-
/* @__PURE__ */
|
|
31139
|
-
/* @__PURE__ */
|
|
31140
|
-
/* @__PURE__ */
|
|
31141
|
-
/* @__PURE__ */
|
|
32077
|
+
/* @__PURE__ */ jsx119("div", { className: styles.personalityIcon, style: { background: p.bg, color: p.fg }, children: p.icon }),
|
|
32078
|
+
/* @__PURE__ */ jsxs86("div", { style: { flex: 1 }, children: [
|
|
32079
|
+
/* @__PURE__ */ jsx119(Text49, { strong: true, style: { fontSize: 15 }, children: p.title }),
|
|
32080
|
+
/* @__PURE__ */ jsx119(Paragraph4, { type: "secondary", style: { margin: "4px 0 0", fontSize: 13, lineHeight: 1.5 }, children: p.desc })
|
|
31142
32081
|
] })
|
|
31143
32082
|
]
|
|
31144
32083
|
},
|
|
31145
32084
|
p.key
|
|
31146
32085
|
)) }),
|
|
31147
|
-
personalityKey === "custom" && /* @__PURE__ */
|
|
31148
|
-
|
|
32086
|
+
personalityKey === "custom" && /* @__PURE__ */ jsx119(
|
|
32087
|
+
Input17.TextArea,
|
|
31149
32088
|
{
|
|
31150
32089
|
rows: 3,
|
|
31151
32090
|
placeholder: "Describe in your own words...",
|
|
@@ -31155,41 +32094,41 @@ var PersonalAssistantPage = () => {
|
|
|
31155
32094
|
style: { marginTop: 12 }
|
|
31156
32095
|
}
|
|
31157
32096
|
),
|
|
31158
|
-
/* @__PURE__ */
|
|
31159
|
-
/* @__PURE__ */
|
|
31160
|
-
/* @__PURE__ */
|
|
32097
|
+
/* @__PURE__ */ jsxs86("div", { style: { display: "flex", gap: 12, marginTop: 20 }, children: [
|
|
32098
|
+
/* @__PURE__ */ jsx119(Button55, { size: "large", icon: /* @__PURE__ */ jsx119(ArrowLeft3, { size: 18 }), onClick: () => setStep(0), children: "Back" }),
|
|
32099
|
+
/* @__PURE__ */ jsx119(Button55, { type: "primary", block: true, size: "large", disabled: !can1, onClick: () => setStep(2), icon: /* @__PURE__ */ jsx119(ArrowRight4, { size: 18 }), children: "Next" })
|
|
31161
32100
|
] })
|
|
31162
32101
|
] }),
|
|
31163
|
-
step === 2 && /* @__PURE__ */
|
|
31164
|
-
/* @__PURE__ */
|
|
31165
|
-
/* @__PURE__ */
|
|
31166
|
-
/* @__PURE__ */
|
|
31167
|
-
/* @__PURE__ */
|
|
31168
|
-
/* @__PURE__ */
|
|
31169
|
-
/* @__PURE__ */
|
|
31170
|
-
/* @__PURE__ */
|
|
31171
|
-
/* @__PURE__ */
|
|
31172
|
-
/* @__PURE__ */
|
|
31173
|
-
/* @__PURE__ */
|
|
31174
|
-
/* @__PURE__ */
|
|
32102
|
+
step === 2 && /* @__PURE__ */ jsxs86(Card29, { className: styles.card, children: [
|
|
32103
|
+
/* @__PURE__ */ jsx119("div", { className: styles.avatar, children: /* @__PURE__ */ jsx119(Bot4, { size: 26 }) }),
|
|
32104
|
+
/* @__PURE__ */ jsx119(Title16, { level: 3, style: { textAlign: "center", margin: "0 0 4px" }, children: "Almost ready!" }),
|
|
32105
|
+
/* @__PURE__ */ jsx119(Paragraph4, { type: "secondary", style: { textAlign: "center", margin: "0 0 24px" }, children: "Your assistant will have private memory and learn about you over time." }),
|
|
32106
|
+
/* @__PURE__ */ jsxs86(Card29, { size: "small", style: { background: "#fafafa", borderRadius: 12, marginBottom: 20 }, children: [
|
|
32107
|
+
/* @__PURE__ */ jsx119(Text49, { type: "secondary", style: { fontSize: 12, textTransform: "uppercase", letterSpacing: 1 }, children: "Name" }),
|
|
32108
|
+
/* @__PURE__ */ jsx119("br", {}),
|
|
32109
|
+
/* @__PURE__ */ jsx119(Text49, { strong: true, style: { fontSize: 18 }, children: name || "(not set)" }),
|
|
32110
|
+
/* @__PURE__ */ jsxs86("div", { style: { marginTop: 10 }, children: [
|
|
32111
|
+
/* @__PURE__ */ jsx119(Text49, { type: "secondary", style: { fontSize: 12, textTransform: "uppercase", letterSpacing: 1 }, children: "Personality" }),
|
|
32112
|
+
/* @__PURE__ */ jsx119("br", {}),
|
|
32113
|
+
/* @__PURE__ */ jsx119(Text49, { style: { fontSize: 14 }, children: personalityKey === "custom" ? customPersonality.slice(0, 100) : PERSONALITIES.find((p) => p.key === personalityKey)?.title })
|
|
31175
32114
|
] })
|
|
31176
32115
|
] }),
|
|
31177
|
-
/* @__PURE__ */
|
|
31178
|
-
/* @__PURE__ */
|
|
31179
|
-
/* @__PURE__ */
|
|
32116
|
+
/* @__PURE__ */ jsxs86("div", { style: { display: "flex", gap: 12 }, children: [
|
|
32117
|
+
/* @__PURE__ */ jsx119(Button55, { size: "large", icon: /* @__PURE__ */ jsx119(ArrowLeft3, { size: 18 }), onClick: () => setStep(1), children: "Back" }),
|
|
32118
|
+
/* @__PURE__ */ jsx119(Button55, { type: "primary", block: true, size: "large", loading: creating, onClick: handleCreate, icon: /* @__PURE__ */ jsx119(Sparkles3, { size: 18 }), children: "Create My Assistant" })
|
|
31180
32119
|
] })
|
|
31181
32120
|
] })
|
|
31182
32121
|
] }) });
|
|
31183
32122
|
};
|
|
31184
32123
|
|
|
31185
32124
|
// src/components/Chat/CustomMenuPage.tsx
|
|
31186
|
-
import { Spin as
|
|
32125
|
+
import { Spin as Spin22 } from "antd";
|
|
31187
32126
|
|
|
31188
32127
|
// src/components/Chat/AgentConversations.tsx
|
|
31189
32128
|
import { Conversations } from "@ant-design/x";
|
|
31190
32129
|
import { theme as theme16 } from "antd";
|
|
31191
|
-
import { useMemo as
|
|
31192
|
-
import { jsx as
|
|
32130
|
+
import { useMemo as useMemo33 } from "react";
|
|
32131
|
+
import { jsx as jsx120 } from "react/jsx-runtime";
|
|
31193
32132
|
var AgentConversations = ({
|
|
31194
32133
|
enableThreadCreation = true,
|
|
31195
32134
|
enableThreadList = true
|
|
@@ -31209,7 +32148,7 @@ var AgentConversations = ({
|
|
|
31209
32148
|
background: "transparent",
|
|
31210
32149
|
borderRadius: token.borderRadius
|
|
31211
32150
|
};
|
|
31212
|
-
const threadItems =
|
|
32151
|
+
const threadItems = useMemo33(() => {
|
|
31213
32152
|
return threads || [];
|
|
31214
32153
|
}, [threads]);
|
|
31215
32154
|
const items = threadItems.map((thread2) => ({
|
|
@@ -31228,7 +32167,7 @@ var AgentConversations = ({
|
|
|
31228
32167
|
const creation = enableThreadCreation ? {
|
|
31229
32168
|
onClick: newChatClick
|
|
31230
32169
|
} : void 0;
|
|
31231
|
-
return /* @__PURE__ */
|
|
32170
|
+
return /* @__PURE__ */ jsx120(
|
|
31232
32171
|
Conversations,
|
|
31233
32172
|
{
|
|
31234
32173
|
creation,
|
|
@@ -31244,7 +32183,7 @@ var AgentConversations = ({
|
|
|
31244
32183
|
};
|
|
31245
32184
|
|
|
31246
32185
|
// src/components/Chat/CustomMenuPage.tsx
|
|
31247
|
-
import { jsx as
|
|
32186
|
+
import { jsx as jsx121, jsxs as jsxs87 } from "react/jsx-runtime";
|
|
31248
32187
|
var IFRAME_STYLE = {
|
|
31249
32188
|
width: "100%",
|
|
31250
32189
|
height: "100%",
|
|
@@ -31254,24 +32193,24 @@ var AgentChatWithThread = ({ assistantId }) => {
|
|
|
31254
32193
|
const { thread } = useConversationContext();
|
|
31255
32194
|
const { menuCollapsed } = useChatUIContext();
|
|
31256
32195
|
if (!thread) {
|
|
31257
|
-
return /* @__PURE__ */
|
|
32196
|
+
return /* @__PURE__ */ jsx121("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", height: "100%" }, children: /* @__PURE__ */ jsx121(Spin22, { tip: "Creating conversation..." }) });
|
|
31258
32197
|
}
|
|
31259
|
-
return /* @__PURE__ */
|
|
32198
|
+
return /* @__PURE__ */ jsx121(
|
|
31260
32199
|
LatticeChat,
|
|
31261
32200
|
{
|
|
31262
32201
|
thread_id: thread.id,
|
|
31263
32202
|
assistant_id: assistantId,
|
|
31264
32203
|
showProjectSelector: false,
|
|
31265
|
-
menu: menuCollapsed ? void 0 : /* @__PURE__ */
|
|
32204
|
+
menu: menuCollapsed ? void 0 : /* @__PURE__ */ jsx121(AgentConversations, {})
|
|
31266
32205
|
}
|
|
31267
32206
|
);
|
|
31268
32207
|
};
|
|
31269
32208
|
var CustomMenuPage = ({ component_key }) => {
|
|
31270
32209
|
const parsed = parseCustomMenuId(component_key);
|
|
31271
32210
|
if (!parsed) {
|
|
31272
|
-
return /* @__PURE__ */
|
|
31273
|
-
/* @__PURE__ */
|
|
31274
|
-
/* @__PURE__ */
|
|
32211
|
+
return /* @__PURE__ */ jsxs87("div", { style: { padding: 24 }, children: [
|
|
32212
|
+
/* @__PURE__ */ jsx121("p", { style: { color: "#999" }, children: "Invalid menu item" }),
|
|
32213
|
+
/* @__PURE__ */ jsxs87("pre", { style: { fontSize: 11, color: "#aaa" }, children: [
|
|
31275
32214
|
"component_key: ",
|
|
31276
32215
|
component_key || "(empty)"
|
|
31277
32216
|
] })
|
|
@@ -31279,39 +32218,39 @@ var CustomMenuPage = ({ component_key }) => {
|
|
|
31279
32218
|
}
|
|
31280
32219
|
switch (parsed.contentType) {
|
|
31281
32220
|
case "agent":
|
|
31282
|
-
return /* @__PURE__ */
|
|
32221
|
+
return /* @__PURE__ */ jsx121(
|
|
31283
32222
|
WorkspaceContextProvider,
|
|
31284
32223
|
{
|
|
31285
32224
|
workspaceId: parsed.workspaceId || void 0,
|
|
31286
32225
|
projectId: parsed.projectId || void 0,
|
|
31287
|
-
children: /* @__PURE__ */
|
|
32226
|
+
children: /* @__PURE__ */ jsx121(
|
|
31288
32227
|
AssistantContextProvider,
|
|
31289
32228
|
{
|
|
31290
32229
|
autoLoad: true,
|
|
31291
32230
|
initialAssistantId: parsed.payload,
|
|
31292
|
-
children: /* @__PURE__ */
|
|
32231
|
+
children: /* @__PURE__ */ jsx121(ConversationContextProvider, { children: /* @__PURE__ */ jsx121(AgentChatWithThread, { assistantId: parsed.payload }) })
|
|
31293
32232
|
}
|
|
31294
32233
|
)
|
|
31295
32234
|
}
|
|
31296
32235
|
);
|
|
31297
32236
|
case "html": {
|
|
31298
32237
|
const url = decodeURIComponent(parsed.payload);
|
|
31299
|
-
return /* @__PURE__ */
|
|
32238
|
+
return /* @__PURE__ */ jsx121("iframe", { src: url, style: IFRAME_STYLE, title: "Custom HTML Page" });
|
|
31300
32239
|
}
|
|
31301
32240
|
case "custom": {
|
|
31302
32241
|
const element = getElement(parsed.payload);
|
|
31303
32242
|
if (element?.side_app_view) {
|
|
31304
32243
|
const Comp = element.side_app_view;
|
|
31305
|
-
return /* @__PURE__ */
|
|
32244
|
+
return /* @__PURE__ */ jsx121(Comp, { component_key: parsed.payload, data: void 0 });
|
|
31306
32245
|
}
|
|
31307
|
-
return /* @__PURE__ */
|
|
32246
|
+
return /* @__PURE__ */ jsxs87("div", { style: { padding: 24, color: "#999" }, children: [
|
|
31308
32247
|
'Component "',
|
|
31309
32248
|
parsed.payload,
|
|
31310
32249
|
'" not found'
|
|
31311
32250
|
] });
|
|
31312
32251
|
}
|
|
31313
32252
|
default:
|
|
31314
|
-
return /* @__PURE__ */
|
|
32253
|
+
return /* @__PURE__ */ jsxs87("div", { style: { padding: 24, color: "#999" }, children: [
|
|
31315
32254
|
"Unknown content type: ",
|
|
31316
32255
|
parsed.contentType
|
|
31317
32256
|
] });
|
|
@@ -31325,10 +32264,10 @@ import {
|
|
|
31325
32264
|
MoreOutlined as MoreOutlined3
|
|
31326
32265
|
} from "@ant-design/icons";
|
|
31327
32266
|
import { Dropdown as Dropdown4, Tooltip as Tooltip25 } from "antd";
|
|
31328
|
-
import { createStyles as
|
|
31329
|
-
import { useEffect as
|
|
31330
|
-
import { Fragment as
|
|
31331
|
-
var useStyle17 =
|
|
32267
|
+
import { createStyles as createStyles37 } from "antd-style";
|
|
32268
|
+
import { useEffect as useEffect52, useMemo as useMemo34, useState as useState76 } from "react";
|
|
32269
|
+
import { Fragment as Fragment25, jsx as jsx122, jsxs as jsxs88 } from "react/jsx-runtime";
|
|
32270
|
+
var useStyle17 = createStyles37(({ token, css }) => {
|
|
31332
32271
|
return {
|
|
31333
32272
|
container: css`
|
|
31334
32273
|
display: flex;
|
|
@@ -31504,15 +32443,15 @@ var useStyle17 = createStyles36(({ token, css }) => {
|
|
|
31504
32443
|
});
|
|
31505
32444
|
var EmptySideAppView = ({ component_key, data }) => {
|
|
31506
32445
|
if (data?.component) {
|
|
31507
|
-
return /* @__PURE__ */
|
|
32446
|
+
return /* @__PURE__ */ jsx122(Fragment25, { children: data.component });
|
|
31508
32447
|
}
|
|
31509
|
-
return /* @__PURE__ */
|
|
31510
|
-
/* @__PURE__ */
|
|
31511
|
-
/* @__PURE__ */
|
|
32448
|
+
return /* @__PURE__ */ jsxs88("div", { children: [
|
|
32449
|
+
/* @__PURE__ */ jsx122("p", { children: "Component view not found" }),
|
|
32450
|
+
/* @__PURE__ */ jsx122("pre", { children: JSON.stringify({ component_key, data }, null, 2) })
|
|
31512
32451
|
] });
|
|
31513
32452
|
};
|
|
31514
32453
|
var getTabIcon = (componentKey) => {
|
|
31515
|
-
return /* @__PURE__ */
|
|
32454
|
+
return /* @__PURE__ */ jsx122(AppstoreOutlined, { style: { fontSize: 12, opacity: 0.6 } });
|
|
31516
32455
|
};
|
|
31517
32456
|
var SideAppViewBrowser = ({ region = "side" }) => {
|
|
31518
32457
|
const { styles } = useStyle17();
|
|
@@ -31527,11 +32466,11 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
31527
32466
|
const selectedCard = region === "side" ? sideAppSelectedCard : contextAppSelectedCard;
|
|
31528
32467
|
const closeApp = region === "side" ? closeSideApp : closeContentApp;
|
|
31529
32468
|
const openApp = region === "side" ? openSideApp : openContentApp;
|
|
31530
|
-
const [activeKey, setActiveKey] =
|
|
32469
|
+
const [activeKey, setActiveKey] = useState76(
|
|
31531
32470
|
JSON.stringify(selectedCard)
|
|
31532
32471
|
);
|
|
31533
|
-
const [hoveredTab, setHoveredTab] =
|
|
31534
|
-
const [items, setItems] =
|
|
32472
|
+
const [hoveredTab, setHoveredTab] = useState76(null);
|
|
32473
|
+
const [items, setItems] = useState76([]);
|
|
31535
32474
|
const add = (key, label, children, componentKey) => {
|
|
31536
32475
|
const newPanes = [...items, { label, children, key, componentKey }];
|
|
31537
32476
|
setItems(newPanes);
|
|
@@ -31558,7 +32497,7 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
31558
32497
|
const switchTab = (key) => {
|
|
31559
32498
|
setActiveKey(key);
|
|
31560
32499
|
};
|
|
31561
|
-
|
|
32500
|
+
useEffect52(() => {
|
|
31562
32501
|
if (!selectedCard) return;
|
|
31563
32502
|
const key = JSON.stringify(selectedCard);
|
|
31564
32503
|
if (items.find((item) => item.key === key)) {
|
|
@@ -31573,7 +32512,7 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
31573
32512
|
add(
|
|
31574
32513
|
key,
|
|
31575
32514
|
selectedCard?.message || selectedCard?.data?.message || "Unnamed",
|
|
31576
|
-
/* @__PURE__ */
|
|
32515
|
+
/* @__PURE__ */ jsx122(
|
|
31577
32516
|
SideAppView,
|
|
31578
32517
|
{
|
|
31579
32518
|
component_key: selectedCard?.component_key || "",
|
|
@@ -31587,7 +32526,7 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
31587
32526
|
const activeItem = items.find((item) => item.key === activeKey);
|
|
31588
32527
|
const dropdownItems = items.map((item) => ({
|
|
31589
32528
|
key: item.key,
|
|
31590
|
-
label: /* @__PURE__ */
|
|
32529
|
+
label: /* @__PURE__ */ jsxs88(
|
|
31591
32530
|
"div",
|
|
31592
32531
|
{
|
|
31593
32532
|
style: {
|
|
@@ -31598,8 +32537,8 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
31598
32537
|
},
|
|
31599
32538
|
children: [
|
|
31600
32539
|
getTabIcon(item.componentKey),
|
|
31601
|
-
/* @__PURE__ */
|
|
31602
|
-
/* @__PURE__ */
|
|
32540
|
+
/* @__PURE__ */ jsx122("span", { style: { flex: 1 }, children: item.label }),
|
|
32541
|
+
/* @__PURE__ */ jsx122(
|
|
31603
32542
|
CloseOutlined4,
|
|
31604
32543
|
{
|
|
31605
32544
|
style: { fontSize: 10, opacity: 0.5 },
|
|
@@ -31614,13 +32553,13 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
31614
32553
|
),
|
|
31615
32554
|
onClick: () => switchTab(item.key)
|
|
31616
32555
|
}));
|
|
31617
|
-
const sideAppBrowserValue =
|
|
32556
|
+
const sideAppBrowserValue = useMemo34(
|
|
31618
32557
|
() => ({ openApp }),
|
|
31619
32558
|
[openApp]
|
|
31620
32559
|
);
|
|
31621
|
-
return /* @__PURE__ */
|
|
31622
|
-
/* @__PURE__ */
|
|
31623
|
-
/* @__PURE__ */
|
|
32560
|
+
return /* @__PURE__ */ jsxs88("div", { className: styles.container, children: [
|
|
32561
|
+
/* @__PURE__ */ jsxs88("div", { className: styles.header, children: [
|
|
32562
|
+
/* @__PURE__ */ jsx122("div", { className: styles.tabsStrip, children: items.map((item) => /* @__PURE__ */ jsx122(Tooltip25, { title: item.label, placement: "bottom", children: /* @__PURE__ */ jsxs88(
|
|
31624
32563
|
"div",
|
|
31625
32564
|
{
|
|
31626
32565
|
"data-tab-key": item.key,
|
|
@@ -31630,8 +32569,8 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
31630
32569
|
onMouseLeave: () => setHoveredTab(null),
|
|
31631
32570
|
children: [
|
|
31632
32571
|
getTabIcon(item.componentKey),
|
|
31633
|
-
/* @__PURE__ */
|
|
31634
|
-
/* @__PURE__ */
|
|
32572
|
+
/* @__PURE__ */ jsx122("span", { className: styles.tabLabel, children: item.label }),
|
|
32573
|
+
/* @__PURE__ */ jsx122(
|
|
31635
32574
|
"span",
|
|
31636
32575
|
{
|
|
31637
32576
|
className: `${styles.closeIndicator} ${hoveredTab === item.key || item.key === activeKey ? "always-visible" : ""}`,
|
|
@@ -31639,48 +32578,48 @@ var SideAppViewBrowser = ({ region = "side" }) => {
|
|
|
31639
32578
|
e.stopPropagation();
|
|
31640
32579
|
remove(item.key);
|
|
31641
32580
|
},
|
|
31642
|
-
children: /* @__PURE__ */
|
|
32581
|
+
children: /* @__PURE__ */ jsx122(CloseOutlined4, { style: { fontSize: 10 } })
|
|
31643
32582
|
}
|
|
31644
32583
|
)
|
|
31645
32584
|
]
|
|
31646
32585
|
}
|
|
31647
32586
|
) }, item.key)) }),
|
|
31648
|
-
/* @__PURE__ */
|
|
31649
|
-
items.length > 0 && /* @__PURE__ */
|
|
31650
|
-
items.length > 1 && /* @__PURE__ */
|
|
32587
|
+
/* @__PURE__ */ jsxs88("div", { className: styles.actions, children: [
|
|
32588
|
+
items.length > 0 && /* @__PURE__ */ jsx122("div", { className: styles.tabCounter, children: items.length }),
|
|
32589
|
+
items.length > 1 && /* @__PURE__ */ jsx122(
|
|
31651
32590
|
Dropdown4,
|
|
31652
32591
|
{
|
|
31653
32592
|
menu: { items: dropdownItems },
|
|
31654
32593
|
placement: "bottomRight",
|
|
31655
32594
|
trigger: ["click"],
|
|
31656
|
-
children: /* @__PURE__ */
|
|
32595
|
+
children: /* @__PURE__ */ jsx122("button", { className: styles.actionBtn, title: "All tabs", children: /* @__PURE__ */ jsx122(MoreOutlined3, {}) })
|
|
31657
32596
|
}
|
|
31658
32597
|
),
|
|
31659
|
-
/* @__PURE__ */
|
|
32598
|
+
/* @__PURE__ */ jsx122(Tooltip25, { title: "Close", children: /* @__PURE__ */ jsx122("button", { className: styles.actionBtn, onClick: closeApp, children: /* @__PURE__ */ jsx122(CloseOutlined4, {}) }) })
|
|
31660
32599
|
] })
|
|
31661
32600
|
] }),
|
|
31662
|
-
/* @__PURE__ */
|
|
31663
|
-
/* @__PURE__ */
|
|
31664
|
-
/* @__PURE__ */
|
|
32601
|
+
/* @__PURE__ */ jsx122("div", { className: styles.content, children: /* @__PURE__ */ jsx122(SideAppBrowserContext.Provider, { value: sideAppBrowserValue, children: activeItem ? /* @__PURE__ */ jsx122("div", { className: styles.contentWrapper, children: activeItem.children }, activeItem.key) : /* @__PURE__ */ jsxs88("div", { className: styles.emptyState, children: [
|
|
32602
|
+
/* @__PURE__ */ jsx122(AppstoreOutlined, { className: "icon" }),
|
|
32603
|
+
/* @__PURE__ */ jsx122("span", { children: "Select an app to start" })
|
|
31665
32604
|
] }) }) })
|
|
31666
32605
|
] });
|
|
31667
32606
|
};
|
|
31668
32607
|
|
|
31669
32608
|
// src/components/Chat/WorkspaceResourceManager.tsx
|
|
31670
|
-
import { jsx as
|
|
32609
|
+
import { jsx as jsx123, jsxs as jsxs89 } from "react/jsx-runtime";
|
|
31671
32610
|
var DEFAULT_WORKSPACE_MENU_ITEMS = [
|
|
31672
32611
|
{
|
|
31673
32612
|
id: "personal_assistant",
|
|
31674
32613
|
type: "route",
|
|
31675
32614
|
name: "Personal Assistant",
|
|
31676
|
-
icon: /* @__PURE__ */
|
|
32615
|
+
icon: /* @__PURE__ */ jsx123(Bot5, { size: 20 }),
|
|
31677
32616
|
order: -10
|
|
31678
32617
|
},
|
|
31679
32618
|
{
|
|
31680
32619
|
id: "workspace_projects",
|
|
31681
32620
|
type: "route",
|
|
31682
32621
|
name: "Projects",
|
|
31683
|
-
icon: /* @__PURE__ */
|
|
32622
|
+
icon: /* @__PURE__ */ jsx123(FolderOpen3, { size: 20 }),
|
|
31684
32623
|
order: 0
|
|
31685
32624
|
},
|
|
31686
32625
|
{
|
|
@@ -31688,7 +32627,7 @@ var DEFAULT_WORKSPACE_MENU_ITEMS = [
|
|
|
31688
32627
|
builtin: "metrics",
|
|
31689
32628
|
type: "route",
|
|
31690
32629
|
name: "Metrics",
|
|
31691
|
-
icon: /* @__PURE__ */
|
|
32630
|
+
icon: /* @__PURE__ */ jsx123(Activity4, { size: 20 }),
|
|
31692
32631
|
order: 10,
|
|
31693
32632
|
group: "DataSource"
|
|
31694
32633
|
},
|
|
@@ -31697,7 +32636,7 @@ var DEFAULT_WORKSPACE_MENU_ITEMS = [
|
|
|
31697
32636
|
builtin: "database",
|
|
31698
32637
|
type: "route",
|
|
31699
32638
|
name: "Database",
|
|
31700
|
-
icon: /* @__PURE__ */
|
|
32639
|
+
icon: /* @__PURE__ */ jsx123(Database7, { size: 20 }),
|
|
31701
32640
|
order: 20,
|
|
31702
32641
|
group: "DataSource"
|
|
31703
32642
|
},
|
|
@@ -31705,7 +32644,7 @@ var DEFAULT_WORKSPACE_MENU_ITEMS = [
|
|
|
31705
32644
|
id: "topology-runtimes",
|
|
31706
32645
|
type: "route",
|
|
31707
32646
|
name: "Runtime",
|
|
31708
|
-
icon: /* @__PURE__ */
|
|
32647
|
+
icon: /* @__PURE__ */ jsx123(History, { size: 20 }),
|
|
31709
32648
|
order: 26,
|
|
31710
32649
|
group: "Process"
|
|
31711
32650
|
},
|
|
@@ -31713,7 +32652,7 @@ var DEFAULT_WORKSPACE_MENU_ITEMS = [
|
|
|
31713
32652
|
id: "topology-inbox",
|
|
31714
32653
|
type: "route",
|
|
31715
32654
|
name: "Inbox",
|
|
31716
|
-
icon: /* @__PURE__ */
|
|
32655
|
+
icon: /* @__PURE__ */ jsx123(Inbox3, { size: 20 }),
|
|
31717
32656
|
order: 27,
|
|
31718
32657
|
group: "Process"
|
|
31719
32658
|
},
|
|
@@ -31721,7 +32660,7 @@ var DEFAULT_WORKSPACE_MENU_ITEMS = [
|
|
|
31721
32660
|
id: "workflows",
|
|
31722
32661
|
type: "route",
|
|
31723
32662
|
name: "Automations",
|
|
31724
|
-
icon: /* @__PURE__ */
|
|
32663
|
+
icon: /* @__PURE__ */ jsx123(Share2, { size: 20 }),
|
|
31725
32664
|
order: 25,
|
|
31726
32665
|
group: "Process"
|
|
31727
32666
|
},
|
|
@@ -31729,7 +32668,7 @@ var DEFAULT_WORKSPACE_MENU_ITEMS = [
|
|
|
31729
32668
|
id: "eval",
|
|
31730
32669
|
type: "route",
|
|
31731
32670
|
name: "Eval",
|
|
31732
|
-
icon: /* @__PURE__ */
|
|
32671
|
+
icon: /* @__PURE__ */ jsx123(FlaskConical3, { size: 20 }),
|
|
31733
32672
|
order: 28,
|
|
31734
32673
|
group: "Process"
|
|
31735
32674
|
},
|
|
@@ -31738,7 +32677,7 @@ var DEFAULT_WORKSPACE_MENU_ITEMS = [
|
|
|
31738
32677
|
builtin: "assistants",
|
|
31739
32678
|
type: "route",
|
|
31740
32679
|
name: "Assistants",
|
|
31741
|
-
icon: /* @__PURE__ */
|
|
32680
|
+
icon: /* @__PURE__ */ jsx123(Bot5, { size: 20 }),
|
|
31742
32681
|
order: 30,
|
|
31743
32682
|
group: "Settings"
|
|
31744
32683
|
},
|
|
@@ -31747,7 +32686,7 @@ var DEFAULT_WORKSPACE_MENU_ITEMS = [
|
|
|
31747
32686
|
builtin: "skills",
|
|
31748
32687
|
type: "route",
|
|
31749
32688
|
name: "Skills",
|
|
31750
|
-
icon: /* @__PURE__ */
|
|
32689
|
+
icon: /* @__PURE__ */ jsx123(Zap2, { size: 20 }),
|
|
31751
32690
|
order: 35,
|
|
31752
32691
|
group: "Settings"
|
|
31753
32692
|
},
|
|
@@ -31756,7 +32695,7 @@ var DEFAULT_WORKSPACE_MENU_ITEMS = [
|
|
|
31756
32695
|
builtin: "mcp",
|
|
31757
32696
|
type: "route",
|
|
31758
32697
|
name: "MCP",
|
|
31759
|
-
icon: /* @__PURE__ */
|
|
32698
|
+
icon: /* @__PURE__ */ jsx123(Plug2, { size: 20 }),
|
|
31760
32699
|
order: 40,
|
|
31761
32700
|
group: "Settings"
|
|
31762
32701
|
},
|
|
@@ -31765,7 +32704,7 @@ var DEFAULT_WORKSPACE_MENU_ITEMS = [
|
|
|
31765
32704
|
builtin: "tools",
|
|
31766
32705
|
type: "route",
|
|
31767
32706
|
name: "Tools",
|
|
31768
|
-
icon: /* @__PURE__ */
|
|
32707
|
+
icon: /* @__PURE__ */ jsx123(Wrench2, { size: 20 }),
|
|
31769
32708
|
order: 50,
|
|
31770
32709
|
group: "Settings"
|
|
31771
32710
|
},
|
|
@@ -31774,13 +32713,13 @@ var DEFAULT_WORKSPACE_MENU_ITEMS = [
|
|
|
31774
32713
|
builtin: "switch-tenant",
|
|
31775
32714
|
type: "action",
|
|
31776
32715
|
name: "Switch tenant",
|
|
31777
|
-
icon: /* @__PURE__ */
|
|
32716
|
+
icon: /* @__PURE__ */ jsx123(Building23, { size: 20 }),
|
|
31778
32717
|
order: 900,
|
|
31779
32718
|
group: "Account"
|
|
31780
32719
|
}
|
|
31781
32720
|
];
|
|
31782
32721
|
var createWrapper = (Component) => {
|
|
31783
|
-
return () => /* @__PURE__ */
|
|
32722
|
+
return () => /* @__PURE__ */ jsx123(Component, { ...{} });
|
|
31784
32723
|
};
|
|
31785
32724
|
var WorkspaceResourceManager = ({
|
|
31786
32725
|
workspaceId,
|
|
@@ -31788,9 +32727,9 @@ var WorkspaceResourceManager = ({
|
|
|
31788
32727
|
logo
|
|
31789
32728
|
}) => {
|
|
31790
32729
|
const { openContentApp, menuCollapsed, setMenuCollapsed } = useChatUIContext();
|
|
31791
|
-
const hasOpenedDefault =
|
|
31792
|
-
const hasRegistered =
|
|
31793
|
-
|
|
32730
|
+
const hasOpenedDefault = useRef28(false);
|
|
32731
|
+
const hasRegistered = useRef28(false);
|
|
32732
|
+
useEffect53(() => {
|
|
31794
32733
|
if (!hasRegistered.current) {
|
|
31795
32734
|
hasRegistered.current = true;
|
|
31796
32735
|
regsiterElement("workspace_projects", {
|
|
@@ -31819,7 +32758,7 @@ var WorkspaceResourceManager = ({
|
|
|
31819
32758
|
});
|
|
31820
32759
|
regsiterElement("workspace_tools", {
|
|
31821
32760
|
card_view: () => null,
|
|
31822
|
-
side_app_view: createWrapper(() => /* @__PURE__ */
|
|
32761
|
+
side_app_view: createWrapper(() => /* @__PURE__ */ jsx123(
|
|
31823
32762
|
ToolsList,
|
|
31824
32763
|
{
|
|
31825
32764
|
onToolSelect: (tool) => {
|
|
@@ -31854,10 +32793,10 @@ var WorkspaceResourceManager = ({
|
|
|
31854
32793
|
const { setWorkspace, setProject } = useWorkspaceContext();
|
|
31855
32794
|
const { config } = useLatticeChatShellContext();
|
|
31856
32795
|
const { get } = useApi();
|
|
31857
|
-
const [tenantModalOpen, setTenantModalOpen] =
|
|
31858
|
-
const [changePasswordOpen, setChangePasswordOpen] =
|
|
31859
|
-
const [fetchedCustomMenuItems, setFetchedCustomMenuItems] =
|
|
31860
|
-
|
|
32796
|
+
const [tenantModalOpen, setTenantModalOpen] = useState77(false);
|
|
32797
|
+
const [changePasswordOpen, setChangePasswordOpen] = useState77(false);
|
|
32798
|
+
const [fetchedCustomMenuItems, setFetchedCustomMenuItems] = useState77([]);
|
|
32799
|
+
useEffect53(() => {
|
|
31861
32800
|
const fetchCustomMenu = async () => {
|
|
31862
32801
|
try {
|
|
31863
32802
|
const json = await get("/api/menu-items?menuTarget=workspace");
|
|
@@ -31870,7 +32809,7 @@ var WorkspaceResourceManager = ({
|
|
|
31870
32809
|
};
|
|
31871
32810
|
fetchCustomMenu();
|
|
31872
32811
|
}, [get]);
|
|
31873
|
-
|
|
32812
|
+
useEffect53(() => {
|
|
31874
32813
|
for (const item of fetchedCustomMenuItems) {
|
|
31875
32814
|
regsiterElement(item.id, {
|
|
31876
32815
|
card_view: () => null,
|
|
@@ -31878,7 +32817,7 @@ var WorkspaceResourceManager = ({
|
|
|
31878
32817
|
});
|
|
31879
32818
|
}
|
|
31880
32819
|
}, [fetchedCustomMenuItems]);
|
|
31881
|
-
const menuItems =
|
|
32820
|
+
const menuItems = useMemo35(() => {
|
|
31882
32821
|
const workspaceMenu = config.workspaceMenuItems?.length ? config.workspaceMenuItems : void 0;
|
|
31883
32822
|
if (workspaceMenu) {
|
|
31884
32823
|
return [...workspaceMenu].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
@@ -31914,7 +32853,7 @@ var WorkspaceResourceManager = ({
|
|
|
31914
32853
|
});
|
|
31915
32854
|
}
|
|
31916
32855
|
};
|
|
31917
|
-
|
|
32856
|
+
useEffect53(() => {
|
|
31918
32857
|
if (!hasOpenedDefault.current && menuItems.length > 0) {
|
|
31919
32858
|
hasOpenedDefault.current = true;
|
|
31920
32859
|
const firstRoute = menuItems.find((item) => item.type === "route");
|
|
@@ -31923,26 +32862,26 @@ var WorkspaceResourceManager = ({
|
|
|
31923
32862
|
}
|
|
31924
32863
|
}
|
|
31925
32864
|
}, []);
|
|
31926
|
-
const userMenuItems = /* @__PURE__ */
|
|
31927
|
-
/* @__PURE__ */
|
|
31928
|
-
/* @__PURE__ */
|
|
31929
|
-
/* @__PURE__ */
|
|
32865
|
+
const userMenuItems = /* @__PURE__ */ jsxs89("div", { style: { minWidth: 160 }, children: [
|
|
32866
|
+
/* @__PURE__ */ jsxs89("div", { style: { padding: "8px 12px", borderBottom: "1px solid #f0f0f0" }, children: [
|
|
32867
|
+
/* @__PURE__ */ jsx123("div", { style: { fontWeight: 500 }, children: user?.name || user?.email }),
|
|
32868
|
+
/* @__PURE__ */ jsx123("div", { style: { fontSize: 12, color: "#666" }, children: user?.email })
|
|
31930
32869
|
] }),
|
|
31931
|
-
/* @__PURE__ */
|
|
31932
|
-
|
|
32870
|
+
/* @__PURE__ */ jsxs89(
|
|
32871
|
+
Button56,
|
|
31933
32872
|
{
|
|
31934
32873
|
type: "text",
|
|
31935
32874
|
block: true,
|
|
31936
32875
|
style: { justifyContent: "flex-start", padding: "8px 12px" },
|
|
31937
32876
|
onClick: () => setChangePasswordOpen(true),
|
|
31938
32877
|
children: [
|
|
31939
|
-
/* @__PURE__ */
|
|
32878
|
+
/* @__PURE__ */ jsx123(Key, { size: 16, style: { marginRight: 8 } }),
|
|
31940
32879
|
"Change Password"
|
|
31941
32880
|
]
|
|
31942
32881
|
}
|
|
31943
32882
|
),
|
|
31944
|
-
/* @__PURE__ */
|
|
31945
|
-
|
|
32883
|
+
/* @__PURE__ */ jsxs89(
|
|
32884
|
+
Button56,
|
|
31946
32885
|
{
|
|
31947
32886
|
type: "text",
|
|
31948
32887
|
block: true,
|
|
@@ -31950,13 +32889,13 @@ var WorkspaceResourceManager = ({
|
|
|
31950
32889
|
style: { justifyContent: "flex-start", padding: "8px 12px" },
|
|
31951
32890
|
onClick: logout,
|
|
31952
32891
|
children: [
|
|
31953
|
-
/* @__PURE__ */
|
|
32892
|
+
/* @__PURE__ */ jsx123(LogOut3, { size: 16, style: { marginRight: 8 } }),
|
|
31954
32893
|
"Logout"
|
|
31955
32894
|
]
|
|
31956
32895
|
}
|
|
31957
32896
|
)
|
|
31958
32897
|
] });
|
|
31959
|
-
return /* @__PURE__ */
|
|
32898
|
+
return /* @__PURE__ */ jsxs89(
|
|
31960
32899
|
"div",
|
|
31961
32900
|
{
|
|
31962
32901
|
style: {
|
|
@@ -31966,10 +32905,10 @@ var WorkspaceResourceManager = ({
|
|
|
31966
32905
|
height: "100%"
|
|
31967
32906
|
},
|
|
31968
32907
|
children: [
|
|
31969
|
-
/* @__PURE__ */
|
|
32908
|
+
/* @__PURE__ */ jsx123(
|
|
31970
32909
|
ColumnLayout,
|
|
31971
32910
|
{
|
|
31972
|
-
menu: /* @__PURE__ */
|
|
32911
|
+
menu: /* @__PURE__ */ jsx123(
|
|
31973
32912
|
Menu,
|
|
31974
32913
|
{
|
|
31975
32914
|
items: menuItems,
|
|
@@ -31980,13 +32919,13 @@ var WorkspaceResourceManager = ({
|
|
|
31980
32919
|
defaultExpanded: config.workspaceMenuDefaultExpanded ?? true,
|
|
31981
32920
|
collapsed: menuCollapsed,
|
|
31982
32921
|
onCollapsedChange: setMenuCollapsed,
|
|
31983
|
-
footer: ({ isIconMode }) => user && /* @__PURE__ */
|
|
32922
|
+
footer: ({ isIconMode }) => user && /* @__PURE__ */ jsx123(
|
|
31984
32923
|
Popover3,
|
|
31985
32924
|
{
|
|
31986
32925
|
content: userMenuItems,
|
|
31987
32926
|
placement: "rightTop",
|
|
31988
32927
|
trigger: "click",
|
|
31989
|
-
children: /* @__PURE__ */
|
|
32928
|
+
children: /* @__PURE__ */ jsxs89(
|
|
31990
32929
|
"div",
|
|
31991
32930
|
{
|
|
31992
32931
|
style: {
|
|
@@ -32000,7 +32939,7 @@ var WorkspaceResourceManager = ({
|
|
|
32000
32939
|
transition: "all 0.2s"
|
|
32001
32940
|
},
|
|
32002
32941
|
children: [
|
|
32003
|
-
/* @__PURE__ */
|
|
32942
|
+
/* @__PURE__ */ jsx123(
|
|
32004
32943
|
Avatar12,
|
|
32005
32944
|
{
|
|
32006
32945
|
size: isIconMode ? 32 : 36,
|
|
@@ -32012,8 +32951,8 @@ var WorkspaceResourceManager = ({
|
|
|
32012
32951
|
children: (user.name?.charAt(0) || user.email.charAt(0)).toUpperCase()
|
|
32013
32952
|
}
|
|
32014
32953
|
),
|
|
32015
|
-
!isIconMode && /* @__PURE__ */
|
|
32016
|
-
/* @__PURE__ */
|
|
32954
|
+
!isIconMode && /* @__PURE__ */ jsxs89("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
32955
|
+
/* @__PURE__ */ jsx123(
|
|
32017
32956
|
"div",
|
|
32018
32957
|
{
|
|
32019
32958
|
style: {
|
|
@@ -32025,7 +32964,7 @@ var WorkspaceResourceManager = ({
|
|
|
32025
32964
|
children: user.name || user.email
|
|
32026
32965
|
}
|
|
32027
32966
|
),
|
|
32028
|
-
/* @__PURE__ */
|
|
32967
|
+
/* @__PURE__ */ jsx123(
|
|
32029
32968
|
"div",
|
|
32030
32969
|
{
|
|
32031
32970
|
style: {
|
|
@@ -32047,11 +32986,11 @@ var WorkspaceResourceManager = ({
|
|
|
32047
32986
|
}
|
|
32048
32987
|
),
|
|
32049
32988
|
logo,
|
|
32050
|
-
main: /* @__PURE__ */
|
|
32989
|
+
main: /* @__PURE__ */ jsx123(SideAppViewBrowser, { region: "content" })
|
|
32051
32990
|
}
|
|
32052
32991
|
),
|
|
32053
|
-
/* @__PURE__ */
|
|
32054
|
-
|
|
32992
|
+
/* @__PURE__ */ jsx123(
|
|
32993
|
+
Modal21,
|
|
32055
32994
|
{
|
|
32056
32995
|
open: tenantModalOpen,
|
|
32057
32996
|
onCancel: () => setTenantModalOpen(false),
|
|
@@ -32067,7 +33006,7 @@ var WorkspaceResourceManager = ({
|
|
|
32067
33006
|
boxShadow: "none"
|
|
32068
33007
|
}
|
|
32069
33008
|
},
|
|
32070
|
-
children: /* @__PURE__ */
|
|
33009
|
+
children: /* @__PURE__ */ jsx123(
|
|
32071
33010
|
TenantSelector,
|
|
32072
33011
|
{
|
|
32073
33012
|
tenants: tenants.map((t) => t.tenant).filter(Boolean),
|
|
@@ -32082,7 +33021,7 @@ var WorkspaceResourceManager = ({
|
|
|
32082
33021
|
)
|
|
32083
33022
|
}
|
|
32084
33023
|
),
|
|
32085
|
-
/* @__PURE__ */
|
|
33024
|
+
/* @__PURE__ */ jsx123(
|
|
32086
33025
|
ChangePasswordModal,
|
|
32087
33026
|
{
|
|
32088
33027
|
open: changePasswordOpen,
|
|
@@ -32098,11 +33037,11 @@ var WorkspaceResourceUIContext = ({
|
|
|
32098
33037
|
workspaceName,
|
|
32099
33038
|
logo
|
|
32100
33039
|
}) => {
|
|
32101
|
-
return /* @__PURE__ */
|
|
33040
|
+
return /* @__PURE__ */ jsx123(ChatUIContextProvider, { children: /* @__PURE__ */ jsx123(WorkspaceResourceManager, { workspaceId, workspaceName, logo }) });
|
|
32102
33041
|
};
|
|
32103
33042
|
|
|
32104
33043
|
// src/context/WorkspaceContext.tsx
|
|
32105
|
-
import { jsx as
|
|
33044
|
+
import { jsx as jsx124 } from "react/jsx-runtime";
|
|
32106
33045
|
var WorkspaceContext = createContext9(null);
|
|
32107
33046
|
var useWorkspaceContext = () => {
|
|
32108
33047
|
const context = useContext11(WorkspaceContext);
|
|
@@ -32129,23 +33068,23 @@ var WorkspaceContextProvider = ({
|
|
|
32129
33068
|
if (typeof window !== "undefined") return sessionStorage.getItem("projectId");
|
|
32130
33069
|
return null;
|
|
32131
33070
|
};
|
|
32132
|
-
const [workspaceId, setWorkspaceId] =
|
|
32133
|
-
const [projectId, setProjectId] =
|
|
32134
|
-
|
|
33071
|
+
const [workspaceId, setWorkspaceId] = useState78(getInitialWorkspaceId);
|
|
33072
|
+
const [projectId, setProjectId] = useState78(getInitialProjectId);
|
|
33073
|
+
React71.useEffect(() => {
|
|
32135
33074
|
const wsId = getInitialWorkspaceId();
|
|
32136
33075
|
const pjId = getInitialProjectId();
|
|
32137
33076
|
if (wsId || pjId) {
|
|
32138
33077
|
Client3.setWorkspaceContext(wsId || void 0, pjId || void 0);
|
|
32139
33078
|
}
|
|
32140
33079
|
}, []);
|
|
32141
|
-
|
|
33080
|
+
useEffect54(() => {
|
|
32142
33081
|
Client3.setWorkspaceContext(workspaceId || void 0, projectId || void 0);
|
|
32143
33082
|
}, [workspaceId, projectId]);
|
|
32144
|
-
const [workspaces, setWorkspaces] =
|
|
32145
|
-
const [projects, setProjects] =
|
|
32146
|
-
const [loading, setLoading] =
|
|
32147
|
-
const [error, setError] =
|
|
32148
|
-
const client =
|
|
33083
|
+
const [workspaces, setWorkspaces] = useState78([]);
|
|
33084
|
+
const [projects, setProjects] = useState78([]);
|
|
33085
|
+
const [loading, setLoading] = useState78(false);
|
|
33086
|
+
const [error, setError] = useState78(null);
|
|
33087
|
+
const client = React71.useMemo(() => {
|
|
32149
33088
|
const authApiKey = isAuthenticated ? sessionStorage.getItem("lattice_token") || config.apiKey || "" : config.apiKey || "";
|
|
32150
33089
|
return new WorkspaceClient({
|
|
32151
33090
|
baseURL: config.baseURL,
|
|
@@ -32154,22 +33093,22 @@ var WorkspaceContextProvider = ({
|
|
|
32154
33093
|
transport: "sse"
|
|
32155
33094
|
}, tenantId);
|
|
32156
33095
|
}, [config.baseURL, config.apiKey, tenantId, isAuthenticated]);
|
|
32157
|
-
const resetSelectedWorkspace =
|
|
33096
|
+
const resetSelectedWorkspace = useCallback40(() => {
|
|
32158
33097
|
setProjects([]);
|
|
32159
33098
|
setWorkspaceId(null);
|
|
32160
33099
|
sessionStorage.removeItem("workspaceId");
|
|
32161
33100
|
setProjectId(defaultProjectId ?? null);
|
|
32162
33101
|
sessionStorage.removeItem("projectId");
|
|
32163
33102
|
}, [setProjects, setWorkspaceId, setProjectId, defaultProjectId]);
|
|
32164
|
-
const resetWS =
|
|
33103
|
+
const resetWS = useCallback40(() => {
|
|
32165
33104
|
setWorkspaces([]);
|
|
32166
33105
|
resetSelectedWorkspace();
|
|
32167
33106
|
}, [resetSelectedWorkspace, setWorkspaces]);
|
|
32168
|
-
|
|
33107
|
+
useEffect54(() => {
|
|
32169
33108
|
resetWS();
|
|
32170
33109
|
refreshWorkspaces();
|
|
32171
33110
|
}, [tenantId]);
|
|
32172
|
-
const refreshWorkspaces =
|
|
33111
|
+
const refreshWorkspaces = useCallback40(async () => {
|
|
32173
33112
|
setLoading(true);
|
|
32174
33113
|
setError(null);
|
|
32175
33114
|
try {
|
|
@@ -32181,7 +33120,7 @@ var WorkspaceContextProvider = ({
|
|
|
32181
33120
|
setLoading(false);
|
|
32182
33121
|
}
|
|
32183
33122
|
}, [client]);
|
|
32184
|
-
const refreshProjects =
|
|
33123
|
+
const refreshProjects = useCallback40(async (wsId) => {
|
|
32185
33124
|
const targetWorkspaceId = wsId || workspaceId;
|
|
32186
33125
|
if (!targetWorkspaceId) {
|
|
32187
33126
|
setProjects([]);
|
|
@@ -32198,29 +33137,29 @@ var WorkspaceContextProvider = ({
|
|
|
32198
33137
|
setLoading(false);
|
|
32199
33138
|
}
|
|
32200
33139
|
}, [client, workspaceId]);
|
|
32201
|
-
|
|
33140
|
+
useEffect54(() => {
|
|
32202
33141
|
if (workspaceId && typeof window !== "undefined") {
|
|
32203
33142
|
sessionStorage.setItem("workspaceId", workspaceId);
|
|
32204
33143
|
}
|
|
32205
33144
|
}, [workspaceId]);
|
|
32206
|
-
|
|
33145
|
+
useEffect54(() => {
|
|
32207
33146
|
if (projectId && typeof window !== "undefined") {
|
|
32208
33147
|
sessionStorage.setItem("projectId", projectId);
|
|
32209
33148
|
}
|
|
32210
33149
|
}, [projectId]);
|
|
32211
|
-
|
|
33150
|
+
useEffect54(() => {
|
|
32212
33151
|
refreshWorkspaces().catch((err) => {
|
|
32213
33152
|
console.warn("Failed to load workspaces:", err);
|
|
32214
33153
|
});
|
|
32215
33154
|
}, [refreshWorkspaces]);
|
|
32216
|
-
|
|
33155
|
+
useEffect54(() => {
|
|
32217
33156
|
if (workspaces.length > 0 && !workspaceId) {
|
|
32218
33157
|
const firstWorkspace = workspaces[0];
|
|
32219
33158
|
setWorkspaceId(firstWorkspace.id);
|
|
32220
33159
|
}
|
|
32221
33160
|
}, [workspaces, workspaceId]);
|
|
32222
|
-
const prevWorkspaceId =
|
|
32223
|
-
|
|
33161
|
+
const prevWorkspaceId = useRef29(workspaceId);
|
|
33162
|
+
useEffect54(() => {
|
|
32224
33163
|
if (workspaceId) {
|
|
32225
33164
|
refreshProjects(workspaceId);
|
|
32226
33165
|
} else {
|
|
@@ -32231,7 +33170,7 @@ var WorkspaceContextProvider = ({
|
|
|
32231
33170
|
}
|
|
32232
33171
|
prevWorkspaceId.current = workspaceId;
|
|
32233
33172
|
}, [workspaceId, refreshProjects]);
|
|
32234
|
-
const createWorkspace =
|
|
33173
|
+
const createWorkspace = useCallback40(async (data) => {
|
|
32235
33174
|
setLoading(true);
|
|
32236
33175
|
setError(null);
|
|
32237
33176
|
try {
|
|
@@ -32246,7 +33185,7 @@ var WorkspaceContextProvider = ({
|
|
|
32246
33185
|
setLoading(false);
|
|
32247
33186
|
}
|
|
32248
33187
|
}, [client, refreshWorkspaces]);
|
|
32249
|
-
const updateWorkspace =
|
|
33188
|
+
const updateWorkspace = useCallback40(async (id, updates) => {
|
|
32250
33189
|
setLoading(true);
|
|
32251
33190
|
setError(null);
|
|
32252
33191
|
try {
|
|
@@ -32261,7 +33200,7 @@ var WorkspaceContextProvider = ({
|
|
|
32261
33200
|
setLoading(false);
|
|
32262
33201
|
}
|
|
32263
33202
|
}, [client, refreshWorkspaces]);
|
|
32264
|
-
const deleteWorkspace =
|
|
33203
|
+
const deleteWorkspace = useCallback40(async (id) => {
|
|
32265
33204
|
setLoading(true);
|
|
32266
33205
|
setError(null);
|
|
32267
33206
|
try {
|
|
@@ -32278,7 +33217,7 @@ var WorkspaceContextProvider = ({
|
|
|
32278
33217
|
setLoading(false);
|
|
32279
33218
|
}
|
|
32280
33219
|
}, [client, workspaceId, refreshWorkspaces]);
|
|
32281
|
-
const createProject =
|
|
33220
|
+
const createProject = useCallback40(async (wsId, data) => {
|
|
32282
33221
|
setLoading(true);
|
|
32283
33222
|
setError(null);
|
|
32284
33223
|
try {
|
|
@@ -32293,7 +33232,7 @@ var WorkspaceContextProvider = ({
|
|
|
32293
33232
|
setLoading(false);
|
|
32294
33233
|
}
|
|
32295
33234
|
}, [client, refreshProjects]);
|
|
32296
|
-
const updateProject =
|
|
33235
|
+
const updateProject = useCallback40(async (wsId, id, updates) => {
|
|
32297
33236
|
setLoading(true);
|
|
32298
33237
|
setError(null);
|
|
32299
33238
|
try {
|
|
@@ -32308,7 +33247,7 @@ var WorkspaceContextProvider = ({
|
|
|
32308
33247
|
setLoading(false);
|
|
32309
33248
|
}
|
|
32310
33249
|
}, [client, refreshProjects]);
|
|
32311
|
-
const deleteProject =
|
|
33250
|
+
const deleteProject = useCallback40(async (wsId, id) => {
|
|
32312
33251
|
setLoading(true);
|
|
32313
33252
|
setError(null);
|
|
32314
33253
|
try {
|
|
@@ -32325,7 +33264,7 @@ var WorkspaceContextProvider = ({
|
|
|
32325
33264
|
setLoading(false);
|
|
32326
33265
|
}
|
|
32327
33266
|
}, [client, projectId, refreshProjects]);
|
|
32328
|
-
const listPath =
|
|
33267
|
+
const listPath = useCallback40(
|
|
32329
33268
|
async (path = "/", assistantId) => {
|
|
32330
33269
|
if (!workspaceId || !projectId) {
|
|
32331
33270
|
return [];
|
|
@@ -32344,7 +33283,7 @@ var WorkspaceContextProvider = ({
|
|
|
32344
33283
|
},
|
|
32345
33284
|
[client, workspaceId, projectId]
|
|
32346
33285
|
);
|
|
32347
|
-
const listPathByFolder =
|
|
33286
|
+
const listPathByFolder = useCallback40(
|
|
32348
33287
|
async (folder, assistantId) => {
|
|
32349
33288
|
let normalizedPath = folder;
|
|
32350
33289
|
if (normalizedPath.startsWith("~/")) {
|
|
@@ -32357,7 +33296,7 @@ var WorkspaceContextProvider = ({
|
|
|
32357
33296
|
},
|
|
32358
33297
|
[listPath]
|
|
32359
33298
|
);
|
|
32360
|
-
const uploadFile =
|
|
33299
|
+
const uploadFile = useCallback40(
|
|
32361
33300
|
async (path, file, assistantId) => {
|
|
32362
33301
|
if (!workspaceId || !projectId) {
|
|
32363
33302
|
throw new Error("Workspace and project must be selected before uploading files");
|
|
@@ -32377,7 +33316,7 @@ var WorkspaceContextProvider = ({
|
|
|
32377
33316
|
},
|
|
32378
33317
|
[client, workspaceId, projectId]
|
|
32379
33318
|
);
|
|
32380
|
-
const uploadFileToFolder =
|
|
33319
|
+
const uploadFileToFolder = useCallback40(
|
|
32381
33320
|
async (folder, file, assistantId) => {
|
|
32382
33321
|
let normalizedFolder = folder;
|
|
32383
33322
|
if (normalizedFolder.startsWith("~/")) {
|
|
@@ -32387,7 +33326,7 @@ var WorkspaceContextProvider = ({
|
|
|
32387
33326
|
},
|
|
32388
33327
|
[uploadFile]
|
|
32389
33328
|
);
|
|
32390
|
-
const getFileViewUrl =
|
|
33329
|
+
const getFileViewUrl = useCallback40(
|
|
32391
33330
|
(filePath, assistantId) => {
|
|
32392
33331
|
if (!workspaceId || !projectId) {
|
|
32393
33332
|
return "";
|
|
@@ -32429,7 +33368,7 @@ var WorkspaceContextProvider = ({
|
|
|
32429
33368
|
await createProject(workspaceId, { name, description });
|
|
32430
33369
|
}
|
|
32431
33370
|
};
|
|
32432
|
-
return /* @__PURE__ */
|
|
33371
|
+
return /* @__PURE__ */ jsx124(WorkspaceContext.Provider, { value, children: projectId ? children : /* @__PURE__ */ jsx124(
|
|
32433
33372
|
WorkspaceResourceUIContext,
|
|
32434
33373
|
{
|
|
32435
33374
|
workspaceId: workspaceId || "",
|
|
@@ -32439,24 +33378,24 @@ var WorkspaceContextProvider = ({
|
|
|
32439
33378
|
};
|
|
32440
33379
|
|
|
32441
33380
|
// src/components/Chat/PinToMenuButton.tsx
|
|
32442
|
-
import { Fragment as
|
|
33381
|
+
import { Fragment as Fragment26, jsx as jsx125, jsxs as jsxs90 } from "react/jsx-runtime";
|
|
32443
33382
|
var MODAL_BODY_STYLE = {
|
|
32444
33383
|
display: "flex",
|
|
32445
33384
|
flexDirection: "column",
|
|
32446
33385
|
gap: 12
|
|
32447
33386
|
};
|
|
32448
33387
|
var PinToMenuButton = ({ assistantId }) => {
|
|
32449
|
-
const workspaceCtx =
|
|
33388
|
+
const workspaceCtx = React72.useContext(WorkspaceContext);
|
|
32450
33389
|
const { config } = useLatticeChatShellContext();
|
|
32451
33390
|
const { post, get, del } = useApi();
|
|
32452
|
-
const [open, setOpen] =
|
|
32453
|
-
const [group, setGroup] =
|
|
32454
|
-
const [name, setName] =
|
|
32455
|
-
const [loading, setLoading] =
|
|
32456
|
-
const [isPinned, setIsPinned] =
|
|
32457
|
-
const [pinnedItemId, setPinnedItemId] =
|
|
32458
|
-
const [checking, setChecking] =
|
|
32459
|
-
const checkPinned =
|
|
33391
|
+
const [open, setOpen] = useState79(false);
|
|
33392
|
+
const [group, setGroup] = useState79("");
|
|
33393
|
+
const [name, setName] = useState79("");
|
|
33394
|
+
const [loading, setLoading] = useState79(false);
|
|
33395
|
+
const [isPinned, setIsPinned] = useState79(false);
|
|
33396
|
+
const [pinnedItemId, setPinnedItemId] = useState79(null);
|
|
33397
|
+
const [checking, setChecking] = useState79(true);
|
|
33398
|
+
const checkPinned = useCallback41(async () => {
|
|
32460
33399
|
if (!assistantId || !config.enableCustomMenu) {
|
|
32461
33400
|
setChecking(false);
|
|
32462
33401
|
return;
|
|
@@ -32483,13 +33422,13 @@ var PinToMenuButton = ({ assistantId }) => {
|
|
|
32483
33422
|
setChecking(false);
|
|
32484
33423
|
}
|
|
32485
33424
|
}, [assistantId, config.enableCustomMenu, get]);
|
|
32486
|
-
|
|
33425
|
+
useEffect55(() => {
|
|
32487
33426
|
checkPinned();
|
|
32488
33427
|
}, [checkPinned]);
|
|
32489
33428
|
if (!assistantId || !config.enableCustomMenu) return null;
|
|
32490
33429
|
const handlePin = async () => {
|
|
32491
33430
|
if (!name.trim()) {
|
|
32492
|
-
|
|
33431
|
+
message20.warning("Please enter a menu name");
|
|
32493
33432
|
return;
|
|
32494
33433
|
}
|
|
32495
33434
|
setLoading(true);
|
|
@@ -32508,16 +33447,16 @@ var PinToMenuButton = ({ assistantId }) => {
|
|
|
32508
33447
|
};
|
|
32509
33448
|
const json = await post("/api/menu-items", body);
|
|
32510
33449
|
if (json.success) {
|
|
32511
|
-
|
|
33450
|
+
message20.success("Pinned to menu");
|
|
32512
33451
|
setOpen(false);
|
|
32513
33452
|
setGroup("");
|
|
32514
33453
|
setName("");
|
|
32515
33454
|
checkPinned();
|
|
32516
33455
|
} else {
|
|
32517
|
-
|
|
33456
|
+
message20.error(json.message || "Failed to pin");
|
|
32518
33457
|
}
|
|
32519
33458
|
} catch {
|
|
32520
|
-
|
|
33459
|
+
message20.error("Failed to pin to menu");
|
|
32521
33460
|
} finally {
|
|
32522
33461
|
setLoading(false);
|
|
32523
33462
|
}
|
|
@@ -32528,14 +33467,14 @@ var PinToMenuButton = ({ assistantId }) => {
|
|
|
32528
33467
|
try {
|
|
32529
33468
|
const json = await del(`/api/menu-items/${pinnedItemId}`);
|
|
32530
33469
|
if (json.success) {
|
|
32531
|
-
|
|
33470
|
+
message20.success("Unpinned from menu");
|
|
32532
33471
|
setIsPinned(false);
|
|
32533
33472
|
setPinnedItemId(null);
|
|
32534
33473
|
} else {
|
|
32535
|
-
|
|
33474
|
+
message20.error(json.message || "Failed to unpin");
|
|
32536
33475
|
}
|
|
32537
33476
|
} catch {
|
|
32538
|
-
|
|
33477
|
+
message20.error("Failed to unpin from menu");
|
|
32539
33478
|
} finally {
|
|
32540
33479
|
setLoading(false);
|
|
32541
33480
|
}
|
|
@@ -32547,19 +33486,19 @@ var PinToMenuButton = ({ assistantId }) => {
|
|
|
32547
33486
|
setOpen(true);
|
|
32548
33487
|
}
|
|
32549
33488
|
};
|
|
32550
|
-
return /* @__PURE__ */
|
|
32551
|
-
/* @__PURE__ */
|
|
32552
|
-
|
|
33489
|
+
return /* @__PURE__ */ jsxs90(Fragment26, { children: [
|
|
33490
|
+
/* @__PURE__ */ jsx125(Tooltip26, { title: isPinned ? "Unpin from Menu" : "Pin to Menu", children: /* @__PURE__ */ jsx125(
|
|
33491
|
+
Button57,
|
|
32553
33492
|
{
|
|
32554
33493
|
type: "text",
|
|
32555
33494
|
size: "small",
|
|
32556
|
-
icon: isPinned ? /* @__PURE__ */
|
|
33495
|
+
icon: isPinned ? /* @__PURE__ */ jsx125(Pin, { size: 14, fill: "currentColor" }) : /* @__PURE__ */ jsx125(Pin, { size: 14 }),
|
|
32557
33496
|
onClick: handleClick,
|
|
32558
33497
|
loading: checking || loading && isPinned
|
|
32559
33498
|
}
|
|
32560
33499
|
) }),
|
|
32561
|
-
/* @__PURE__ */
|
|
32562
|
-
|
|
33500
|
+
/* @__PURE__ */ jsx125(
|
|
33501
|
+
Modal22,
|
|
32563
33502
|
{
|
|
32564
33503
|
title: "Pin to Menu",
|
|
32565
33504
|
open,
|
|
@@ -32567,17 +33506,17 @@ var PinToMenuButton = ({ assistantId }) => {
|
|
|
32567
33506
|
onCancel: () => setOpen(false),
|
|
32568
33507
|
confirmLoading: loading,
|
|
32569
33508
|
okText: "Pin",
|
|
32570
|
-
children: /* @__PURE__ */
|
|
32571
|
-
/* @__PURE__ */
|
|
32572
|
-
|
|
33509
|
+
children: /* @__PURE__ */ jsxs90("div", { style: MODAL_BODY_STYLE, children: [
|
|
33510
|
+
/* @__PURE__ */ jsx125(
|
|
33511
|
+
Input18,
|
|
32573
33512
|
{
|
|
32574
33513
|
placeholder: "Menu name (required)",
|
|
32575
33514
|
value: name,
|
|
32576
33515
|
onChange: (e) => setName(e.target.value)
|
|
32577
33516
|
}
|
|
32578
33517
|
),
|
|
32579
|
-
/* @__PURE__ */
|
|
32580
|
-
|
|
33518
|
+
/* @__PURE__ */ jsx125(
|
|
33519
|
+
Input18,
|
|
32581
33520
|
{
|
|
32582
33521
|
placeholder: "Group (optional, e.g. Process)",
|
|
32583
33522
|
value: group,
|
|
@@ -32591,16 +33530,16 @@ var PinToMenuButton = ({ assistantId }) => {
|
|
|
32591
33530
|
};
|
|
32592
33531
|
|
|
32593
33532
|
// src/components/Chat/LatticeChat.tsx
|
|
32594
|
-
import { createStyles as
|
|
33533
|
+
import { createStyles as createStyles40 } from "antd-style";
|
|
32595
33534
|
|
|
32596
33535
|
// src/components/Chat/ProjectSelector.tsx
|
|
32597
|
-
import { useState as
|
|
32598
|
-
import { Modal as
|
|
32599
|
-
import { createStyles as
|
|
33536
|
+
import { useState as useState80, useCallback as useCallback42, useMemo as useMemo36, useRef as useRef30 } from "react";
|
|
33537
|
+
import { Modal as Modal23, Input as Input19, Button as Button58, message as message21 } from "antd";
|
|
33538
|
+
import { createStyles as createStyles38 } from "antd-style";
|
|
32600
33539
|
import { Folder, ChevronDown as ChevronDown6, Building2 as Building24 } from "lucide-react";
|
|
32601
|
-
import { Fragment as
|
|
33540
|
+
import { Fragment as Fragment27, jsx as jsx126, jsxs as jsxs91 } from "react/jsx-runtime";
|
|
32602
33541
|
var PROJECT_NAME_MAX_LENGTH = 50;
|
|
32603
|
-
var
|
|
33542
|
+
var useStyles21 = createStyles38(({ token, css }) => ({
|
|
32604
33543
|
container: css`
|
|
32605
33544
|
position: relative;
|
|
32606
33545
|
`,
|
|
@@ -32820,7 +33759,7 @@ var useStyles20 = createStyles37(({ token, css }) => ({
|
|
|
32820
33759
|
var ProjectSelector = ({
|
|
32821
33760
|
disableDropdown = true
|
|
32822
33761
|
}) => {
|
|
32823
|
-
const { styles } =
|
|
33762
|
+
const { styles } = useStyles21();
|
|
32824
33763
|
const {
|
|
32825
33764
|
workspaceId,
|
|
32826
33765
|
workspaces,
|
|
@@ -32830,34 +33769,34 @@ var ProjectSelector = ({
|
|
|
32830
33769
|
setProject,
|
|
32831
33770
|
createProject
|
|
32832
33771
|
} = useWorkspaceContext();
|
|
32833
|
-
const [isWorkspaceListOpen, setIsWorkspaceListOpen] =
|
|
32834
|
-
const workspaceDropdownRef =
|
|
32835
|
-
const [isProjectListOpen, setIsProjectListOpen] =
|
|
32836
|
-
const [isModalOpen, setIsModalOpen] =
|
|
32837
|
-
const [projectName, setProjectName] =
|
|
32838
|
-
const [validationError, setValidationError] =
|
|
32839
|
-
const [isCreating, setIsCreating] =
|
|
32840
|
-
const projectNameInputRef =
|
|
32841
|
-
const currentProject =
|
|
33772
|
+
const [isWorkspaceListOpen, setIsWorkspaceListOpen] = useState80(false);
|
|
33773
|
+
const workspaceDropdownRef = useRef30(null);
|
|
33774
|
+
const [isProjectListOpen, setIsProjectListOpen] = useState80(false);
|
|
33775
|
+
const [isModalOpen, setIsModalOpen] = useState80(false);
|
|
33776
|
+
const [projectName, setProjectName] = useState80("");
|
|
33777
|
+
const [validationError, setValidationError] = useState80(null);
|
|
33778
|
+
const [isCreating, setIsCreating] = useState80(false);
|
|
33779
|
+
const projectNameInputRef = useRef30(null);
|
|
33780
|
+
const currentProject = useMemo36(() => {
|
|
32842
33781
|
return projects.find((p) => p.id === projectId);
|
|
32843
33782
|
}, [projects, projectId]);
|
|
32844
|
-
const currentWorkspace =
|
|
33783
|
+
const currentWorkspace = useMemo36(() => {
|
|
32845
33784
|
return workspaces.find((w) => w.id === workspaceId);
|
|
32846
33785
|
}, [workspaces, workspaceId]);
|
|
32847
|
-
const handleSelectProject =
|
|
33786
|
+
const handleSelectProject = useCallback42((selectedProjectId) => {
|
|
32848
33787
|
setProject(selectedProjectId);
|
|
32849
33788
|
setIsProjectListOpen(false);
|
|
32850
33789
|
}, [setProject]);
|
|
32851
|
-
const handleWorkspaceClick =
|
|
33790
|
+
const handleWorkspaceClick = useCallback42(() => {
|
|
32852
33791
|
setProject(null);
|
|
32853
33792
|
}, [setProject]);
|
|
32854
|
-
const toggleProjectList =
|
|
33793
|
+
const toggleProjectList = useCallback42(() => {
|
|
32855
33794
|
setIsProjectListOpen((prev) => !prev);
|
|
32856
33795
|
}, []);
|
|
32857
|
-
const toggleWorkspaceList =
|
|
33796
|
+
const toggleWorkspaceList = useCallback42(() => {
|
|
32858
33797
|
setIsWorkspaceListOpen((prev) => !prev);
|
|
32859
33798
|
}, []);
|
|
32860
|
-
const validateProjectName =
|
|
33799
|
+
const validateProjectName = useCallback42((name) => {
|
|
32861
33800
|
const trimmed = name.trim();
|
|
32862
33801
|
if (!trimmed) return "Project name is required";
|
|
32863
33802
|
if (trimmed.length > PROJECT_NAME_MAX_LENGTH) {
|
|
@@ -32865,10 +33804,10 @@ var ProjectSelector = ({
|
|
|
32865
33804
|
}
|
|
32866
33805
|
return null;
|
|
32867
33806
|
}, []);
|
|
32868
|
-
const handleOpenModal =
|
|
33807
|
+
const handleOpenModal = useCallback42((e) => {
|
|
32869
33808
|
e.stopPropagation();
|
|
32870
33809
|
if (!workspaceId) {
|
|
32871
|
-
|
|
33810
|
+
message21.warning("Please select a workspace first");
|
|
32872
33811
|
return;
|
|
32873
33812
|
}
|
|
32874
33813
|
setProjectName("");
|
|
@@ -32876,7 +33815,7 @@ var ProjectSelector = ({
|
|
|
32876
33815
|
setIsModalOpen(true);
|
|
32877
33816
|
setTimeout(() => projectNameInputRef.current?.input?.focus(), 100);
|
|
32878
33817
|
}, [workspaceId]);
|
|
32879
|
-
const handleCloseModal =
|
|
33818
|
+
const handleCloseModal = useCallback42(() => {
|
|
32880
33819
|
setIsModalOpen(false);
|
|
32881
33820
|
setProjectName("");
|
|
32882
33821
|
setValidationError(null);
|
|
@@ -32886,7 +33825,7 @@ var ProjectSelector = ({
|
|
|
32886
33825
|
setProjectName(value);
|
|
32887
33826
|
setValidationError(validateProjectName(value));
|
|
32888
33827
|
};
|
|
32889
|
-
const handleCreateProject =
|
|
33828
|
+
const handleCreateProject = useCallback42(async () => {
|
|
32890
33829
|
if (!workspaceId) return;
|
|
32891
33830
|
const trimmed = projectName.trim();
|
|
32892
33831
|
const error = validateProjectName(trimmed);
|
|
@@ -32902,7 +33841,7 @@ var ProjectSelector = ({
|
|
|
32902
33841
|
setProjectName("");
|
|
32903
33842
|
setValidationError(null);
|
|
32904
33843
|
setProject(project.id);
|
|
32905
|
-
|
|
33844
|
+
message21.success(`Project "${project.name}" created`);
|
|
32906
33845
|
} catch (err) {
|
|
32907
33846
|
const errMsg = err instanceof Error ? err.message : "Failed to create project";
|
|
32908
33847
|
setValidationError(errMsg);
|
|
@@ -32918,49 +33857,49 @@ var ProjectSelector = ({
|
|
|
32918
33857
|
}
|
|
32919
33858
|
};
|
|
32920
33859
|
const isProjectNameValid = !validateProjectName(projectName.trim());
|
|
32921
|
-
return /* @__PURE__ */
|
|
32922
|
-
/* @__PURE__ */
|
|
32923
|
-
/* @__PURE__ */
|
|
33860
|
+
return /* @__PURE__ */ jsxs91(Fragment27, { children: [
|
|
33861
|
+
/* @__PURE__ */ jsx126("div", { className: styles.container, children: /* @__PURE__ */ jsxs91("div", { className: styles.selectorWrapper, children: [
|
|
33862
|
+
/* @__PURE__ */ jsx126("div", { style: { position: "relative" }, ref: workspaceDropdownRef, children: /* @__PURE__ */ jsx126(
|
|
32924
33863
|
"button",
|
|
32925
33864
|
{
|
|
32926
33865
|
className: styles.workspaceButton,
|
|
32927
33866
|
onClick: handleWorkspaceClick,
|
|
32928
33867
|
title: currentWorkspace?.name || "Select Workspace",
|
|
32929
|
-
children: /* @__PURE__ */
|
|
33868
|
+
children: /* @__PURE__ */ jsx126("div", { className: styles.workspaceButtonIcon, children: /* @__PURE__ */ jsx126(Building24, { size: 16 }) })
|
|
32930
33869
|
}
|
|
32931
33870
|
) }),
|
|
32932
|
-
/* @__PURE__ */
|
|
32933
|
-
/* @__PURE__ */
|
|
33871
|
+
/* @__PURE__ */ jsx126("span", { className: styles.divider, children: "/" }),
|
|
33872
|
+
/* @__PURE__ */ jsxs91(
|
|
32934
33873
|
"div",
|
|
32935
33874
|
{
|
|
32936
33875
|
className: styles.projectTrigger,
|
|
32937
33876
|
onClick: disableDropdown ? void 0 : toggleProjectList,
|
|
32938
33877
|
style: { cursor: disableDropdown ? "default" : "pointer" },
|
|
32939
33878
|
children: [
|
|
32940
|
-
/* @__PURE__ */
|
|
32941
|
-
/* @__PURE__ */
|
|
32942
|
-
!disableDropdown && /* @__PURE__ */
|
|
33879
|
+
/* @__PURE__ */ jsx126("div", { className: styles.projectTriggerIcon, children: /* @__PURE__ */ jsx126(Folder, { size: 16 }) }),
|
|
33880
|
+
/* @__PURE__ */ jsx126("div", { className: styles.projectTriggerInfo, children: /* @__PURE__ */ jsx126("div", { className: styles.projectTriggerName, children: currentProject?.name || "Select Project" }) }),
|
|
33881
|
+
!disableDropdown && /* @__PURE__ */ jsx126("div", { className: `${styles.projectTriggerArrow} ${isProjectListOpen ? "expanded" : ""}`, children: /* @__PURE__ */ jsx126(ChevronDown6, { size: 14 }) })
|
|
32943
33882
|
]
|
|
32944
33883
|
}
|
|
32945
33884
|
),
|
|
32946
|
-
!disableDropdown && isProjectListOpen && /* @__PURE__ */
|
|
32947
|
-
projects.map((project) => /* @__PURE__ */
|
|
33885
|
+
!disableDropdown && isProjectListOpen && /* @__PURE__ */ jsxs91("div", { className: styles.projectDropdown, children: [
|
|
33886
|
+
projects.map((project) => /* @__PURE__ */ jsxs91(
|
|
32948
33887
|
"div",
|
|
32949
33888
|
{
|
|
32950
33889
|
className: `${styles.projectDropdownItem} ${project.id === projectId ? "active" : ""}`,
|
|
32951
33890
|
onClick: () => handleSelectProject(project.id),
|
|
32952
33891
|
children: [
|
|
32953
|
-
/* @__PURE__ */
|
|
32954
|
-
/* @__PURE__ */
|
|
33892
|
+
/* @__PURE__ */ jsx126("div", { className: styles.projectDropdownItemIcon, children: /* @__PURE__ */ jsx126(Folder, { size: 14 }) }),
|
|
33893
|
+
/* @__PURE__ */ jsx126("div", { className: project.id === projectId ? styles.projectDropdownItemNameActive : styles.projectDropdownItemName, children: project.name })
|
|
32955
33894
|
]
|
|
32956
33895
|
},
|
|
32957
33896
|
project.id
|
|
32958
33897
|
)),
|
|
32959
|
-
projects.length === 0 && /* @__PURE__ */
|
|
33898
|
+
projects.length === 0 && /* @__PURE__ */ jsx126("div", { className: styles.emptyState, children: "No projects" })
|
|
32960
33899
|
] })
|
|
32961
33900
|
] }) }),
|
|
32962
|
-
/* @__PURE__ */
|
|
32963
|
-
|
|
33901
|
+
/* @__PURE__ */ jsxs91(
|
|
33902
|
+
Modal23,
|
|
32964
33903
|
{
|
|
32965
33904
|
title: "Create New Project",
|
|
32966
33905
|
open: isModalOpen,
|
|
@@ -32971,10 +33910,10 @@ var ProjectSelector = ({
|
|
|
32971
33910
|
maskClosable: !isCreating,
|
|
32972
33911
|
keyboard: true,
|
|
32973
33912
|
closable: true,
|
|
32974
|
-
footer: /* @__PURE__ */
|
|
32975
|
-
/* @__PURE__ */
|
|
32976
|
-
/* @__PURE__ */
|
|
32977
|
-
|
|
33913
|
+
footer: /* @__PURE__ */ jsxs91("div", { className: styles.modalFooter, children: [
|
|
33914
|
+
/* @__PURE__ */ jsx126(Button58, { onClick: handleCloseModal, disabled: isCreating, children: "Cancel" }),
|
|
33915
|
+
/* @__PURE__ */ jsx126(
|
|
33916
|
+
Button58,
|
|
32978
33917
|
{
|
|
32979
33918
|
type: "primary",
|
|
32980
33919
|
onClick: handleCreateProject,
|
|
@@ -32985,8 +33924,8 @@ var ProjectSelector = ({
|
|
|
32985
33924
|
)
|
|
32986
33925
|
] }),
|
|
32987
33926
|
children: [
|
|
32988
|
-
/* @__PURE__ */
|
|
32989
|
-
|
|
33927
|
+
/* @__PURE__ */ jsx126(
|
|
33928
|
+
Input19,
|
|
32990
33929
|
{
|
|
32991
33930
|
ref: projectNameInputRef,
|
|
32992
33931
|
value: projectName,
|
|
@@ -32997,7 +33936,7 @@ var ProjectSelector = ({
|
|
|
32997
33936
|
status: validationError ? "error" : void 0
|
|
32998
33937
|
}
|
|
32999
33938
|
),
|
|
33000
|
-
validationError && /* @__PURE__ */
|
|
33939
|
+
validationError && /* @__PURE__ */ jsx126("div", { style: { color: "#ff4d4f", fontSize: "12px", marginTop: "4px" }, children: validationError })
|
|
33001
33940
|
]
|
|
33002
33941
|
}
|
|
33003
33942
|
)
|
|
@@ -33005,16 +33944,16 @@ var ProjectSelector = ({
|
|
|
33005
33944
|
};
|
|
33006
33945
|
|
|
33007
33946
|
// src/components/Chat/ToolPanelFiles.tsx
|
|
33008
|
-
import { useCallback as
|
|
33009
|
-
import { message as
|
|
33947
|
+
import { useCallback as useCallback43, useEffect as useEffect56, useMemo as useMemo37, useState as useState81 } from "react";
|
|
33948
|
+
import { message as message22 } from "antd";
|
|
33010
33949
|
|
|
33011
33950
|
// src/components/Chat/FileDirectoryPanel.tsx
|
|
33012
|
-
import
|
|
33013
|
-
import { Spin as
|
|
33951
|
+
import React74 from "react";
|
|
33952
|
+
import { Spin as Spin23 } from "antd";
|
|
33014
33953
|
import { ChevronRight as ChevronRight8, FolderOpen as FolderOpen4, Upload } from "lucide-react";
|
|
33015
|
-
import { createStyles as
|
|
33016
|
-
import { Fragment as
|
|
33017
|
-
var
|
|
33954
|
+
import { createStyles as createStyles39 } from "antd-style";
|
|
33955
|
+
import { Fragment as Fragment28, jsx as jsx127, jsxs as jsxs92 } from "react/jsx-runtime";
|
|
33956
|
+
var useStyles22 = createStyles39(({ token, css }) => ({
|
|
33018
33957
|
container: css`
|
|
33019
33958
|
height: 100%;
|
|
33020
33959
|
overflow-y: auto;
|
|
@@ -33240,27 +34179,27 @@ var FileDirectoryPanel = ({
|
|
|
33240
34179
|
onToggleDirectory,
|
|
33241
34180
|
onAssetClick
|
|
33242
34181
|
}) => {
|
|
33243
|
-
const { styles } =
|
|
33244
|
-
const renderEntry =
|
|
34182
|
+
const { styles } = useStyles22();
|
|
34183
|
+
const renderEntry = React74.useCallback((entry, depth) => {
|
|
33245
34184
|
const entryName = getEntryName(entry);
|
|
33246
34185
|
if (entry.is_dir) {
|
|
33247
34186
|
const isExpanded = directoryExpanded[entry.path] || false;
|
|
33248
34187
|
const children = directoryChildren[entry.path] || [];
|
|
33249
34188
|
const isLoading = directoryLoading[entry.path] || false;
|
|
33250
|
-
return /* @__PURE__ */
|
|
33251
|
-
/* @__PURE__ */
|
|
33252
|
-
Array.from({ length: depth }).map((_, index) => /* @__PURE__ */
|
|
33253
|
-
/* @__PURE__ */
|
|
34189
|
+
return /* @__PURE__ */ jsxs92("div", { className: styles.treeChildren, children: [
|
|
34190
|
+
/* @__PURE__ */ jsxs92("div", { className: styles.treeRow, children: [
|
|
34191
|
+
Array.from({ length: depth }).map((_, index) => /* @__PURE__ */ jsx127("span", { className: styles.treeIndent }, `${entry.path}-indent-${index}`)),
|
|
34192
|
+
/* @__PURE__ */ jsx127(
|
|
33254
34193
|
"button",
|
|
33255
34194
|
{
|
|
33256
34195
|
type: "button",
|
|
33257
34196
|
className: styles.treeToggle,
|
|
33258
34197
|
"aria-label": `${isExpanded ? "collapse" : "expand"} ${entryName}`,
|
|
33259
34198
|
onClick: () => void onToggleDirectory(entry.path),
|
|
33260
|
-
children: /* @__PURE__ */
|
|
34199
|
+
children: /* @__PURE__ */ jsx127(ChevronRight8, { size: 14, style: { transform: isExpanded ? "rotate(90deg)" : void 0 } })
|
|
33261
34200
|
}
|
|
33262
34201
|
),
|
|
33263
|
-
/* @__PURE__ */
|
|
34202
|
+
/* @__PURE__ */ jsxs92(
|
|
33264
34203
|
"button",
|
|
33265
34204
|
{
|
|
33266
34205
|
type: "button",
|
|
@@ -33269,19 +34208,19 @@ var FileDirectoryPanel = ({
|
|
|
33269
34208
|
onClick: () => void onToggleDirectory(entry.path),
|
|
33270
34209
|
title: entryName,
|
|
33271
34210
|
children: [
|
|
33272
|
-
/* @__PURE__ */
|
|
33273
|
-
/* @__PURE__ */
|
|
34211
|
+
/* @__PURE__ */ jsx127("div", { className: styles.assetIcon, children: /* @__PURE__ */ jsx127(FolderOpen4, { size: 14 }) }),
|
|
34212
|
+
/* @__PURE__ */ jsx127("div", { className: styles.assetInfo, children: /* @__PURE__ */ jsx127("div", { className: styles.assetName, children: entryName }) })
|
|
33274
34213
|
]
|
|
33275
34214
|
}
|
|
33276
34215
|
)
|
|
33277
34216
|
] }),
|
|
33278
|
-
isExpanded ? isLoading ? /* @__PURE__ */
|
|
34217
|
+
isExpanded ? isLoading ? /* @__PURE__ */ jsx127("div", { className: styles.loading, children: /* @__PURE__ */ jsx127(Spin23, { size: "small" }) }) : children.length > 0 ? children.map((child) => renderEntry(child, depth + 1)) : /* @__PURE__ */ jsx127("div", { className: styles.emptyState, children: "No files in this folder" }) : null
|
|
33279
34218
|
] }, entry.path);
|
|
33280
34219
|
}
|
|
33281
|
-
return /* @__PURE__ */
|
|
33282
|
-
Array.from({ length: depth }).map((_, index) => /* @__PURE__ */
|
|
33283
|
-
/* @__PURE__ */
|
|
33284
|
-
/* @__PURE__ */
|
|
34220
|
+
return /* @__PURE__ */ jsxs92("div", { className: styles.treeRow, children: [
|
|
34221
|
+
Array.from({ length: depth }).map((_, index) => /* @__PURE__ */ jsx127("span", { className: styles.treeIndent }, `${entry.path}-indent-${index}`)),
|
|
34222
|
+
/* @__PURE__ */ jsx127("span", { className: styles.treeSpacer }),
|
|
34223
|
+
/* @__PURE__ */ jsxs92(
|
|
33285
34224
|
"button",
|
|
33286
34225
|
{
|
|
33287
34226
|
type: "button",
|
|
@@ -33290,10 +34229,10 @@ var FileDirectoryPanel = ({
|
|
|
33290
34229
|
"aria-label": `open ${entryName}`,
|
|
33291
34230
|
title: entryName,
|
|
33292
34231
|
children: [
|
|
33293
|
-
/* @__PURE__ */
|
|
33294
|
-
/* @__PURE__ */
|
|
33295
|
-
/* @__PURE__ */
|
|
33296
|
-
/* @__PURE__ */
|
|
34232
|
+
/* @__PURE__ */ jsx127("div", { className: styles.assetIcon, children: getFileIcon(entryName) }),
|
|
34233
|
+
/* @__PURE__ */ jsxs92("div", { className: styles.assetInfo, children: [
|
|
34234
|
+
/* @__PURE__ */ jsx127("div", { className: styles.assetName, children: entryName }),
|
|
34235
|
+
/* @__PURE__ */ jsx127("div", { className: styles.assetMeta, children: formatDate5(entry.modified_at) })
|
|
33297
34236
|
] })
|
|
33298
34237
|
]
|
|
33299
34238
|
}
|
|
@@ -33301,20 +34240,20 @@ var FileDirectoryPanel = ({
|
|
|
33301
34240
|
] }, entry.path);
|
|
33302
34241
|
}, [directoryChildren, directoryExpanded, directoryLoading, onAssetClick, onToggleDirectory, styles]);
|
|
33303
34242
|
if (!projectId) {
|
|
33304
|
-
return /* @__PURE__ */
|
|
34243
|
+
return /* @__PURE__ */ jsx127("div", { className: styles.emptyState, children: "Please select a project to browse files" });
|
|
33305
34244
|
}
|
|
33306
|
-
return /* @__PURE__ */
|
|
33307
|
-
/* @__PURE__ */
|
|
33308
|
-
/* @__PURE__ */
|
|
33309
|
-
/* @__PURE__ */
|
|
34245
|
+
return /* @__PURE__ */ jsxs92("div", { className: styles.container, children: [
|
|
34246
|
+
/* @__PURE__ */ jsxs92("h3", { className: styles.header, children: [
|
|
34247
|
+
/* @__PURE__ */ jsx127(FolderOpen4, { size: 16 }),
|
|
34248
|
+
/* @__PURE__ */ jsx127("span", { children: "Files" })
|
|
33310
34249
|
] }),
|
|
33311
34250
|
resourceFolders.map((folder) => {
|
|
33312
34251
|
const entries = folderEntries[folder.name] || [];
|
|
33313
34252
|
const isLoading = folderLoading[folder.name] || false;
|
|
33314
34253
|
const itemCount = entries.length;
|
|
33315
|
-
return /* @__PURE__ */
|
|
33316
|
-
/* @__PURE__ */
|
|
33317
|
-
/* @__PURE__ */
|
|
34254
|
+
return /* @__PURE__ */ jsxs92("div", { className: styles.section, children: [
|
|
34255
|
+
/* @__PURE__ */ jsxs92("div", { className: styles.sectionHeader, children: [
|
|
34256
|
+
/* @__PURE__ */ jsx127(
|
|
33318
34257
|
"span",
|
|
33319
34258
|
{
|
|
33320
34259
|
className: styles.sectionTitle,
|
|
@@ -33323,24 +34262,24 @@ var FileDirectoryPanel = ({
|
|
|
33323
34262
|
children: folder.displayName || folder.name
|
|
33324
34263
|
}
|
|
33325
34264
|
),
|
|
33326
|
-
/* @__PURE__ */
|
|
34265
|
+
/* @__PURE__ */ jsx127("span", { className: styles.badge, children: itemCount })
|
|
33327
34266
|
] }),
|
|
33328
|
-
isLoading ? /* @__PURE__ */
|
|
34267
|
+
isLoading ? /* @__PURE__ */ jsx127("div", { className: styles.loading, children: /* @__PURE__ */ jsx127(Spin23, { size: "small" }) }) : /* @__PURE__ */ jsxs92("div", { className: styles.assetList, children: [
|
|
33329
34268
|
entries.map((entry) => renderEntry(entry, 0)),
|
|
33330
|
-
entries.length === 0 ? /* @__PURE__ */
|
|
33331
|
-
folder.allowUpload ? /* @__PURE__ */
|
|
34269
|
+
entries.length === 0 ? /* @__PURE__ */ jsx127("div", { className: styles.emptyState, children: "No files in this folder" }) : null,
|
|
34270
|
+
folder.allowUpload ? /* @__PURE__ */ jsx127(
|
|
33332
34271
|
"button",
|
|
33333
34272
|
{
|
|
33334
34273
|
type: "button",
|
|
33335
34274
|
className: styles.uploadBtn,
|
|
33336
34275
|
onClick: () => void onUploadFolder(folder.name),
|
|
33337
34276
|
disabled: !workspaceId || !projectId || uploadingFolder === folder.name,
|
|
33338
|
-
children: uploadingFolder === folder.name ? /* @__PURE__ */
|
|
33339
|
-
/* @__PURE__ */
|
|
33340
|
-
/* @__PURE__ */
|
|
33341
|
-
] }) : /* @__PURE__ */
|
|
33342
|
-
/* @__PURE__ */
|
|
33343
|
-
/* @__PURE__ */
|
|
34277
|
+
children: uploadingFolder === folder.name ? /* @__PURE__ */ jsxs92(Fragment28, { children: [
|
|
34278
|
+
/* @__PURE__ */ jsx127(Spin23, { size: "small" }),
|
|
34279
|
+
/* @__PURE__ */ jsx127("span", { children: "Uploading..." })
|
|
34280
|
+
] }) : /* @__PURE__ */ jsxs92(Fragment28, { children: [
|
|
34281
|
+
/* @__PURE__ */ jsx127(Upload, { size: 14 }),
|
|
34282
|
+
/* @__PURE__ */ jsx127("span", { children: "Upload" })
|
|
33344
34283
|
] })
|
|
33345
34284
|
}
|
|
33346
34285
|
) : null
|
|
@@ -33351,7 +34290,7 @@ var FileDirectoryPanel = ({
|
|
|
33351
34290
|
};
|
|
33352
34291
|
|
|
33353
34292
|
// src/components/Chat/ToolPanelFiles.tsx
|
|
33354
|
-
import { jsx as
|
|
34293
|
+
import { jsx as jsx128 } from "react/jsx-runtime";
|
|
33355
34294
|
var ToolPanelFiles = () => {
|
|
33356
34295
|
const { config } = useLatticeChatShellContext();
|
|
33357
34296
|
const { openSideApp } = useChatUIContext();
|
|
@@ -33364,16 +34303,16 @@ var ToolPanelFiles = () => {
|
|
|
33364
34303
|
uploadFileToFolder
|
|
33365
34304
|
} = useWorkspaceContext();
|
|
33366
34305
|
const { currentAssistant } = useAssistantContext();
|
|
33367
|
-
const [folderEntries, setFolderEntries] =
|
|
33368
|
-
const [folderLoading, setFolderLoading] =
|
|
33369
|
-
const [directoryChildren, setDirectoryChildren] =
|
|
33370
|
-
const [directoryLoading, setDirectoryLoading] =
|
|
33371
|
-
const [directoryExpanded, setDirectoryExpanded] =
|
|
33372
|
-
const [uploadingFolder, setUploadingFolder] =
|
|
33373
|
-
const resourceFolders =
|
|
34306
|
+
const [folderEntries, setFolderEntries] = useState81({});
|
|
34307
|
+
const [folderLoading, setFolderLoading] = useState81({});
|
|
34308
|
+
const [directoryChildren, setDirectoryChildren] = useState81({});
|
|
34309
|
+
const [directoryLoading, setDirectoryLoading] = useState81({});
|
|
34310
|
+
const [directoryExpanded, setDirectoryExpanded] = useState81({});
|
|
34311
|
+
const [uploadingFolder, setUploadingFolder] = useState81(null);
|
|
34312
|
+
const resourceFolders = useMemo37(() => {
|
|
33374
34313
|
return config.resourceFolders && config.resourceFolders.length > 0 ? config.resourceFolders : [{ name: "/", displayName: "Project Assets", allowUpload: true }];
|
|
33375
34314
|
}, [config.resourceFolders]);
|
|
33376
|
-
const loadAssetsForFolder =
|
|
34315
|
+
const loadAssetsForFolder = useCallback43(
|
|
33377
34316
|
async (folder, clearSubdirectoryCache = true) => {
|
|
33378
34317
|
if (!workspaceId || !projectId) {
|
|
33379
34318
|
setFolderEntries((prev) => ({ ...prev, [folder.name]: [] }));
|
|
@@ -33413,7 +34352,7 @@ var ToolPanelFiles = () => {
|
|
|
33413
34352
|
},
|
|
33414
34353
|
[workspaceId, projectId, listPathByFolder, currentAssistant?.id]
|
|
33415
34354
|
);
|
|
33416
|
-
const handleToggleDirectory =
|
|
34355
|
+
const handleToggleDirectory = useCallback43(async (path) => {
|
|
33417
34356
|
const isExpanded = directoryExpanded[path] || false;
|
|
33418
34357
|
if (isExpanded) {
|
|
33419
34358
|
setDirectoryExpanded((prev) => ({ ...prev, [path]: false }));
|
|
@@ -33431,15 +34370,15 @@ var ToolPanelFiles = () => {
|
|
|
33431
34370
|
setDirectoryLoading((prev) => ({ ...prev, [path]: false }));
|
|
33432
34371
|
}
|
|
33433
34372
|
}, [directoryExpanded, listPath, currentAssistant?.id]);
|
|
33434
|
-
|
|
34373
|
+
useEffect56(() => {
|
|
33435
34374
|
resourceFolders.forEach((folder) => {
|
|
33436
34375
|
void loadAssetsForFolder(folder, false);
|
|
33437
34376
|
});
|
|
33438
34377
|
}, [resourceFolders, loadAssetsForFolder]);
|
|
33439
|
-
const handleAssetClick =
|
|
34378
|
+
const handleAssetClick = useCallback43((asset) => {
|
|
33440
34379
|
const fileUrl = getFileViewUrl(asset.path, currentAssistant?.id);
|
|
33441
34380
|
if (!fileUrl) {
|
|
33442
|
-
|
|
34381
|
+
message22.warning("Please select a workspace and project first.");
|
|
33443
34382
|
return;
|
|
33444
34383
|
}
|
|
33445
34384
|
openSideApp({
|
|
@@ -33452,9 +34391,9 @@ var ToolPanelFiles = () => {
|
|
|
33452
34391
|
message: `Preview: ${asset.name || asset.path}`
|
|
33453
34392
|
});
|
|
33454
34393
|
}, [getFileViewUrl, openSideApp, currentAssistant?.id]);
|
|
33455
|
-
const handleUploadFolder =
|
|
34394
|
+
const handleUploadFolder = useCallback43(async (folderName) => {
|
|
33456
34395
|
if (!workspaceId || !projectId) {
|
|
33457
|
-
|
|
34396
|
+
message22.warning("Please select a workspace and project before uploading.");
|
|
33458
34397
|
return;
|
|
33459
34398
|
}
|
|
33460
34399
|
const input = document.createElement("input");
|
|
@@ -33468,14 +34407,14 @@ var ToolPanelFiles = () => {
|
|
|
33468
34407
|
setUploadingFolder(folderName);
|
|
33469
34408
|
try {
|
|
33470
34409
|
await uploadFileToFolder(folderName, file, currentAssistant?.id);
|
|
33471
|
-
|
|
34410
|
+
message22.success(`Uploaded "${file.name}" successfully`);
|
|
33472
34411
|
const folder = resourceFolders.find((item) => item.name === folderName);
|
|
33473
34412
|
if (folder) {
|
|
33474
34413
|
await loadAssetsForFolder(folder);
|
|
33475
34414
|
}
|
|
33476
34415
|
} catch (error) {
|
|
33477
34416
|
const errMsg = error instanceof Error ? error.message : "Failed to upload file";
|
|
33478
|
-
|
|
34417
|
+
message22.error(errMsg);
|
|
33479
34418
|
} finally {
|
|
33480
34419
|
setUploadingFolder(null);
|
|
33481
34420
|
input.remove();
|
|
@@ -33483,7 +34422,7 @@ var ToolPanelFiles = () => {
|
|
|
33483
34422
|
};
|
|
33484
34423
|
input.click();
|
|
33485
34424
|
}, [workspaceId, projectId, uploadFileToFolder, resourceFolders, loadAssetsForFolder, currentAssistant?.id]);
|
|
33486
|
-
return /* @__PURE__ */
|
|
34425
|
+
return /* @__PURE__ */ jsx128(
|
|
33487
34426
|
FileDirectoryPanel,
|
|
33488
34427
|
{
|
|
33489
34428
|
workspaceId,
|
|
@@ -33504,8 +34443,8 @@ var ToolPanelFiles = () => {
|
|
|
33504
34443
|
};
|
|
33505
34444
|
|
|
33506
34445
|
// src/components/Chat/LatticeChat.tsx
|
|
33507
|
-
import { Fragment as
|
|
33508
|
-
var
|
|
34446
|
+
import { Fragment as Fragment29, jsx as jsx129, jsxs as jsxs93 } from "react/jsx-runtime";
|
|
34447
|
+
var useStyles23 = createStyles40(({ css }) => ({
|
|
33509
34448
|
wrapper: css`
|
|
33510
34449
|
display: flex;
|
|
33511
34450
|
flex-direction: column;
|
|
@@ -33535,31 +34474,31 @@ var useStyles22 = createStyles39(({ css }) => ({
|
|
|
33535
34474
|
var LatticeChatContent = (props) => {
|
|
33536
34475
|
const { assistant_id: assistantId, thread_id = "", menu, header, headerRight, showProjectSelector, emptyPlaceholder, ...chatingProps } = props;
|
|
33537
34476
|
const { config } = useLatticeChatShellContext();
|
|
33538
|
-
const { styles } =
|
|
34477
|
+
const { styles } = useStyles23();
|
|
33539
34478
|
const showWorkspaceSelector = showProjectSelector ?? config.enableWorkspace;
|
|
33540
|
-
const layoutHeader = /* @__PURE__ */
|
|
33541
|
-
/* @__PURE__ */
|
|
33542
|
-
/* @__PURE__ */
|
|
33543
|
-
/* @__PURE__ */
|
|
33544
|
-
/* @__PURE__ */
|
|
34479
|
+
const layoutHeader = /* @__PURE__ */ jsxs93("div", { className: styles.headerBar, children: [
|
|
34480
|
+
/* @__PURE__ */ jsx129("div", { className: styles.headerLeft, children: showWorkspaceSelector ? /* @__PURE__ */ jsx129(ProjectSelector, {}) : null }),
|
|
34481
|
+
/* @__PURE__ */ jsx129("div", { className: styles.headerRight, children: headerRight !== void 0 ? headerRight : /* @__PURE__ */ jsxs93(Fragment29, { children: [
|
|
34482
|
+
/* @__PURE__ */ jsx129(PinToMenuButton, { assistantId }),
|
|
34483
|
+
/* @__PURE__ */ jsx129(FilePanelToggle, {})
|
|
33545
34484
|
] }) })
|
|
33546
34485
|
] });
|
|
33547
|
-
return /* @__PURE__ */
|
|
34486
|
+
return /* @__PURE__ */ jsxs93("div", { className: styles.wrapper, children: [
|
|
33548
34487
|
header,
|
|
33549
|
-
/* @__PURE__ */
|
|
34488
|
+
/* @__PURE__ */ jsx129(
|
|
33550
34489
|
ColumnLayout,
|
|
33551
34490
|
{
|
|
33552
34491
|
menu,
|
|
33553
34492
|
header: layoutHeader,
|
|
33554
|
-
main: thread_id ? /* @__PURE__ */
|
|
33555
|
-
detail: /* @__PURE__ */
|
|
33556
|
-
tools: /* @__PURE__ */
|
|
34493
|
+
main: thread_id ? /* @__PURE__ */ jsx129(Chating, { ...chatingProps }) : emptyPlaceholder ?? /* @__PURE__ */ jsx129("div", { children: "Please create a conversation first" }),
|
|
34494
|
+
detail: /* @__PURE__ */ jsx129(SideAppViewBrowser, {}),
|
|
34495
|
+
tools: /* @__PURE__ */ jsx129(ToolPanelFiles, {})
|
|
33557
34496
|
}
|
|
33558
34497
|
)
|
|
33559
34498
|
] });
|
|
33560
34499
|
};
|
|
33561
34500
|
var LatticeChat = (props) => {
|
|
33562
|
-
return /* @__PURE__ */
|
|
34501
|
+
return /* @__PURE__ */ jsx129(
|
|
33563
34502
|
AgentThreadProvider,
|
|
33564
34503
|
{
|
|
33565
34504
|
assistantId: props.assistant_id,
|
|
@@ -33569,7 +34508,7 @@ var LatticeChat = (props) => {
|
|
|
33569
34508
|
enableReturnStateWhenStreamCompleted: true,
|
|
33570
34509
|
enableResumeStream: true
|
|
33571
34510
|
},
|
|
33572
|
-
children: /* @__PURE__ */
|
|
34511
|
+
children: /* @__PURE__ */ jsx129(ChatUIContextProvider, { children: /* @__PURE__ */ jsx129(LatticeChatContent, { ...props }) })
|
|
33573
34512
|
}
|
|
33574
34513
|
);
|
|
33575
34514
|
};
|
|
@@ -33578,8 +34517,8 @@ var LatticeChat = (props) => {
|
|
|
33578
34517
|
import { useContext as useContext12 } from "react";
|
|
33579
34518
|
|
|
33580
34519
|
// src/components/Chat/ChatSidebar.tsx
|
|
33581
|
-
import { useState as
|
|
33582
|
-
import { Drawer as Drawer3, Avatar as Avatar13, Popover as Popover4, Button as
|
|
34520
|
+
import { useState as useState82, useMemo as useMemo38, useCallback as useCallback45 } from "react";
|
|
34521
|
+
import { Drawer as Drawer3, Avatar as Avatar13, Popover as Popover4, Button as Button59 } from "antd";
|
|
33583
34522
|
import {
|
|
33584
34523
|
History as History2,
|
|
33585
34524
|
LogOut as LogOut4,
|
|
@@ -33589,12 +34528,12 @@ import {
|
|
|
33589
34528
|
} from "lucide-react";
|
|
33590
34529
|
|
|
33591
34530
|
// src/components/Chat/ThreadHistoryMenuContent.tsx
|
|
33592
|
-
import
|
|
33593
|
-
import { createStyles as
|
|
33594
|
-
import { MessageSquare as MessageSquare4, Trash2 as
|
|
33595
|
-
import { message as
|
|
33596
|
-
import { jsx as
|
|
33597
|
-
var
|
|
34531
|
+
import React76, { useCallback as useCallback44 } from "react";
|
|
34532
|
+
import { createStyles as createStyles41 } from "antd-style";
|
|
34533
|
+
import { MessageSquare as MessageSquare4, Trash2 as Trash210 } from "lucide-react";
|
|
34534
|
+
import { message as message23, Modal as Modal24 } from "antd";
|
|
34535
|
+
import { jsx as jsx130, jsxs as jsxs94 } from "react/jsx-runtime";
|
|
34536
|
+
var useStyles24 = createStyles41(({ token, css }) => ({
|
|
33598
34537
|
container: css`
|
|
33599
34538
|
padding: 4px;
|
|
33600
34539
|
font-size: 13px;
|
|
@@ -33695,7 +34634,7 @@ var useStyles23 = createStyles40(({ token, css }) => ({
|
|
|
33695
34634
|
`
|
|
33696
34635
|
}));
|
|
33697
34636
|
var ThreadHistoryMenuContent = () => {
|
|
33698
|
-
const { styles } =
|
|
34637
|
+
const { styles } = useStyles24();
|
|
33699
34638
|
const {
|
|
33700
34639
|
threads,
|
|
33701
34640
|
threadId,
|
|
@@ -33703,10 +34642,10 @@ var ThreadHistoryMenuContent = () => {
|
|
|
33703
34642
|
deleteThread,
|
|
33704
34643
|
isLoading
|
|
33705
34644
|
} = useConversationContext();
|
|
33706
|
-
const handleDeleteThread =
|
|
34645
|
+
const handleDeleteThread = useCallback44(
|
|
33707
34646
|
async (e, threadIdToDelete) => {
|
|
33708
34647
|
e.stopPropagation();
|
|
33709
|
-
|
|
34648
|
+
Modal24.confirm({
|
|
33710
34649
|
title: "Delete Conversation",
|
|
33711
34650
|
content: "Are you sure you want to delete this conversation? This action cannot be undone.",
|
|
33712
34651
|
okText: "Delete",
|
|
@@ -33715,16 +34654,16 @@ var ThreadHistoryMenuContent = () => {
|
|
|
33715
34654
|
onOk: async () => {
|
|
33716
34655
|
try {
|
|
33717
34656
|
await deleteThread(threadIdToDelete);
|
|
33718
|
-
|
|
34657
|
+
message23.success("Conversation deleted");
|
|
33719
34658
|
} catch (error) {
|
|
33720
|
-
|
|
34659
|
+
message23.error("Failed to delete conversation");
|
|
33721
34660
|
}
|
|
33722
34661
|
}
|
|
33723
34662
|
});
|
|
33724
34663
|
},
|
|
33725
34664
|
[deleteThread]
|
|
33726
34665
|
);
|
|
33727
|
-
const sortedThreads =
|
|
34666
|
+
const sortedThreads = React76.useMemo(() => {
|
|
33728
34667
|
return [...threads].sort((a, b) => {
|
|
33729
34668
|
const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
|
|
33730
34669
|
const dateB = b.updatedAt ? new Date(b.updatedAt).getTime() : 0;
|
|
@@ -33732,30 +34671,30 @@ var ThreadHistoryMenuContent = () => {
|
|
|
33732
34671
|
});
|
|
33733
34672
|
}, [threads]);
|
|
33734
34673
|
if (isLoading) {
|
|
33735
|
-
return /* @__PURE__ */
|
|
34674
|
+
return /* @__PURE__ */ jsx130("div", { className: styles.container, children: /* @__PURE__ */ jsx130("div", { className: styles.loading, children: "Loading conversations..." }) });
|
|
33736
34675
|
}
|
|
33737
|
-
return /* @__PURE__ */
|
|
34676
|
+
return /* @__PURE__ */ jsx130("div", { className: styles.container, children: sortedThreads.length === 0 ? /* @__PURE__ */ jsx130("div", { className: styles.emptyState, children: "No conversations yet" }) : /* @__PURE__ */ jsx130("div", { className: styles.threadList, children: sortedThreads.map((thread) => /* @__PURE__ */ jsxs94(
|
|
33738
34677
|
"div",
|
|
33739
34678
|
{
|
|
33740
34679
|
className: `${styles.threadItem} ${thread.id === threadId ? "active" : ""}`,
|
|
33741
34680
|
onClick: () => selectThread(thread.id),
|
|
33742
34681
|
title: thread.label,
|
|
33743
34682
|
children: [
|
|
33744
|
-
/* @__PURE__ */
|
|
33745
|
-
/* @__PURE__ */
|
|
34683
|
+
/* @__PURE__ */ jsx130("div", { className: styles.threadIcon, children: /* @__PURE__ */ jsx130(MessageSquare4, { size: 14 }) }),
|
|
34684
|
+
/* @__PURE__ */ jsx130(
|
|
33746
34685
|
"div",
|
|
33747
34686
|
{
|
|
33748
34687
|
className: thread.id === threadId ? styles.threadNameActive : styles.threadName,
|
|
33749
34688
|
children: thread.label
|
|
33750
34689
|
}
|
|
33751
34690
|
),
|
|
33752
|
-
/* @__PURE__ */
|
|
34691
|
+
/* @__PURE__ */ jsx130(
|
|
33753
34692
|
"button",
|
|
33754
34693
|
{
|
|
33755
34694
|
className: styles.deleteBtn,
|
|
33756
34695
|
onClick: (e) => handleDeleteThread(e, thread.id),
|
|
33757
34696
|
title: "Delete conversation",
|
|
33758
|
-
children: /* @__PURE__ */
|
|
34697
|
+
children: /* @__PURE__ */ jsx130(Trash210, { size: 12 })
|
|
33759
34698
|
}
|
|
33760
34699
|
)
|
|
33761
34700
|
]
|
|
@@ -33765,7 +34704,7 @@ var ThreadHistoryMenuContent = () => {
|
|
|
33765
34704
|
};
|
|
33766
34705
|
|
|
33767
34706
|
// src/components/Chat/ChatSidebar.tsx
|
|
33768
|
-
import { Fragment as
|
|
34707
|
+
import { Fragment as Fragment30, jsx as jsx131, jsxs as jsxs95 } from "react/jsx-runtime";
|
|
33769
34708
|
var DRAWER_STYLES2 = {
|
|
33770
34709
|
wrapper: {
|
|
33771
34710
|
background: "transparent",
|
|
@@ -33790,7 +34729,7 @@ var DEFAULT_MENU_ITEMS = [
|
|
|
33790
34729
|
builtin: "new-analysis",
|
|
33791
34730
|
type: "action",
|
|
33792
34731
|
name: "New Analysis",
|
|
33793
|
-
icon: /* @__PURE__ */
|
|
34732
|
+
icon: /* @__PURE__ */ jsx131(PlusCircle, { size: 20 }),
|
|
33794
34733
|
order: 0
|
|
33795
34734
|
},
|
|
33796
34735
|
{
|
|
@@ -33798,13 +34737,13 @@ var DEFAULT_MENU_ITEMS = [
|
|
|
33798
34737
|
builtin: "thread-history",
|
|
33799
34738
|
type: "drawer",
|
|
33800
34739
|
name: "History",
|
|
33801
|
-
icon: /* @__PURE__ */
|
|
34740
|
+
icon: /* @__PURE__ */ jsx131(History2, { size: 20 }),
|
|
33802
34741
|
order: 1,
|
|
33803
34742
|
title: "Conversation History",
|
|
33804
34743
|
width: 320,
|
|
33805
34744
|
inline: true,
|
|
33806
34745
|
inlineDefaultExpanded: true,
|
|
33807
|
-
content: /* @__PURE__ */
|
|
34746
|
+
content: /* @__PURE__ */ jsx131(ThreadHistoryMenuContent, {})
|
|
33808
34747
|
}
|
|
33809
34748
|
];
|
|
33810
34749
|
var ChatSidebar = ({
|
|
@@ -33816,8 +34755,8 @@ var ChatSidebar = ({
|
|
|
33816
34755
|
const { sideAppVisible, menuCollapsed, setMenuCollapsed } = useChatUIContext();
|
|
33817
34756
|
const { user, logout } = useAuth();
|
|
33818
34757
|
const { createThread } = useConversationContext();
|
|
33819
|
-
const [drawerStates, setDrawerStates] =
|
|
33820
|
-
const [changePasswordOpen, setChangePasswordOpen] =
|
|
34758
|
+
const [drawerStates, setDrawerStates] = useState82({});
|
|
34759
|
+
const [changePasswordOpen, setChangePasswordOpen] = useState82(false);
|
|
33821
34760
|
const {
|
|
33822
34761
|
sidebarMode,
|
|
33823
34762
|
sidebarShowToggle,
|
|
@@ -33826,11 +34765,11 @@ var ChatSidebar = ({
|
|
|
33826
34765
|
sidebarLogoIcon
|
|
33827
34766
|
} = config;
|
|
33828
34767
|
const isExpandedMode = sidebarMode === "expanded";
|
|
33829
|
-
const menuItems =
|
|
34768
|
+
const menuItems = useMemo38(() => {
|
|
33830
34769
|
const items = customMenuItems.length > 0 ? [...customMenuItems] : [...DEFAULT_MENU_ITEMS];
|
|
33831
34770
|
return items.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
33832
34771
|
}, [customMenuItems]);
|
|
33833
|
-
const handleMenuClick =
|
|
34772
|
+
const handleMenuClick = useCallback45(async (item) => {
|
|
33834
34773
|
if (item.builtin === "settings") {
|
|
33835
34774
|
setSettingsModalOpen(true);
|
|
33836
34775
|
onSettingsClick?.();
|
|
@@ -33853,44 +34792,44 @@ var ChatSidebar = ({
|
|
|
33853
34792
|
}
|
|
33854
34793
|
}
|
|
33855
34794
|
}, [onSettingsClick, setSettingsModalOpen, createThread, logout]);
|
|
33856
|
-
const handleCloseDrawer =
|
|
34795
|
+
const handleCloseDrawer = useCallback45((itemId) => {
|
|
33857
34796
|
setDrawerStates((prev) => ({ ...prev, [itemId]: false }));
|
|
33858
34797
|
}, []);
|
|
33859
|
-
const handleNewAnalysis =
|
|
34798
|
+
const handleNewAnalysis = useCallback45(async () => {
|
|
33860
34799
|
try {
|
|
33861
34800
|
await createThread("New Analysis");
|
|
33862
34801
|
} catch (error) {
|
|
33863
34802
|
console.error("Failed to create new thread:", error);
|
|
33864
34803
|
}
|
|
33865
34804
|
}, [createThread]);
|
|
33866
|
-
const renderDrawerContent =
|
|
34805
|
+
const renderDrawerContent = useCallback45((item) => {
|
|
33867
34806
|
switch (item.builtin) {
|
|
33868
34807
|
case "thread-history":
|
|
33869
|
-
return /* @__PURE__ */
|
|
34808
|
+
return /* @__PURE__ */ jsx131(ThreadHistoryMenuContent, {});
|
|
33870
34809
|
default:
|
|
33871
34810
|
return item.content;
|
|
33872
34811
|
}
|
|
33873
34812
|
}, []);
|
|
33874
|
-
const userMenuItems = /* @__PURE__ */
|
|
33875
|
-
/* @__PURE__ */
|
|
33876
|
-
/* @__PURE__ */
|
|
33877
|
-
/* @__PURE__ */
|
|
34813
|
+
const userMenuItems = /* @__PURE__ */ jsxs95("div", { style: { minWidth: 160 }, children: [
|
|
34814
|
+
/* @__PURE__ */ jsxs95("div", { style: { padding: "8px 12px", borderBottom: "1px solid #f0f0f0" }, children: [
|
|
34815
|
+
/* @__PURE__ */ jsx131("div", { style: { fontWeight: 500 }, children: user?.name || user?.email }),
|
|
34816
|
+
/* @__PURE__ */ jsx131("div", { style: { fontSize: 12, color: "#666" }, children: user?.email })
|
|
33878
34817
|
] }),
|
|
33879
|
-
/* @__PURE__ */
|
|
33880
|
-
|
|
34818
|
+
/* @__PURE__ */ jsxs95(
|
|
34819
|
+
Button59,
|
|
33881
34820
|
{
|
|
33882
34821
|
type: "text",
|
|
33883
34822
|
block: true,
|
|
33884
34823
|
style: { justifyContent: "flex-start", padding: "8px 12px" },
|
|
33885
34824
|
onClick: () => setChangePasswordOpen(true),
|
|
33886
34825
|
children: [
|
|
33887
|
-
/* @__PURE__ */
|
|
34826
|
+
/* @__PURE__ */ jsx131(Key2, { size: 16, style: { marginRight: 8 } }),
|
|
33888
34827
|
"Change Password"
|
|
33889
34828
|
]
|
|
33890
34829
|
}
|
|
33891
34830
|
),
|
|
33892
|
-
/* @__PURE__ */
|
|
33893
|
-
|
|
34831
|
+
/* @__PURE__ */ jsxs95(
|
|
34832
|
+
Button59,
|
|
33894
34833
|
{
|
|
33895
34834
|
type: "text",
|
|
33896
34835
|
block: true,
|
|
@@ -33898,14 +34837,14 @@ var ChatSidebar = ({
|
|
|
33898
34837
|
style: { justifyContent: "flex-start", padding: "8px 12px" },
|
|
33899
34838
|
onClick: logout,
|
|
33900
34839
|
children: [
|
|
33901
|
-
/* @__PURE__ */
|
|
34840
|
+
/* @__PURE__ */ jsx131(LogOut4, { size: 16, style: { marginRight: 8 } }),
|
|
33902
34841
|
"Logout"
|
|
33903
34842
|
]
|
|
33904
34843
|
}
|
|
33905
34844
|
)
|
|
33906
34845
|
] });
|
|
33907
|
-
return /* @__PURE__ */
|
|
33908
|
-
/* @__PURE__ */
|
|
34846
|
+
return /* @__PURE__ */ jsxs95(Fragment30, { children: [
|
|
34847
|
+
/* @__PURE__ */ jsx131(
|
|
33909
34848
|
Menu,
|
|
33910
34849
|
{
|
|
33911
34850
|
items: menuItems,
|
|
@@ -33919,13 +34858,13 @@ var ChatSidebar = ({
|
|
|
33919
34858
|
forceIconMode: sideAppVisible,
|
|
33920
34859
|
collapsed: menuCollapsed,
|
|
33921
34860
|
onCollapsedChange: setMenuCollapsed,
|
|
33922
|
-
footer: ({ isIconMode }) => user && /* @__PURE__ */
|
|
34861
|
+
footer: ({ isIconMode }) => user && /* @__PURE__ */ jsx131(
|
|
33923
34862
|
Popover4,
|
|
33924
34863
|
{
|
|
33925
34864
|
content: userMenuItems,
|
|
33926
34865
|
placement: "rightTop",
|
|
33927
34866
|
trigger: "click",
|
|
33928
|
-
children: /* @__PURE__ */
|
|
34867
|
+
children: /* @__PURE__ */ jsxs95(
|
|
33929
34868
|
"div",
|
|
33930
34869
|
{
|
|
33931
34870
|
style: {
|
|
@@ -33939,7 +34878,7 @@ var ChatSidebar = ({
|
|
|
33939
34878
|
transition: "all 0.2s"
|
|
33940
34879
|
},
|
|
33941
34880
|
children: [
|
|
33942
|
-
/* @__PURE__ */
|
|
34881
|
+
/* @__PURE__ */ jsx131(
|
|
33943
34882
|
Avatar13,
|
|
33944
34883
|
{
|
|
33945
34884
|
size: isIconMode ? 32 : 36,
|
|
@@ -33951,8 +34890,8 @@ var ChatSidebar = ({
|
|
|
33951
34890
|
children: (user.name?.charAt(0) || user.email.charAt(0)).toUpperCase()
|
|
33952
34891
|
}
|
|
33953
34892
|
),
|
|
33954
|
-
!isIconMode && /* @__PURE__ */
|
|
33955
|
-
/* @__PURE__ */
|
|
34893
|
+
!isIconMode && /* @__PURE__ */ jsxs95("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
34894
|
+
/* @__PURE__ */ jsx131(
|
|
33956
34895
|
"div",
|
|
33957
34896
|
{
|
|
33958
34897
|
style: {
|
|
@@ -33964,7 +34903,7 @@ var ChatSidebar = ({
|
|
|
33964
34903
|
children: user.name || user.email
|
|
33965
34904
|
}
|
|
33966
34905
|
),
|
|
33967
|
-
/* @__PURE__ */
|
|
34906
|
+
/* @__PURE__ */ jsx131(
|
|
33968
34907
|
"div",
|
|
33969
34908
|
{
|
|
33970
34909
|
style: {
|
|
@@ -33985,19 +34924,19 @@ var ChatSidebar = ({
|
|
|
33985
34924
|
)
|
|
33986
34925
|
}
|
|
33987
34926
|
),
|
|
33988
|
-
/* @__PURE__ */
|
|
34927
|
+
/* @__PURE__ */ jsx131(
|
|
33989
34928
|
ChangePasswordModal,
|
|
33990
34929
|
{
|
|
33991
34930
|
open: changePasswordOpen,
|
|
33992
34931
|
onClose: () => setChangePasswordOpen(false)
|
|
33993
34932
|
}
|
|
33994
34933
|
),
|
|
33995
|
-
menuItems.filter((item) => item.type === "drawer" && !item.inline).map((item) => /* @__PURE__ */
|
|
34934
|
+
menuItems.filter((item) => item.type === "drawer" && !item.inline).map((item) => /* @__PURE__ */ jsx131(
|
|
33996
34935
|
Drawer3,
|
|
33997
34936
|
{
|
|
33998
|
-
title: /* @__PURE__ */
|
|
33999
|
-
/* @__PURE__ */
|
|
34000
|
-
/* @__PURE__ */
|
|
34937
|
+
title: /* @__PURE__ */ jsxs95("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" }, children: [
|
|
34938
|
+
/* @__PURE__ */ jsx131("span", { style: { fontSize: 16, fontWeight: 600, textTransform: "uppercase", letterSpacing: 0.5 }, children: item.title || item.name }),
|
|
34939
|
+
/* @__PURE__ */ jsx131(
|
|
34001
34940
|
"button",
|
|
34002
34941
|
{
|
|
34003
34942
|
onClick: () => handleCloseDrawer(item.id),
|
|
@@ -34012,7 +34951,7 @@ var ChatSidebar = ({
|
|
|
34012
34951
|
background: "rgba(255, 255, 255, 0.5)",
|
|
34013
34952
|
cursor: "pointer"
|
|
34014
34953
|
},
|
|
34015
|
-
children: /* @__PURE__ */
|
|
34954
|
+
children: /* @__PURE__ */ jsx131(PanelLeftClose2, { size: 24 })
|
|
34016
34955
|
}
|
|
34017
34956
|
)
|
|
34018
34957
|
] }),
|
|
@@ -34043,7 +34982,7 @@ var ChatSidebar = ({
|
|
|
34043
34982
|
};
|
|
34044
34983
|
|
|
34045
34984
|
// src/components/Chat/LatticeChatView.tsx
|
|
34046
|
-
import { jsx as
|
|
34985
|
+
import { jsx as jsx132 } from "react/jsx-runtime";
|
|
34047
34986
|
var LatticeChatView = (props) => {
|
|
34048
34987
|
const shellContext = useContext12(LatticeChatShellContext);
|
|
34049
34988
|
const { showSideMenu, sideMenuItems } = shellContext.config;
|
|
@@ -34052,7 +34991,7 @@ var LatticeChatView = (props) => {
|
|
|
34052
34991
|
const {
|
|
34053
34992
|
config: { baseURL }
|
|
34054
34993
|
} = useLatticeChatShellContext();
|
|
34055
|
-
return assistantId && thread ? /* @__PURE__ */
|
|
34994
|
+
return assistantId && thread ? /* @__PURE__ */ jsx132(
|
|
34056
34995
|
AxiomLatticeProvider,
|
|
34057
34996
|
{
|
|
34058
34997
|
config: {
|
|
@@ -34061,14 +35000,14 @@ var LatticeChatView = (props) => {
|
|
|
34061
35000
|
assistantId,
|
|
34062
35001
|
transport: "sse"
|
|
34063
35002
|
},
|
|
34064
|
-
children: /* @__PURE__ */
|
|
35003
|
+
children: /* @__PURE__ */ jsx132(
|
|
34065
35004
|
LatticeChat,
|
|
34066
35005
|
{
|
|
34067
35006
|
thread_id: thread?.id,
|
|
34068
35007
|
assistant_id: assistantId,
|
|
34069
35008
|
name: currentAssistant?.name,
|
|
34070
35009
|
description: currentAssistant?.description,
|
|
34071
|
-
menu: showSideMenu ? /* @__PURE__ */
|
|
35010
|
+
menu: showSideMenu ? /* @__PURE__ */ jsx132(ChatSidebar, { customMenuItems: sideMenuItems }) : void 0
|
|
34072
35011
|
}
|
|
34073
35012
|
)
|
|
34074
35013
|
}
|
|
@@ -34076,17 +35015,17 @@ var LatticeChatView = (props) => {
|
|
|
34076
35015
|
};
|
|
34077
35016
|
|
|
34078
35017
|
// src/components/Chat/SettingsModal.tsx
|
|
34079
|
-
import { useState as
|
|
35018
|
+
import { useState as useState83, useEffect as useEffect57, useRef as useRef31 } from "react";
|
|
34080
35019
|
import {
|
|
34081
|
-
Modal as
|
|
34082
|
-
Input as
|
|
34083
|
-
Button as
|
|
34084
|
-
message as
|
|
35020
|
+
Modal as Modal25,
|
|
35021
|
+
Input as Input20,
|
|
35022
|
+
Button as Button60,
|
|
35023
|
+
message as message24,
|
|
34085
35024
|
notification as notification5,
|
|
34086
|
-
Typography as
|
|
35025
|
+
Typography as Typography61,
|
|
34087
35026
|
Alert as Alert9,
|
|
34088
|
-
Select as
|
|
34089
|
-
Switch as
|
|
35027
|
+
Select as Select9,
|
|
35028
|
+
Switch as Switch5,
|
|
34090
35029
|
Space as Space39,
|
|
34091
35030
|
Tabs as Tabs4
|
|
34092
35031
|
} from "antd";
|
|
@@ -34102,11 +35041,11 @@ import {
|
|
|
34102
35041
|
PlusOutlined as PlusOutlined9,
|
|
34103
35042
|
CloudServerOutlined
|
|
34104
35043
|
} from "@ant-design/icons";
|
|
34105
|
-
import { createStyles as
|
|
34106
|
-
import { Fragment as
|
|
34107
|
-
var { Text:
|
|
34108
|
-
var { TextArea: TextArea9 } =
|
|
34109
|
-
var
|
|
35044
|
+
import { createStyles as createStyles42 } from "antd-style";
|
|
35045
|
+
import { Fragment as Fragment31, jsx as jsx133, jsxs as jsxs96 } from "react/jsx-runtime";
|
|
35046
|
+
var { Text: Text50, Title: Title17 } = Typography61;
|
|
35047
|
+
var { TextArea: TextArea9 } = Input20;
|
|
35048
|
+
var useStyles25 = createStyles42(({ token, css }) => ({
|
|
34110
35049
|
// settingsModal: css`
|
|
34111
35050
|
// .ant-modal {
|
|
34112
35051
|
// max-width: 100vw !important;
|
|
@@ -34451,21 +35390,21 @@ var SETTINGS_MENU_ITEMS = [
|
|
|
34451
35390
|
{
|
|
34452
35391
|
key: "environment",
|
|
34453
35392
|
label: "Environment Variables",
|
|
34454
|
-
icon: /* @__PURE__ */
|
|
35393
|
+
icon: /* @__PURE__ */ jsx133(EnvironmentOutlined, {})
|
|
34455
35394
|
},
|
|
34456
35395
|
{
|
|
34457
35396
|
key: "models",
|
|
34458
35397
|
label: "Model Configuration",
|
|
34459
|
-
icon: /* @__PURE__ */
|
|
35398
|
+
icon: /* @__PURE__ */ jsx133(ApiOutlined, {})
|
|
34460
35399
|
}
|
|
34461
35400
|
];
|
|
34462
35401
|
var SettingsModal = ({
|
|
34463
35402
|
open,
|
|
34464
35403
|
onClose
|
|
34465
35404
|
}) => {
|
|
34466
|
-
const { styles } =
|
|
35405
|
+
const { styles } = useStyles25();
|
|
34467
35406
|
const { config: shellConfig, updateConfigValue } = useLatticeChatShellContext();
|
|
34468
|
-
const [connections, setConnections] =
|
|
35407
|
+
const [connections, setConnections] = useState83(() => {
|
|
34469
35408
|
if (typeof window !== "undefined") {
|
|
34470
35409
|
try {
|
|
34471
35410
|
const stored = localStorage.getItem("lattice_server_connections");
|
|
@@ -34488,21 +35427,21 @@ var SettingsModal = ({
|
|
|
34488
35427
|
}
|
|
34489
35428
|
return [];
|
|
34490
35429
|
});
|
|
34491
|
-
const [serverConfigs, setServerConfigs] =
|
|
34492
|
-
const connectionsRef =
|
|
34493
|
-
|
|
35430
|
+
const [serverConfigs, setServerConfigs] = useState83({});
|
|
35431
|
+
const connectionsRef = useRef31(connections);
|
|
35432
|
+
useEffect57(() => {
|
|
34494
35433
|
connectionsRef.current = connections;
|
|
34495
35434
|
}, [connections]);
|
|
34496
|
-
const [activeTabKey, setActiveTabKey] =
|
|
35435
|
+
const [activeTabKey, setActiveTabKey] = useState83(
|
|
34497
35436
|
connections.length > 0 ? connections[0].id : ""
|
|
34498
35437
|
);
|
|
34499
|
-
const [activeMenu, setActiveMenu] =
|
|
34500
|
-
const [loading, setLoading] =
|
|
34501
|
-
const [showAddServerModal, setShowAddServerModal] =
|
|
34502
|
-
const [newServerUrl, setNewServerUrl] =
|
|
34503
|
-
const [newServerName, setNewServerName] =
|
|
34504
|
-
const [newServerApiKey, setNewServerApiKey] =
|
|
34505
|
-
const [addingServer, setAddingServer] =
|
|
35438
|
+
const [activeMenu, setActiveMenu] = useState83("environment");
|
|
35439
|
+
const [loading, setLoading] = useState83(false);
|
|
35440
|
+
const [showAddServerModal, setShowAddServerModal] = useState83(false);
|
|
35441
|
+
const [newServerUrl, setNewServerUrl] = useState83("");
|
|
35442
|
+
const [newServerName, setNewServerName] = useState83("");
|
|
35443
|
+
const [newServerApiKey, setNewServerApiKey] = useState83("");
|
|
35444
|
+
const [addingServer, setAddingServer] = useState83(false);
|
|
34506
35445
|
const saveConnections = (newConnections) => {
|
|
34507
35446
|
setConnections(newConnections);
|
|
34508
35447
|
if (typeof window !== "undefined") {
|
|
@@ -34641,7 +35580,7 @@ var SettingsModal = ({
|
|
|
34641
35580
|
}
|
|
34642
35581
|
} catch (error) {
|
|
34643
35582
|
console.error("Failed to load configuration:", error);
|
|
34644
|
-
|
|
35583
|
+
message24.error("Failed to load current configuration");
|
|
34645
35584
|
}
|
|
34646
35585
|
};
|
|
34647
35586
|
const loadModelsConfig = async (serverId) => {
|
|
@@ -34692,7 +35631,7 @@ var SettingsModal = ({
|
|
|
34692
35631
|
console.error("Failed to load models configuration:", error);
|
|
34693
35632
|
}
|
|
34694
35633
|
};
|
|
34695
|
-
|
|
35634
|
+
useEffect57(() => {
|
|
34696
35635
|
if (open && activeTabKey) {
|
|
34697
35636
|
initializeServerConfig(activeTabKey);
|
|
34698
35637
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
@@ -34701,7 +35640,7 @@ var SettingsModal = ({
|
|
|
34701
35640
|
}
|
|
34702
35641
|
}
|
|
34703
35642
|
}, [open, activeTabKey]);
|
|
34704
|
-
|
|
35643
|
+
useEffect57(() => {
|
|
34705
35644
|
if (open && activeTabKey) {
|
|
34706
35645
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
34707
35646
|
if (connection?.connected) {
|
|
@@ -34715,7 +35654,7 @@ var SettingsModal = ({
|
|
|
34715
35654
|
}, [open, activeTabKey, activeMenu]);
|
|
34716
35655
|
const handleAddServer = async () => {
|
|
34717
35656
|
if (!newServerUrl.trim()) {
|
|
34718
|
-
|
|
35657
|
+
message24.error("Please enter a server URL");
|
|
34719
35658
|
return;
|
|
34720
35659
|
}
|
|
34721
35660
|
let normalizedUrl = newServerUrl.trim();
|
|
@@ -34778,12 +35717,12 @@ var SettingsModal = ({
|
|
|
34778
35717
|
const handleSave = async () => {
|
|
34779
35718
|
const connection = connections.find((c) => c.id === activeTabKey);
|
|
34780
35719
|
if (!connection || !connection.connected) {
|
|
34781
|
-
|
|
35720
|
+
message24.error("Please connect to a server first");
|
|
34782
35721
|
return;
|
|
34783
35722
|
}
|
|
34784
35723
|
const url = connection.url;
|
|
34785
35724
|
if (!url) {
|
|
34786
|
-
|
|
35725
|
+
message24.error("Please connect to a server first");
|
|
34787
35726
|
return;
|
|
34788
35727
|
}
|
|
34789
35728
|
try {
|
|
@@ -34847,7 +35786,7 @@ var SettingsModal = ({
|
|
|
34847
35786
|
const data = await response.json();
|
|
34848
35787
|
if (response.ok && data.success) {
|
|
34849
35788
|
if (data.requiresRestart && data.requiresRestart.length > 0) {
|
|
34850
|
-
|
|
35789
|
+
message24.warning(
|
|
34851
35790
|
`Configuration saved. Please restart the server for ${data.requiresRestart.join(
|
|
34852
35791
|
", "
|
|
34853
35792
|
)} to take effect.`,
|
|
@@ -34861,12 +35800,12 @@ var SettingsModal = ({
|
|
|
34861
35800
|
}
|
|
34862
35801
|
if (data.warnings && data.warnings.length > 0) {
|
|
34863
35802
|
data.warnings.forEach((warning) => {
|
|
34864
|
-
|
|
35803
|
+
message24.warning(warning, 5);
|
|
34865
35804
|
});
|
|
34866
35805
|
}
|
|
34867
35806
|
onClose();
|
|
34868
35807
|
} else {
|
|
34869
|
-
|
|
35808
|
+
message24.error(data.error || "Failed to save configuration");
|
|
34870
35809
|
}
|
|
34871
35810
|
} else if (activeMenu === "models") {
|
|
34872
35811
|
const validModels = config.models.filter(
|
|
@@ -34891,12 +35830,12 @@ var SettingsModal = ({
|
|
|
34891
35830
|
});
|
|
34892
35831
|
onClose();
|
|
34893
35832
|
} else {
|
|
34894
|
-
|
|
35833
|
+
message24.error(data.error || "Failed to save model configuration");
|
|
34895
35834
|
}
|
|
34896
35835
|
}
|
|
34897
35836
|
} catch (error) {
|
|
34898
35837
|
console.error("Failed to save configuration:", error);
|
|
34899
|
-
|
|
35838
|
+
message24.error(error.message || "Failed to save configuration");
|
|
34900
35839
|
} finally {
|
|
34901
35840
|
setLoading(false);
|
|
34902
35841
|
}
|
|
@@ -34912,25 +35851,25 @@ var SettingsModal = ({
|
|
|
34912
35851
|
}
|
|
34913
35852
|
}));
|
|
34914
35853
|
};
|
|
34915
|
-
return /* @__PURE__ */
|
|
34916
|
-
/* @__PURE__ */
|
|
35854
|
+
return /* @__PURE__ */ jsxs96("div", { className: styles.formContainer, children: [
|
|
35855
|
+
/* @__PURE__ */ jsx133(
|
|
34917
35856
|
Alert9,
|
|
34918
35857
|
{
|
|
34919
35858
|
message: "Configuration Effect",
|
|
34920
|
-
description: /* @__PURE__ */
|
|
34921
|
-
/* @__PURE__ */
|
|
34922
|
-
/* @__PURE__ */
|
|
35859
|
+
description: /* @__PURE__ */ jsxs96("div", { children: [
|
|
35860
|
+
/* @__PURE__ */ jsxs96("div", { style: { marginBottom: 8 }, children: [
|
|
35861
|
+
/* @__PURE__ */ jsx133(
|
|
34923
35862
|
CheckCircleOutlined8,
|
|
34924
35863
|
{
|
|
34925
35864
|
style: { color: "#52c41a", marginRight: 8 }
|
|
34926
35865
|
}
|
|
34927
35866
|
),
|
|
34928
|
-
/* @__PURE__ */
|
|
35867
|
+
/* @__PURE__ */ jsx133("strong", { children: "Immediately effective:" }),
|
|
34929
35868
|
" QUEUE_SERVICE_TYPE, REDIS_URL, REDIS_PASSWORD, QUEUE_NAME"
|
|
34930
35869
|
] }),
|
|
34931
|
-
/* @__PURE__ */
|
|
34932
|
-
/* @__PURE__ */
|
|
34933
|
-
/* @__PURE__ */
|
|
35870
|
+
/* @__PURE__ */ jsxs96("div", { children: [
|
|
35871
|
+
/* @__PURE__ */ jsx133(ReloadOutlined6, { style: { color: "#faad14", marginRight: 8 } }),
|
|
35872
|
+
/* @__PURE__ */ jsx133("strong", { children: "Requires restart:" }),
|
|
34934
35873
|
" PORT (server must be restarted to change port)"
|
|
34935
35874
|
] })
|
|
34936
35875
|
] }),
|
|
@@ -34939,8 +35878,8 @@ var SettingsModal = ({
|
|
|
34939
35878
|
className: styles.alertCard
|
|
34940
35879
|
}
|
|
34941
35880
|
),
|
|
34942
|
-
/* @__PURE__ */
|
|
34943
|
-
/* @__PURE__ */
|
|
35881
|
+
/* @__PURE__ */ jsx133("div", { style: { marginBottom: 24 }, children: /* @__PURE__ */ jsx133(Text50, { 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." }) }),
|
|
35882
|
+
/* @__PURE__ */ jsx133(
|
|
34944
35883
|
TextArea9,
|
|
34945
35884
|
{
|
|
34946
35885
|
value: config.envText,
|
|
@@ -35017,10 +35956,10 @@ QUEUE_NAME=tasks`,
|
|
|
35017
35956
|
}));
|
|
35018
35957
|
}
|
|
35019
35958
|
};
|
|
35020
|
-
return /* @__PURE__ */
|
|
35021
|
-
/* @__PURE__ */
|
|
35022
|
-
config.models.map((model, index) => /* @__PURE__ */
|
|
35023
|
-
/* @__PURE__ */
|
|
35959
|
+
return /* @__PURE__ */ jsxs96("div", { className: styles.formContainer, children: [
|
|
35960
|
+
/* @__PURE__ */ jsx133("div", { style: { marginBottom: 32 }, children: /* @__PURE__ */ jsx133(Text50, { 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." }) }),
|
|
35961
|
+
config.models.map((model, index) => /* @__PURE__ */ jsxs96("div", { className: styles.card, children: [
|
|
35962
|
+
/* @__PURE__ */ jsxs96(
|
|
35024
35963
|
"div",
|
|
35025
35964
|
{
|
|
35026
35965
|
style: {
|
|
@@ -35032,13 +35971,13 @@ QUEUE_NAME=tasks`,
|
|
|
35032
35971
|
borderBottom: "1px solid rgba(0, 0, 0, 0.06)"
|
|
35033
35972
|
},
|
|
35034
35973
|
children: [
|
|
35035
|
-
/* @__PURE__ */
|
|
35036
|
-
/* @__PURE__ */
|
|
35974
|
+
/* @__PURE__ */ jsxs96("div", { children: [
|
|
35975
|
+
/* @__PURE__ */ jsxs96(Text50, { strong: true, style: { fontSize: 16 }, children: [
|
|
35037
35976
|
"Model ",
|
|
35038
35977
|
index + 1
|
|
35039
35978
|
] }),
|
|
35040
|
-
model.key && /* @__PURE__ */
|
|
35041
|
-
|
|
35979
|
+
model.key && /* @__PURE__ */ jsxs96(
|
|
35980
|
+
Text50,
|
|
35042
35981
|
{
|
|
35043
35982
|
type: "secondary",
|
|
35044
35983
|
style: { marginLeft: 8, fontSize: 12 },
|
|
@@ -35050,8 +35989,8 @@ QUEUE_NAME=tasks`,
|
|
|
35050
35989
|
}
|
|
35051
35990
|
)
|
|
35052
35991
|
] }),
|
|
35053
|
-
config.models.length > 1 && /* @__PURE__ */
|
|
35054
|
-
|
|
35992
|
+
config.models.length > 1 && /* @__PURE__ */ jsx133(
|
|
35993
|
+
Button60,
|
|
35055
35994
|
{
|
|
35056
35995
|
type: "text",
|
|
35057
35996
|
danger: true,
|
|
@@ -35067,11 +36006,11 @@ QUEUE_NAME=tasks`,
|
|
|
35067
36006
|
]
|
|
35068
36007
|
}
|
|
35069
36008
|
),
|
|
35070
|
-
/* @__PURE__ */
|
|
35071
|
-
/* @__PURE__ */
|
|
35072
|
-
/* @__PURE__ */
|
|
35073
|
-
/* @__PURE__ */
|
|
35074
|
-
|
|
36009
|
+
/* @__PURE__ */ jsxs96(Space39, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
36010
|
+
/* @__PURE__ */ jsxs96("div", { children: [
|
|
36011
|
+
/* @__PURE__ */ jsx133(Text50, { className: styles.formLabel, children: "Key *" }),
|
|
36012
|
+
/* @__PURE__ */ jsx133(
|
|
36013
|
+
Input20,
|
|
35075
36014
|
{
|
|
35076
36015
|
placeholder: "e.g., default, gpt-4, claude",
|
|
35077
36016
|
value: model.key,
|
|
@@ -35079,12 +36018,12 @@ QUEUE_NAME=tasks`,
|
|
|
35079
36018
|
style: { height: 40 }
|
|
35080
36019
|
}
|
|
35081
36020
|
),
|
|
35082
|
-
/* @__PURE__ */
|
|
36021
|
+
/* @__PURE__ */ jsx133(Text50, { className: styles.formDescription, children: "Unique identifier for this model" })
|
|
35083
36022
|
] }),
|
|
35084
|
-
/* @__PURE__ */
|
|
35085
|
-
/* @__PURE__ */
|
|
35086
|
-
/* @__PURE__ */
|
|
35087
|
-
|
|
36023
|
+
/* @__PURE__ */ jsxs96("div", { children: [
|
|
36024
|
+
/* @__PURE__ */ jsx133(Text50, { className: styles.formLabel, children: "Provider *" }),
|
|
36025
|
+
/* @__PURE__ */ jsx133(
|
|
36026
|
+
Select9,
|
|
35088
36027
|
{
|
|
35089
36028
|
style: { width: "100%", height: 40 },
|
|
35090
36029
|
value: model.provider,
|
|
@@ -35099,10 +36038,10 @@ QUEUE_NAME=tasks`,
|
|
|
35099
36038
|
}
|
|
35100
36039
|
)
|
|
35101
36040
|
] }),
|
|
35102
|
-
/* @__PURE__ */
|
|
35103
|
-
/* @__PURE__ */
|
|
35104
|
-
/* @__PURE__ */
|
|
35105
|
-
|
|
36041
|
+
/* @__PURE__ */ jsxs96("div", { children: [
|
|
36042
|
+
/* @__PURE__ */ jsx133(Text50, { className: styles.formLabel, children: "Model Name *" }),
|
|
36043
|
+
/* @__PURE__ */ jsx133(
|
|
36044
|
+
Input20,
|
|
35106
36045
|
{
|
|
35107
36046
|
placeholder: "e.g., gpt-4, claude-3-opus, kimi-k2-250905",
|
|
35108
36047
|
value: model.model,
|
|
@@ -35111,10 +36050,10 @@ QUEUE_NAME=tasks`,
|
|
|
35111
36050
|
}
|
|
35112
36051
|
)
|
|
35113
36052
|
] }),
|
|
35114
|
-
/* @__PURE__ */
|
|
35115
|
-
/* @__PURE__ */
|
|
35116
|
-
/* @__PURE__ */
|
|
35117
|
-
|
|
36053
|
+
/* @__PURE__ */ jsxs96("div", { children: [
|
|
36054
|
+
/* @__PURE__ */ jsx133(Text50, { className: styles.formLabel, children: "API Key" }),
|
|
36055
|
+
/* @__PURE__ */ jsx133(
|
|
36056
|
+
Input20.Password,
|
|
35118
36057
|
{
|
|
35119
36058
|
placeholder: "Enter your API key",
|
|
35120
36059
|
value: model.apiKey,
|
|
@@ -35122,12 +36061,12 @@ QUEUE_NAME=tasks`,
|
|
|
35122
36061
|
style: { height: 40 }
|
|
35123
36062
|
}
|
|
35124
36063
|
),
|
|
35125
|
-
/* @__PURE__ */
|
|
36064
|
+
/* @__PURE__ */ jsx133(Text50, { className: styles.formDescription, children: "API key for the model provider. Leave empty to use environment variable." })
|
|
35126
36065
|
] }),
|
|
35127
|
-
/* @__PURE__ */
|
|
35128
|
-
/* @__PURE__ */
|
|
35129
|
-
/* @__PURE__ */
|
|
35130
|
-
|
|
36066
|
+
/* @__PURE__ */ jsxs96("div", { children: [
|
|
36067
|
+
/* @__PURE__ */ jsx133(Text50, { className: styles.formLabel, children: "Base URL" }),
|
|
36068
|
+
/* @__PURE__ */ jsx133(
|
|
36069
|
+
Input20,
|
|
35131
36070
|
{
|
|
35132
36071
|
placeholder: "e.g., https://api.openai.com/v1",
|
|
35133
36072
|
value: model.baseURL,
|
|
@@ -35135,23 +36074,23 @@ QUEUE_NAME=tasks`,
|
|
|
35135
36074
|
style: { height: 40 }
|
|
35136
36075
|
}
|
|
35137
36076
|
),
|
|
35138
|
-
/* @__PURE__ */
|
|
36077
|
+
/* @__PURE__ */ jsx133(Text50, { className: styles.formDescription, children: "Optional custom base URL for the API" })
|
|
35139
36078
|
] }),
|
|
35140
|
-
/* @__PURE__ */
|
|
35141
|
-
/* @__PURE__ */
|
|
35142
|
-
|
|
36079
|
+
/* @__PURE__ */ jsx133("div", { children: /* @__PURE__ */ jsxs96(Space39, { children: [
|
|
36080
|
+
/* @__PURE__ */ jsx133(
|
|
36081
|
+
Switch5,
|
|
35143
36082
|
{
|
|
35144
36083
|
checked: model.streaming,
|
|
35145
36084
|
onChange: (checked) => handleModelChange(index, "streaming", checked)
|
|
35146
36085
|
}
|
|
35147
36086
|
),
|
|
35148
|
-
/* @__PURE__ */
|
|
36087
|
+
/* @__PURE__ */ jsx133(Text50, { children: "Enable Streaming" })
|
|
35149
36088
|
] }) }),
|
|
35150
|
-
/* @__PURE__ */
|
|
35151
|
-
/* @__PURE__ */
|
|
35152
|
-
/* @__PURE__ */
|
|
35153
|
-
/* @__PURE__ */
|
|
35154
|
-
|
|
36089
|
+
/* @__PURE__ */ jsxs96("div", { style: { display: "flex", gap: 20 }, children: [
|
|
36090
|
+
/* @__PURE__ */ jsxs96("div", { style: { flex: 1 }, children: [
|
|
36091
|
+
/* @__PURE__ */ jsx133(Text50, { className: styles.formLabel, children: "Max Tokens" }),
|
|
36092
|
+
/* @__PURE__ */ jsx133(
|
|
36093
|
+
Input20,
|
|
35155
36094
|
{
|
|
35156
36095
|
type: "number",
|
|
35157
36096
|
placeholder: "e.g., 4096",
|
|
@@ -35165,10 +36104,10 @@ QUEUE_NAME=tasks`,
|
|
|
35165
36104
|
}
|
|
35166
36105
|
)
|
|
35167
36106
|
] }),
|
|
35168
|
-
/* @__PURE__ */
|
|
35169
|
-
/* @__PURE__ */
|
|
35170
|
-
/* @__PURE__ */
|
|
35171
|
-
|
|
36107
|
+
/* @__PURE__ */ jsxs96("div", { style: { flex: 1 }, children: [
|
|
36108
|
+
/* @__PURE__ */ jsx133(Text50, { className: styles.formLabel, children: "Temperature" }),
|
|
36109
|
+
/* @__PURE__ */ jsx133(
|
|
36110
|
+
Input20,
|
|
35172
36111
|
{
|
|
35173
36112
|
type: "number",
|
|
35174
36113
|
step: "0.1",
|
|
@@ -35186,8 +36125,8 @@ QUEUE_NAME=tasks`,
|
|
|
35186
36125
|
] })
|
|
35187
36126
|
] })
|
|
35188
36127
|
] }, index)),
|
|
35189
|
-
/* @__PURE__ */
|
|
35190
|
-
|
|
36128
|
+
/* @__PURE__ */ jsx133(
|
|
36129
|
+
Button60,
|
|
35191
36130
|
{
|
|
35192
36131
|
type: "dashed",
|
|
35193
36132
|
onClick: handleAddModel,
|
|
@@ -35214,8 +36153,8 @@ QUEUE_NAME=tasks`,
|
|
|
35214
36153
|
);
|
|
35215
36154
|
const currentConnection = connections.find((c) => c.id === activeTabKey);
|
|
35216
36155
|
const renderTabLabel = (connection) => {
|
|
35217
|
-
return /* @__PURE__ */
|
|
35218
|
-
/* @__PURE__ */
|
|
36156
|
+
return /* @__PURE__ */ jsxs96("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
36157
|
+
/* @__PURE__ */ jsx133(
|
|
35219
36158
|
CloudServerOutlined,
|
|
35220
36159
|
{
|
|
35221
36160
|
style: {
|
|
@@ -35224,14 +36163,14 @@ QUEUE_NAME=tasks`,
|
|
|
35224
36163
|
}
|
|
35225
36164
|
}
|
|
35226
36165
|
),
|
|
35227
|
-
/* @__PURE__ */
|
|
35228
|
-
connection.connected && /* @__PURE__ */
|
|
36166
|
+
/* @__PURE__ */ jsx133("span", { children: connection.name }),
|
|
36167
|
+
connection.connected && /* @__PURE__ */ jsx133(
|
|
35229
36168
|
CheckCircleFilled,
|
|
35230
36169
|
{
|
|
35231
36170
|
style: { color: "#52c41a", fontSize: 12, marginLeft: 8 }
|
|
35232
36171
|
}
|
|
35233
36172
|
),
|
|
35234
|
-
connection.error && !connection.connecting && /* @__PURE__ */
|
|
36173
|
+
connection.error && !connection.connecting && /* @__PURE__ */ jsx133(
|
|
35235
36174
|
CloseCircleFilled,
|
|
35236
36175
|
{
|
|
35237
36176
|
style: { color: "#ff4d4f", fontSize: 12, marginLeft: 8 }
|
|
@@ -35242,35 +36181,35 @@ QUEUE_NAME=tasks`,
|
|
|
35242
36181
|
const tabItems = connections.map((connection) => ({
|
|
35243
36182
|
key: connection.id,
|
|
35244
36183
|
label: renderTabLabel(connection),
|
|
35245
|
-
children: /* @__PURE__ */
|
|
35246
|
-
/* @__PURE__ */
|
|
36184
|
+
children: /* @__PURE__ */ jsx133("div", { className: styles.tabContent, children: connection.connected ? /* @__PURE__ */ jsx133(Fragment31, { children: /* @__PURE__ */ jsxs96("div", { style: { display: "flex", height: "100%" }, children: [
|
|
36185
|
+
/* @__PURE__ */ jsx133("div", { className: styles.sidebar, children: SETTINGS_MENU_ITEMS.map((item) => /* @__PURE__ */ jsxs96(
|
|
35247
36186
|
"div",
|
|
35248
36187
|
{
|
|
35249
36188
|
className: `${styles.menuItem} ${activeMenu === item.key ? "active" : ""}`,
|
|
35250
36189
|
onClick: () => setActiveMenu(item.key),
|
|
35251
36190
|
children: [
|
|
35252
|
-
/* @__PURE__ */
|
|
35253
|
-
/* @__PURE__ */
|
|
36191
|
+
/* @__PURE__ */ jsx133("span", { className: styles.menuItemIcon, children: item.icon }),
|
|
36192
|
+
/* @__PURE__ */ jsx133("span", { className: styles.menuItemText, children: item.label })
|
|
35254
36193
|
]
|
|
35255
36194
|
},
|
|
35256
36195
|
item.key
|
|
35257
36196
|
)) }),
|
|
35258
|
-
/* @__PURE__ */
|
|
35259
|
-
/* @__PURE__ */
|
|
35260
|
-
/* @__PURE__ */
|
|
35261
|
-
/* @__PURE__ */
|
|
35262
|
-
/* @__PURE__ */
|
|
36197
|
+
/* @__PURE__ */ jsxs96("div", { className: styles.content, children: [
|
|
36198
|
+
/* @__PURE__ */ jsxs96("div", { className: styles.contentHeader, children: [
|
|
36199
|
+
/* @__PURE__ */ jsxs96("div", { className: styles.contentHeaderLeft, children: [
|
|
36200
|
+
/* @__PURE__ */ jsx133(Title17, { level: 3, className: styles.contentTitle, children: activeMenuItem?.label }),
|
|
36201
|
+
/* @__PURE__ */ jsxs96(Text50, { className: styles.contentDescription, children: [
|
|
35263
36202
|
activeMenu === "environment" && "Manage environment variables for the gateway server",
|
|
35264
36203
|
activeMenu === "models" && "Configure and register model lattices for use by agents"
|
|
35265
36204
|
] })
|
|
35266
36205
|
] }),
|
|
35267
|
-
/* @__PURE__ */
|
|
35268
|
-
/* @__PURE__ */
|
|
35269
|
-
/* @__PURE__ */
|
|
35270
|
-
|
|
36206
|
+
/* @__PURE__ */ jsxs96("div", { className: styles.contentHeaderRight, children: [
|
|
36207
|
+
/* @__PURE__ */ jsx133(Button60, { onClick: onClose, children: "Cancel" }),
|
|
36208
|
+
/* @__PURE__ */ jsx133(
|
|
36209
|
+
Button60,
|
|
35271
36210
|
{
|
|
35272
36211
|
type: "primary",
|
|
35273
|
-
icon: /* @__PURE__ */
|
|
36212
|
+
icon: /* @__PURE__ */ jsx133(SaveOutlined2, {}),
|
|
35274
36213
|
onClick: handleSave,
|
|
35275
36214
|
loading,
|
|
35276
36215
|
children: "Save Configuration"
|
|
@@ -35278,9 +36217,9 @@ QUEUE_NAME=tasks`,
|
|
|
35278
36217
|
)
|
|
35279
36218
|
] })
|
|
35280
36219
|
] }),
|
|
35281
|
-
/* @__PURE__ */
|
|
36220
|
+
/* @__PURE__ */ jsx133("div", { className: styles.contentBody, children: renderContent(connection.id) })
|
|
35282
36221
|
] })
|
|
35283
|
-
] }) }) : /* @__PURE__ */
|
|
36222
|
+
] }) }) : /* @__PURE__ */ jsx133(
|
|
35284
36223
|
"div",
|
|
35285
36224
|
{
|
|
35286
36225
|
style: {
|
|
@@ -35292,29 +36231,29 @@ QUEUE_NAME=tasks`,
|
|
|
35292
36231
|
gap: 16,
|
|
35293
36232
|
padding: 48
|
|
35294
36233
|
},
|
|
35295
|
-
children: connection.connecting ? /* @__PURE__ */
|
|
35296
|
-
/* @__PURE__ */
|
|
35297
|
-
/* @__PURE__ */
|
|
35298
|
-
/* @__PURE__ */
|
|
36234
|
+
children: connection.connecting ? /* @__PURE__ */ jsxs96(Fragment31, { children: [
|
|
36235
|
+
/* @__PURE__ */ jsx133(LinkOutlined2, { style: { fontSize: 64, color: "#1890ff" }, spin: true }),
|
|
36236
|
+
/* @__PURE__ */ jsx133(Title17, { level: 4, children: "Connecting..." }),
|
|
36237
|
+
/* @__PURE__ */ jsxs96(Text50, { type: "secondary", style: { textAlign: "center" }, children: [
|
|
35299
36238
|
"Connecting to ",
|
|
35300
36239
|
connection.url
|
|
35301
36240
|
] })
|
|
35302
|
-
] }) : /* @__PURE__ */
|
|
35303
|
-
/* @__PURE__ */
|
|
35304
|
-
/* @__PURE__ */
|
|
35305
|
-
/* @__PURE__ */
|
|
35306
|
-
|
|
36241
|
+
] }) : /* @__PURE__ */ jsxs96(Fragment31, { children: [
|
|
36242
|
+
/* @__PURE__ */ jsx133(LinkOutlined2, { style: { fontSize: 64, color: "#d9d9d9" } }),
|
|
36243
|
+
/* @__PURE__ */ jsx133(Title17, { level: 4, type: "secondary", children: connection.error || "Not Connected" }),
|
|
36244
|
+
/* @__PURE__ */ jsx133(
|
|
36245
|
+
Text50,
|
|
35307
36246
|
{
|
|
35308
36247
|
type: "secondary",
|
|
35309
36248
|
style: { textAlign: "center", maxWidth: 400 },
|
|
35310
36249
|
children: connection.error ? `Failed to connect to ${connection.url}. Please check the server URL and try again.` : `Click "Reconnect" to connect to ${connection.url}`
|
|
35311
36250
|
}
|
|
35312
36251
|
),
|
|
35313
|
-
/* @__PURE__ */
|
|
35314
|
-
|
|
36252
|
+
/* @__PURE__ */ jsx133(
|
|
36253
|
+
Button60,
|
|
35315
36254
|
{
|
|
35316
36255
|
type: "primary",
|
|
35317
|
-
icon: /* @__PURE__ */
|
|
36256
|
+
icon: /* @__PURE__ */ jsx133(LinkOutlined2, {}),
|
|
35318
36257
|
onClick: () => checkConnection(connection.id),
|
|
35319
36258
|
loading: connection.connecting,
|
|
35320
36259
|
style: { marginTop: 16 },
|
|
@@ -35326,9 +36265,9 @@ QUEUE_NAME=tasks`,
|
|
|
35326
36265
|
) }),
|
|
35327
36266
|
closable: connections.length > 1
|
|
35328
36267
|
}));
|
|
35329
|
-
return /* @__PURE__ */
|
|
35330
|
-
/* @__PURE__ */
|
|
35331
|
-
|
|
36268
|
+
return /* @__PURE__ */ jsxs96(Fragment31, { children: [
|
|
36269
|
+
/* @__PURE__ */ jsx133(
|
|
36270
|
+
Modal25,
|
|
35332
36271
|
{
|
|
35333
36272
|
open,
|
|
35334
36273
|
onCancel: onClose,
|
|
@@ -35336,7 +36275,7 @@ QUEUE_NAME=tasks`,
|
|
|
35336
36275
|
width: "80%",
|
|
35337
36276
|
footer: null,
|
|
35338
36277
|
title: "Settings",
|
|
35339
|
-
children: /* @__PURE__ */
|
|
36278
|
+
children: /* @__PURE__ */ jsx133("div", { children: /* @__PURE__ */ jsx133(
|
|
35340
36279
|
Tabs4,
|
|
35341
36280
|
{
|
|
35342
36281
|
activeKey: activeTabKey,
|
|
@@ -35350,7 +36289,7 @@ QUEUE_NAME=tasks`,
|
|
|
35350
36289
|
}
|
|
35351
36290
|
},
|
|
35352
36291
|
items: tabItems,
|
|
35353
|
-
addIcon: /* @__PURE__ */
|
|
36292
|
+
addIcon: /* @__PURE__ */ jsxs96(
|
|
35354
36293
|
"div",
|
|
35355
36294
|
{
|
|
35356
36295
|
style: {
|
|
@@ -35360,8 +36299,8 @@ QUEUE_NAME=tasks`,
|
|
|
35360
36299
|
padding: "4px 8px"
|
|
35361
36300
|
},
|
|
35362
36301
|
children: [
|
|
35363
|
-
/* @__PURE__ */
|
|
35364
|
-
/* @__PURE__ */
|
|
36302
|
+
/* @__PURE__ */ jsx133(PlusOutlined9, {}),
|
|
36303
|
+
/* @__PURE__ */ jsx133("span", { children: "Add Server" })
|
|
35365
36304
|
]
|
|
35366
36305
|
}
|
|
35367
36306
|
)
|
|
@@ -35369,8 +36308,8 @@ QUEUE_NAME=tasks`,
|
|
|
35369
36308
|
) })
|
|
35370
36309
|
}
|
|
35371
36310
|
),
|
|
35372
|
-
/* @__PURE__ */
|
|
35373
|
-
|
|
36311
|
+
/* @__PURE__ */ jsx133(
|
|
36312
|
+
Modal25,
|
|
35374
36313
|
{
|
|
35375
36314
|
title: "Add New Server",
|
|
35376
36315
|
open: showAddServerModal,
|
|
@@ -35383,11 +36322,11 @@ QUEUE_NAME=tasks`,
|
|
|
35383
36322
|
},
|
|
35384
36323
|
confirmLoading: addingServer,
|
|
35385
36324
|
className: styles.addServerModal,
|
|
35386
|
-
children: /* @__PURE__ */
|
|
35387
|
-
/* @__PURE__ */
|
|
35388
|
-
/* @__PURE__ */
|
|
35389
|
-
/* @__PURE__ */
|
|
35390
|
-
|
|
36325
|
+
children: /* @__PURE__ */ jsxs96(Space39, { direction: "vertical", style: { width: "100%" }, size: "large", children: [
|
|
36326
|
+
/* @__PURE__ */ jsxs96("div", { children: [
|
|
36327
|
+
/* @__PURE__ */ jsx133(Text50, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server Name" }),
|
|
36328
|
+
/* @__PURE__ */ jsx133(
|
|
36329
|
+
Input20,
|
|
35391
36330
|
{
|
|
35392
36331
|
placeholder: "e.g., Production Server",
|
|
35393
36332
|
value: newServerName,
|
|
@@ -35395,12 +36334,12 @@ QUEUE_NAME=tasks`,
|
|
|
35395
36334
|
onPressEnter: handleAddServer
|
|
35396
36335
|
}
|
|
35397
36336
|
),
|
|
35398
|
-
/* @__PURE__ */
|
|
36337
|
+
/* @__PURE__ */ jsx133(Text50, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: Leave empty to use URL as name" })
|
|
35399
36338
|
] }),
|
|
35400
|
-
/* @__PURE__ */
|
|
35401
|
-
/* @__PURE__ */
|
|
35402
|
-
/* @__PURE__ */
|
|
35403
|
-
|
|
36339
|
+
/* @__PURE__ */ jsxs96("div", { children: [
|
|
36340
|
+
/* @__PURE__ */ jsx133(Text50, { strong: true, style: { display: "block", marginBottom: 8 }, children: "Server URL *" }),
|
|
36341
|
+
/* @__PURE__ */ jsx133(
|
|
36342
|
+
Input20,
|
|
35404
36343
|
{
|
|
35405
36344
|
placeholder: "e.g., http://localhost:4001",
|
|
35406
36345
|
value: newServerUrl,
|
|
@@ -35408,12 +36347,12 @@ QUEUE_NAME=tasks`,
|
|
|
35408
36347
|
onPressEnter: handleAddServer
|
|
35409
36348
|
}
|
|
35410
36349
|
),
|
|
35411
|
-
/* @__PURE__ */
|
|
36350
|
+
/* @__PURE__ */ jsx133(Text50, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Enter the full URL of the gateway server" })
|
|
35412
36351
|
] }),
|
|
35413
|
-
/* @__PURE__ */
|
|
35414
|
-
/* @__PURE__ */
|
|
35415
|
-
/* @__PURE__ */
|
|
35416
|
-
|
|
36352
|
+
/* @__PURE__ */ jsxs96("div", { children: [
|
|
36353
|
+
/* @__PURE__ */ jsx133(Text50, { strong: true, style: { display: "block", marginBottom: 8 }, children: "API Key" }),
|
|
36354
|
+
/* @__PURE__ */ jsx133(
|
|
36355
|
+
Input20.Password,
|
|
35417
36356
|
{
|
|
35418
36357
|
placeholder: "Optional: Enter API key for authentication",
|
|
35419
36358
|
value: newServerApiKey,
|
|
@@ -35421,7 +36360,7 @@ QUEUE_NAME=tasks`,
|
|
|
35421
36360
|
onPressEnter: handleAddServer
|
|
35422
36361
|
}
|
|
35423
36362
|
),
|
|
35424
|
-
/* @__PURE__ */
|
|
36363
|
+
/* @__PURE__ */ jsx133(Text50, { type: "secondary", style: { fontSize: 12, marginTop: 4 }, children: "Optional: API key for server authentication" })
|
|
35425
36364
|
] })
|
|
35426
36365
|
] })
|
|
35427
36366
|
}
|
|
@@ -35430,10 +36369,10 @@ QUEUE_NAME=tasks`,
|
|
|
35430
36369
|
};
|
|
35431
36370
|
|
|
35432
36371
|
// src/components/Chat/AgentServerSetting.tsx
|
|
35433
|
-
import { jsx as
|
|
36372
|
+
import { jsx as jsx134 } from "react/jsx-runtime";
|
|
35434
36373
|
var AgentServerSetting = () => {
|
|
35435
36374
|
const { settingsModalOpen, setSettingsModalOpen } = useLatticeChatShellContext();
|
|
35436
|
-
return /* @__PURE__ */
|
|
36375
|
+
return /* @__PURE__ */ jsx134(
|
|
35437
36376
|
SettingsModal,
|
|
35438
36377
|
{
|
|
35439
36378
|
open: settingsModalOpen,
|
|
@@ -35443,24 +36382,24 @@ var AgentServerSetting = () => {
|
|
|
35443
36382
|
};
|
|
35444
36383
|
|
|
35445
36384
|
// src/components/Chat/LatticeChatShell.tsx
|
|
35446
|
-
import { Fragment as
|
|
36385
|
+
import { Fragment as Fragment32, jsx as jsx135, jsxs as jsxs97 } from "react/jsx-runtime";
|
|
35447
36386
|
var ShellContent = ({
|
|
35448
36387
|
initialAssistantId,
|
|
35449
36388
|
enableWorkspace
|
|
35450
36389
|
}) => {
|
|
35451
36390
|
const { currentTenant } = useAuth();
|
|
35452
|
-
return /* @__PURE__ */
|
|
35453
|
-
/* @__PURE__ */
|
|
35454
|
-
/* @__PURE__ */
|
|
35455
|
-
] }) : /* @__PURE__ */
|
|
35456
|
-
/* @__PURE__ */
|
|
35457
|
-
/* @__PURE__ */
|
|
36391
|
+
return /* @__PURE__ */ jsx135(Fragment32, { children: enableWorkspace ? /* @__PURE__ */ jsxs97(WorkspaceContextProvider, { children: [
|
|
36392
|
+
/* @__PURE__ */ jsx135(AssistantContextProvider, { autoLoad: true, initialAssistantId, children: /* @__PURE__ */ jsx135(ConversationContextProvider, { children: /* @__PURE__ */ jsx135(LatticeChatView, {}) }) }),
|
|
36393
|
+
/* @__PURE__ */ jsx135(AgentServerSetting, {})
|
|
36394
|
+
] }) : /* @__PURE__ */ jsxs97(Fragment32, { children: [
|
|
36395
|
+
/* @__PURE__ */ jsx135(AssistantContextProvider, { autoLoad: true, initialAssistantId, children: /* @__PURE__ */ jsx135(ConversationContextProvider, { children: /* @__PURE__ */ jsx135(LatticeChatView, {}) }) }),
|
|
36396
|
+
/* @__PURE__ */ jsx135(AgentServerSetting, {})
|
|
35458
36397
|
] }) });
|
|
35459
36398
|
};
|
|
35460
36399
|
var LatticeChatShell = (props) => {
|
|
35461
36400
|
const { enableAssistantCreation, enableAssistantEditing, enableWorkspace: enableWorkspaceProp, ...restProps } = props;
|
|
35462
36401
|
const enableWorkspace = enableWorkspaceProp ?? restProps.initialConfig?.enableWorkspace ?? false;
|
|
35463
|
-
return /* @__PURE__ */
|
|
36402
|
+
return /* @__PURE__ */ jsx135(
|
|
35464
36403
|
LatticeChatShellContextProvider,
|
|
35465
36404
|
{
|
|
35466
36405
|
initialConfig: {
|
|
@@ -35469,7 +36408,7 @@ var LatticeChatShell = (props) => {
|
|
|
35469
36408
|
enableWorkspace,
|
|
35470
36409
|
...restProps.initialConfig
|
|
35471
36410
|
},
|
|
35472
|
-
children: /* @__PURE__ */
|
|
36411
|
+
children: /* @__PURE__ */ jsx135(
|
|
35473
36412
|
ShellContent,
|
|
35474
36413
|
{
|
|
35475
36414
|
initialAssistantId: restProps.initialConfig?.assistantId,
|
|
@@ -35481,28 +36420,28 @@ var LatticeChatShell = (props) => {
|
|
|
35481
36420
|
};
|
|
35482
36421
|
|
|
35483
36422
|
// src/components/Chat/ChannelInstallationsDrawerContent.tsx
|
|
35484
|
-
import { useEffect as
|
|
36423
|
+
import { useEffect as useEffect58, useState as useState84 } from "react";
|
|
35485
36424
|
import {
|
|
35486
|
-
Button as
|
|
36425
|
+
Button as Button61,
|
|
35487
36426
|
Card as Card30,
|
|
35488
|
-
Form as
|
|
35489
|
-
Input as
|
|
35490
|
-
Modal as
|
|
35491
|
-
Popconfirm as
|
|
35492
|
-
Spin as
|
|
36427
|
+
Form as Form10,
|
|
36428
|
+
Input as Input21,
|
|
36429
|
+
Modal as Modal26,
|
|
36430
|
+
Popconfirm as Popconfirm13,
|
|
36431
|
+
Spin as Spin24,
|
|
35493
36432
|
Tag as Tag30,
|
|
35494
|
-
Typography as
|
|
35495
|
-
message as
|
|
36433
|
+
Typography as Typography62,
|
|
36434
|
+
message as message25
|
|
35496
36435
|
} from "antd";
|
|
35497
|
-
import { Edit2 as Edit24, Plus as
|
|
35498
|
-
import { jsx as
|
|
35499
|
-
var { Text:
|
|
36436
|
+
import { Edit2 as Edit24, Plus as Plus10, RadioTower, Trash2 as Trash211 } from "lucide-react";
|
|
36437
|
+
import { jsx as jsx136, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
36438
|
+
var { Text: Text51, Title: Title18 } = Typography62;
|
|
35500
36439
|
var ChannelInstallationsDrawerContent = () => {
|
|
35501
36440
|
const { get, post, put, del } = useApi();
|
|
35502
|
-
const [installations, setInstallations] =
|
|
35503
|
-
const [loading, setLoading] =
|
|
35504
|
-
const [formModalOpen, setFormModalOpen] =
|
|
35505
|
-
const [editingInstallation, setEditingInstallation] =
|
|
36441
|
+
const [installations, setInstallations] = useState84([]);
|
|
36442
|
+
const [loading, setLoading] = useState84(false);
|
|
36443
|
+
const [formModalOpen, setFormModalOpen] = useState84(false);
|
|
36444
|
+
const [editingInstallation, setEditingInstallation] = useState84(null);
|
|
35506
36445
|
const loadInstallations = async () => {
|
|
35507
36446
|
setLoading(true);
|
|
35508
36447
|
try {
|
|
@@ -35513,17 +36452,17 @@ var ChannelInstallationsDrawerContent = () => {
|
|
|
35513
36452
|
setInstallations(result.data?.records ?? []);
|
|
35514
36453
|
} else {
|
|
35515
36454
|
setInstallations([]);
|
|
35516
|
-
|
|
36455
|
+
message25.error(result.message || "Failed to load channel installations");
|
|
35517
36456
|
}
|
|
35518
36457
|
} catch (error) {
|
|
35519
36458
|
console.error("Failed to load channel installations:", error);
|
|
35520
36459
|
setInstallations([]);
|
|
35521
|
-
|
|
36460
|
+
message25.error("Failed to load channel installations");
|
|
35522
36461
|
} finally {
|
|
35523
36462
|
setLoading(false);
|
|
35524
36463
|
}
|
|
35525
36464
|
};
|
|
35526
|
-
|
|
36465
|
+
useEffect58(() => {
|
|
35527
36466
|
loadInstallations();
|
|
35528
36467
|
}, []);
|
|
35529
36468
|
const handleDelete = async (installation) => {
|
|
@@ -35535,17 +36474,17 @@ var ChannelInstallationsDrawerContent = () => {
|
|
|
35535
36474
|
setInstallations(
|
|
35536
36475
|
(current) => current.filter((item) => item.id !== installation.id)
|
|
35537
36476
|
);
|
|
35538
|
-
|
|
36477
|
+
message25.success("Installation deleted");
|
|
35539
36478
|
} else {
|
|
35540
|
-
|
|
36479
|
+
message25.error(result.message || "Failed to delete installation");
|
|
35541
36480
|
}
|
|
35542
36481
|
} catch (error) {
|
|
35543
36482
|
console.error("Failed to delete channel installation:", error);
|
|
35544
|
-
|
|
36483
|
+
message25.error("Failed to delete installation");
|
|
35545
36484
|
}
|
|
35546
36485
|
};
|
|
35547
|
-
return /* @__PURE__ */
|
|
35548
|
-
/* @__PURE__ */
|
|
36486
|
+
return /* @__PURE__ */ jsxs98("div", { style: { height: "100%", display: "flex", flexDirection: "column" }, children: [
|
|
36487
|
+
/* @__PURE__ */ jsx136("div", { style: { padding: 16 }, children: /* @__PURE__ */ jsxs98(
|
|
35549
36488
|
"div",
|
|
35550
36489
|
{
|
|
35551
36490
|
style: {
|
|
@@ -35554,12 +36493,12 @@ var ChannelInstallationsDrawerContent = () => {
|
|
|
35554
36493
|
alignItems: "center"
|
|
35555
36494
|
},
|
|
35556
36495
|
children: [
|
|
35557
|
-
/* @__PURE__ */
|
|
35558
|
-
/* @__PURE__ */
|
|
35559
|
-
|
|
36496
|
+
/* @__PURE__ */ jsx136(Title18, { level: 5, style: { margin: 0 }, children: "Channel Installations" }),
|
|
36497
|
+
/* @__PURE__ */ jsx136(
|
|
36498
|
+
Button61,
|
|
35560
36499
|
{
|
|
35561
36500
|
type: "primary",
|
|
35562
|
-
icon: /* @__PURE__ */
|
|
36501
|
+
icon: /* @__PURE__ */ jsx136(Plus10, { size: 16 }),
|
|
35563
36502
|
onClick: () => {
|
|
35564
36503
|
setEditingInstallation(null);
|
|
35565
36504
|
setFormModalOpen(true);
|
|
@@ -35570,7 +36509,7 @@ var ChannelInstallationsDrawerContent = () => {
|
|
|
35570
36509
|
]
|
|
35571
36510
|
}
|
|
35572
36511
|
) }),
|
|
35573
|
-
/* @__PURE__ */
|
|
36512
|
+
/* @__PURE__ */ jsx136("div", { style: { flex: 1, overflowY: "auto", padding: 16 }, children: loading ? /* @__PURE__ */ jsx136("div", { style: { display: "flex", justifyContent: "center", padding: 32 }, children: /* @__PURE__ */ jsx136(Spin24, {}) }) : installations.length === 0 ? /* @__PURE__ */ jsxs98(
|
|
35574
36513
|
"div",
|
|
35575
36514
|
{
|
|
35576
36515
|
style: {
|
|
@@ -35581,15 +36520,15 @@ var ChannelInstallationsDrawerContent = () => {
|
|
|
35581
36520
|
padding: "48px 16px"
|
|
35582
36521
|
},
|
|
35583
36522
|
children: [
|
|
35584
|
-
/* @__PURE__ */
|
|
35585
|
-
/* @__PURE__ */
|
|
35586
|
-
/* @__PURE__ */
|
|
36523
|
+
/* @__PURE__ */ jsx136(RadioTower, { size: 48, style: { marginBottom: 16, opacity: 0.5 } }),
|
|
36524
|
+
/* @__PURE__ */ jsx136(Text51, { strong: true, style: { fontSize: 15 }, children: "No channel installations" }),
|
|
36525
|
+
/* @__PURE__ */ jsx136(Text51, { type: "secondary", style: { marginTop: 8 }, children: 'Click "Add Installation" to create one' })
|
|
35587
36526
|
]
|
|
35588
36527
|
}
|
|
35589
|
-
) : /* @__PURE__ */
|
|
36528
|
+
) : /* @__PURE__ */ jsx136("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: installations.map((installation) => {
|
|
35590
36529
|
const webhookPath = installation.channel === "lark" ? `/api/channels/lark/installations/${installation.id}/events` : null;
|
|
35591
|
-
return /* @__PURE__ */
|
|
35592
|
-
/* @__PURE__ */
|
|
36530
|
+
return /* @__PURE__ */ jsxs98(Card30, { size: "small", children: [
|
|
36531
|
+
/* @__PURE__ */ jsxs98(
|
|
35593
36532
|
"div",
|
|
35594
36533
|
{
|
|
35595
36534
|
style: {
|
|
@@ -35599,12 +36538,12 @@ var ChannelInstallationsDrawerContent = () => {
|
|
|
35599
36538
|
marginBottom: 10
|
|
35600
36539
|
},
|
|
35601
36540
|
children: [
|
|
35602
|
-
/* @__PURE__ */
|
|
35603
|
-
/* @__PURE__ */
|
|
36541
|
+
/* @__PURE__ */ jsx136(Text51, { strong: true, style: { fontSize: 15 }, children: installation.name || installation.id }),
|
|
36542
|
+
/* @__PURE__ */ jsx136(Tag30, { color: "blue", children: installation.channel })
|
|
35604
36543
|
]
|
|
35605
36544
|
}
|
|
35606
36545
|
),
|
|
35607
|
-
/* @__PURE__ */
|
|
36546
|
+
/* @__PURE__ */ jsxs98(
|
|
35608
36547
|
"div",
|
|
35609
36548
|
{
|
|
35610
36549
|
style: {
|
|
@@ -35614,19 +36553,19 @@ var ChannelInstallationsDrawerContent = () => {
|
|
|
35614
36553
|
marginBottom: 12
|
|
35615
36554
|
},
|
|
35616
36555
|
children: [
|
|
35617
|
-
/* @__PURE__ */
|
|
36556
|
+
/* @__PURE__ */ jsxs98(Text51, { type: "secondary", style: { fontSize: 12 }, children: [
|
|
35618
36557
|
"ID: ",
|
|
35619
36558
|
installation.id
|
|
35620
36559
|
] }),
|
|
35621
|
-
webhookPath ? /* @__PURE__ */
|
|
36560
|
+
webhookPath ? /* @__PURE__ */ jsx136(Text51, { code: true, style: { fontSize: 12 }, children: webhookPath }) : /* @__PURE__ */ jsx136(Text51, { type: "secondary", style: { fontSize: 12 }, children: "Unsupported channel configuration UI" })
|
|
35622
36561
|
]
|
|
35623
36562
|
}
|
|
35624
36563
|
),
|
|
35625
|
-
/* @__PURE__ */
|
|
35626
|
-
/* @__PURE__ */
|
|
35627
|
-
|
|
36564
|
+
/* @__PURE__ */ jsxs98("div", { style: { display: "flex", gap: 8 }, children: [
|
|
36565
|
+
/* @__PURE__ */ jsx136(
|
|
36566
|
+
Button61,
|
|
35628
36567
|
{
|
|
35629
|
-
icon: /* @__PURE__ */
|
|
36568
|
+
icon: /* @__PURE__ */ jsx136(Edit24, { size: 14 }),
|
|
35630
36569
|
onClick: () => {
|
|
35631
36570
|
setEditingInstallation(installation);
|
|
35632
36571
|
setFormModalOpen(true);
|
|
@@ -35634,8 +36573,8 @@ var ChannelInstallationsDrawerContent = () => {
|
|
|
35634
36573
|
children: "Edit"
|
|
35635
36574
|
}
|
|
35636
36575
|
),
|
|
35637
|
-
/* @__PURE__ */
|
|
35638
|
-
|
|
36576
|
+
/* @__PURE__ */ jsx136(
|
|
36577
|
+
Popconfirm13,
|
|
35639
36578
|
{
|
|
35640
36579
|
title: "Delete Channel Installation",
|
|
35641
36580
|
description: `Are you sure you want to delete "${installation.name || installation.id}"?`,
|
|
@@ -35643,13 +36582,13 @@ var ChannelInstallationsDrawerContent = () => {
|
|
|
35643
36582
|
okText: "Delete",
|
|
35644
36583
|
okType: "danger",
|
|
35645
36584
|
cancelText: "Cancel",
|
|
35646
|
-
children: /* @__PURE__ */
|
|
36585
|
+
children: /* @__PURE__ */ jsx136(Button61, { danger: true, icon: /* @__PURE__ */ jsx136(Trash211, { size: 14 }), children: "Delete" })
|
|
35647
36586
|
}
|
|
35648
36587
|
)
|
|
35649
36588
|
] })
|
|
35650
36589
|
] }, installation.id);
|
|
35651
36590
|
}) }) }),
|
|
35652
|
-
formModalOpen ? /* @__PURE__ */
|
|
36591
|
+
formModalOpen ? /* @__PURE__ */ jsx136(
|
|
35653
36592
|
LarkChannelInstallationFormModal,
|
|
35654
36593
|
{
|
|
35655
36594
|
installation: editingInstallation,
|
|
@@ -35670,8 +36609,8 @@ var ChannelInstallationsDrawerContent = () => {
|
|
|
35670
36609
|
] });
|
|
35671
36610
|
};
|
|
35672
36611
|
var LarkChannelInstallationFormModal = ({ installation, open, post, put, onCancel, onSave }) => {
|
|
35673
|
-
const [form] =
|
|
35674
|
-
|
|
36612
|
+
const [form] = Form10.useForm();
|
|
36613
|
+
useEffect58(() => {
|
|
35675
36614
|
if (installation) {
|
|
35676
36615
|
const config = installation.config;
|
|
35677
36616
|
form.setFieldsValue({
|
|
@@ -35704,10 +36643,10 @@ var LarkChannelInstallationFormModal = ({ installation, open, post, put, onCance
|
|
|
35704
36643
|
payload2
|
|
35705
36644
|
);
|
|
35706
36645
|
if (result2.success) {
|
|
35707
|
-
|
|
36646
|
+
message25.success("Installation updated");
|
|
35708
36647
|
onSave();
|
|
35709
36648
|
} else {
|
|
35710
|
-
|
|
36649
|
+
message25.error(result2.message || "Failed to update installation");
|
|
35711
36650
|
}
|
|
35712
36651
|
return;
|
|
35713
36652
|
}
|
|
@@ -35721,20 +36660,20 @@ var LarkChannelInstallationFormModal = ({ installation, open, post, put, onCance
|
|
|
35721
36660
|
payload
|
|
35722
36661
|
);
|
|
35723
36662
|
if (result.success) {
|
|
35724
|
-
|
|
36663
|
+
message25.success("Installation created");
|
|
35725
36664
|
onSave();
|
|
35726
36665
|
} else {
|
|
35727
|
-
|
|
36666
|
+
message25.error(result.message || "Failed to create installation");
|
|
35728
36667
|
}
|
|
35729
36668
|
} catch (error) {
|
|
35730
36669
|
console.error("Failed to save channel installation:", error);
|
|
35731
|
-
|
|
36670
|
+
message25.error(
|
|
35732
36671
|
installation ? "Failed to update installation" : "Failed to create installation"
|
|
35733
36672
|
);
|
|
35734
36673
|
}
|
|
35735
36674
|
};
|
|
35736
|
-
return /* @__PURE__ */
|
|
35737
|
-
|
|
36675
|
+
return /* @__PURE__ */ jsx136(
|
|
36676
|
+
Modal26,
|
|
35738
36677
|
{
|
|
35739
36678
|
open,
|
|
35740
36679
|
title: installation ? "Edit Installation" : "Add Installation",
|
|
@@ -35742,29 +36681,29 @@ var LarkChannelInstallationFormModal = ({ installation, open, post, put, onCance
|
|
|
35742
36681
|
onOk: handleSubmit,
|
|
35743
36682
|
okText: installation ? "Save" : "Create",
|
|
35744
36683
|
destroyOnHidden: true,
|
|
35745
|
-
children: /* @__PURE__ */
|
|
35746
|
-
/* @__PURE__ */
|
|
35747
|
-
/* @__PURE__ */
|
|
35748
|
-
/* @__PURE__ */
|
|
35749
|
-
|
|
36684
|
+
children: /* @__PURE__ */ jsxs98(Form10, { form, layout: "vertical", children: [
|
|
36685
|
+
/* @__PURE__ */ jsx136(Form10.Item, { label: "Channel", children: /* @__PURE__ */ jsx136(Input21, { value: "lark", disabled: true }) }),
|
|
36686
|
+
/* @__PURE__ */ jsx136(Form10.Item, { name: "name", label: "Name", children: /* @__PURE__ */ jsx136(Input21, {}) }),
|
|
36687
|
+
/* @__PURE__ */ jsx136(
|
|
36688
|
+
Form10.Item,
|
|
35750
36689
|
{
|
|
35751
36690
|
name: "appId",
|
|
35752
36691
|
label: "App ID",
|
|
35753
36692
|
rules: [{ required: true, message: "App ID is required" }],
|
|
35754
|
-
children: /* @__PURE__ */
|
|
36693
|
+
children: /* @__PURE__ */ jsx136(Input21, {})
|
|
35755
36694
|
}
|
|
35756
36695
|
),
|
|
35757
|
-
/* @__PURE__ */
|
|
35758
|
-
|
|
36696
|
+
/* @__PURE__ */ jsx136(
|
|
36697
|
+
Form10.Item,
|
|
35759
36698
|
{
|
|
35760
36699
|
name: "appSecret",
|
|
35761
36700
|
label: "App Secret",
|
|
35762
36701
|
rules: [{ required: true, message: "App Secret is required" }],
|
|
35763
|
-
children: /* @__PURE__ */
|
|
36702
|
+
children: /* @__PURE__ */ jsx136(Input21, {})
|
|
35764
36703
|
}
|
|
35765
36704
|
),
|
|
35766
|
-
/* @__PURE__ */
|
|
35767
|
-
/* @__PURE__ */
|
|
36705
|
+
/* @__PURE__ */ jsx136(Form10.Item, { name: "verificationToken", label: "Verification Token", children: /* @__PURE__ */ jsx136(Input21, {}) }),
|
|
36706
|
+
/* @__PURE__ */ jsx136(Form10.Item, { name: "encryptKey", label: "Encrypt Key", children: /* @__PURE__ */ jsx136(Input21, {}) })
|
|
35768
36707
|
] })
|
|
35769
36708
|
}
|
|
35770
36709
|
);
|
|
@@ -35808,6 +36747,7 @@ export {
|
|
|
35808
36747
|
MDViewFormItem,
|
|
35809
36748
|
MetricsConfigDrawerContent,
|
|
35810
36749
|
ModelSelector,
|
|
36750
|
+
PersonalAssistantChannelModal,
|
|
35811
36751
|
PersonalAssistantPage,
|
|
35812
36752
|
ProtectedRoute,
|
|
35813
36753
|
RegisterForm,
|