@axiom-lattice/react-sdk 2.1.91 → 2.1.93
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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +85 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +180 -139
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/hooks/useChat.ts
|
|
2
|
-
import { useState as useState3, useCallback as useCallback3, useEffect as useEffect3, useRef as
|
|
2
|
+
import { useState as useState3, useCallback as useCallback3, useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
3
3
|
import { v4 as uuidv4 } from "uuid";
|
|
4
4
|
|
|
5
5
|
// src/context.tsx
|
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
useContext as useContext2,
|
|
10
10
|
useEffect as useEffect2,
|
|
11
11
|
useMemo,
|
|
12
|
-
useRef
|
|
12
|
+
useRef as useRef2
|
|
13
13
|
} from "react";
|
|
14
14
|
import { Client } from "@axiom-lattice/client-sdk";
|
|
15
15
|
|
|
16
16
|
// src/context/AuthContext.tsx
|
|
17
|
-
import { createContext, useContext, useState, useCallback, useEffect } from "react";
|
|
17
|
+
import { createContext, useContext, useState, useCallback, useEffect, useRef } from "react";
|
|
18
18
|
import { jsx } from "react/jsx-runtime";
|
|
19
19
|
var AuthContext = createContext(null);
|
|
20
20
|
var useAuth = () => {
|
|
@@ -41,18 +41,24 @@ var AuthProvider = ({
|
|
|
41
41
|
const [personalAssistant, setPersonalAssistant] = useState(null);
|
|
42
42
|
const [isLoading, setIsLoading] = useState(false);
|
|
43
43
|
const [error, setError] = useState(null);
|
|
44
|
+
const getPAKey = (tenantId) => tenantId ? `lattice_personal_assistant_${tenantId}` : "lattice_personal_assistant";
|
|
45
|
+
const currentTenantRef = useRef(currentTenant);
|
|
46
|
+
currentTenantRef.current = currentTenant;
|
|
44
47
|
useEffect(() => {
|
|
45
48
|
const storedUser = sessionStorage.getItem("lattice_user");
|
|
46
49
|
const storedTenants = sessionStorage.getItem("lattice_tenants");
|
|
47
50
|
const storedCurrentTenant = sessionStorage.getItem("lattice_current_tenant");
|
|
48
|
-
const storedPA = sessionStorage.getItem("lattice_personal_assistant");
|
|
49
51
|
if (storedUser) {
|
|
50
52
|
try {
|
|
51
53
|
const userData = JSON.parse(storedUser);
|
|
52
54
|
setUser(userData);
|
|
53
55
|
if (storedTenants) setTenants(JSON.parse(storedTenants));
|
|
54
|
-
if (storedCurrentTenant)
|
|
55
|
-
|
|
56
|
+
if (storedCurrentTenant) {
|
|
57
|
+
const ct = JSON.parse(storedCurrentTenant);
|
|
58
|
+
setCurrentTenant(ct);
|
|
59
|
+
const storedPA = sessionStorage.getItem(getPAKey(ct.id));
|
|
60
|
+
if (storedPA) setPersonalAssistant(JSON.parse(storedPA));
|
|
61
|
+
}
|
|
56
62
|
} catch {
|
|
57
63
|
sessionStorage.removeItem("lattice_user");
|
|
58
64
|
sessionStorage.removeItem("lattice_tenants");
|
|
@@ -158,13 +164,18 @@ var AuthProvider = ({
|
|
|
158
164
|
}
|
|
159
165
|
const result = await response.json();
|
|
160
166
|
const tenantData = result.data.tenant;
|
|
167
|
+
const oldTenantId = currentTenantRef.current?.id;
|
|
168
|
+
if (oldTenantId) {
|
|
169
|
+
sessionStorage.removeItem(getPAKey(oldTenantId));
|
|
170
|
+
}
|
|
161
171
|
setCurrentTenant(tenantData);
|
|
162
172
|
sessionStorage.setItem("lattice_current_tenant", JSON.stringify(tenantData));
|
|
163
173
|
setPersonalAssistant(result.data.personalAssistant || null);
|
|
164
174
|
if (result.data.personalAssistant) {
|
|
165
|
-
|
|
175
|
+
const paWithTenant = { ...result.data.personalAssistant, tenantId: tenantData.id };
|
|
176
|
+
sessionStorage.setItem(getPAKey(tenantData.id), JSON.stringify(paWithTenant));
|
|
166
177
|
} else {
|
|
167
|
-
sessionStorage.removeItem(
|
|
178
|
+
sessionStorage.removeItem(getPAKey(tenantData.id));
|
|
168
179
|
}
|
|
169
180
|
if (result.data.token) {
|
|
170
181
|
sessionStorage.setItem("lattice_token", result.data.token);
|
|
@@ -288,9 +299,14 @@ var AuthProvider = ({
|
|
|
288
299
|
}, [baseURL]);
|
|
289
300
|
const wrappedSetPersonalAssistant = useCallback((info) => {
|
|
290
301
|
setPersonalAssistant(info);
|
|
302
|
+
const tenantId = currentTenantRef.current?.id;
|
|
291
303
|
if (info) {
|
|
292
|
-
|
|
304
|
+
const paWithTenant = { ...info, tenantId: tenantId || info.tenantId };
|
|
305
|
+
sessionStorage.setItem(getPAKey(tenantId), JSON.stringify(paWithTenant));
|
|
293
306
|
} else {
|
|
307
|
+
if (tenantId) {
|
|
308
|
+
sessionStorage.removeItem(getPAKey(tenantId));
|
|
309
|
+
}
|
|
294
310
|
sessionStorage.removeItem("lattice_personal_assistant");
|
|
295
311
|
}
|
|
296
312
|
}, []);
|
|
@@ -335,7 +351,7 @@ function AxiomLatticeProvider({
|
|
|
335
351
|
}
|
|
336
352
|
return config.apiKey;
|
|
337
353
|
}, [authContext?.isAuthenticated, authContext?.currentTenant?.id, config.apiKey]);
|
|
338
|
-
const clientCacheRef =
|
|
354
|
+
const clientCacheRef = useRef2(/* @__PURE__ */ new Map());
|
|
339
355
|
const baseConfig = useMemo(
|
|
340
356
|
() => ({
|
|
341
357
|
baseURL: config.baseURL,
|
|
@@ -424,8 +440,8 @@ function useChat(threadId, assistantId, options = {}) {
|
|
|
424
440
|
interrupts: void 0,
|
|
425
441
|
...options.enableReturnStateWhenStreamCompleted ? { agentState: null } : {}
|
|
426
442
|
});
|
|
427
|
-
const stopStreamingRef =
|
|
428
|
-
const chunkMessageMerger =
|
|
443
|
+
const stopStreamingRef = useRef3(null);
|
|
444
|
+
const chunkMessageMerger = useRef3(createSimpleMessageMerger());
|
|
429
445
|
const fetchAndUpdateAgentState = useCallback3(
|
|
430
446
|
async (threadId2) => {
|
|
431
447
|
if (!options.enableReturnStateWhenStreamCompleted) return;
|
|
@@ -723,7 +739,7 @@ import {
|
|
|
723
739
|
useState as useState7,
|
|
724
740
|
useCallback as useCallback7,
|
|
725
741
|
useEffect as useEffect6,
|
|
726
|
-
useRef as
|
|
742
|
+
useRef as useRef6
|
|
727
743
|
} from "react";
|
|
728
744
|
import {
|
|
729
745
|
createSimpleMessageMerger as createSimpleMessageMerger2
|
|
@@ -737,7 +753,7 @@ import {
|
|
|
737
753
|
useContext as useContext5,
|
|
738
754
|
useEffect as useEffect5,
|
|
739
755
|
useMemo as useMemo2,
|
|
740
|
-
useRef as
|
|
756
|
+
useRef as useRef5,
|
|
741
757
|
useState as useState6
|
|
742
758
|
} from "react";
|
|
743
759
|
|
|
@@ -747,7 +763,7 @@ import {
|
|
|
747
763
|
useCallback as useCallback4,
|
|
748
764
|
useContext as useContext3,
|
|
749
765
|
useEffect as useEffect4,
|
|
750
|
-
useRef as
|
|
766
|
+
useRef as useRef4,
|
|
751
767
|
useState as useState4
|
|
752
768
|
} from "react";
|
|
753
769
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
@@ -793,7 +809,7 @@ var AssistantContextProvider = ({
|
|
|
793
809
|
isLoading: false,
|
|
794
810
|
error: null
|
|
795
811
|
});
|
|
796
|
-
const assistantsRef =
|
|
812
|
+
const assistantsRef = useRef4([]);
|
|
797
813
|
useEffect4(() => {
|
|
798
814
|
assistantsRef.current = state.assistants;
|
|
799
815
|
}, [state.assistants]);
|
|
@@ -1562,10 +1578,10 @@ var ConversationContextProvider = ({
|
|
|
1562
1578
|
const [isLoading, setIsLoading] = useState6(false);
|
|
1563
1579
|
const [error, setError] = useState6(null);
|
|
1564
1580
|
const [customRunConfig, setCustomRunConfig] = useState6({});
|
|
1565
|
-
const loadedAssistantIdRef =
|
|
1566
|
-
const prevAssistantIdRef =
|
|
1567
|
-
const isLoadingRef =
|
|
1568
|
-
const clientRef =
|
|
1581
|
+
const loadedAssistantIdRef = useRef5(null);
|
|
1582
|
+
const prevAssistantIdRef = useRef5(null);
|
|
1583
|
+
const isLoadingRef = useRef5(false);
|
|
1584
|
+
const clientRef = useRef5(client);
|
|
1569
1585
|
useEffect5(() => {
|
|
1570
1586
|
clientRef.current = client;
|
|
1571
1587
|
}, [client]);
|
|
@@ -1880,14 +1896,14 @@ function AgentThreadProvider({
|
|
|
1880
1896
|
threadId
|
|
1881
1897
|
}));
|
|
1882
1898
|
}, [clientAssistantId, tenantId, threadId]);
|
|
1883
|
-
const stopStreamingRef =
|
|
1884
|
-
const sendMessageStreamsRef =
|
|
1885
|
-
const chunkMessageMerger =
|
|
1886
|
-
const lastAgentStateCreatedAtRef =
|
|
1887
|
-
const messageCountRef =
|
|
1888
|
-
const onToolCompletedRef =
|
|
1899
|
+
const stopStreamingRef = useRef6(null);
|
|
1900
|
+
const sendMessageStreamsRef = useRef6(/* @__PURE__ */ new Map());
|
|
1901
|
+
const chunkMessageMerger = useRef6(createSimpleMessageMerger2());
|
|
1902
|
+
const lastAgentStateCreatedAtRef = useRef6(null);
|
|
1903
|
+
const messageCountRef = useRef6(0);
|
|
1904
|
+
const onToolCompletedRef = useRef6(onToolCompleted);
|
|
1889
1905
|
onToolCompletedRef.current = onToolCompleted;
|
|
1890
|
-
const onStreamCompletedRef =
|
|
1906
|
+
const onStreamCompletedRef = useRef6(onStreamCompleted);
|
|
1891
1907
|
onStreamCompletedRef.current = onStreamCompleted;
|
|
1892
1908
|
useEffect6(() => {
|
|
1893
1909
|
messageCountRef.current = state.messages.length;
|
|
@@ -2431,15 +2447,15 @@ function useAgentChat(options) {
|
|
|
2431
2447
|
}
|
|
2432
2448
|
|
|
2433
2449
|
// src/hooks/useAgentState.ts
|
|
2434
|
-
import { useState as useState8, useCallback as useCallback8, useEffect as useEffect7, useRef as
|
|
2450
|
+
import { useState as useState8, useCallback as useCallback8, useEffect as useEffect7, useRef as useRef7 } from "react";
|
|
2435
2451
|
function useAgentState(threadId, assistantId, options = {}) {
|
|
2436
2452
|
const client = useClient(assistantId);
|
|
2437
2453
|
const [agentState, setAgentState] = useState8(null);
|
|
2438
2454
|
const [isLoading, setIsLoading] = useState8(false);
|
|
2439
2455
|
const [error, setError] = useState8(null);
|
|
2440
|
-
const pollingIntervalRef =
|
|
2441
|
-
const pollingTimeoutRef =
|
|
2442
|
-
const hasFetchedRef =
|
|
2456
|
+
const pollingIntervalRef = useRef7(null);
|
|
2457
|
+
const pollingTimeoutRef = useRef7(null);
|
|
2458
|
+
const hasFetchedRef = useRef7(false);
|
|
2443
2459
|
const {
|
|
2444
2460
|
pollingInterval = 2e3,
|
|
2445
2461
|
// 2 seconds by default
|
|
@@ -2761,7 +2777,7 @@ function useEvalRuns(projectId) {
|
|
|
2761
2777
|
}
|
|
2762
2778
|
|
|
2763
2779
|
// src/hooks/eval/useEvalRunStream.ts
|
|
2764
|
-
import { useState as useState15, useEffect as useEffect12, useRef as
|
|
2780
|
+
import { useState as useState15, useEffect as useEffect12, useRef as useRef8, useCallback as useCallback15 } from "react";
|
|
2765
2781
|
function useEvalRunStream(runId) {
|
|
2766
2782
|
const client = useClient("__GLOBAL__");
|
|
2767
2783
|
const [status, setStatus] = useState15("idle");
|
|
@@ -2772,7 +2788,7 @@ function useEvalRunStream(runId) {
|
|
|
2772
2788
|
failed: 0
|
|
2773
2789
|
});
|
|
2774
2790
|
const [connected, setConnected] = useState15(false);
|
|
2775
|
-
const abortRef =
|
|
2791
|
+
const abortRef = useRef8(null);
|
|
2776
2792
|
const stopStreaming = useCallback15(() => {
|
|
2777
2793
|
abortRef.current?.abort();
|
|
2778
2794
|
abortRef.current = null;
|
|
@@ -4230,12 +4246,12 @@ import React71, {
|
|
|
4230
4246
|
useState as useState78,
|
|
4231
4247
|
useCallback as useCallback40,
|
|
4232
4248
|
useEffect as useEffect54,
|
|
4233
|
-
useRef as
|
|
4249
|
+
useRef as useRef30
|
|
4234
4250
|
} from "react";
|
|
4235
4251
|
import { WorkspaceClient, Client as Client3 } from "@axiom-lattice/client-sdk";
|
|
4236
4252
|
|
|
4237
4253
|
// src/components/Chat/WorkspaceResourceManager.tsx
|
|
4238
|
-
import { useMemo as useMemo35, useEffect as useEffect53, useRef as
|
|
4254
|
+
import { useMemo as useMemo35, useEffect as useEffect53, useRef as useRef29, useState as useState77 } from "react";
|
|
4239
4255
|
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";
|
|
4240
4256
|
import { Modal as Modal21, Avatar as Avatar12, Popover as Popover3, Button as Button56 } from "antd";
|
|
4241
4257
|
|
|
@@ -8012,7 +8028,7 @@ var McpConfigFormModal = ({
|
|
|
8012
8028
|
};
|
|
8013
8029
|
|
|
8014
8030
|
// src/components/Chat/AssistantFlow.tsx
|
|
8015
|
-
import { useMemo as useMemo6, useEffect as useEffect21, useState as useState31, useCallback as useCallback21, useRef as
|
|
8031
|
+
import { useMemo as useMemo6, useEffect as useEffect21, useState as useState31, useCallback as useCallback21, useRef as useRef10 } from "react";
|
|
8016
8032
|
import {
|
|
8017
8033
|
ReactFlow,
|
|
8018
8034
|
Background,
|
|
@@ -8818,7 +8834,7 @@ var AssistantNode = ({
|
|
|
8818
8834
|
var AssistantNode_default = AssistantNode;
|
|
8819
8835
|
|
|
8820
8836
|
// src/components/Chat/AgentConfigPanel.tsx
|
|
8821
|
-
import { useState as useState28, useEffect as useEffect19, useMemo as useMemo5, useCallback as useCallback19, useRef as
|
|
8837
|
+
import { useState as useState28, useEffect as useEffect19, useMemo as useMemo5, useCallback as useCallback19, useRef as useRef9 } from "react";
|
|
8822
8838
|
import {
|
|
8823
8839
|
Form as Form4,
|
|
8824
8840
|
Input as Input7,
|
|
@@ -9082,7 +9098,7 @@ var SkillListField = ({ propertyKey, label, value, onChange, token }) => {
|
|
|
9082
9098
|
const [skills, setSkills] = useState28([]);
|
|
9083
9099
|
const [loading, setLoading] = useState28(false);
|
|
9084
9100
|
const { get } = useApi();
|
|
9085
|
-
const fetchedRef =
|
|
9101
|
+
const fetchedRef = useRef9(false);
|
|
9086
9102
|
useEffect19(() => {
|
|
9087
9103
|
if (fetchedRef.current) return;
|
|
9088
9104
|
fetchedRef.current = true;
|
|
@@ -9193,7 +9209,7 @@ var DatabaseListField = ({ propertyKey, label, value, onChange, token }) => {
|
|
|
9193
9209
|
const [databases, setDatabases] = useState28([]);
|
|
9194
9210
|
const [loading, setLoading] = useState28(false);
|
|
9195
9211
|
const { get } = useApi();
|
|
9196
|
-
const fetchedRef =
|
|
9212
|
+
const fetchedRef = useRef9(false);
|
|
9197
9213
|
useEffect19(() => {
|
|
9198
9214
|
if (fetchedRef.current) return;
|
|
9199
9215
|
fetchedRef.current = true;
|
|
@@ -9308,7 +9324,7 @@ var MetricsListField = ({ propertyKey, label, value, onChange, token }) => {
|
|
|
9308
9324
|
const [servers, setServers] = useState28([]);
|
|
9309
9325
|
const [loading, setLoading] = useState28(false);
|
|
9310
9326
|
const { get } = useApi();
|
|
9311
|
-
const fetchedRef =
|
|
9327
|
+
const fetchedRef = useRef9(false);
|
|
9312
9328
|
useEffect19(() => {
|
|
9313
9329
|
if (fetchedRef.current) return;
|
|
9314
9330
|
fetchedRef.current = true;
|
|
@@ -11306,7 +11322,7 @@ var AssistantFlowInner = ({ onChat }) => {
|
|
|
11306
11322
|
}
|
|
11307
11323
|
}
|
|
11308
11324
|
}, [assistants, selectedAssistant, configPanelVisible]);
|
|
11309
|
-
const lastCreatedAssistantRef =
|
|
11325
|
+
const lastCreatedAssistantRef = useRef10(null);
|
|
11310
11326
|
useEffect21(() => {
|
|
11311
11327
|
if (lastCreatedAssistantRef.current && !assistants.find((a) => a.id === lastCreatedAssistantRef.current?.id)) {
|
|
11312
11328
|
lastCreatedAssistantRef.current = null;
|
|
@@ -13408,7 +13424,7 @@ var ToolsList = ({
|
|
|
13408
13424
|
};
|
|
13409
13425
|
|
|
13410
13426
|
// src/components/Chat/TopologyRuntimeView.tsx
|
|
13411
|
-
import { useEffect as useEffect45, useState as useState68, useMemo as useMemo27, useCallback as useCallback36, useRef as
|
|
13427
|
+
import { useEffect as useEffect45, useState as useState68, useMemo as useMemo27, useCallback as useCallback36, useRef as useRef25 } from "react";
|
|
13412
13428
|
import {
|
|
13413
13429
|
Spin as Spin16,
|
|
13414
13430
|
Empty as Empty14,
|
|
@@ -13451,7 +13467,7 @@ import dagre2 from "dagre";
|
|
|
13451
13467
|
|
|
13452
13468
|
// src/components/GenUI/MDResponse.tsx
|
|
13453
13469
|
import XMarkdown from "@ant-design/x-markdown";
|
|
13454
|
-
import React54, { useRef as
|
|
13470
|
+
import React54, { useRef as useRef24, useState as useState66, useMemo as useMemo24, useDeferredValue } from "react";
|
|
13455
13471
|
import { createStyles as createStyles30 } from "antd-style";
|
|
13456
13472
|
|
|
13457
13473
|
// src/components/GenUI/elements/confirm_feedback.tsx
|
|
@@ -14505,7 +14521,7 @@ import {
|
|
|
14505
14521
|
import { createStyles as createStyles10 } from "antd-style";
|
|
14506
14522
|
|
|
14507
14523
|
// src/components/GenUI/MarkdownViewer.tsx
|
|
14508
|
-
import React24, { useState as useState40, useEffect as useEffect26, useRef as
|
|
14524
|
+
import React24, { useState as useState40, useEffect as useEffect26, useRef as useRef11 } from "react";
|
|
14509
14525
|
import { Button as Button21, Tooltip as Tooltip4, message as message9 } from "antd";
|
|
14510
14526
|
import {
|
|
14511
14527
|
CopyOutlined as CopyOutlined2,
|
|
@@ -14779,7 +14795,7 @@ var MarkdownViewer = ({
|
|
|
14779
14795
|
}) => {
|
|
14780
14796
|
const { styles, cx } = useStyles3();
|
|
14781
14797
|
const [copied, setCopied] = useState40(false);
|
|
14782
|
-
const contentRef =
|
|
14798
|
+
const contentRef = useRef11(null);
|
|
14783
14799
|
useEffect26(() => {
|
|
14784
14800
|
if (copied) {
|
|
14785
14801
|
const timer = setTimeout(() => setCopied(false), 2e3);
|
|
@@ -15759,7 +15775,7 @@ function AttachmentsViewerSideApp({
|
|
|
15759
15775
|
import { Button as Button26, Space as Space17, Typography as Typography22 } from "antd";
|
|
15760
15776
|
|
|
15761
15777
|
// src/components/GenUI/elements/ContentPreviewCollapse.tsx
|
|
15762
|
-
import { useRef as
|
|
15778
|
+
import { useRef as useRef12, useState as useState45, useEffect as useEffect30, useCallback as useCallback23 } from "react";
|
|
15763
15779
|
import { Collapse as Collapse5 } from "antd";
|
|
15764
15780
|
import { createStyles as createStyles12 } from "antd-style";
|
|
15765
15781
|
import { DownOutlined as DownOutlined3, UpOutlined as UpOutlined2 } from "@ant-design/icons";
|
|
@@ -15831,7 +15847,7 @@ var ContentPreviewCollapse = ({
|
|
|
15831
15847
|
}) => {
|
|
15832
15848
|
const [showFullContent, setShowFullContent] = useState45(false);
|
|
15833
15849
|
const [isOverflowing, setIsOverflowing] = useState45(false);
|
|
15834
|
-
const contentRef =
|
|
15850
|
+
const contentRef = useRef12(null);
|
|
15835
15851
|
const showShadow = isOverflowing && !showFullContent;
|
|
15836
15852
|
const { styles, cx } = useStyle5({ showShadow });
|
|
15837
15853
|
const checkOverflow = useCallback23(() => {
|
|
@@ -16336,7 +16352,7 @@ import {
|
|
|
16336
16352
|
useCallback as useCallback24,
|
|
16337
16353
|
useEffect as useEffect31,
|
|
16338
16354
|
useMemo as useMemo11,
|
|
16339
|
-
useRef as
|
|
16355
|
+
useRef as useRef13,
|
|
16340
16356
|
useState as useState46
|
|
16341
16357
|
} from "react";
|
|
16342
16358
|
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
@@ -16345,7 +16361,7 @@ var LazyBubble = ({
|
|
|
16345
16361
|
renderContent,
|
|
16346
16362
|
autoLoadRightPanel
|
|
16347
16363
|
}) => {
|
|
16348
|
-
const ref =
|
|
16364
|
+
const ref = useRef13(null);
|
|
16349
16365
|
const [isVisible, setIsVisible] = useState46(false);
|
|
16350
16366
|
const [wasEverVisible, setWasEverVisible] = useState46(false);
|
|
16351
16367
|
useEffect31(() => {
|
|
@@ -16400,7 +16416,7 @@ var MessageList = ({
|
|
|
16400
16416
|
}) => {
|
|
16401
16417
|
const { styles } = useStyle();
|
|
16402
16418
|
const openSideApp = useSideAppOpener();
|
|
16403
|
-
const messageLengthRef =
|
|
16419
|
+
const messageLengthRef = useRef13(messages?.length ?? 0);
|
|
16404
16420
|
useEffect31(() => {
|
|
16405
16421
|
if (messages?.length) {
|
|
16406
16422
|
messageLengthRef.current = messages?.length;
|
|
@@ -16511,7 +16527,7 @@ import {
|
|
|
16511
16527
|
Space as Space28,
|
|
16512
16528
|
Typography as Typography33
|
|
16513
16529
|
} from "antd";
|
|
16514
|
-
import React38, { useCallback as useCallback28, useContext as useContext10, useEffect as useEffect37, useRef as
|
|
16530
|
+
import React38, { useCallback as useCallback28, useContext as useContext10, useEffect as useEffect37, useRef as useRef19, useState as useState56 } from "react";
|
|
16515
16531
|
import { BrainCircuit as BrainCircuit3 } from "lucide-react";
|
|
16516
16532
|
|
|
16517
16533
|
// src/components/GenUI/HITLContainer.tsx
|
|
@@ -17569,7 +17585,7 @@ var ThreadManagementButtons = () => {
|
|
|
17569
17585
|
};
|
|
17570
17586
|
|
|
17571
17587
|
// src/components/Chat/DatabasePicker.tsx
|
|
17572
|
-
import { useRef as
|
|
17588
|
+
import { useRef as useRef14, useState as useState49 } from "react";
|
|
17573
17589
|
import { Modal as Modal10, List as List7, Checkbox as Checkbox5, Spin as Spin8, Empty as Empty5, Typography as Typography27, Button as Button35, Space as Space23, Tooltip as Tooltip13 } from "antd";
|
|
17574
17590
|
import { Database as Database4 } from "lucide-react";
|
|
17575
17591
|
import { Fragment as Fragment12, jsx as jsx66, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
@@ -17579,7 +17595,7 @@ var DatabasePicker = ({ senderRef, iconOnly }) => {
|
|
|
17579
17595
|
const [loading, setLoading] = useState49(false);
|
|
17580
17596
|
const [selectedDatabases, setSelectedDatabases] = useState49([]);
|
|
17581
17597
|
const { get } = useApi();
|
|
17582
|
-
const fetchedRef =
|
|
17598
|
+
const fetchedRef = useRef14(false);
|
|
17583
17599
|
const loadDatabases = async () => {
|
|
17584
17600
|
setLoading(true);
|
|
17585
17601
|
try {
|
|
@@ -17719,7 +17735,7 @@ var DatabasePicker = ({ senderRef, iconOnly }) => {
|
|
|
17719
17735
|
};
|
|
17720
17736
|
|
|
17721
17737
|
// src/components/Chat/SkillPicker.tsx
|
|
17722
|
-
import { useRef as
|
|
17738
|
+
import { useRef as useRef15, useState as useState50 } from "react";
|
|
17723
17739
|
import { Modal as Modal11, List as List8, Checkbox as Checkbox6, Spin as Spin9, Empty as Empty6, Typography as Typography28, Button as Button36, Space as Space24, Tooltip as Tooltip14 } from "antd";
|
|
17724
17740
|
import { BrainCircuit } from "lucide-react";
|
|
17725
17741
|
import { Fragment as Fragment13, jsx as jsx67, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
@@ -17729,7 +17745,7 @@ var SkillPicker = ({ senderRef, iconOnly }) => {
|
|
|
17729
17745
|
const [loading, setLoading] = useState50(false);
|
|
17730
17746
|
const [selectedSkills, setSelectedSkills] = useState50([]);
|
|
17731
17747
|
const { get } = useApi();
|
|
17732
|
-
const fetchedRef =
|
|
17748
|
+
const fetchedRef = useRef15(false);
|
|
17733
17749
|
const loadSkills = async () => {
|
|
17734
17750
|
setLoading(true);
|
|
17735
17751
|
try {
|
|
@@ -17869,7 +17885,7 @@ var SkillPicker = ({ senderRef, iconOnly }) => {
|
|
|
17869
17885
|
};
|
|
17870
17886
|
|
|
17871
17887
|
// src/components/Chat/AgentPicker.tsx
|
|
17872
|
-
import { useRef as
|
|
17888
|
+
import { useRef as useRef16, useState as useState51 } from "react";
|
|
17873
17889
|
import { Modal as Modal12, List as List9, Empty as Empty7, Typography as Typography29, Button as Button37, Tooltip as Tooltip15 } from "antd";
|
|
17874
17890
|
import { Bot as Bot2 } from "lucide-react";
|
|
17875
17891
|
import { Fragment as Fragment14, jsx as jsx68, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
@@ -17878,7 +17894,7 @@ var AgentPicker = ({ senderRef, iconOnly }) => {
|
|
|
17878
17894
|
const [loading, setLoading] = useState51(false);
|
|
17879
17895
|
const [selectedAgent, setSelectedAgent] = useState51(null);
|
|
17880
17896
|
const { assistants, currentAssistant, selectAssistant } = useAssistantContext();
|
|
17881
|
-
const fetchedRef =
|
|
17897
|
+
const fetchedRef = useRef16(false);
|
|
17882
17898
|
const handleOpenModal = () => {
|
|
17883
17899
|
setSelectedAgent(currentAssistant?.id || null);
|
|
17884
17900
|
setModalOpen(true);
|
|
@@ -17985,7 +18001,7 @@ var AgentPicker = ({ senderRef, iconOnly }) => {
|
|
|
17985
18001
|
};
|
|
17986
18002
|
|
|
17987
18003
|
// src/components/Chat/MetricsDataSourcePicker.tsx
|
|
17988
|
-
import { useEffect as useEffect34, useState as useState52, useRef as
|
|
18004
|
+
import { useEffect as useEffect34, useState as useState52, useRef as useRef17 } from "react";
|
|
17989
18005
|
import { Modal as Modal13, List as List10, Spin as Spin11, Empty as Empty8, Typography as Typography30, Button as Button38, Tag as Tag14, Tooltip as Tooltip16 } from "antd";
|
|
17990
18006
|
import { Database as Database5, Check as Check4, Server as Server2 } from "lucide-react";
|
|
17991
18007
|
import { Fragment as Fragment15, jsx as jsx69, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
@@ -18000,7 +18016,7 @@ var MetricsDataSourcePicker = ({
|
|
|
18000
18016
|
const { config } = useLatticeChatShellContext();
|
|
18001
18017
|
const { customRunConfig, updateCustomRunConfig } = useConversationContext();
|
|
18002
18018
|
const { get } = useApi();
|
|
18003
|
-
const hasInitializedRef =
|
|
18019
|
+
const hasInitializedRef = useRef17(false);
|
|
18004
18020
|
const loadDataSources = async () => {
|
|
18005
18021
|
setLoading(true);
|
|
18006
18022
|
try {
|
|
@@ -18325,7 +18341,7 @@ var MetricsDataSourcePicker = ({
|
|
|
18325
18341
|
};
|
|
18326
18342
|
|
|
18327
18343
|
// src/components/Chat/ModelSelector.tsx
|
|
18328
|
-
import { useState as useState53, useEffect as useEffect35, useCallback as useCallback27, useRef as
|
|
18344
|
+
import { useState as useState53, useEffect as useEffect35, useCallback as useCallback27, useRef as useRef18 } from "react";
|
|
18329
18345
|
import { Select as Select6 } from "antd";
|
|
18330
18346
|
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
18331
18347
|
var STORAGE_KEY = "axiom-lattice:selected-model";
|
|
@@ -18353,8 +18369,8 @@ var ModelSelector = ({
|
|
|
18353
18369
|
const [internalValue, setInternalValue] = useState53(null);
|
|
18354
18370
|
const [dropdownOpen, setDropdownOpen] = useState53(false);
|
|
18355
18371
|
const [isHovered, setIsHovered] = useState53(false);
|
|
18356
|
-
const hasFetchedRef =
|
|
18357
|
-
const hasSetDefaultRef =
|
|
18372
|
+
const hasFetchedRef = useRef18(false);
|
|
18373
|
+
const hasSetDefaultRef = useRef18(false);
|
|
18358
18374
|
const { get } = useApi();
|
|
18359
18375
|
const selectedModelConfig = value !== void 0 ? value : internalValue;
|
|
18360
18376
|
const setSelectedModelConfig = useCallback27((config) => {
|
|
@@ -19123,7 +19139,7 @@ var Chating = ({
|
|
|
19123
19139
|
const [attachedFiles, setAttachedFiles] = useState56([]);
|
|
19124
19140
|
const { styles } = useStyle();
|
|
19125
19141
|
const [headerOpen, setHeaderOpen] = useState56(false);
|
|
19126
|
-
const attachmentsRef =
|
|
19142
|
+
const attachmentsRef = useRef19(null);
|
|
19127
19143
|
const senderRef = React38.useRef(null);
|
|
19128
19144
|
const {
|
|
19129
19145
|
assistantId,
|
|
@@ -19156,9 +19172,9 @@ var Chating = ({
|
|
|
19156
19172
|
return () => clearInterval(interval);
|
|
19157
19173
|
}, [isStreaming]);
|
|
19158
19174
|
const conversationContext = useConversationContext();
|
|
19159
|
-
const systemContextSentRef =
|
|
19160
|
-
const initialMessageSentRef =
|
|
19161
|
-
const prevLoadingRef =
|
|
19175
|
+
const systemContextSentRef = useRef19(false);
|
|
19176
|
+
const initialMessageSentRef = useRef19(false);
|
|
19177
|
+
const prevLoadingRef = useRef19(false);
|
|
19162
19178
|
useEffect37(() => {
|
|
19163
19179
|
systemContextSentRef.current = false;
|
|
19164
19180
|
}, [threadId]);
|
|
@@ -23868,7 +23884,7 @@ var TaskBoard = ({
|
|
|
23868
23884
|
};
|
|
23869
23885
|
|
|
23870
23886
|
// src/components/GenUI/elements/Mailbox.tsx
|
|
23871
|
-
import { useState as useState63, useMemo as useMemo20, useRef as
|
|
23887
|
+
import { useState as useState63, useMemo as useMemo20, useRef as useRef20, useEffect as useEffect39 } from "react";
|
|
23872
23888
|
import { jsx as jsx91, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
23873
23889
|
var useStyle12 = () => {
|
|
23874
23890
|
return {
|
|
@@ -24155,7 +24171,7 @@ var TeamChat = ({ data }) => {
|
|
|
24155
24171
|
const styles = useStyle12();
|
|
24156
24172
|
const { teamName, currentUser, teammates, messages, onSendMessage } = data || {};
|
|
24157
24173
|
const [inputValue, setInputValue] = useState63("");
|
|
24158
|
-
const messagesEndRef =
|
|
24174
|
+
const messagesEndRef = useRef20(null);
|
|
24159
24175
|
const sortedMessages = useMemo20(() => {
|
|
24160
24176
|
return [...messages || []].sort(
|
|
24161
24177
|
(a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()
|
|
@@ -24338,7 +24354,7 @@ import { Button as Button46, Typography as Typography47 } from "antd";
|
|
|
24338
24354
|
import { ExpandOutlined as ExpandOutlined2 } from "@ant-design/icons";
|
|
24339
24355
|
|
|
24340
24356
|
// src/streaming-html/StreamingHTMLRenderer.tsx
|
|
24341
|
-
import React48, { useEffect as useEffect40, useRef as
|
|
24357
|
+
import React48, { useEffect as useEffect40, useRef as useRef21, useCallback as useCallback30, useState as useState64 } from "react";
|
|
24342
24358
|
|
|
24343
24359
|
// src/streaming-html/show-widget-css-generator.ts
|
|
24344
24360
|
function generateShowWidgetCSS(tokens) {
|
|
@@ -25029,14 +25045,14 @@ var StreamingHTMLRenderer = ({
|
|
|
25029
25045
|
title,
|
|
25030
25046
|
loadingMessages
|
|
25031
25047
|
}) => {
|
|
25032
|
-
const iframeRef =
|
|
25033
|
-
const containerRef =
|
|
25034
|
-
const resizeObserverRef =
|
|
25035
|
-
const prevHTMLRef =
|
|
25036
|
-
const isReadyRef =
|
|
25037
|
-
const pendingChunksRef =
|
|
25038
|
-
const isCompleteRef =
|
|
25039
|
-
const isScriptExecuted =
|
|
25048
|
+
const iframeRef = useRef21(null);
|
|
25049
|
+
const containerRef = useRef21(null);
|
|
25050
|
+
const resizeObserverRef = useRef21(null);
|
|
25051
|
+
const prevHTMLRef = useRef21("");
|
|
25052
|
+
const isReadyRef = useRef21(false);
|
|
25053
|
+
const pendingChunksRef = useRef21([]);
|
|
25054
|
+
const isCompleteRef = useRef21(isComplete);
|
|
25055
|
+
const isScriptExecuted = useRef21(false);
|
|
25040
25056
|
const [iframeHeight, setIframeHeight] = React48.useState(0);
|
|
25041
25057
|
const [iframeWidth, setIframeWidth] = React48.useState(void 0);
|
|
25042
25058
|
const [currentMessageIndex, setCurrentMessageIndex] = useState64(0);
|
|
@@ -25531,12 +25547,12 @@ import { CodeHighlighter, Mermaid } from "@ant-design/x";
|
|
|
25531
25547
|
|
|
25532
25548
|
// src/components/GenUI/ReactInfographic.tsx
|
|
25533
25549
|
import { Infographic } from "@antv/infographic";
|
|
25534
|
-
import { useRef as
|
|
25550
|
+
import { useRef as useRef22, useEffect as useEffect41 } from "react";
|
|
25535
25551
|
import { jsx as jsx95 } from "react/jsx-runtime";
|
|
25536
25552
|
var ReactInfographic = (props) => {
|
|
25537
25553
|
const { children } = props;
|
|
25538
|
-
const $container =
|
|
25539
|
-
const infographicInstance =
|
|
25554
|
+
const $container = useRef22(null);
|
|
25555
|
+
const infographicInstance = useRef22(null);
|
|
25540
25556
|
useEffect41(() => {
|
|
25541
25557
|
if ($container.current) {
|
|
25542
25558
|
infographicInstance.current = new Infographic({
|
|
@@ -25568,7 +25584,7 @@ data
|
|
|
25568
25584
|
};
|
|
25569
25585
|
|
|
25570
25586
|
// src/components/GenUI/ReactChart.tsx
|
|
25571
|
-
import { useEffect as useEffect42, useRef as
|
|
25587
|
+
import { useEffect as useEffect42, useRef as useRef23, useState as useState65 } from "react";
|
|
25572
25588
|
import * as echarts from "echarts";
|
|
25573
25589
|
import { Card as Card22 } from "antd";
|
|
25574
25590
|
import { parse } from "best-effort-json-parser";
|
|
@@ -25881,9 +25897,9 @@ function parseAndValidateChartData(input) {
|
|
|
25881
25897
|
}
|
|
25882
25898
|
var ReactChart = (props) => {
|
|
25883
25899
|
const { children } = props;
|
|
25884
|
-
const chartRef =
|
|
25885
|
-
const chartInstance =
|
|
25886
|
-
const resizeObserverRef =
|
|
25900
|
+
const chartRef = useRef23(null);
|
|
25901
|
+
const chartInstance = useRef23(null);
|
|
25902
|
+
const resizeObserverRef = useRef23(null);
|
|
25887
25903
|
const [tableData, setTableData] = useState65(null);
|
|
25888
25904
|
useEffect42(() => {
|
|
25889
25905
|
if (!chartRef.current) {
|
|
@@ -28154,8 +28170,8 @@ var RunDetail = ({ run, agentName, open, onClose, onRunUpdate, autoRefresh, onAu
|
|
|
28154
28170
|
const [loading, setLoading] = useState68(false);
|
|
28155
28171
|
const [graphDefinition, setGraphDefinition] = useState68(null);
|
|
28156
28172
|
const [graphLoading, setGraphLoading] = useState68(false);
|
|
28157
|
-
const stepsPollTimeoutRef =
|
|
28158
|
-
const stepsPollSessionRef =
|
|
28173
|
+
const stepsPollTimeoutRef = useRef25(null);
|
|
28174
|
+
const stepsPollSessionRef = useRef25(0);
|
|
28159
28175
|
const fetchSteps = useCallback36(async () => {
|
|
28160
28176
|
try {
|
|
28161
28177
|
const [stepsRes, runsRes] = await Promise.all([
|
|
@@ -28268,7 +28284,7 @@ var TopologyRuntimeView = () => {
|
|
|
28268
28284
|
const [error, setError] = useState68(null);
|
|
28269
28285
|
const [selectedRun, setSelectedRun] = useState68(null);
|
|
28270
28286
|
const [autoRefresh, setAutoRefresh] = useState68(true);
|
|
28271
|
-
const pollingSessionRef =
|
|
28287
|
+
const pollingSessionRef = useRef25(0);
|
|
28272
28288
|
const handleRunUpdate = useCallback36((updated) => {
|
|
28273
28289
|
setRuns(
|
|
28274
28290
|
(prev) => prev.map((r) => r.id === updated.id ? updated : r)
|
|
@@ -28541,7 +28557,7 @@ var TopologyInboxView = () => {
|
|
|
28541
28557
|
};
|
|
28542
28558
|
|
|
28543
28559
|
// src/components/Chat/WorkflowAutomationView.tsx
|
|
28544
|
-
import { useEffect as useEffect48, useState as useState70, useCallback as useCallback37, useMemo as useMemo30, useRef as
|
|
28560
|
+
import { useEffect as useEffect48, useState as useState70, useCallback as useCallback37, useMemo as useMemo30, useRef as useRef26 } from "react";
|
|
28545
28561
|
import {
|
|
28546
28562
|
ReactFlowProvider as ReactFlowProvider6
|
|
28547
28563
|
} from "@xyflow/react";
|
|
@@ -29559,7 +29575,7 @@ var WorkflowAutomationView = () => {
|
|
|
29559
29575
|
}, [get]);
|
|
29560
29576
|
const [copilotOpen, setCopilotOpen] = useState70(true);
|
|
29561
29577
|
const [copilotWidth, setCopilotWidth] = useState70(420);
|
|
29562
|
-
const resizingRef =
|
|
29578
|
+
const resizingRef = useRef26(null);
|
|
29563
29579
|
const [initialLoading, setInitialLoading] = useState70(true);
|
|
29564
29580
|
const [error, setError] = useState70(null);
|
|
29565
29581
|
const [specModalOpen, setSpecModalOpen] = useState70(false);
|
|
@@ -30917,7 +30933,7 @@ var EvalPanel = () => {
|
|
|
30917
30933
|
};
|
|
30918
30934
|
|
|
30919
30935
|
// src/components/Chat/PersonalAssistantPage.tsx
|
|
30920
|
-
import { useEffect as useEffect51, useState as useState75, useCallback as useCallback39, useRef as
|
|
30936
|
+
import { useEffect as useEffect51, useState as useState75, useCallback as useCallback39, useRef as useRef28 } from "react";
|
|
30921
30937
|
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
30938
|
import { createStyles as createStyles36 } from "antd-style";
|
|
30923
30939
|
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";
|
|
@@ -30933,7 +30949,7 @@ var LatticeAgentWorkspace = ({
|
|
|
30933
30949
|
}) => /* @__PURE__ */ jsx117(WorkspaceContextProvider, { workspaceId, projectId, children: /* @__PURE__ */ jsx117(AssistantContextProvider, { autoLoad: true, initialAssistantId: assistant_id, children: /* @__PURE__ */ jsx117(LatticeChat, { showProjectSelector: false, assistant_id, ...chatProps }) }) });
|
|
30934
30950
|
|
|
30935
30951
|
// src/components/Chat/PersonalAssistantChannelModal.tsx
|
|
30936
|
-
import { useEffect as useEffect50, useState as useState74, useCallback as useCallback38, useMemo as useMemo32, useRef as
|
|
30952
|
+
import { useEffect as useEffect50, useState as useState74, useCallback as useCallback38, useMemo as useMemo32, useRef as useRef27 } from "react";
|
|
30937
30953
|
import {
|
|
30938
30954
|
Button as Button54,
|
|
30939
30955
|
Form as Form9,
|
|
@@ -31180,25 +31196,30 @@ var PersonalAssistantChannelModal = ({
|
|
|
31180
31196
|
const [qrLoading, setQrLoading] = useState74(false);
|
|
31181
31197
|
const [qrCodeUrl, setQrCodeUrl] = useState74(null);
|
|
31182
31198
|
const [qrStatus, setQrStatus] = useState74("idle");
|
|
31183
|
-
const
|
|
31184
|
-
const
|
|
31185
|
-
const
|
|
31186
|
-
|
|
31187
|
-
|
|
31188
|
-
|
|
31199
|
+
const [qrCountdown, setQrCountdown] = useState74(0);
|
|
31200
|
+
const qrCodeRef = useRef27(null);
|
|
31201
|
+
const qrCountdownRef = useRef27(null);
|
|
31202
|
+
const clearQrCountdown = useCallback38(() => {
|
|
31203
|
+
if (qrCountdownRef.current) {
|
|
31204
|
+
clearInterval(qrCountdownRef.current);
|
|
31205
|
+
qrCountdownRef.current = null;
|
|
31189
31206
|
}
|
|
31190
31207
|
}, []);
|
|
31191
31208
|
const resetQrState = useCallback38(() => {
|
|
31192
|
-
|
|
31209
|
+
clearQrCountdown();
|
|
31193
31210
|
setQrLoading(false);
|
|
31194
31211
|
setQrCodeUrl(null);
|
|
31195
31212
|
setQrStatus("idle");
|
|
31213
|
+
setQrCountdown(0);
|
|
31196
31214
|
qrCodeRef.current = null;
|
|
31197
|
-
}, [
|
|
31215
|
+
}, [clearQrCountdown]);
|
|
31216
|
+
const QR_EXPIRY_SECONDS = 300;
|
|
31198
31217
|
const fetchQrCode = useCallback38(async () => {
|
|
31199
31218
|
setQrLoading(true);
|
|
31200
31219
|
setQrStatus("loading");
|
|
31201
31220
|
setQrCodeUrl(null);
|
|
31221
|
+
clearQrCountdown();
|
|
31222
|
+
setQrCountdown(0);
|
|
31202
31223
|
try {
|
|
31203
31224
|
const res = await get(
|
|
31204
31225
|
"/api/channels/wechat/setup/qrcode"
|
|
@@ -31207,32 +31228,17 @@ var PersonalAssistantChannelModal = ({
|
|
|
31207
31228
|
qrCodeRef.current = res.data.qrcode;
|
|
31208
31229
|
setQrCodeUrl(res.data.qrcodeImgUrl);
|
|
31209
31230
|
setQrStatus("wait");
|
|
31210
|
-
|
|
31211
|
-
|
|
31212
|
-
|
|
31213
|
-
|
|
31214
|
-
|
|
31215
|
-
|
|
31216
|
-
|
|
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
|
-
}
|
|
31231
|
+
setQrCountdown(QR_EXPIRY_SECONDS);
|
|
31232
|
+
qrCountdownRef.current = setInterval(() => {
|
|
31233
|
+
setQrCountdown((prev) => {
|
|
31234
|
+
if (prev <= 1) {
|
|
31235
|
+
clearQrCountdown();
|
|
31236
|
+
setQrStatus("expired");
|
|
31237
|
+
return 0;
|
|
31232
31238
|
}
|
|
31233
|
-
|
|
31234
|
-
}
|
|
31235
|
-
},
|
|
31239
|
+
return prev - 1;
|
|
31240
|
+
});
|
|
31241
|
+
}, 1e3);
|
|
31236
31242
|
} else {
|
|
31237
31243
|
setQrStatus("error");
|
|
31238
31244
|
message18.error("Failed to get QR code");
|
|
@@ -31243,10 +31249,36 @@ var PersonalAssistantChannelModal = ({
|
|
|
31243
31249
|
} finally {
|
|
31244
31250
|
setQrLoading(false);
|
|
31245
31251
|
}
|
|
31246
|
-
}, [get,
|
|
31252
|
+
}, [get, clearQrCountdown]);
|
|
31253
|
+
const checkQrStatus = useCallback38(async () => {
|
|
31254
|
+
if (!qrCodeRef.current) return;
|
|
31255
|
+
try {
|
|
31256
|
+
const statusRes = await get(`/api/channels/wechat/setup/status?qrcode=${encodeURIComponent(qrCodeRef.current)}`);
|
|
31257
|
+
if (statusRes.success && statusRes.data) {
|
|
31258
|
+
const s = statusRes.data.status;
|
|
31259
|
+
if (s === "confirmed" && statusRes.data.botToken) {
|
|
31260
|
+
setQrStatus("confirmed");
|
|
31261
|
+
clearQrCountdown();
|
|
31262
|
+
form.setFieldsValue({
|
|
31263
|
+
botToken: statusRes.data.botToken,
|
|
31264
|
+
uin: statusRes.data.uin
|
|
31265
|
+
});
|
|
31266
|
+
message18.success("WeChat login confirmed!");
|
|
31267
|
+
} else if (s === "expired") {
|
|
31268
|
+
setQrStatus("expired");
|
|
31269
|
+
clearQrCountdown();
|
|
31270
|
+
setQrCountdown(0);
|
|
31271
|
+
} else if (s === "scaned") {
|
|
31272
|
+
setQrStatus("scaned");
|
|
31273
|
+
}
|
|
31274
|
+
}
|
|
31275
|
+
} catch {
|
|
31276
|
+
message18.error("Failed to check QR status");
|
|
31277
|
+
}
|
|
31278
|
+
}, [get, clearQrCountdown, form]);
|
|
31247
31279
|
useEffect50(() => {
|
|
31248
31280
|
return () => {
|
|
31249
|
-
if (
|
|
31281
|
+
if (qrCountdownRef.current) clearInterval(qrCountdownRef.current);
|
|
31250
31282
|
};
|
|
31251
31283
|
}, []);
|
|
31252
31284
|
const loadInstallations = useCallback38(async () => {
|
|
@@ -31624,7 +31656,7 @@ var PersonalAssistantChannelModal = ({
|
|
|
31624
31656
|
/* @__PURE__ */ jsx118(Spin20, {}),
|
|
31625
31657
|
/* @__PURE__ */ jsx118(Text48, { type: "secondary", style: { display: "block", marginTop: 8, fontSize: 12 }, children: "Generating QR code..." })
|
|
31626
31658
|
] }),
|
|
31627
|
-
(qrStatus === "wait" || qrStatus === "scaned") && qrCodeUrl && /* @__PURE__ */ jsxs85("div", { children: [
|
|
31659
|
+
(qrStatus === "wait" || qrStatus === "scaned") && qrCodeUrl && /* @__PURE__ */ jsxs85("div", { style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [
|
|
31628
31660
|
/* @__PURE__ */ jsx118(QRCode, { value: qrCodeUrl, size: 180 }),
|
|
31629
31661
|
/* @__PURE__ */ jsx118(
|
|
31630
31662
|
Text48,
|
|
@@ -31639,7 +31671,16 @@ var PersonalAssistantChannelModal = ({
|
|
|
31639
31671
|
children: qrStatus === "scaned" ? "Scanned! Confirm on your phone..." : "Scan with WeChat"
|
|
31640
31672
|
}
|
|
31641
31673
|
),
|
|
31642
|
-
/* @__PURE__ */ jsx118(Text48, { type: "secondary", style: { fontSize: 11, marginTop: 4, display: "block" }, children:
|
|
31674
|
+
/* @__PURE__ */ jsx118(Text48, { type: "secondary", style: { fontSize: 11, marginTop: 4, display: "block" }, children: qrCountdown > 0 ? `Expires in ${Math.floor(qrCountdown / 60)}:${String(qrCountdown % 60).padStart(2, "0")}` : "QR code expired" }),
|
|
31675
|
+
/* @__PURE__ */ jsx118(
|
|
31676
|
+
Button54,
|
|
31677
|
+
{
|
|
31678
|
+
size: "small",
|
|
31679
|
+
style: { marginTop: 8 },
|
|
31680
|
+
onClick: checkQrStatus,
|
|
31681
|
+
children: "Refresh Status"
|
|
31682
|
+
}
|
|
31683
|
+
)
|
|
31643
31684
|
] }),
|
|
31644
31685
|
qrStatus === "confirmed" && /* @__PURE__ */ jsxs85("div", { style: { padding: "12px 0" }, children: [
|
|
31645
31686
|
/* @__PURE__ */ jsx118(Text48, { strong: true, style: { fontSize: 14, color: "var(--color-success, #22c55e)", display: "block" }, children: "Login confirmed!" }),
|
|
@@ -31887,7 +31928,7 @@ var PERSONALITY_MAP = {
|
|
|
31887
31928
|
var PersonalAssistantPage = () => {
|
|
31888
31929
|
const { styles } = useStyles20();
|
|
31889
31930
|
const { get, post, del } = useApi();
|
|
31890
|
-
const { personalAssistant, setPersonalAssistant } = useAuth();
|
|
31931
|
+
const { personalAssistant, setPersonalAssistant, currentTenant } = useAuth();
|
|
31891
31932
|
const auth = useAuthOptional();
|
|
31892
31933
|
const userName = auth?.user?.name || auth?.user?.email?.split("@")[0];
|
|
31893
31934
|
const [creating, setCreating] = useState75(false);
|
|
@@ -31914,7 +31955,7 @@ var PersonalAssistantPage = () => {
|
|
|
31914
31955
|
message19.error(b.message);
|
|
31915
31956
|
return;
|
|
31916
31957
|
}
|
|
31917
|
-
const info = { assistantId: b.data.id, projectId: b.data.projectId, workspaceId: b.data.workspaceId || "default" };
|
|
31958
|
+
const info = { assistantId: b.data.id, projectId: b.data.projectId, workspaceId: b.data.workspaceId || "default", tenantId: currentTenant?.id };
|
|
31918
31959
|
setPersonalAssistant(info);
|
|
31919
31960
|
message19.success("Done!");
|
|
31920
31961
|
} catch {
|
|
@@ -31937,7 +31978,7 @@ var PersonalAssistantPage = () => {
|
|
|
31937
31978
|
);
|
|
31938
31979
|
return created.data.id;
|
|
31939
31980
|
}, [get, post, workspaceId, projectId]);
|
|
31940
|
-
const lastDate =
|
|
31981
|
+
const lastDate = useRef28("");
|
|
31941
31982
|
useEffect51(() => {
|
|
31942
31983
|
if (!assistantId) return;
|
|
31943
31984
|
let timer;
|
|
@@ -32727,8 +32768,8 @@ var WorkspaceResourceManager = ({
|
|
|
32727
32768
|
logo
|
|
32728
32769
|
}) => {
|
|
32729
32770
|
const { openContentApp, menuCollapsed, setMenuCollapsed } = useChatUIContext();
|
|
32730
|
-
const hasOpenedDefault =
|
|
32731
|
-
const hasRegistered =
|
|
32771
|
+
const hasOpenedDefault = useRef29(false);
|
|
32772
|
+
const hasRegistered = useRef29(false);
|
|
32732
32773
|
useEffect53(() => {
|
|
32733
32774
|
if (!hasRegistered.current) {
|
|
32734
32775
|
hasRegistered.current = true;
|
|
@@ -33158,7 +33199,7 @@ var WorkspaceContextProvider = ({
|
|
|
33158
33199
|
setWorkspaceId(firstWorkspace.id);
|
|
33159
33200
|
}
|
|
33160
33201
|
}, [workspaces, workspaceId]);
|
|
33161
|
-
const prevWorkspaceId =
|
|
33202
|
+
const prevWorkspaceId = useRef30(workspaceId);
|
|
33162
33203
|
useEffect54(() => {
|
|
33163
33204
|
if (workspaceId) {
|
|
33164
33205
|
refreshProjects(workspaceId);
|
|
@@ -33533,7 +33574,7 @@ var PinToMenuButton = ({ assistantId }) => {
|
|
|
33533
33574
|
import { createStyles as createStyles40 } from "antd-style";
|
|
33534
33575
|
|
|
33535
33576
|
// src/components/Chat/ProjectSelector.tsx
|
|
33536
|
-
import { useState as useState80, useCallback as useCallback42, useMemo as useMemo36, useRef as
|
|
33577
|
+
import { useState as useState80, useCallback as useCallback42, useMemo as useMemo36, useRef as useRef31 } from "react";
|
|
33537
33578
|
import { Modal as Modal23, Input as Input19, Button as Button58, message as message21 } from "antd";
|
|
33538
33579
|
import { createStyles as createStyles38 } from "antd-style";
|
|
33539
33580
|
import { Folder, ChevronDown as ChevronDown6, Building2 as Building24 } from "lucide-react";
|
|
@@ -33770,13 +33811,13 @@ var ProjectSelector = ({
|
|
|
33770
33811
|
createProject
|
|
33771
33812
|
} = useWorkspaceContext();
|
|
33772
33813
|
const [isWorkspaceListOpen, setIsWorkspaceListOpen] = useState80(false);
|
|
33773
|
-
const workspaceDropdownRef =
|
|
33814
|
+
const workspaceDropdownRef = useRef31(null);
|
|
33774
33815
|
const [isProjectListOpen, setIsProjectListOpen] = useState80(false);
|
|
33775
33816
|
const [isModalOpen, setIsModalOpen] = useState80(false);
|
|
33776
33817
|
const [projectName, setProjectName] = useState80("");
|
|
33777
33818
|
const [validationError, setValidationError] = useState80(null);
|
|
33778
33819
|
const [isCreating, setIsCreating] = useState80(false);
|
|
33779
|
-
const projectNameInputRef =
|
|
33820
|
+
const projectNameInputRef = useRef31(null);
|
|
33780
33821
|
const currentProject = useMemo36(() => {
|
|
33781
33822
|
return projects.find((p) => p.id === projectId);
|
|
33782
33823
|
}, [projects, projectId]);
|
|
@@ -35015,7 +35056,7 @@ var LatticeChatView = (props) => {
|
|
|
35015
35056
|
};
|
|
35016
35057
|
|
|
35017
35058
|
// src/components/Chat/SettingsModal.tsx
|
|
35018
|
-
import { useState as useState83, useEffect as useEffect57, useRef as
|
|
35059
|
+
import { useState as useState83, useEffect as useEffect57, useRef as useRef32 } from "react";
|
|
35019
35060
|
import {
|
|
35020
35061
|
Modal as Modal25,
|
|
35021
35062
|
Input as Input20,
|
|
@@ -35428,7 +35469,7 @@ var SettingsModal = ({
|
|
|
35428
35469
|
return [];
|
|
35429
35470
|
});
|
|
35430
35471
|
const [serverConfigs, setServerConfigs] = useState83({});
|
|
35431
|
-
const connectionsRef =
|
|
35472
|
+
const connectionsRef = useRef32(connections);
|
|
35432
35473
|
useEffect57(() => {
|
|
35433
35474
|
connectionsRef.current = connections;
|
|
35434
35475
|
}, [connections]);
|