@axiom-lattice/react-sdk 2.1.6 → 2.1.7
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 +191 -73
- package/dist/index.d.ts +191 -73
- package/dist/index.js +2257 -1314
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2307 -1360
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
// src/hooks/useChat.ts
|
|
2
|
-
import { useState, useCallback, useEffect, useRef } from "react";
|
|
2
|
+
import { useState as useState2, useCallback, useEffect as useEffect2, useRef } from "react";
|
|
3
3
|
|
|
4
4
|
// src/context.tsx
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
createContext,
|
|
7
|
+
useContext,
|
|
8
|
+
useEffect,
|
|
9
|
+
useMemo,
|
|
10
|
+
useState
|
|
11
|
+
} from "react";
|
|
6
12
|
import { Client } from "@axiom-lattice/client-sdk";
|
|
7
13
|
import { jsx } from "react/jsx-runtime";
|
|
8
14
|
var AxiomLatticeContext = createContext({
|
|
@@ -24,21 +30,32 @@ function AxiomLatticeProvider({
|
|
|
24
30
|
const value = useMemo(() => ({ client }), [client]);
|
|
25
31
|
return /* @__PURE__ */ jsx(AxiomLatticeContext.Provider, { value, children });
|
|
26
32
|
}
|
|
27
|
-
function useAxiomLattice(
|
|
33
|
+
function useAxiomLattice({
|
|
34
|
+
assistantId
|
|
35
|
+
} = {}) {
|
|
28
36
|
const context = useContext(AxiomLatticeContext);
|
|
29
|
-
|
|
37
|
+
const [client, setClient] = useState(context.client);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (assistantId && context.client && context.client.assistantId !== assistantId) {
|
|
40
|
+
const newClient = context.client.clone({ assistantId });
|
|
41
|
+
setClient(newClient);
|
|
42
|
+
} else {
|
|
43
|
+
setClient(context.client);
|
|
44
|
+
}
|
|
45
|
+
}, [assistantId, context.client]);
|
|
46
|
+
if (!client) {
|
|
30
47
|
throw new Error(
|
|
31
48
|
"useAxiomLattice must be used within an AxiomLatticeProvider"
|
|
32
49
|
);
|
|
33
50
|
}
|
|
34
|
-
return
|
|
51
|
+
return client;
|
|
35
52
|
}
|
|
36
53
|
|
|
37
54
|
// src/hooks/useChat.ts
|
|
38
55
|
import { createSimpleMessageMerger } from "@axiom-lattice/client-sdk";
|
|
39
56
|
function useChat(threadId, options = {}) {
|
|
40
57
|
const client = useAxiomLattice();
|
|
41
|
-
const [state, setState] =
|
|
58
|
+
const [state, setState] = useState2({
|
|
42
59
|
messages: options.initialMessages || [],
|
|
43
60
|
isLoading: false,
|
|
44
61
|
error: null,
|
|
@@ -73,7 +90,7 @@ function useChat(threadId, options = {}) {
|
|
|
73
90
|
},
|
|
74
91
|
[client, options.enableReturnStateWhenStreamCompleted]
|
|
75
92
|
);
|
|
76
|
-
|
|
93
|
+
useEffect2(() => {
|
|
77
94
|
if (options.initialMessages && options.initialMessages.length > 0) {
|
|
78
95
|
chunkMessageMerger.current.initialMessages(options.initialMessages);
|
|
79
96
|
}
|
|
@@ -120,7 +137,7 @@ function useChat(threadId, options = {}) {
|
|
|
120
137
|
stopStreamingRef.current = null;
|
|
121
138
|
}
|
|
122
139
|
const { input, command, streaming = true } = data;
|
|
123
|
-
const { message:
|
|
140
|
+
const { message: message4, files, ...rest } = input || {};
|
|
124
141
|
setState((prev) => ({
|
|
125
142
|
...prev,
|
|
126
143
|
isLoading: true,
|
|
@@ -129,7 +146,7 @@ function useChat(threadId, options = {}) {
|
|
|
129
146
|
}));
|
|
130
147
|
const userMessage = {
|
|
131
148
|
id: Date.now().toString(),
|
|
132
|
-
content:
|
|
149
|
+
content: message4 || command?.resume?.message || "",
|
|
133
150
|
files,
|
|
134
151
|
role: "human"
|
|
135
152
|
};
|
|
@@ -318,7 +335,7 @@ function useChat(threadId, options = {}) {
|
|
|
318
335
|
error: null
|
|
319
336
|
}));
|
|
320
337
|
}, []);
|
|
321
|
-
|
|
338
|
+
useEffect2(() => {
|
|
322
339
|
if (threadId) {
|
|
323
340
|
loadMessages();
|
|
324
341
|
} else {
|
|
@@ -341,71 +358,286 @@ function useChat(threadId, options = {}) {
|
|
|
341
358
|
};
|
|
342
359
|
}
|
|
343
360
|
|
|
344
|
-
// src/
|
|
345
|
-
import {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
361
|
+
// src/context/AgentThreadContext.tsx
|
|
362
|
+
import {
|
|
363
|
+
createContext as createContext2,
|
|
364
|
+
useContext as useContext2,
|
|
365
|
+
useState as useState3,
|
|
366
|
+
useCallback as useCallback2,
|
|
367
|
+
useEffect as useEffect3,
|
|
368
|
+
useRef as useRef2
|
|
369
|
+
} from "react";
|
|
370
|
+
import { createSimpleMessageMerger as createSimpleMessageMerger2 } from "@axiom-lattice/client-sdk";
|
|
371
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
372
|
+
var AgentThreadContext = createContext2(
|
|
373
|
+
null
|
|
374
|
+
);
|
|
375
|
+
function AgentThreadProvider({
|
|
376
|
+
threadId,
|
|
377
|
+
assistantId,
|
|
378
|
+
options = {},
|
|
379
|
+
children
|
|
380
|
+
}) {
|
|
381
|
+
const client = useAxiomLattice({ assistantId });
|
|
382
|
+
const { assistantId: clientAssistantId, tenantId } = client;
|
|
383
|
+
if (!threadId) {
|
|
384
|
+
return null;
|
|
385
|
+
}
|
|
386
|
+
const [state, setState] = useState3({
|
|
387
|
+
assistantId: clientAssistantId,
|
|
388
|
+
tenantId,
|
|
389
|
+
threadId,
|
|
390
|
+
messages: options.initialMessages || [],
|
|
351
391
|
isLoading: false,
|
|
352
|
-
error: null
|
|
392
|
+
error: null,
|
|
393
|
+
streamingMessage: null,
|
|
394
|
+
interrupts: void 0,
|
|
395
|
+
agentState: null
|
|
353
396
|
});
|
|
354
|
-
const
|
|
355
|
-
|
|
356
|
-
|
|
397
|
+
const stopStreamingRef = useRef2(null);
|
|
398
|
+
const chunkMessageMerger = useRef2(createSimpleMessageMerger2());
|
|
399
|
+
const fetchAndUpdateAgentState = useCallback2(
|
|
400
|
+
async (threadId2) => {
|
|
401
|
+
if (!options.enableReturnStateWhenStreamCompleted) return;
|
|
357
402
|
try {
|
|
358
|
-
const
|
|
359
|
-
const thread = await client.getThread(threadId);
|
|
403
|
+
const agentState = await client.getAgentState(threadId2);
|
|
360
404
|
setState((prev) => ({
|
|
361
405
|
...prev,
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
406
|
+
agentState,
|
|
407
|
+
interrupts: agentState?.tasks?.flatMap((task) => {
|
|
408
|
+
return task.interrupts.map((interrupt) => {
|
|
409
|
+
return {
|
|
410
|
+
id: interrupt.id,
|
|
411
|
+
value: interrupt.value,
|
|
412
|
+
role: "ai",
|
|
413
|
+
type: "interrupt"
|
|
414
|
+
};
|
|
415
|
+
});
|
|
416
|
+
})
|
|
365
417
|
}));
|
|
366
|
-
return threadId;
|
|
367
418
|
} catch (error) {
|
|
368
|
-
|
|
369
|
-
...prev,
|
|
370
|
-
isLoading: false,
|
|
371
|
-
error: error instanceof Error ? error : new Error(String(error))
|
|
372
|
-
}));
|
|
373
|
-
throw error;
|
|
419
|
+
console.warn("Failed to fetch agent state:", error);
|
|
374
420
|
}
|
|
375
421
|
},
|
|
376
|
-
[client]
|
|
422
|
+
[client, options.enableReturnStateWhenStreamCompleted]
|
|
377
423
|
);
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
424
|
+
useEffect3(() => {
|
|
425
|
+
if (options.initialMessages && options.initialMessages.length > 0) {
|
|
426
|
+
chunkMessageMerger.current.initialMessages(options.initialMessages);
|
|
427
|
+
}
|
|
428
|
+
}, [options.initialMessages]);
|
|
429
|
+
const handleStreamEvent = useCallback2(
|
|
430
|
+
(chunk) => {
|
|
431
|
+
let interrupt;
|
|
432
|
+
if (chunk.type === "interrupt") {
|
|
433
|
+
interrupt = chunk;
|
|
434
|
+
} else {
|
|
435
|
+
chunkMessageMerger.current.push(chunk);
|
|
436
|
+
}
|
|
437
|
+
let todos;
|
|
438
|
+
if (chunk.type === "tool" && chunk.data && typeof chunk.data.content === "string" && chunk.data.content.startsWith("```todo_list")) {
|
|
439
|
+
try {
|
|
440
|
+
const content = chunk.data.content;
|
|
441
|
+
const match = content.match(/```todo_list\s*([\s\S]*?)\s*```/);
|
|
442
|
+
if (match && match[1]) {
|
|
443
|
+
todos = JSON.parse(match[1]);
|
|
444
|
+
}
|
|
445
|
+
} catch (e) {
|
|
446
|
+
console.error("Failed to parse todo list from chunk", e);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
const updatedMessages = chunkMessageMerger.current.getMessages();
|
|
450
|
+
setState((prev) => ({
|
|
451
|
+
...prev,
|
|
452
|
+
todos: todos || prev.todos,
|
|
453
|
+
messages: updatedMessages,
|
|
454
|
+
isLoading: true,
|
|
455
|
+
streamingMessage: null
|
|
456
|
+
}));
|
|
457
|
+
},
|
|
458
|
+
[]
|
|
459
|
+
);
|
|
460
|
+
const sendMessage = useCallback2(
|
|
461
|
+
async (data) => {
|
|
462
|
+
if (!threadId) {
|
|
463
|
+
throw new Error("Thread ID is required to send messages");
|
|
464
|
+
}
|
|
465
|
+
if (stopStreamingRef.current) {
|
|
466
|
+
stopStreamingRef.current();
|
|
467
|
+
stopStreamingRef.current = null;
|
|
468
|
+
}
|
|
469
|
+
const { input, command, streaming = true } = data;
|
|
470
|
+
const { message: message4, files, ...rest } = input || {};
|
|
471
|
+
setState((prev) => ({
|
|
472
|
+
...prev,
|
|
473
|
+
isLoading: true,
|
|
474
|
+
error: null,
|
|
475
|
+
streamingMessage: null
|
|
476
|
+
}));
|
|
477
|
+
const userMessage = {
|
|
478
|
+
id: Date.now().toString(),
|
|
479
|
+
content: message4 || command?.resume?.message || "",
|
|
480
|
+
files,
|
|
481
|
+
role: "human"
|
|
482
|
+
};
|
|
483
|
+
chunkMessageMerger.current.push({
|
|
484
|
+
type: "human",
|
|
485
|
+
data: {
|
|
486
|
+
id: userMessage.id,
|
|
487
|
+
content: userMessage.content
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
setState((prev) => ({
|
|
491
|
+
...prev,
|
|
492
|
+
messages: chunkMessageMerger.current.getMessages()
|
|
493
|
+
}));
|
|
381
494
|
try {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
495
|
+
if (options.streaming !== false && streaming !== false) {
|
|
496
|
+
const stopStreaming2 = client.chat.stream(
|
|
497
|
+
{
|
|
498
|
+
threadId,
|
|
499
|
+
messages: [userMessage],
|
|
500
|
+
command,
|
|
501
|
+
...rest
|
|
502
|
+
},
|
|
503
|
+
(chunk) => handleStreamEvent(chunk),
|
|
504
|
+
async () => {
|
|
505
|
+
setState((prev) => ({
|
|
506
|
+
...prev,
|
|
507
|
+
isLoading: false
|
|
508
|
+
}));
|
|
509
|
+
if (options.enableReturnStateWhenStreamCompleted) {
|
|
510
|
+
await fetchAndUpdateAgentState(threadId);
|
|
511
|
+
}
|
|
512
|
+
stopStreamingRef.current = null;
|
|
513
|
+
},
|
|
514
|
+
(error) => {
|
|
515
|
+
setState((prev) => ({
|
|
516
|
+
...prev,
|
|
517
|
+
isLoading: false,
|
|
518
|
+
error,
|
|
519
|
+
streamingMessage: null
|
|
520
|
+
}));
|
|
521
|
+
stopStreamingRef.current = null;
|
|
522
|
+
}
|
|
523
|
+
);
|
|
524
|
+
stopStreamingRef.current = stopStreaming2;
|
|
525
|
+
} else {
|
|
526
|
+
const response = await client.chat.send({
|
|
527
|
+
threadId,
|
|
528
|
+
messages: [userMessage],
|
|
529
|
+
command,
|
|
530
|
+
...rest
|
|
531
|
+
});
|
|
532
|
+
chunkMessageMerger.current.initialMessages(response.messages);
|
|
533
|
+
setState((prev) => ({
|
|
534
|
+
...prev,
|
|
535
|
+
messages: chunkMessageMerger.current.getMessages(),
|
|
536
|
+
isLoading: false
|
|
537
|
+
}));
|
|
538
|
+
}
|
|
388
539
|
} catch (error) {
|
|
389
540
|
setState((prev) => ({
|
|
390
541
|
...prev,
|
|
391
542
|
isLoading: false,
|
|
392
543
|
error: error instanceof Error ? error : new Error(String(error))
|
|
393
544
|
}));
|
|
394
|
-
throw error;
|
|
395
545
|
}
|
|
396
546
|
},
|
|
397
|
-
[
|
|
547
|
+
[
|
|
548
|
+
client,
|
|
549
|
+
threadId,
|
|
550
|
+
options.streaming,
|
|
551
|
+
options.enableReturnStateWhenStreamCompleted,
|
|
552
|
+
handleStreamEvent,
|
|
553
|
+
fetchAndUpdateAgentState
|
|
554
|
+
]
|
|
398
555
|
);
|
|
399
|
-
const
|
|
400
|
-
|
|
556
|
+
const stopStreaming = useCallback2(() => {
|
|
557
|
+
if (stopStreamingRef.current) {
|
|
558
|
+
stopStreamingRef.current();
|
|
559
|
+
stopStreamingRef.current = null;
|
|
560
|
+
const currentMessages = chunkMessageMerger.current.getMessages().map((msg) => ({
|
|
561
|
+
id: msg.id,
|
|
562
|
+
role: msg.role === "ai" ? "assistant" : msg.role === "human" ? "user" : msg.role === "system" ? "system" : "tool",
|
|
563
|
+
content: typeof msg.content === "string" ? msg.content : JSON.stringify(msg.content || ""),
|
|
564
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
565
|
+
}));
|
|
566
|
+
setState((prev) => ({
|
|
567
|
+
...prev,
|
|
568
|
+
messages: currentMessages,
|
|
569
|
+
isLoading: false,
|
|
570
|
+
streamingMessage: null
|
|
571
|
+
}));
|
|
572
|
+
}
|
|
573
|
+
}, []);
|
|
574
|
+
const loadMessages = useCallback2(
|
|
575
|
+
async (limit) => {
|
|
576
|
+
if (!threadId) {
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
if (stopStreamingRef.current) {
|
|
580
|
+
stopStreamingRef.current();
|
|
581
|
+
stopStreamingRef.current = null;
|
|
582
|
+
}
|
|
401
583
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
402
584
|
try {
|
|
403
|
-
const
|
|
585
|
+
const agentState = await client.getAgentState(threadId);
|
|
586
|
+
const interrupts = agentState?.tasks?.flatMap(
|
|
587
|
+
(task) => {
|
|
588
|
+
return task.interrupts.map((interrupt) => {
|
|
589
|
+
return {
|
|
590
|
+
id: interrupt.id,
|
|
591
|
+
value: interrupt.value,
|
|
592
|
+
role: "ai",
|
|
593
|
+
type: "interrupt"
|
|
594
|
+
};
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
);
|
|
598
|
+
const fetchedMessages = await client.getMessages({ threadId });
|
|
599
|
+
chunkMessageMerger.current.reset();
|
|
600
|
+
chunkMessageMerger.current.initialMessages(fetchedMessages);
|
|
404
601
|
setState((prev) => ({
|
|
405
602
|
...prev,
|
|
406
|
-
|
|
603
|
+
agentState,
|
|
604
|
+
interrupts,
|
|
605
|
+
todos: agentState?.values?.todos,
|
|
606
|
+
messages: chunkMessageMerger.current.getMessages(),
|
|
407
607
|
isLoading: false
|
|
408
608
|
}));
|
|
609
|
+
if (options.enableResumeStream && fetchedMessages.length > 0) {
|
|
610
|
+
const lastMessage = fetchedMessages[fetchedMessages.length - 1];
|
|
611
|
+
chunkMessageMerger.current.removeMessageById(lastMessage.id);
|
|
612
|
+
const stopResumeStream = client.resumeStream(
|
|
613
|
+
{
|
|
614
|
+
threadId,
|
|
615
|
+
messageId: lastMessage.id,
|
|
616
|
+
knownContent: "",
|
|
617
|
+
pollInterval: options.resumeStreamPollInterval || 100
|
|
618
|
+
},
|
|
619
|
+
handleStreamEvent,
|
|
620
|
+
async () => {
|
|
621
|
+
setState((prev) => ({
|
|
622
|
+
...prev,
|
|
623
|
+
isLoading: false
|
|
624
|
+
}));
|
|
625
|
+
if (options.enableReturnStateWhenStreamCompleted) {
|
|
626
|
+
await fetchAndUpdateAgentState(threadId);
|
|
627
|
+
}
|
|
628
|
+
stopStreamingRef.current = null;
|
|
629
|
+
},
|
|
630
|
+
(error) => {
|
|
631
|
+
console.error("Resume stream error:", error);
|
|
632
|
+
setState((prev) => ({
|
|
633
|
+
...prev,
|
|
634
|
+
error
|
|
635
|
+
}));
|
|
636
|
+
stopStreamingRef.current = null;
|
|
637
|
+
}
|
|
638
|
+
);
|
|
639
|
+
stopStreamingRef.current = stopResumeStream;
|
|
640
|
+
}
|
|
409
641
|
} catch (error) {
|
|
410
642
|
setState((prev) => ({
|
|
411
643
|
...prev,
|
|
@@ -414,10 +646,153 @@ function useThread() {
|
|
|
414
646
|
}));
|
|
415
647
|
}
|
|
416
648
|
},
|
|
417
|
-
[
|
|
649
|
+
[
|
|
650
|
+
client,
|
|
651
|
+
threadId,
|
|
652
|
+
options.enableResumeStream,
|
|
653
|
+
options.resumeStreamPollInterval,
|
|
654
|
+
handleStreamEvent,
|
|
655
|
+
fetchAndUpdateAgentState
|
|
656
|
+
]
|
|
418
657
|
);
|
|
419
|
-
const
|
|
420
|
-
|
|
658
|
+
const clearMessages = useCallback2(() => {
|
|
659
|
+
chunkMessageMerger.current.reset();
|
|
660
|
+
setState((prev) => ({
|
|
661
|
+
...prev,
|
|
662
|
+
messages: [],
|
|
663
|
+
interrupts: void 0,
|
|
664
|
+
streamingMessage: null
|
|
665
|
+
}));
|
|
666
|
+
}, []);
|
|
667
|
+
const clearError = useCallback2(() => {
|
|
668
|
+
setState((prev) => ({
|
|
669
|
+
...prev,
|
|
670
|
+
error: null
|
|
671
|
+
}));
|
|
672
|
+
}, []);
|
|
673
|
+
useEffect3(() => {
|
|
674
|
+
if (threadId) {
|
|
675
|
+
loadMessages();
|
|
676
|
+
} else {
|
|
677
|
+
clearMessages();
|
|
678
|
+
}
|
|
679
|
+
return () => {
|
|
680
|
+
if (stopStreamingRef.current) {
|
|
681
|
+
stopStreamingRef.current();
|
|
682
|
+
stopStreamingRef.current = null;
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
}, [threadId, loadMessages, clearMessages]);
|
|
686
|
+
const value = {
|
|
687
|
+
state,
|
|
688
|
+
sendMessage,
|
|
689
|
+
stopStreaming,
|
|
690
|
+
loadMessages,
|
|
691
|
+
clearMessages,
|
|
692
|
+
clearError
|
|
693
|
+
};
|
|
694
|
+
return /* @__PURE__ */ jsx2(AgentThreadContext.Provider, { value, children });
|
|
695
|
+
}
|
|
696
|
+
function useAgentThreadContext() {
|
|
697
|
+
const context = useContext2(AgentThreadContext);
|
|
698
|
+
if (!context) {
|
|
699
|
+
throw new Error(
|
|
700
|
+
"useAgentThreadContext must be used within an AgentThreadProvider"
|
|
701
|
+
);
|
|
702
|
+
}
|
|
703
|
+
return context;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
// src/hooks/useAgentChat.ts
|
|
707
|
+
function useAgentChat(options) {
|
|
708
|
+
const context = useAgentThreadContext();
|
|
709
|
+
return {
|
|
710
|
+
...context.state,
|
|
711
|
+
sendMessage: context.sendMessage,
|
|
712
|
+
stopStreaming: context.stopStreaming,
|
|
713
|
+
loadMessages: context.loadMessages,
|
|
714
|
+
clearMessages: context.clearMessages,
|
|
715
|
+
clearError: context.clearError
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
// src/hooks/useThread.ts
|
|
720
|
+
import { useState as useState4, useCallback as useCallback3 } from "react";
|
|
721
|
+
function useThread() {
|
|
722
|
+
const client = useAxiomLattice();
|
|
723
|
+
const [state, setState] = useState4({
|
|
724
|
+
threads: [],
|
|
725
|
+
currentThread: null,
|
|
726
|
+
isLoading: false,
|
|
727
|
+
error: null
|
|
728
|
+
});
|
|
729
|
+
const createThread = useCallback3(
|
|
730
|
+
async (options = {}) => {
|
|
731
|
+
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
732
|
+
try {
|
|
733
|
+
const threadId = await client.createThread(options);
|
|
734
|
+
const thread = await client.getThread(threadId);
|
|
735
|
+
setState((prev) => ({
|
|
736
|
+
...prev,
|
|
737
|
+
threads: [...prev.threads, thread],
|
|
738
|
+
currentThread: thread,
|
|
739
|
+
isLoading: false
|
|
740
|
+
}));
|
|
741
|
+
return threadId;
|
|
742
|
+
} catch (error) {
|
|
743
|
+
setState((prev) => ({
|
|
744
|
+
...prev,
|
|
745
|
+
isLoading: false,
|
|
746
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
747
|
+
}));
|
|
748
|
+
throw error;
|
|
749
|
+
}
|
|
750
|
+
},
|
|
751
|
+
[client]
|
|
752
|
+
);
|
|
753
|
+
const getThread = useCallback3(
|
|
754
|
+
async (threadId) => {
|
|
755
|
+
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
756
|
+
try {
|
|
757
|
+
const thread = await client.getThread(threadId);
|
|
758
|
+
setState((prev) => ({
|
|
759
|
+
...prev,
|
|
760
|
+
isLoading: false
|
|
761
|
+
}));
|
|
762
|
+
return thread;
|
|
763
|
+
} catch (error) {
|
|
764
|
+
setState((prev) => ({
|
|
765
|
+
...prev,
|
|
766
|
+
isLoading: false,
|
|
767
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
768
|
+
}));
|
|
769
|
+
throw error;
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
[client]
|
|
773
|
+
);
|
|
774
|
+
const listThreads = useCallback3(
|
|
775
|
+
async (limit, offset) => {
|
|
776
|
+
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
777
|
+
try {
|
|
778
|
+
const threads = await client.listThreads({ limit, offset });
|
|
779
|
+
setState((prev) => ({
|
|
780
|
+
...prev,
|
|
781
|
+
threads,
|
|
782
|
+
isLoading: false
|
|
783
|
+
}));
|
|
784
|
+
} catch (error) {
|
|
785
|
+
setState((prev) => ({
|
|
786
|
+
...prev,
|
|
787
|
+
isLoading: false,
|
|
788
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
789
|
+
}));
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
[client]
|
|
793
|
+
);
|
|
794
|
+
const deleteThread = useCallback3(
|
|
795
|
+
async (threadId) => {
|
|
421
796
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
422
797
|
try {
|
|
423
798
|
await client.deleteThread(threadId);
|
|
@@ -438,7 +813,7 @@ function useThread() {
|
|
|
438
813
|
},
|
|
439
814
|
[client]
|
|
440
815
|
);
|
|
441
|
-
const selectThread =
|
|
816
|
+
const selectThread = useCallback3(
|
|
442
817
|
async (threadId) => {
|
|
443
818
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
444
819
|
try {
|
|
@@ -470,20 +845,20 @@ function useThread() {
|
|
|
470
845
|
}
|
|
471
846
|
|
|
472
847
|
// src/hooks/useAgentState.ts
|
|
473
|
-
import { useState as
|
|
848
|
+
import { useState as useState5, useCallback as useCallback4, useEffect as useEffect5, useRef as useRef3 } from "react";
|
|
474
849
|
function useAgentState(threadId, options = {}) {
|
|
475
850
|
const client = useAxiomLattice();
|
|
476
|
-
const [agentState, setAgentState] =
|
|
477
|
-
const [isLoading, setIsLoading] =
|
|
478
|
-
const [error, setError] =
|
|
479
|
-
const pollingIntervalRef =
|
|
480
|
-
const pollingTimeoutRef =
|
|
851
|
+
const [agentState, setAgentState] = useState5(null);
|
|
852
|
+
const [isLoading, setIsLoading] = useState5(false);
|
|
853
|
+
const [error, setError] = useState5(null);
|
|
854
|
+
const pollingIntervalRef = useRef3(null);
|
|
855
|
+
const pollingTimeoutRef = useRef3(null);
|
|
481
856
|
const {
|
|
482
857
|
pollingInterval = 2e3,
|
|
483
858
|
// 2 seconds by default
|
|
484
859
|
autoStart = true
|
|
485
860
|
} = options;
|
|
486
|
-
const fetchAgentState =
|
|
861
|
+
const fetchAgentState = useCallback4(async () => {
|
|
487
862
|
if (!threadId) {
|
|
488
863
|
return;
|
|
489
864
|
}
|
|
@@ -498,7 +873,7 @@ function useAgentState(threadId, options = {}) {
|
|
|
498
873
|
setIsLoading(false);
|
|
499
874
|
}
|
|
500
875
|
}, [client, threadId]);
|
|
501
|
-
const startPolling =
|
|
876
|
+
const startPolling = useCallback4(() => {
|
|
502
877
|
if (!threadId) {
|
|
503
878
|
return;
|
|
504
879
|
}
|
|
@@ -519,17 +894,17 @@ function useAgentState(threadId, options = {}) {
|
|
|
519
894
|
};
|
|
520
895
|
poll();
|
|
521
896
|
}, [threadId, pollingInterval, fetchAgentState]);
|
|
522
|
-
const stopPolling =
|
|
897
|
+
const stopPolling = useCallback4(() => {
|
|
523
898
|
pollingIntervalRef.current = null;
|
|
524
899
|
if (pollingTimeoutRef.current) {
|
|
525
900
|
clearTimeout(pollingTimeoutRef.current);
|
|
526
901
|
pollingTimeoutRef.current = null;
|
|
527
902
|
}
|
|
528
903
|
}, []);
|
|
529
|
-
const refresh =
|
|
904
|
+
const refresh = useCallback4(async () => {
|
|
530
905
|
await fetchAgentState();
|
|
531
906
|
}, [fetchAgentState]);
|
|
532
|
-
|
|
907
|
+
useEffect5(() => {
|
|
533
908
|
if (threadId && autoStart) {
|
|
534
909
|
startPolling();
|
|
535
910
|
} else {
|
|
@@ -550,13 +925,13 @@ function useAgentState(threadId, options = {}) {
|
|
|
550
925
|
}
|
|
551
926
|
|
|
552
927
|
// src/hooks/useAgentGraph.ts
|
|
553
|
-
import { useState as
|
|
928
|
+
import { useState as useState6, useCallback as useCallback5 } from "react";
|
|
554
929
|
function useAgentGraph() {
|
|
555
930
|
const client = useAxiomLattice();
|
|
556
|
-
const [graphImage, setGraphImage] =
|
|
557
|
-
const [isLoading, setIsLoading] =
|
|
558
|
-
const [error, setError] =
|
|
559
|
-
const fetchGraph =
|
|
931
|
+
const [graphImage, setGraphImage] = useState6(null);
|
|
932
|
+
const [isLoading, setIsLoading] = useState6(false);
|
|
933
|
+
const [error, setError] = useState6(null);
|
|
934
|
+
const fetchGraph = useCallback5(async () => {
|
|
560
935
|
setIsLoading(true);
|
|
561
936
|
setError(null);
|
|
562
937
|
try {
|
|
@@ -579,167 +954,793 @@ function useAgentGraph() {
|
|
|
579
954
|
// src/index.ts
|
|
580
955
|
export * from "@axiom-lattice/protocols";
|
|
581
956
|
|
|
582
|
-
// src/components/
|
|
583
|
-
import
|
|
584
|
-
import {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
957
|
+
// src/components/Chat/ChatUIContext.tsx
|
|
958
|
+
import { createContext as createContext3, useCallback as useCallback6, useContext as useContext3, useState as useState7 } from "react";
|
|
959
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
960
|
+
var ChatUIContext = createContext3({
|
|
961
|
+
sideAppVisible: false,
|
|
962
|
+
setSideAppVisible: () => {
|
|
963
|
+
},
|
|
964
|
+
sideAppSize: "large",
|
|
965
|
+
setSideAppSize: () => {
|
|
966
|
+
},
|
|
967
|
+
sideAppSelectedCard: null,
|
|
968
|
+
setSideAppSelectedCard: () => {
|
|
969
|
+
},
|
|
970
|
+
openSideApp: () => {
|
|
971
|
+
},
|
|
972
|
+
closeSideApp: () => {
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
var ChatUIContextProvider = ({
|
|
976
|
+
children
|
|
600
977
|
}) => {
|
|
601
|
-
const
|
|
602
|
-
const [
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
978
|
+
const [sideAppVisible, setSideAppVisible] = useState7(false);
|
|
979
|
+
const [sideAppSize, setSideAppSize] = useState7("large");
|
|
980
|
+
const [sideAppSelectedCard, setSideAppSelectedCard] = useState7(null);
|
|
981
|
+
const openSideApp = useCallback6(
|
|
982
|
+
(card) => {
|
|
983
|
+
setSideAppSelectedCard(card);
|
|
984
|
+
setSideAppVisible(true);
|
|
985
|
+
},
|
|
986
|
+
[setSideAppSelectedCard, setSideAppVisible]
|
|
987
|
+
);
|
|
988
|
+
const closeSideApp = useCallback6(() => {
|
|
989
|
+
setSideAppSelectedCard(null);
|
|
990
|
+
setSideAppVisible(false);
|
|
991
|
+
}, [setSideAppSelectedCard, setSideAppVisible]);
|
|
992
|
+
return /* @__PURE__ */ jsx3(
|
|
993
|
+
ChatUIContext.Provider,
|
|
994
|
+
{
|
|
995
|
+
value: {
|
|
996
|
+
sideAppVisible,
|
|
997
|
+
setSideAppVisible,
|
|
998
|
+
sideAppSize,
|
|
999
|
+
setSideAppSize,
|
|
1000
|
+
sideAppSelectedCard,
|
|
1001
|
+
setSideAppSelectedCard,
|
|
1002
|
+
openSideApp,
|
|
1003
|
+
closeSideApp
|
|
622
1004
|
},
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
style: {
|
|
630
|
-
border: feedback?.data?.action === "yes" ? "2px dashed rgb(74 73 77)" : "none"
|
|
631
|
-
},
|
|
632
|
-
type: "primary",
|
|
633
|
-
onClick: () => {
|
|
634
|
-
setClicked(true);
|
|
635
|
-
eventHandler(
|
|
636
|
-
"confirm_feedback",
|
|
637
|
-
{
|
|
638
|
-
action: "yes",
|
|
639
|
-
config
|
|
640
|
-
},
|
|
641
|
-
"\u786E\u8BA4"
|
|
642
|
-
);
|
|
643
|
-
},
|
|
644
|
-
children: "\u786E\u8BA4"
|
|
645
|
-
}
|
|
646
|
-
),
|
|
647
|
-
/* @__PURE__ */ jsx2(
|
|
648
|
-
Button,
|
|
649
|
-
{
|
|
650
|
-
disabled: !interactive || clicked || feedback,
|
|
651
|
-
type: "default",
|
|
652
|
-
style: {
|
|
653
|
-
border: feedback?.data?.action === "no" ? "2px dashed rgb(74 73 77)" : "none"
|
|
654
|
-
},
|
|
655
|
-
onClick: () => {
|
|
656
|
-
setClicked(true);
|
|
657
|
-
eventHandler(
|
|
658
|
-
"confirm_feedback",
|
|
659
|
-
{
|
|
660
|
-
action: "no",
|
|
661
|
-
config
|
|
662
|
-
},
|
|
663
|
-
"\u62D2\u7EDD"
|
|
664
|
-
);
|
|
665
|
-
},
|
|
666
|
-
children: "\u62D2\u7EDD"
|
|
667
|
-
}
|
|
668
|
-
)
|
|
669
|
-
] })
|
|
670
|
-
] });
|
|
1005
|
+
children
|
|
1006
|
+
}
|
|
1007
|
+
);
|
|
1008
|
+
};
|
|
1009
|
+
var useChatUIContext = () => {
|
|
1010
|
+
return useContext3(ChatUIContext);
|
|
671
1011
|
};
|
|
672
1012
|
|
|
673
|
-
// src/components/
|
|
674
|
-
import {
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
1013
|
+
// src/components/Chat/useStyle.tsx
|
|
1014
|
+
import { createStyles } from "antd-style";
|
|
1015
|
+
var useStyle = createStyles(({ token, css }) => {
|
|
1016
|
+
return {
|
|
1017
|
+
layout: css`
|
|
1018
|
+
width: 100%;
|
|
1019
|
+
/* min-width: 1000px; */
|
|
1020
|
+
height: 100%;
|
|
1021
|
+
border-radius: ${token.borderRadius}px;
|
|
1022
|
+
display: flex;
|
|
1023
|
+
background: ${token.colorBgLayout}95;
|
|
1024
|
+
font-family: ${token.fontFamily}, sans-serif;
|
|
1025
|
+
position: relative;
|
|
1026
|
+
overflow: hidden;
|
|
1027
|
+
padding: 16px;
|
|
1028
|
+
padding-top: 2px;
|
|
1029
|
+
gap: 16px;
|
|
1030
|
+
|
|
1031
|
+
.ant-prompts {
|
|
1032
|
+
color: ${token.colorText};
|
|
1033
|
+
}
|
|
1034
|
+
`,
|
|
1035
|
+
menu: css`
|
|
1036
|
+
background: ${token.colorBgContainer}90;
|
|
1037
|
+
width: 280px;
|
|
1038
|
+
display: flex;
|
|
1039
|
+
flex-direction: column;
|
|
1040
|
+
flex-shrink: 0;
|
|
1041
|
+
transition: all 0.3s ease;
|
|
1042
|
+
overflow: hidden;
|
|
1043
|
+
position: relative;
|
|
1044
|
+
border-radius: ${token.borderRadiusLG}px;
|
|
1045
|
+
box-shadow: ${token.boxShadow};
|
|
1046
|
+
|
|
1047
|
+
&.open {
|
|
1048
|
+
background: transparent;
|
|
1049
|
+
box-shadow: none;
|
|
1050
|
+
margin-left: -16px;
|
|
1051
|
+
height: 100%;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
&.collapsed {
|
|
1055
|
+
width: 64px;
|
|
1056
|
+
height: fit-content;
|
|
1057
|
+
border-radius: 32px;
|
|
1058
|
+
.ant-conversations {
|
|
1059
|
+
width: 64px;
|
|
712
1060
|
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
if (value === null || value === void 0) {
|
|
717
|
-
return "-";
|
|
1061
|
+
|
|
1062
|
+
.ant-conversations-list {
|
|
1063
|
+
display: none !important;
|
|
718
1064
|
}
|
|
719
|
-
|
|
720
|
-
|
|
1065
|
+
|
|
1066
|
+
.btn-text {
|
|
1067
|
+
display: none !important;
|
|
721
1068
|
}
|
|
722
|
-
return String(value);
|
|
723
1069
|
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
1070
|
+
`,
|
|
1071
|
+
menuToggle: css`
|
|
1072
|
+
position: relative;
|
|
1073
|
+
bottom: 20px;
|
|
1074
|
+
left: 24px;
|
|
1075
|
+
z-index: 1;
|
|
1076
|
+
|
|
1077
|
+
&.collapsed {
|
|
1078
|
+
left: 16px;
|
|
1079
|
+
}
|
|
1080
|
+
`,
|
|
1081
|
+
logoutBtn: css`
|
|
1082
|
+
position: absolute;
|
|
1083
|
+
bottom: 32px;
|
|
1084
|
+
left: 24px;
|
|
1085
|
+
z-index: 1;
|
|
1086
|
+
color: ${token.colorTextSecondary};
|
|
1087
|
+
|
|
1088
|
+
&:hover {
|
|
1089
|
+
color: ${token.colorError};
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
&.collapsed {
|
|
1093
|
+
left: 16px;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
.btn-text {
|
|
1097
|
+
margin-left: 8px;
|
|
1098
|
+
transition: opacity 0.3s ease, width 0.3s ease;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
&.collapsed .btn-text {
|
|
1102
|
+
display: none;
|
|
1103
|
+
}
|
|
1104
|
+
`,
|
|
1105
|
+
conversations: css`
|
|
1106
|
+
padding: 0 12px;
|
|
1107
|
+
flex: 1;
|
|
1108
|
+
overflow-y: auto;
|
|
1109
|
+
transition: padding 0.3s ease;
|
|
1110
|
+
|
|
1111
|
+
.collapsed & {
|
|
1112
|
+
padding: 0 4px;
|
|
1113
|
+
}
|
|
1114
|
+
`,
|
|
1115
|
+
mainContent: css`
|
|
1116
|
+
min-width: 320px;
|
|
1117
|
+
flex: 1;
|
|
1118
|
+
display: flex;
|
|
1119
|
+
position: relative;
|
|
1120
|
+
overflow: hidden;
|
|
1121
|
+
gap: 16px;
|
|
1122
|
+
justify-content: center;
|
|
1123
|
+
&.open {
|
|
1124
|
+
box-shadow: ${token.boxShadow};
|
|
1125
|
+
background: ${token.colorBgContainer}90;
|
|
1126
|
+
margin-left: 0px;
|
|
1127
|
+
}
|
|
1128
|
+
border-radius: ${token.borderRadiusLG}px;
|
|
1129
|
+
.ant-bubble-content {
|
|
1130
|
+
.ant-card {
|
|
1131
|
+
background: #ffffff4f;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
pre {
|
|
1136
|
+
white-space: pre-wrap;
|
|
1137
|
+
word-break: break-all;
|
|
1138
|
+
}
|
|
1139
|
+
`,
|
|
1140
|
+
chat: css`
|
|
1141
|
+
width: 100%;
|
|
1142
|
+
max-width: 1000px;
|
|
1143
|
+
box-sizing: border-box;
|
|
1144
|
+
display: flex;
|
|
1145
|
+
flex-direction: column;
|
|
1146
|
+
padding: ${token.paddingXS}px;
|
|
1147
|
+
gap: 0px;
|
|
1148
|
+
transition: all 0.3s ease;
|
|
1149
|
+
flex-shrink: 0;
|
|
1150
|
+
|
|
1151
|
+
&.drawer-open {
|
|
1152
|
+
min-width: 200px;
|
|
1153
|
+
max-width: 466px;
|
|
1154
|
+
}
|
|
1155
|
+
`,
|
|
1156
|
+
detailPanel: css`
|
|
1157
|
+
display: flex;
|
|
1158
|
+
flex-direction: column;
|
|
1159
|
+
width: 0;
|
|
1160
|
+
background: ${token.colorBgContainer}90;
|
|
1161
|
+
|
|
1162
|
+
transition: all 0.3s ease;
|
|
1163
|
+
overflow: hidden;
|
|
1164
|
+
flex-shrink: 0;
|
|
1165
|
+
border-radius: ${token.borderRadiusLG}px;
|
|
1166
|
+
|
|
1167
|
+
&.open {
|
|
1168
|
+
width: 66%;
|
|
1169
|
+
box-shadow: ${token.boxShadow};
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
&.small {
|
|
1173
|
+
width: 22%;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
&.middle {
|
|
1177
|
+
width: 44%;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
&.large {
|
|
1181
|
+
width: 66%;
|
|
1182
|
+
}
|
|
1183
|
+
&.full {
|
|
1184
|
+
width: 98%;
|
|
1185
|
+
position: absolute;
|
|
1186
|
+
background-color: rgba(255, 255, 255, 0.7);
|
|
1187
|
+
backdrop-filter: blur(10px);
|
|
1188
|
+
-webkit-backdrop-filter: blur(10px);
|
|
1189
|
+
//border: 1px solid rgba(255, 255, 255, 0.2);
|
|
1190
|
+
z-index: 10;
|
|
1191
|
+
bottom: 16px;
|
|
1192
|
+
top: 2px;
|
|
1193
|
+
}
|
|
1194
|
+
`,
|
|
1195
|
+
detailContent: css`
|
|
1196
|
+
padding: 8px 8px;
|
|
1197
|
+
height: 100%;
|
|
1198
|
+
flex: 1;
|
|
1199
|
+
overflow: hidden;
|
|
1200
|
+
pre {
|
|
1201
|
+
white-space: pre-wrap;
|
|
1202
|
+
word-break: break-all;
|
|
1203
|
+
}
|
|
1204
|
+
`,
|
|
1205
|
+
detailHeader: css`
|
|
1206
|
+
padding: 16px 24px;
|
|
1207
|
+
border-bottom: 1px solid ${token.colorBorder};
|
|
1208
|
+
display: flex;
|
|
1209
|
+
justify-content: space-between;
|
|
1210
|
+
align-items: center;
|
|
1211
|
+
|
|
1212
|
+
h3 {
|
|
1213
|
+
margin: 0;
|
|
1214
|
+
font-size: 16px;
|
|
1215
|
+
font-weight: 500;
|
|
1216
|
+
}
|
|
1217
|
+
`,
|
|
1218
|
+
messages: css`
|
|
1219
|
+
padding: 0 20px;
|
|
1220
|
+
flex: 1;
|
|
1221
|
+
overflow: hidden;
|
|
1222
|
+
`,
|
|
1223
|
+
placeholder: css`
|
|
1224
|
+
padding-top: 32px;
|
|
1225
|
+
`,
|
|
1226
|
+
sender: css`
|
|
1227
|
+
box-shadow: ${token.boxShadow};
|
|
1228
|
+
`,
|
|
1229
|
+
logo: css`
|
|
1230
|
+
display: flex;
|
|
1231
|
+
height: 72px;
|
|
1232
|
+
align-items: center;
|
|
1233
|
+
justify-content: start;
|
|
1234
|
+
padding: 0 24px;
|
|
1235
|
+
box-sizing: border-box;
|
|
1236
|
+
white-space: nowrap;
|
|
1237
|
+
overflow: hidden;
|
|
1238
|
+
transition: padding 0.3s ease;
|
|
1239
|
+
|
|
1240
|
+
img {
|
|
1241
|
+
width: 24px;
|
|
1242
|
+
height: 24px;
|
|
1243
|
+
display: inline-block;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
span {
|
|
1247
|
+
display: inline-block;
|
|
1248
|
+
margin: 0 8px;
|
|
1249
|
+
font-weight: bold;
|
|
1250
|
+
color: ${token.colorText};
|
|
1251
|
+
font-size: 16px;
|
|
1252
|
+
opacity: 1;
|
|
1253
|
+
transition: opacity 0.3s ease, width 0.3s ease, margin 0.3s ease;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
&.collapsed {
|
|
1257
|
+
padding: 0 20px;
|
|
1258
|
+
justify-content: center;
|
|
1259
|
+
|
|
1260
|
+
span {
|
|
1261
|
+
opacity: 0;
|
|
1262
|
+
width: 0;
|
|
1263
|
+
margin: 0;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
`,
|
|
1267
|
+
addBtn: css`
|
|
1268
|
+
background: #1677ff0f;
|
|
1269
|
+
border: 1px solid #1677ff34;
|
|
1270
|
+
width: calc(100% - 24px);
|
|
1271
|
+
margin: 0 12px 24px 12px;
|
|
1272
|
+
white-space: nowrap;
|
|
1273
|
+
overflow: hidden;
|
|
1274
|
+
transition: all 0.3s ease;
|
|
1275
|
+
|
|
1276
|
+
&.collapsed {
|
|
1277
|
+
width: 48px;
|
|
1278
|
+
min-width: 48px;
|
|
1279
|
+
margin: 0 auto 24px auto;
|
|
1280
|
+
justify-content: center;
|
|
1281
|
+
padding: 0;
|
|
1282
|
+
}
|
|
1283
|
+
`
|
|
1284
|
+
};
|
|
1285
|
+
});
|
|
1286
|
+
|
|
1287
|
+
// src/components/Chat/ColumnLayout.tsx
|
|
1288
|
+
import { Fragment, jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
1289
|
+
var ColumnLayout = ({ left, right }) => {
|
|
1290
|
+
const { styles } = useStyle();
|
|
1291
|
+
const { sideAppVisible, sideAppSize, sideAppSelectedCard } = useChatUIContext();
|
|
1292
|
+
return /* @__PURE__ */ jsxs("div", { className: `fina_chat ${styles.layout}`, children: [
|
|
1293
|
+
/* @__PURE__ */ jsx4("div", { className: `${styles.mainContent} ${sideAppVisible ? "open" : ""}`, children: /* @__PURE__ */ jsx4("div", { className: `${styles.chat}`, children: left }) }),
|
|
1294
|
+
/* @__PURE__ */ jsxs(
|
|
1295
|
+
"div",
|
|
1296
|
+
{
|
|
1297
|
+
className: `${styles.detailPanel} ${sideAppVisible ? `open ${sideAppSize || "large"}` : ""}`,
|
|
1298
|
+
children: [
|
|
1299
|
+
/* @__PURE__ */ jsx4(Fragment, {}),
|
|
1300
|
+
sideAppSelectedCard && sideAppVisible && /* @__PURE__ */ jsx4(Fragment, { children: /* @__PURE__ */ jsx4("div", { className: styles.detailContent, children: right }) })
|
|
1301
|
+
]
|
|
1302
|
+
}
|
|
1303
|
+
)
|
|
1304
|
+
] });
|
|
1305
|
+
};
|
|
1306
|
+
|
|
1307
|
+
// src/components/Chat/SideAppViewBrowser.tsx
|
|
1308
|
+
import {
|
|
1309
|
+
CloseOutlined,
|
|
1310
|
+
CompressOutlined,
|
|
1311
|
+
ExpandOutlined,
|
|
1312
|
+
FullscreenOutlined
|
|
1313
|
+
} from "@ant-design/icons";
|
|
1314
|
+
|
|
1315
|
+
// src/components/GenUI/elements/confirm_feedback.tsx
|
|
1316
|
+
import { Button, Space, Typography } from "antd";
|
|
1317
|
+
import { useState as useState9 } from "react";
|
|
1318
|
+
|
|
1319
|
+
// src/components/GenUI/MDResponse.tsx
|
|
1320
|
+
import ReactMarkdown from "react-markdown";
|
|
1321
|
+
import { Prism } from "react-syntax-highlighter";
|
|
1322
|
+
import { dark } from "react-syntax-highlighter/dist/cjs/styles/prism";
|
|
1323
|
+
import remarkGfm from "remark-gfm";
|
|
1324
|
+
import { useMemo as useMemo2, useRef as useRef5, useState as useState8 } from "react";
|
|
1325
|
+
import { createStyles as createStyles2 } from "antd-style";
|
|
1326
|
+
import rehypeRaw from "rehype-raw";
|
|
1327
|
+
|
|
1328
|
+
// src/components/GenUI/MDMermaid.tsx
|
|
1329
|
+
import mermaid from "mermaid";
|
|
1330
|
+
import { useEffect as useEffect6, useRef as useRef4 } from "react";
|
|
1331
|
+
import { v4 } from "uuid";
|
|
1332
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1333
|
+
var MDMermaid = ({ children = [] }) => {
|
|
1334
|
+
const domId = useRef4(`dom${v4()}`);
|
|
1335
|
+
const code = String(children);
|
|
1336
|
+
const target = useRef4(null);
|
|
1337
|
+
const targetInternal = useRef4(null);
|
|
1338
|
+
useEffect6(() => {
|
|
1339
|
+
if (target.current && code) {
|
|
1340
|
+
mermaid.initialize({
|
|
1341
|
+
startOnLoad: true,
|
|
1342
|
+
theme: "default",
|
|
1343
|
+
securityLevel: "loose",
|
|
1344
|
+
themeCSS: `
|
|
1345
|
+
g.classGroup rect {
|
|
1346
|
+
fill: #282a36;
|
|
1347
|
+
stroke: #6272a4;
|
|
1348
|
+
}
|
|
1349
|
+
g.classGroup text {
|
|
1350
|
+
fill: #f8f8f2;
|
|
1351
|
+
}
|
|
1352
|
+
g.classGroup line {
|
|
1353
|
+
stroke: #f8f8f2;
|
|
1354
|
+
stroke-width: 0.5;
|
|
1355
|
+
}
|
|
1356
|
+
.classLabel .box {
|
|
1357
|
+
stroke: #21222c;
|
|
1358
|
+
stroke-width: 3;
|
|
1359
|
+
fill: #21222c;
|
|
1360
|
+
opacity: 1;
|
|
1361
|
+
}
|
|
1362
|
+
.classLabel .label {
|
|
1363
|
+
fill: #f1fa8c;
|
|
1364
|
+
}
|
|
1365
|
+
.relation {
|
|
1366
|
+
stroke: #ff79c6;
|
|
1367
|
+
stroke-width: 1;
|
|
1368
|
+
}
|
|
1369
|
+
#compositionStart, #compositionEnd {
|
|
1370
|
+
fill: #bd93f9;
|
|
1371
|
+
stroke: #bd93f9;
|
|
1372
|
+
stroke-width: 1;
|
|
1373
|
+
}
|
|
1374
|
+
#aggregationEnd, #aggregationStart {
|
|
1375
|
+
fill: #21222c;
|
|
1376
|
+
stroke: #50fa7b;
|
|
1377
|
+
stroke-width: 1;
|
|
1378
|
+
}
|
|
1379
|
+
#dependencyStart, #dependencyEnd {
|
|
1380
|
+
fill: #00bcd4;
|
|
1381
|
+
stroke: #00bcd4;
|
|
1382
|
+
stroke-width: 1;
|
|
1383
|
+
}
|
|
1384
|
+
#extensionStart, #extensionEnd {
|
|
1385
|
+
fill: #f8f8f2;
|
|
1386
|
+
stroke: #f8f8f2;
|
|
1387
|
+
stroke-width: 1;
|
|
1388
|
+
}
|
|
1389
|
+
`,
|
|
1390
|
+
fontFamily: "Fira Code",
|
|
1391
|
+
sequence: { showSequenceNumbers: true }
|
|
1392
|
+
});
|
|
1393
|
+
mermaid.render(domId.current, code, target.current).then((result) => {
|
|
1394
|
+
target.current.innerHTML = result.svg;
|
|
1395
|
+
}).catch((error) => {
|
|
1396
|
+
console.log(error);
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
}, [code]);
|
|
1400
|
+
return /* @__PURE__ */ jsx5("div", { style: { minWidth: 750 }, ref: target, children: /* @__PURE__ */ jsx5("code", { id: domId.current, style: { display: "none" } }) });
|
|
1401
|
+
};
|
|
1402
|
+
|
|
1403
|
+
// src/components/GenUI/MDResponse.tsx
|
|
1404
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1405
|
+
var SyntaxHighlighter = Prism;
|
|
1406
|
+
var useStyles = createStyles2(({ token, css }) => ({
|
|
1407
|
+
markdownTableContainer: css`
|
|
1408
|
+
overflow-x: auto;
|
|
1409
|
+
width: 100%;
|
|
1410
|
+
`,
|
|
1411
|
+
markdownTable: css`
|
|
1412
|
+
width: 100%;
|
|
1413
|
+
border-collapse: collapse;
|
|
1414
|
+
margin: 16px 0;
|
|
1415
|
+
border-radius: ${token.borderRadius}px;
|
|
1416
|
+
overflow: hidden;
|
|
1417
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
1418
|
+
white-space: nowrap;
|
|
1419
|
+
`,
|
|
1420
|
+
markdownTh: css`
|
|
1421
|
+
background: ${token.colorFillAlter};
|
|
1422
|
+
padding: 12px 16px;
|
|
1423
|
+
text-align: left;
|
|
1424
|
+
font-weight: 600;
|
|
1425
|
+
border-bottom: 1px solid ${token.colorBorder};
|
|
1426
|
+
color: ${token.colorTextHeading};
|
|
1427
|
+
font-size: ${token.fontSize}px;
|
|
1428
|
+
`,
|
|
1429
|
+
markdownTd: css`
|
|
1430
|
+
padding: 12px 16px;
|
|
1431
|
+
border-bottom: 1px solid ${token.colorBorder};
|
|
1432
|
+
color: ${token.colorText};
|
|
1433
|
+
font-size: ${token.fontSize}px;
|
|
1434
|
+
|
|
1435
|
+
&:last-child {
|
|
1436
|
+
border-right: none;
|
|
1437
|
+
}
|
|
1438
|
+
`,
|
|
1439
|
+
markdownTr: css`
|
|
1440
|
+
&:hover {
|
|
1441
|
+
background: ${token.colorFillTertiary};
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
&:last-child td {
|
|
1445
|
+
border-bottom: none;
|
|
1446
|
+
}
|
|
1447
|
+
`,
|
|
1448
|
+
markdownContainer: css`
|
|
1449
|
+
white-space: normal;
|
|
1450
|
+
|
|
1451
|
+
/* 为整个markdown内容添加基础样式 */
|
|
1452
|
+
h1,
|
|
1453
|
+
h2,
|
|
1454
|
+
h3,
|
|
1455
|
+
h4,
|
|
1456
|
+
h5,
|
|
1457
|
+
h6 {
|
|
1458
|
+
color: ${token.colorTextHeading};
|
|
1459
|
+
margin-top: 24px;
|
|
1460
|
+
margin-bottom: 16px;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
p {
|
|
1464
|
+
color: ${token.colorText};
|
|
1465
|
+
line-height: 1.6;
|
|
1466
|
+
margin-bottom: 16px;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
blockquote {
|
|
1470
|
+
border-left: 4px solid ${token.colorPrimary};
|
|
1471
|
+
background: ${token.colorFillAlter};
|
|
1472
|
+
padding: 16px;
|
|
1473
|
+
margin: 16px 0;
|
|
1474
|
+
border-radius: 0 ${token.borderRadius}px ${token.borderRadius}px 0;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
code:not(pre code) {
|
|
1478
|
+
background: ${token.colorFillAlter};
|
|
1479
|
+
padding: 2px 6px;
|
|
1480
|
+
border-radius: ${token.borderRadius}px;
|
|
1481
|
+
font-family: ${token.fontFamilyCode};
|
|
1482
|
+
color: ${token.colorError};
|
|
1483
|
+
}
|
|
1484
|
+
`
|
|
1485
|
+
}));
|
|
1486
|
+
var MDResponse = ({
|
|
1487
|
+
content = "",
|
|
1488
|
+
context,
|
|
1489
|
+
embeddedLink,
|
|
1490
|
+
interactive,
|
|
1491
|
+
userData,
|
|
1492
|
+
noGenUI
|
|
1493
|
+
}) => {
|
|
1494
|
+
const { styles } = useStyles();
|
|
1495
|
+
const config = useMemo2(
|
|
1496
|
+
() => ({
|
|
1497
|
+
components: {
|
|
1498
|
+
a({ node, ...props }) {
|
|
1499
|
+
if (embeddedLink) {
|
|
1500
|
+
return /* @__PURE__ */ jsx6(IFrameCard, { src: props.href });
|
|
1501
|
+
} else return /* @__PURE__ */ jsx6("a", { ...props });
|
|
1502
|
+
},
|
|
1503
|
+
table({ node, ...props }) {
|
|
1504
|
+
return /* @__PURE__ */ jsx6("div", { className: styles.markdownTableContainer, children: /* @__PURE__ */ jsx6("table", { className: styles.markdownTable, ...props }) });
|
|
1505
|
+
},
|
|
1506
|
+
th({ node, ...props }) {
|
|
1507
|
+
return /* @__PURE__ */ jsx6("th", { className: styles.markdownTh, ...props });
|
|
1508
|
+
},
|
|
1509
|
+
td({ node, ...props }) {
|
|
1510
|
+
return /* @__PURE__ */ jsx6("td", { className: styles.markdownTd, ...props });
|
|
1511
|
+
},
|
|
1512
|
+
tr({ node, ...props }) {
|
|
1513
|
+
return /* @__PURE__ */ jsx6("tr", { className: styles.markdownTr, ...props });
|
|
1514
|
+
},
|
|
1515
|
+
code({ children, className, node, ...rest }) {
|
|
1516
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
1517
|
+
const language = match?.[1];
|
|
1518
|
+
if (language) {
|
|
1519
|
+
const Element = getElement(language)?.card_view;
|
|
1520
|
+
if (Element) {
|
|
1521
|
+
let childrenData;
|
|
1522
|
+
try {
|
|
1523
|
+
childrenData = JSON.parse(children);
|
|
1524
|
+
} catch (error) {
|
|
1525
|
+
}
|
|
1526
|
+
return /* @__PURE__ */ jsx6(
|
|
1527
|
+
Element,
|
|
1528
|
+
{
|
|
1529
|
+
context,
|
|
1530
|
+
interactive,
|
|
1531
|
+
component_key: language,
|
|
1532
|
+
data: childrenData
|
|
1533
|
+
}
|
|
1534
|
+
);
|
|
1535
|
+
}
|
|
1536
|
+
switch (language) {
|
|
1537
|
+
case "mermaid":
|
|
1538
|
+
return /* @__PURE__ */ jsx6(MDMermaid, { children });
|
|
1539
|
+
default:
|
|
1540
|
+
return /* @__PURE__ */ jsx6(
|
|
1541
|
+
SyntaxHighlighter,
|
|
1542
|
+
{
|
|
1543
|
+
...rest,
|
|
1544
|
+
PreTag: "div",
|
|
1545
|
+
language,
|
|
1546
|
+
style: dark,
|
|
1547
|
+
children: String(children).replace(/\n$/, "")
|
|
1548
|
+
}
|
|
1549
|
+
);
|
|
1550
|
+
}
|
|
1551
|
+
} else {
|
|
1552
|
+
return /* @__PURE__ */ jsx6("code", { ...rest, className, children });
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
},
|
|
1556
|
+
remarkPlugins: [remarkGfm],
|
|
1557
|
+
rehypePlugins: [rehypeRaw]
|
|
1558
|
+
}),
|
|
1559
|
+
[userData, interactive, embeddedLink, styles]
|
|
1560
|
+
);
|
|
1561
|
+
return /* @__PURE__ */ jsx6("div", { className: styles.markdownContainer, children: /* @__PURE__ */ jsx6(ReactMarkdown, { ...config, children: content }) });
|
|
1562
|
+
};
|
|
1563
|
+
var MDViewFormItem = ({ value }) => {
|
|
1564
|
+
return /* @__PURE__ */ jsx6(MDResponse, { content: value || "" });
|
|
1565
|
+
};
|
|
1566
|
+
var IFrameCard = ({ src }) => {
|
|
1567
|
+
const containerRef = useRef5(null);
|
|
1568
|
+
const [width, setWidth] = useState8("640px");
|
|
1569
|
+
const [height, setHeight] = useState8("320px");
|
|
1570
|
+
const valid_images = [
|
|
1571
|
+
"jpg",
|
|
1572
|
+
"jpeg",
|
|
1573
|
+
"png",
|
|
1574
|
+
"gif",
|
|
1575
|
+
"bmp",
|
|
1576
|
+
"svg",
|
|
1577
|
+
"tif",
|
|
1578
|
+
"tiff",
|
|
1579
|
+
"webp"
|
|
1580
|
+
];
|
|
1581
|
+
if (!src) {
|
|
1582
|
+
return null;
|
|
1583
|
+
}
|
|
1584
|
+
const spitedSrc = src.split(".");
|
|
1585
|
+
if (valid_images.includes(spitedSrc[spitedSrc.length - 1].toLowerCase())) {
|
|
1586
|
+
return /* @__PURE__ */ jsx6("div", { children: /* @__PURE__ */ jsx6("img", { src, style: { width: "100%" } }) });
|
|
1587
|
+
} else {
|
|
1588
|
+
return /* @__PURE__ */ jsx6("div", { children: /* @__PURE__ */ jsx6("a", { href: src, target: "_black", children: src }) });
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
|
|
1592
|
+
// src/components/GenUI/elements/confirm_feedback.tsx
|
|
1593
|
+
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1594
|
+
var { Text } = Typography;
|
|
1595
|
+
var ConfirmFeedback = ({
|
|
1596
|
+
data,
|
|
1597
|
+
interactive = true
|
|
1598
|
+
}) => {
|
|
1599
|
+
const { message: message4, type, config, feedback, options } = data ?? {};
|
|
1600
|
+
const { sendMessage } = useAgentChat();
|
|
1601
|
+
const [clicked, setClicked] = useState9(false);
|
|
1602
|
+
return /* @__PURE__ */ jsxs2(Space, { direction: "vertical", style: { width: "100%" }, children: [
|
|
1603
|
+
/* @__PURE__ */ jsx7(MDResponse, { content: message4 }),
|
|
1604
|
+
options ? /* @__PURE__ */ jsx7(Space, { style: { justifyContent: "flex-end", width: "100%" }, children: options?.map((option) => /* @__PURE__ */ jsx7(
|
|
1605
|
+
Button,
|
|
1606
|
+
{
|
|
1607
|
+
title: option.description,
|
|
1608
|
+
disabled: !interactive || clicked || feedback,
|
|
1609
|
+
style: {
|
|
1610
|
+
border: feedback?.data?.action === option.value ? "2px dashed rgb(74 73 77)" : "none"
|
|
1611
|
+
},
|
|
1612
|
+
onClick: () => {
|
|
1613
|
+
setClicked(true);
|
|
1614
|
+
sendMessage({
|
|
1615
|
+
command: {
|
|
1616
|
+
resume: {
|
|
1617
|
+
action: option.value,
|
|
1618
|
+
data: config,
|
|
1619
|
+
message: option.label
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
});
|
|
1623
|
+
},
|
|
1624
|
+
children: option.label
|
|
1625
|
+
},
|
|
1626
|
+
option.value
|
|
1627
|
+
)) }) : /* @__PURE__ */ jsxs2(Space, { style: { justifyContent: "flex-end", width: "100%" }, children: [
|
|
1628
|
+
/* @__PURE__ */ jsx7(
|
|
1629
|
+
Button,
|
|
1630
|
+
{
|
|
1631
|
+
disabled: !interactive || clicked || feedback,
|
|
1632
|
+
style: {
|
|
1633
|
+
border: feedback?.data?.action === "yes" ? "2px dashed rgb(74 73 77)" : "none"
|
|
1634
|
+
},
|
|
1635
|
+
type: "primary",
|
|
1636
|
+
onClick: () => {
|
|
1637
|
+
setClicked(true);
|
|
1638
|
+
sendMessage({
|
|
1639
|
+
command: {
|
|
1640
|
+
resume: {
|
|
1641
|
+
action: "yes",
|
|
1642
|
+
data: config,
|
|
1643
|
+
message: "\u786E\u8BA4"
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
});
|
|
1647
|
+
},
|
|
1648
|
+
children: "\u786E\u8BA4"
|
|
1649
|
+
}
|
|
1650
|
+
),
|
|
1651
|
+
/* @__PURE__ */ jsx7(
|
|
1652
|
+
Button,
|
|
1653
|
+
{
|
|
1654
|
+
disabled: !interactive || clicked || feedback,
|
|
1655
|
+
type: "default",
|
|
1656
|
+
style: {
|
|
1657
|
+
border: feedback?.data?.action === "no" ? "2px dashed rgb(74 73 77)" : "none"
|
|
1658
|
+
},
|
|
1659
|
+
onClick: () => {
|
|
1660
|
+
setClicked(true);
|
|
1661
|
+
sendMessage({
|
|
1662
|
+
command: {
|
|
1663
|
+
resume: {
|
|
1664
|
+
action: "no",
|
|
1665
|
+
data: config,
|
|
1666
|
+
message: "\u62D2\u7EDD"
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1670
|
+
},
|
|
1671
|
+
children: "\u62D2\u7EDD"
|
|
1672
|
+
}
|
|
1673
|
+
)
|
|
1674
|
+
] })
|
|
1675
|
+
] });
|
|
1676
|
+
};
|
|
1677
|
+
|
|
1678
|
+
// src/components/GenUI/elements/generic_data_table.tsx
|
|
1679
|
+
import { Table, Typography as Typography2, Button as Button2, Flex, Space as Space2 } from "antd";
|
|
1680
|
+
import { useState as useState10 } from "react";
|
|
1681
|
+
import { DownloadOutlined, ExpandAltOutlined } from "@ant-design/icons";
|
|
1682
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1683
|
+
var { Text: Text2 } = Typography2;
|
|
1684
|
+
var GenericDataTable = ({ data, interactive = true, default_open_in_side_app = true }) => {
|
|
1685
|
+
const { dataSource, message: message4 } = data ?? {};
|
|
1686
|
+
const [expandedRowKeys, setExpandedRowKeys] = useState10([]);
|
|
1687
|
+
const { openSideApp } = useChatUIContext();
|
|
1688
|
+
const processedData = dataSource?.map((item, index) => ({
|
|
1689
|
+
...item,
|
|
1690
|
+
key: `${index}_${JSON.stringify(item).slice(0, 20)}`
|
|
1691
|
+
})) || [];
|
|
1692
|
+
const generateColumns = (dataItem) => {
|
|
1693
|
+
if (!dataItem || typeof dataItem !== "object") {
|
|
1694
|
+
return [];
|
|
1695
|
+
}
|
|
1696
|
+
return Object.keys(dataItem).filter((key) => key !== "key" && key !== "expandItem").map((key) => ({
|
|
1697
|
+
title: formatColumnTitle(key),
|
|
1698
|
+
dataIndex: key,
|
|
1699
|
+
key,
|
|
1700
|
+
width: 150,
|
|
1701
|
+
sorter: (a, b) => {
|
|
1702
|
+
const aVal = a[key];
|
|
1703
|
+
const bVal = b[key];
|
|
1704
|
+
if (aVal === null || aVal === void 0) return 1;
|
|
1705
|
+
if (bVal === null || bVal === void 0) return -1;
|
|
1706
|
+
if (typeof aVal === "number" && typeof bVal === "number") {
|
|
1707
|
+
return aVal - bVal;
|
|
1708
|
+
}
|
|
1709
|
+
const aDate = new Date(aVal);
|
|
1710
|
+
const bDate = new Date(bVal);
|
|
1711
|
+
if (!isNaN(aDate.getTime()) && !isNaN(bDate.getTime())) {
|
|
1712
|
+
return aDate.getTime() - bDate.getTime();
|
|
1713
|
+
}
|
|
1714
|
+
return String(aVal).localeCompare(String(bVal), "zh-CN");
|
|
1715
|
+
},
|
|
1716
|
+
render: (value) => {
|
|
1717
|
+
if (value === null || value === void 0) {
|
|
1718
|
+
return "-";
|
|
1719
|
+
}
|
|
1720
|
+
if (typeof value === "object") {
|
|
1721
|
+
return JSON.stringify(value);
|
|
1722
|
+
}
|
|
1723
|
+
return String(value);
|
|
1724
|
+
}
|
|
1725
|
+
}));
|
|
1726
|
+
};
|
|
1727
|
+
const formatColumnTitle = (key) => {
|
|
1728
|
+
return key.replace(/([A-Z])/g, " $1").replace(/_/g, " ").replace(/^./, (str) => str.toUpperCase()).trim();
|
|
1729
|
+
};
|
|
729
1730
|
const columns = processedData.length > 0 ? generateColumns(processedData[0]) : [];
|
|
730
1731
|
const expandedRowRender = (record) => {
|
|
731
1732
|
const expandItem = record.expandItem;
|
|
732
1733
|
if (!expandItem) {
|
|
733
1734
|
return null;
|
|
734
1735
|
}
|
|
735
|
-
return /* @__PURE__ */
|
|
736
|
-
expandItem.content && /* @__PURE__ */
|
|
737
|
-
/* @__PURE__ */
|
|
738
|
-
/* @__PURE__ */
|
|
1736
|
+
return /* @__PURE__ */ jsxs3("div", { style: { padding: "16px" }, children: [
|
|
1737
|
+
expandItem.content && /* @__PURE__ */ jsxs3("div", { style: { marginBottom: "16px" }, children: [
|
|
1738
|
+
/* @__PURE__ */ jsx8(Text2, { strong: true, style: { display: "block", marginBottom: "8px" }, children: "\u8BE6\u7EC6\u4FE1\u606F:" }),
|
|
1739
|
+
/* @__PURE__ */ jsx8(MDResponse, { content: expandItem.content })
|
|
739
1740
|
] }),
|
|
740
|
-
expandItem.dataSource && expandItem.dataSource.length > 0 && /* @__PURE__ */
|
|
741
|
-
/* @__PURE__ */
|
|
742
|
-
/* @__PURE__ */
|
|
1741
|
+
expandItem.dataSource && expandItem.dataSource.length > 0 && /* @__PURE__ */ jsxs3("div", { children: [
|
|
1742
|
+
/* @__PURE__ */ jsx8(Text2, { strong: true, style: { display: "block", marginBottom: "8px" }, children: "\u5B50\u8868\u6570\u636E:" }),
|
|
1743
|
+
/* @__PURE__ */ jsx8(
|
|
743
1744
|
GenericDataTable,
|
|
744
1745
|
{
|
|
745
1746
|
component_key: `nested_${record.key}`,
|
|
@@ -747,7 +1748,6 @@ var GenericDataTable = ({
|
|
|
747
1748
|
dataSource: expandItem.dataSource,
|
|
748
1749
|
message: void 0
|
|
749
1750
|
},
|
|
750
|
-
eventHandler,
|
|
751
1751
|
interactive
|
|
752
1752
|
}
|
|
753
1753
|
)
|
|
@@ -756,46 +1756,43 @@ var GenericDataTable = ({
|
|
|
756
1756
|
};
|
|
757
1757
|
const exportToExcel = () => {
|
|
758
1758
|
if (!processedData || processedData.length === 0) return;
|
|
759
|
-
console.warn(
|
|
1759
|
+
console.warn(
|
|
1760
|
+
"Export to Excel not implemented in SDK yet (requires xlsx dependency)"
|
|
1761
|
+
);
|
|
760
1762
|
};
|
|
761
1763
|
const hasExpandableRows = processedData.some((item) => item.expandItem);
|
|
762
|
-
return /* @__PURE__ */
|
|
1764
|
+
return /* @__PURE__ */ jsx8(
|
|
763
1765
|
Table,
|
|
764
1766
|
{
|
|
765
1767
|
size: "small",
|
|
766
|
-
title: () => /* @__PURE__ */
|
|
767
|
-
/* @__PURE__ */
|
|
768
|
-
/* @__PURE__ */
|
|
769
|
-
/* @__PURE__ */
|
|
1768
|
+
title: () => /* @__PURE__ */ jsxs3(Flex, { justify: "space-between", align: "center", children: [
|
|
1769
|
+
/* @__PURE__ */ jsx8(Space2, { children: /* @__PURE__ */ jsx8(Text2, { strong: true, style: { fontSize: 16 }, children: message4 || "" }) }),
|
|
1770
|
+
/* @__PURE__ */ jsxs3(Space2, { children: [
|
|
1771
|
+
/* @__PURE__ */ jsx8(
|
|
770
1772
|
Button2,
|
|
771
1773
|
{
|
|
772
1774
|
type: "text",
|
|
773
1775
|
size: "small",
|
|
774
|
-
icon: /* @__PURE__ */
|
|
1776
|
+
icon: /* @__PURE__ */ jsx8(DownloadOutlined, {}),
|
|
775
1777
|
onClick: exportToExcel,
|
|
776
1778
|
disabled: !processedData || processedData.length === 0,
|
|
777
1779
|
children: "\u5BFC\u51FAExcel"
|
|
778
1780
|
}
|
|
779
1781
|
),
|
|
780
|
-
|
|
1782
|
+
default_open_in_side_app && /* @__PURE__ */ jsxs3(
|
|
781
1783
|
Button2,
|
|
782
1784
|
{
|
|
783
1785
|
type: "link",
|
|
784
1786
|
size: "small",
|
|
785
1787
|
onClick: () => {
|
|
786
|
-
|
|
787
|
-
"
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
data: { dataSource, message: message3 },
|
|
792
|
-
size: "large"
|
|
793
|
-
},
|
|
794
|
-
""
|
|
795
|
-
);
|
|
1788
|
+
openSideApp({
|
|
1789
|
+
component_key: "generic_data_table",
|
|
1790
|
+
message: message4 || "",
|
|
1791
|
+
data: { dataSource, message: message4 }
|
|
1792
|
+
});
|
|
796
1793
|
},
|
|
797
1794
|
children: [
|
|
798
|
-
/* @__PURE__ */
|
|
1795
|
+
/* @__PURE__ */ jsx8(ExpandAltOutlined, {}),
|
|
799
1796
|
"\u5C55\u5F00"
|
|
800
1797
|
]
|
|
801
1798
|
}
|
|
@@ -824,9 +1821,9 @@ var GenericDataTable = ({
|
|
|
824
1821
|
};
|
|
825
1822
|
|
|
826
1823
|
// src/components/GenUI/elements/generic_data_table_side_app.tsx
|
|
827
|
-
import { jsx as
|
|
1824
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
828
1825
|
var GenericDataTableSideApp = (props) => {
|
|
829
|
-
return /* @__PURE__ */
|
|
1826
|
+
return /* @__PURE__ */ jsx9(GenericDataTable, { ...props, default_open_in_side_app: false });
|
|
830
1827
|
};
|
|
831
1828
|
|
|
832
1829
|
// src/components/GenUI/elements/ToolCall.tsx
|
|
@@ -840,11 +1837,11 @@ import {
|
|
|
840
1837
|
|
|
841
1838
|
// src/components/GenUI/elements/ToolCard.tsx
|
|
842
1839
|
import { Card as Card2, Typography as Typography3, Space as Space3, Tag } from "antd";
|
|
843
|
-
import { createStyles } from "antd-style";
|
|
1840
|
+
import { createStyles as createStyles3 } from "antd-style";
|
|
844
1841
|
import { ToolOutlined, CodeOutlined } from "@ant-design/icons";
|
|
845
|
-
import { jsx as
|
|
1842
|
+
import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
846
1843
|
var { Text: Text3, Title } = Typography3;
|
|
847
|
-
var
|
|
1844
|
+
var useStyle2 = createStyles3(({ token, css }) => ({
|
|
848
1845
|
card: css`
|
|
849
1846
|
max-width: 500px;
|
|
850
1847
|
background: linear-gradient(
|
|
@@ -908,12 +1905,11 @@ var useStyle = createStyles(({ token, css }) => ({
|
|
|
908
1905
|
var ToolCard = ({
|
|
909
1906
|
data,
|
|
910
1907
|
component_key,
|
|
911
|
-
eventHandler,
|
|
912
1908
|
interactive = true
|
|
913
1909
|
}) => {
|
|
914
|
-
const { styles } =
|
|
1910
|
+
const { styles } = useStyle2();
|
|
915
1911
|
if (!data || !data.name) {
|
|
916
|
-
return /* @__PURE__ */
|
|
1912
|
+
return /* @__PURE__ */ jsx10(Card2, { size: "small", className: styles.card, bordered: false, children: /* @__PURE__ */ jsx10(Text3, { type: "secondary", children: "Invalid tool data" }) });
|
|
917
1913
|
}
|
|
918
1914
|
const formatToolName = (name) => {
|
|
919
1915
|
return name.replace(/([a-z])([A-Z])/g, "$1 $2").split(/[_-]/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
@@ -956,7 +1952,7 @@ var ToolCard = ({
|
|
|
956
1952
|
return typeof value;
|
|
957
1953
|
};
|
|
958
1954
|
const hasParameters = data.parameters && Object.keys(data.parameters).length > 0;
|
|
959
|
-
return /* @__PURE__ */
|
|
1955
|
+
return /* @__PURE__ */ jsxs4(
|
|
960
1956
|
Card2,
|
|
961
1957
|
{
|
|
962
1958
|
size: "small",
|
|
@@ -964,13 +1960,13 @@ var ToolCard = ({
|
|
|
964
1960
|
bordered: false,
|
|
965
1961
|
bodyStyle: { padding: "16px" },
|
|
966
1962
|
children: [
|
|
967
|
-
/* @__PURE__ */
|
|
968
|
-
/* @__PURE__ */
|
|
969
|
-
/* @__PURE__ */
|
|
970
|
-
/* @__PURE__ */
|
|
971
|
-
data.type && /* @__PURE__ */
|
|
1963
|
+
/* @__PURE__ */ jsxs4("div", { className: styles.header, children: [
|
|
1964
|
+
/* @__PURE__ */ jsxs4(Space3, { align: "center", children: [
|
|
1965
|
+
/* @__PURE__ */ jsx10(ToolOutlined, { style: { color: "#1890ff", fontSize: "18px" } }),
|
|
1966
|
+
/* @__PURE__ */ jsx10(Title, { level: 5, className: styles.toolName, style: { margin: 0 }, children: formatToolName(data.name) }),
|
|
1967
|
+
data.type && /* @__PURE__ */ jsx10(Tag, { color: "blue", className: styles.typeTag, children: data.type })
|
|
972
1968
|
] }),
|
|
973
|
-
data.description && /* @__PURE__ */
|
|
1969
|
+
data.description && /* @__PURE__ */ jsx10(
|
|
974
1970
|
Text3,
|
|
975
1971
|
{
|
|
976
1972
|
type: "secondary",
|
|
@@ -979,19 +1975,19 @@ var ToolCard = ({
|
|
|
979
1975
|
}
|
|
980
1976
|
)
|
|
981
1977
|
] }),
|
|
982
|
-
hasParameters ? /* @__PURE__ */
|
|
983
|
-
/* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
985
|
-
/* @__PURE__ */
|
|
1978
|
+
hasParameters ? /* @__PURE__ */ jsxs4("div", { children: [
|
|
1979
|
+
/* @__PURE__ */ jsxs4(Space3, { align: "center", style: { marginBottom: "12px" }, children: [
|
|
1980
|
+
/* @__PURE__ */ jsx10(CodeOutlined, { style: { color: "#52c41a", fontSize: "14px" } }),
|
|
1981
|
+
/* @__PURE__ */ jsxs4(Text3, { strong: true, style: { fontSize: "14px" }, children: [
|
|
986
1982
|
"Parameters (",
|
|
987
1983
|
Object.keys(data.parameters).length,
|
|
988
1984
|
")"
|
|
989
1985
|
] })
|
|
990
1986
|
] }),
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
/* @__PURE__ */
|
|
993
|
-
/* @__PURE__ */
|
|
994
|
-
/* @__PURE__ */
|
|
1987
|
+
/* @__PURE__ */ jsx10("div", { className: styles.parameterGrid, children: Object.entries(data.parameters).map(([key, value], index) => /* @__PURE__ */ jsxs4("div", { className: styles.parameterItem, children: [
|
|
1988
|
+
/* @__PURE__ */ jsx10("div", { className: styles.parameterName, children: /* @__PURE__ */ jsxs4(Space3, { align: "center", children: [
|
|
1989
|
+
/* @__PURE__ */ jsx10("span", { children: key }),
|
|
1990
|
+
/* @__PURE__ */ jsx10(
|
|
995
1991
|
Tag,
|
|
996
1992
|
{
|
|
997
1993
|
color: getTypeColor(value),
|
|
@@ -1000,11 +1996,11 @@ var ToolCard = ({
|
|
|
1000
1996
|
}
|
|
1001
1997
|
)
|
|
1002
1998
|
] }) }),
|
|
1003
|
-
/* @__PURE__ */
|
|
1999
|
+
/* @__PURE__ */ jsx10("div", { className: styles.parameterValue, children: formatParameterValue(value) })
|
|
1004
2000
|
] }, index)) })
|
|
1005
|
-
] }) : /* @__PURE__ */
|
|
1006
|
-
/* @__PURE__ */
|
|
1007
|
-
/* @__PURE__ */
|
|
2001
|
+
] }) : /* @__PURE__ */ jsxs4(Space3, { align: "center", children: [
|
|
2002
|
+
/* @__PURE__ */ jsx10(CodeOutlined, { style: { color: "#d9d9d9", fontSize: "14px" } }),
|
|
2003
|
+
/* @__PURE__ */ jsx10(Text3, { type: "secondary", style: { fontSize: "13px" }, children: "No parameters" })
|
|
1008
2004
|
] })
|
|
1009
2005
|
]
|
|
1010
2006
|
}
|
|
@@ -1012,18 +2008,18 @@ var ToolCard = ({
|
|
|
1012
2008
|
};
|
|
1013
2009
|
|
|
1014
2010
|
// src/components/GenUI/elements/ToolCall.tsx
|
|
1015
|
-
import { jsx as
|
|
2011
|
+
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1016
2012
|
function getStatusIcon(status) {
|
|
1017
2013
|
switch (status) {
|
|
1018
2014
|
case "success":
|
|
1019
|
-
return /* @__PURE__ */
|
|
2015
|
+
return /* @__PURE__ */ jsx11(CheckCircleOutlined, { style: { color: "#52c41a" } });
|
|
1020
2016
|
case "error":
|
|
1021
|
-
return /* @__PURE__ */
|
|
2017
|
+
return /* @__PURE__ */ jsx11(InfoCircleOutlined, { style: { color: "#ff4d4f" } });
|
|
1022
2018
|
default:
|
|
1023
|
-
return /* @__PURE__ */
|
|
2019
|
+
return /* @__PURE__ */ jsx11(LoadingOutlined, { style: { color: "#1890ff" } });
|
|
1024
2020
|
}
|
|
1025
2021
|
}
|
|
1026
|
-
var ToolCall = ({ data
|
|
2022
|
+
var ToolCall = ({ data }) => {
|
|
1027
2023
|
const toolCallData = data;
|
|
1028
2024
|
const formatToolName = (name) => {
|
|
1029
2025
|
if (!name) {
|
|
@@ -1043,9 +2039,9 @@ var ToolCall = ({ data, eventHandler }) => {
|
|
|
1043
2039
|
return "Error parsing args";
|
|
1044
2040
|
}
|
|
1045
2041
|
};
|
|
1046
|
-
const header = /* @__PURE__ */
|
|
1047
|
-
/* @__PURE__ */
|
|
1048
|
-
/* @__PURE__ */
|
|
2042
|
+
const header = /* @__PURE__ */ jsxs5(Flex2, { align: "center", wrap: "wrap", children: [
|
|
2043
|
+
/* @__PURE__ */ jsx11(Typography4.Text, { strong: true, children: formatToolName(toolCallData.name) }),
|
|
2044
|
+
/* @__PURE__ */ jsx11(
|
|
1049
2045
|
Typography4.Text,
|
|
1050
2046
|
{
|
|
1051
2047
|
type: "secondary",
|
|
@@ -1059,19 +2055,17 @@ var ToolCall = ({ data, eventHandler }) => {
|
|
|
1059
2055
|
parameters: toolCallData.args,
|
|
1060
2056
|
type: "tool_call"
|
|
1061
2057
|
};
|
|
1062
|
-
const content = /* @__PURE__ */
|
|
1063
|
-
/* @__PURE__ */
|
|
2058
|
+
const content = /* @__PURE__ */ jsxs5("div", { style: { marginTop: "8px" }, children: [
|
|
2059
|
+
/* @__PURE__ */ jsx11(
|
|
1064
2060
|
ToolCard,
|
|
1065
2061
|
{
|
|
1066
2062
|
data: toolCardData,
|
|
1067
2063
|
component_key: `${toolCallData.id}-params`,
|
|
1068
|
-
eventHandler: () => {
|
|
1069
|
-
},
|
|
1070
2064
|
interactive: false
|
|
1071
2065
|
}
|
|
1072
2066
|
),
|
|
1073
|
-
toolCallData.response && /* @__PURE__ */
|
|
1074
|
-
/* @__PURE__ */
|
|
2067
|
+
toolCallData.response && /* @__PURE__ */ jsxs5("div", { style: { marginTop: "12px" }, children: [
|
|
2068
|
+
/* @__PURE__ */ jsx11(
|
|
1075
2069
|
Typography4.Text,
|
|
1076
2070
|
{
|
|
1077
2071
|
strong: true,
|
|
@@ -1079,7 +2073,7 @@ var ToolCall = ({ data, eventHandler }) => {
|
|
|
1079
2073
|
children: "Response:"
|
|
1080
2074
|
}
|
|
1081
2075
|
),
|
|
1082
|
-
/* @__PURE__ */
|
|
2076
|
+
/* @__PURE__ */ jsx11(MDResponse, { content: toolCallData.response })
|
|
1083
2077
|
] })
|
|
1084
2078
|
] });
|
|
1085
2079
|
const expandIcon = ({ isActive }) => {
|
|
@@ -1089,18 +2083,17 @@ var ToolCall = ({ data, eventHandler }) => {
|
|
|
1089
2083
|
if (toolCallElement) {
|
|
1090
2084
|
return toolCallElement.card_view({
|
|
1091
2085
|
data: toolCallData,
|
|
1092
|
-
component_key: toolCallData.id
|
|
1093
|
-
eventHandler
|
|
2086
|
+
component_key: toolCallData.id
|
|
1094
2087
|
});
|
|
1095
2088
|
}
|
|
1096
|
-
return /* @__PURE__ */
|
|
2089
|
+
return /* @__PURE__ */ jsx11(
|
|
1097
2090
|
Collapse,
|
|
1098
2091
|
{
|
|
1099
2092
|
size: "small",
|
|
1100
2093
|
bordered: false,
|
|
1101
2094
|
defaultActiveKey: [],
|
|
1102
2095
|
expandIcon,
|
|
1103
|
-
children: /* @__PURE__ */
|
|
2096
|
+
children: /* @__PURE__ */ jsx11(
|
|
1104
2097
|
CollapsePanel,
|
|
1105
2098
|
{
|
|
1106
2099
|
header,
|
|
@@ -1115,15 +2108,15 @@ var ToolCall = ({ data, eventHandler }) => {
|
|
|
1115
2108
|
|
|
1116
2109
|
// src/components/GenUI/elements/Todo.tsx
|
|
1117
2110
|
import { Card as Card3, List, Typography as Typography5, Space as Space5 } from "antd";
|
|
1118
|
-
import { createStyles as
|
|
2111
|
+
import { createStyles as createStyles4 } from "antd-style";
|
|
1119
2112
|
import {
|
|
1120
2113
|
ArrowRightOutlined,
|
|
1121
2114
|
CheckCircleOutlined as CheckCircleOutlined2,
|
|
1122
2115
|
ClockCircleOutlined
|
|
1123
2116
|
} from "@ant-design/icons";
|
|
1124
|
-
import { jsx as
|
|
2117
|
+
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1125
2118
|
var { Text: Text4 } = Typography5;
|
|
1126
|
-
var
|
|
2119
|
+
var useStyle3 = createStyles4(({ token, css }) => ({
|
|
1127
2120
|
card: css`
|
|
1128
2121
|
max-width: 1200px;
|
|
1129
2122
|
background: linear-gradient(
|
|
@@ -1152,18 +2145,17 @@ var useStyle2 = createStyles2(({ token, css }) => ({
|
|
|
1152
2145
|
var Todo = ({
|
|
1153
2146
|
data,
|
|
1154
2147
|
component_key,
|
|
1155
|
-
eventHandler,
|
|
1156
2148
|
interactive = true
|
|
1157
2149
|
}) => {
|
|
1158
|
-
const { styles } =
|
|
1159
|
-
const
|
|
2150
|
+
const { styles } = useStyle3();
|
|
2151
|
+
const getStatusIcon2 = (status) => {
|
|
1160
2152
|
switch (status) {
|
|
1161
2153
|
case "completed":
|
|
1162
|
-
return /* @__PURE__ */
|
|
2154
|
+
return /* @__PURE__ */ jsx12(CheckCircleOutlined2, { style: { color: "#52c41a" } });
|
|
1163
2155
|
case "in_progress":
|
|
1164
|
-
return /* @__PURE__ */
|
|
2156
|
+
return /* @__PURE__ */ jsx12(ArrowRightOutlined, { style: { fontWeight: "500" } });
|
|
1165
2157
|
case "pending":
|
|
1166
|
-
return /* @__PURE__ */
|
|
2158
|
+
return /* @__PURE__ */ jsx12(ClockCircleOutlined, { style: { color: "gray" } });
|
|
1167
2159
|
default:
|
|
1168
2160
|
return null;
|
|
1169
2161
|
}
|
|
@@ -1205,35 +2197,35 @@ var Todo = ({
|
|
|
1205
2197
|
}
|
|
1206
2198
|
};
|
|
1207
2199
|
if (!data || !Array.isArray(data)) {
|
|
1208
|
-
return /* @__PURE__ */
|
|
2200
|
+
return /* @__PURE__ */ jsx12(
|
|
1209
2201
|
Card3,
|
|
1210
2202
|
{
|
|
1211
2203
|
size: "small",
|
|
1212
2204
|
className: `shadow-sm ${styles.card}`,
|
|
1213
2205
|
bordered: false,
|
|
1214
|
-
children: /* @__PURE__ */
|
|
2206
|
+
children: /* @__PURE__ */ jsx12(Text4, { type: "secondary", children: "No todo items available" })
|
|
1215
2207
|
}
|
|
1216
2208
|
);
|
|
1217
2209
|
}
|
|
1218
|
-
return /* @__PURE__ */
|
|
1219
|
-
/* @__PURE__ */
|
|
2210
|
+
return /* @__PURE__ */ jsx12(Card3, { size: "small", className: `shadow-sm ${styles.card}`, bordered: false, children: /* @__PURE__ */ jsxs6(Space5, { direction: "vertical", style: { width: "100%" }, children: [
|
|
2211
|
+
/* @__PURE__ */ jsx12(
|
|
1220
2212
|
List,
|
|
1221
2213
|
{
|
|
1222
2214
|
size: "small",
|
|
1223
2215
|
dataSource: data,
|
|
1224
|
-
renderItem: (item, index) => /* @__PURE__ */
|
|
2216
|
+
renderItem: (item, index) => /* @__PURE__ */ jsx12(
|
|
1225
2217
|
List.Item,
|
|
1226
2218
|
{
|
|
1227
2219
|
className: `${styles.todoItem} ${getItemClassName(item.status)}`,
|
|
1228
|
-
children: /* @__PURE__ */
|
|
1229
|
-
|
|
1230
|
-
/* @__PURE__ */
|
|
2220
|
+
children: /* @__PURE__ */ jsxs6(Space5, { align: "center", style: { width: "100%" }, children: [
|
|
2221
|
+
getStatusIcon2(item.status),
|
|
2222
|
+
/* @__PURE__ */ jsx12(Text4, { style: { flex: 1 }, children: item.content })
|
|
1231
2223
|
] })
|
|
1232
2224
|
}
|
|
1233
2225
|
)
|
|
1234
2226
|
}
|
|
1235
2227
|
),
|
|
1236
|
-
/* @__PURE__ */
|
|
2228
|
+
/* @__PURE__ */ jsxs6(Text4, { type: "secondary", style: { fontSize: 12 }, children: [
|
|
1237
2229
|
"Total items: ",
|
|
1238
2230
|
data.length,
|
|
1239
2231
|
" | Completed:",
|
|
@@ -1252,12 +2244,11 @@ var Todo = ({
|
|
|
1252
2244
|
import { Space as Space6, Collapse as Collapse2, Typography as Typography6 } from "antd";
|
|
1253
2245
|
import { UnorderedListOutlined } from "@ant-design/icons";
|
|
1254
2246
|
import CollapsePanel2 from "antd/es/collapse/CollapsePanel";
|
|
1255
|
-
import { jsx as
|
|
2247
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1256
2248
|
var { Text: Text5 } = Typography6;
|
|
1257
2249
|
var WriteTodos = ({
|
|
1258
2250
|
data,
|
|
1259
2251
|
component_key,
|
|
1260
|
-
eventHandler,
|
|
1261
2252
|
interactive = true
|
|
1262
2253
|
}) => {
|
|
1263
2254
|
const toolCallData = data;
|
|
@@ -1267,11 +2258,11 @@ var WriteTodos = ({
|
|
|
1267
2258
|
(item) => item.status === "completed"
|
|
1268
2259
|
).length;
|
|
1269
2260
|
const expandIcon = () => {
|
|
1270
|
-
return /* @__PURE__ */
|
|
2261
|
+
return /* @__PURE__ */ jsx13(UnorderedListOutlined, {});
|
|
1271
2262
|
};
|
|
1272
|
-
const header = /* @__PURE__ */
|
|
1273
|
-
/* @__PURE__ */
|
|
1274
|
-
/* @__PURE__ */
|
|
2263
|
+
const header = /* @__PURE__ */ jsxs7(Space6, { children: [
|
|
2264
|
+
/* @__PURE__ */ jsx13(Text5, { strong: true, children: "Todos" }),
|
|
2265
|
+
/* @__PURE__ */ jsxs7(Text5, { style: { fontSize: 12 }, type: "secondary", children: [
|
|
1275
2266
|
completedCount,
|
|
1276
2267
|
"/",
|
|
1277
2268
|
totalCount,
|
|
@@ -1281,24 +2272,23 @@ var WriteTodos = ({
|
|
|
1281
2272
|
if (!toolCallData) {
|
|
1282
2273
|
return null;
|
|
1283
2274
|
}
|
|
1284
|
-
return /* @__PURE__ */
|
|
2275
|
+
return /* @__PURE__ */ jsx13(
|
|
1285
2276
|
Collapse2,
|
|
1286
2277
|
{
|
|
1287
2278
|
size: "small",
|
|
1288
2279
|
bordered: false,
|
|
1289
2280
|
defaultActiveKey: [toolCallData.id],
|
|
1290
2281
|
expandIcon,
|
|
1291
|
-
children: /* @__PURE__ */
|
|
2282
|
+
children: /* @__PURE__ */ jsx13(
|
|
1292
2283
|
CollapsePanel2,
|
|
1293
2284
|
{
|
|
1294
2285
|
header,
|
|
1295
2286
|
style: { minWidth: 400 },
|
|
1296
|
-
children: /* @__PURE__ */
|
|
2287
|
+
children: /* @__PURE__ */ jsx13(
|
|
1297
2288
|
Todo,
|
|
1298
2289
|
{
|
|
1299
2290
|
data: data.args.todos,
|
|
1300
2291
|
component_key,
|
|
1301
|
-
eventHandler,
|
|
1302
2292
|
interactive
|
|
1303
2293
|
}
|
|
1304
2294
|
)
|
|
@@ -1310,7 +2300,7 @@ var WriteTodos = ({
|
|
|
1310
2300
|
};
|
|
1311
2301
|
|
|
1312
2302
|
// src/components/GenUI/FileExplorer.tsx
|
|
1313
|
-
import { useState as
|
|
2303
|
+
import { useState as useState11, useEffect as useEffect7, useMemo as useMemo3 } from "react";
|
|
1314
2304
|
import { Splitter, Tree, Empty, Button as Button3, Tooltip, message } from "antd";
|
|
1315
2305
|
import {
|
|
1316
2306
|
FolderOutlined,
|
|
@@ -1319,7 +2309,7 @@ import {
|
|
|
1319
2309
|
DownloadOutlined as DownloadOutlined2,
|
|
1320
2310
|
CheckOutlined
|
|
1321
2311
|
} from "@ant-design/icons";
|
|
1322
|
-
import { createStyles as
|
|
2312
|
+
import { createStyles as createStyles5 } from "antd-style";
|
|
1323
2313
|
|
|
1324
2314
|
// src/components/GenUI/elements/getFileIcon.tsx
|
|
1325
2315
|
import {
|
|
@@ -1331,41 +2321,41 @@ import {
|
|
|
1331
2321
|
FileUnknownOutlined,
|
|
1332
2322
|
Html5Outlined
|
|
1333
2323
|
} from "@ant-design/icons";
|
|
1334
|
-
import { jsx as
|
|
2324
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1335
2325
|
var getFileIcon = (filename) => {
|
|
1336
2326
|
const ext = filename?.split(".")?.pop()?.toLowerCase();
|
|
1337
2327
|
const iconStyle = { fontSize: 14, marginRight: 4, verticalAlign: "middle" };
|
|
1338
2328
|
switch (ext) {
|
|
1339
2329
|
case "ts":
|
|
1340
2330
|
case "tsx":
|
|
1341
|
-
return /* @__PURE__ */
|
|
2331
|
+
return /* @__PURE__ */ jsx14(CodeOutlined2, { style: { ...iconStyle, color: "#3178c6" } });
|
|
1342
2332
|
case "js":
|
|
1343
2333
|
case "jsx":
|
|
1344
|
-
return /* @__PURE__ */
|
|
2334
|
+
return /* @__PURE__ */ jsx14(CodeOutlined2, { style: { ...iconStyle, color: "#f7df1e" } });
|
|
1345
2335
|
case "html":
|
|
1346
|
-
return /* @__PURE__ */
|
|
2336
|
+
return /* @__PURE__ */ jsx14(Html5Outlined, { style: { ...iconStyle, color: "#e34c26" } });
|
|
1347
2337
|
case "css":
|
|
1348
2338
|
case "less":
|
|
1349
2339
|
case "scss":
|
|
1350
|
-
return /* @__PURE__ */
|
|
2340
|
+
return /* @__PURE__ */ jsx14(FileUnknownOutlined, { style: { ...iconStyle, color: "#563d7c" } });
|
|
1351
2341
|
case "md":
|
|
1352
|
-
return /* @__PURE__ */
|
|
2342
|
+
return /* @__PURE__ */ jsx14(FileMarkdownOutlined, { style: { ...iconStyle, color: "#083fa1" } });
|
|
1353
2343
|
case "json":
|
|
1354
|
-
return /* @__PURE__ */
|
|
2344
|
+
return /* @__PURE__ */ jsx14(FileTextOutlined, { style: { ...iconStyle, color: "#fbc02d" } });
|
|
1355
2345
|
case "png":
|
|
1356
2346
|
case "jpg":
|
|
1357
2347
|
case "jpeg":
|
|
1358
2348
|
case "gif":
|
|
1359
2349
|
case "svg":
|
|
1360
|
-
return /* @__PURE__ */
|
|
2350
|
+
return /* @__PURE__ */ jsx14(FileImageOutlined, { style: { ...iconStyle, color: "#4caf50" } });
|
|
1361
2351
|
default:
|
|
1362
|
-
return /* @__PURE__ */
|
|
2352
|
+
return /* @__PURE__ */ jsx14(FileOutlined, { style: { ...iconStyle, color: "#9e9e9e" } });
|
|
1363
2353
|
}
|
|
1364
2354
|
};
|
|
1365
2355
|
|
|
1366
2356
|
// src/components/GenUI/FileExplorer.tsx
|
|
1367
|
-
import { jsx as
|
|
1368
|
-
var
|
|
2357
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2358
|
+
var useStyles2 = createStyles5(({ token, css }) => ({
|
|
1369
2359
|
container: css`
|
|
1370
2360
|
height: 100%;
|
|
1371
2361
|
background: ${token.colorBgContainer};
|
|
@@ -1496,7 +2486,7 @@ var getFolderIcon = (expanded) => {
|
|
|
1496
2486
|
color: "#dcb67a",
|
|
1497
2487
|
verticalAlign: "middle"
|
|
1498
2488
|
};
|
|
1499
|
-
return expanded ? /* @__PURE__ */
|
|
2489
|
+
return expanded ? /* @__PURE__ */ jsx15(FolderOpenOutlined, { style: iconStyle }) : /* @__PURE__ */ jsx15(FolderOutlined, { style: iconStyle });
|
|
1500
2490
|
};
|
|
1501
2491
|
var sortTreeNodes = (nodes) => {
|
|
1502
2492
|
return nodes.sort((a, b) => {
|
|
@@ -1521,7 +2511,7 @@ var buildTreeData = (files, expandedKeys) => {
|
|
|
1521
2511
|
const key = parts.slice(0, index + 1).join("/");
|
|
1522
2512
|
let existingNode = currentLevel.find((node) => node.key === key);
|
|
1523
2513
|
if (!existingNode) {
|
|
1524
|
-
const title = part === "" && index === 0 ? /* @__PURE__ */
|
|
2514
|
+
const title = part === "" && index === 0 ? /* @__PURE__ */ jsx15(
|
|
1525
2515
|
"span",
|
|
1526
2516
|
{
|
|
1527
2517
|
style: {
|
|
@@ -1551,23 +2541,22 @@ var buildTreeData = (files, expandedKeys) => {
|
|
|
1551
2541
|
};
|
|
1552
2542
|
var FileExplorer = ({
|
|
1553
2543
|
data,
|
|
1554
|
-
eventHandler,
|
|
1555
2544
|
interactive = true,
|
|
1556
2545
|
default_open_in_side_app = true
|
|
1557
2546
|
}) => {
|
|
1558
2547
|
const { files } = data ?? {};
|
|
1559
|
-
const { styles, cx } =
|
|
1560
|
-
const [fileList, setFileList] =
|
|
1561
|
-
const [selectedKey, setSelectedKey] =
|
|
1562
|
-
const [expandedKeys, setExpandedKeys] =
|
|
1563
|
-
const [copied, setCopied] =
|
|
1564
|
-
|
|
2548
|
+
const { styles, cx } = useStyles2();
|
|
2549
|
+
const [fileList, setFileList] = useState11([]);
|
|
2550
|
+
const [selectedKey, setSelectedKey] = useState11("");
|
|
2551
|
+
const [expandedKeys, setExpandedKeys] = useState11([]);
|
|
2552
|
+
const [copied, setCopied] = useState11(false);
|
|
2553
|
+
useEffect7(() => {
|
|
1565
2554
|
if (copied) {
|
|
1566
2555
|
const timer = setTimeout(() => setCopied(false), 2e3);
|
|
1567
2556
|
return () => clearTimeout(timer);
|
|
1568
2557
|
}
|
|
1569
2558
|
}, [copied]);
|
|
1570
|
-
|
|
2559
|
+
useEffect7(() => {
|
|
1571
2560
|
let list = [];
|
|
1572
2561
|
if (Array.isArray(files)) {
|
|
1573
2562
|
list = files;
|
|
@@ -1583,11 +2572,11 @@ var FileExplorer = ({
|
|
|
1583
2572
|
setSelectedKey(list[0].name);
|
|
1584
2573
|
}
|
|
1585
2574
|
}, [files]);
|
|
1586
|
-
const treeData =
|
|
2575
|
+
const treeData = useMemo3(
|
|
1587
2576
|
() => buildTreeData(fileList, expandedKeys),
|
|
1588
2577
|
[fileList, expandedKeys]
|
|
1589
2578
|
);
|
|
1590
|
-
|
|
2579
|
+
useEffect7(() => {
|
|
1591
2580
|
if (treeData.length > 0 && expandedKeys.length === 0) {
|
|
1592
2581
|
const getAllKeys = (nodes) => {
|
|
1593
2582
|
let keys = [];
|
|
@@ -1604,7 +2593,7 @@ var FileExplorer = ({
|
|
|
1604
2593
|
setExpandedKeys(getAllKeys(treeData));
|
|
1605
2594
|
}
|
|
1606
2595
|
}, [treeData.length]);
|
|
1607
|
-
const selectedFile =
|
|
2596
|
+
const selectedFile = useMemo3(() => {
|
|
1608
2597
|
return fileList.find((f) => f.name === selectedKey);
|
|
1609
2598
|
}, [fileList, selectedKey]);
|
|
1610
2599
|
const handleCopy = () => {
|
|
@@ -1631,7 +2620,7 @@ var FileExplorer = ({
|
|
|
1631
2620
|
};
|
|
1632
2621
|
const renderContent = () => {
|
|
1633
2622
|
if (!selectedFile) {
|
|
1634
|
-
return /* @__PURE__ */
|
|
2623
|
+
return /* @__PURE__ */ jsx15("div", { className: styles.emptyState, children: /* @__PURE__ */ jsx15(
|
|
1635
2624
|
Empty,
|
|
1636
2625
|
{
|
|
1637
2626
|
description: "Select a file to preview",
|
|
@@ -1640,38 +2629,38 @@ var FileExplorer = ({
|
|
|
1640
2629
|
) });
|
|
1641
2630
|
}
|
|
1642
2631
|
const content = Array.isArray(selectedFile.content) ? selectedFile.content.join("\n") : selectedFile.content;
|
|
1643
|
-
return /* @__PURE__ */
|
|
2632
|
+
return /* @__PURE__ */ jsxs8(
|
|
1644
2633
|
"div",
|
|
1645
2634
|
{
|
|
1646
2635
|
style: { minHeight: "100%", display: "flex", flexDirection: "column" },
|
|
1647
2636
|
children: [
|
|
1648
|
-
/* @__PURE__ */
|
|
1649
|
-
/* @__PURE__ */
|
|
2637
|
+
/* @__PURE__ */ jsxs8("div", { className: styles.header, children: [
|
|
2638
|
+
/* @__PURE__ */ jsx15(Tooltip, { title: "Copy Content", children: /* @__PURE__ */ jsx15(
|
|
1650
2639
|
Button3,
|
|
1651
2640
|
{
|
|
1652
2641
|
type: "text",
|
|
1653
|
-
icon: copied ? /* @__PURE__ */
|
|
2642
|
+
icon: copied ? /* @__PURE__ */ jsx15(CheckOutlined, {}) : /* @__PURE__ */ jsx15(CopyOutlined, {}),
|
|
1654
2643
|
onClick: handleCopy,
|
|
1655
2644
|
size: "small"
|
|
1656
2645
|
}
|
|
1657
2646
|
) }),
|
|
1658
|
-
/* @__PURE__ */
|
|
2647
|
+
/* @__PURE__ */ jsx15(Tooltip, { title: "Download File", children: /* @__PURE__ */ jsx15(
|
|
1659
2648
|
Button3,
|
|
1660
2649
|
{
|
|
1661
2650
|
type: "text",
|
|
1662
|
-
icon: /* @__PURE__ */
|
|
2651
|
+
icon: /* @__PURE__ */ jsx15(DownloadOutlined2, {}),
|
|
1663
2652
|
onClick: handleDownload,
|
|
1664
2653
|
size: "small"
|
|
1665
2654
|
}
|
|
1666
2655
|
) })
|
|
1667
2656
|
] }),
|
|
1668
|
-
/* @__PURE__ */
|
|
2657
|
+
/* @__PURE__ */ jsx15("div", { className: styles.contentBody, children: /* @__PURE__ */ jsx15(MDResponse, { content }) })
|
|
1669
2658
|
]
|
|
1670
2659
|
}
|
|
1671
2660
|
);
|
|
1672
2661
|
};
|
|
1673
|
-
return /* @__PURE__ */
|
|
1674
|
-
/* @__PURE__ */
|
|
2662
|
+
return /* @__PURE__ */ jsx15("div", { className: styles.container, children: /* @__PURE__ */ jsxs8(Splitter, { className: styles.splitter, children: [
|
|
2663
|
+
/* @__PURE__ */ jsx15(Splitter.Panel, { defaultSize: "25%", min: "15%", max: "40%", children: /* @__PURE__ */ jsx15("div", { className: styles.leftPanel, children: /* @__PURE__ */ jsx15(
|
|
1675
2664
|
Tree,
|
|
1676
2665
|
{
|
|
1677
2666
|
showIcon: true,
|
|
@@ -1709,12 +2698,12 @@ var FileExplorer = ({
|
|
|
1709
2698
|
}
|
|
1710
2699
|
}
|
|
1711
2700
|
) }) }),
|
|
1712
|
-
/* @__PURE__ */
|
|
2701
|
+
/* @__PURE__ */ jsx15(Splitter.Panel, { children: /* @__PURE__ */ jsx15("div", { className: styles.rightPanel, children: renderContent() }) })
|
|
1713
2702
|
] }) });
|
|
1714
2703
|
};
|
|
1715
2704
|
|
|
1716
2705
|
// src/components/GenUI/elements/attachments_card.tsx
|
|
1717
|
-
import {
|
|
2706
|
+
import { FileCard } from "@ant-design/x";
|
|
1718
2707
|
import {
|
|
1719
2708
|
Card as Card4,
|
|
1720
2709
|
Flex as Flex3,
|
|
@@ -1725,18 +2714,18 @@ import {
|
|
|
1725
2714
|
Button as Button4
|
|
1726
2715
|
} from "antd";
|
|
1727
2716
|
import dayjs from "dayjs";
|
|
1728
|
-
import { useState as
|
|
1729
|
-
import { jsx as
|
|
2717
|
+
import { useState as useState12 } from "react";
|
|
2718
|
+
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1730
2719
|
var AttachmentsCard = ({
|
|
1731
2720
|
data,
|
|
1732
|
-
eventHandler,
|
|
1733
2721
|
component_key,
|
|
1734
2722
|
size = "medium",
|
|
1735
2723
|
columns = 1,
|
|
1736
2724
|
showDownloadButton = false
|
|
1737
2725
|
}) => {
|
|
1738
|
-
const { Text:
|
|
1739
|
-
const [showAll, setShowAll] =
|
|
2726
|
+
const { Text: Text11 } = Typography7;
|
|
2727
|
+
const [showAll, setShowAll] = useState12(false);
|
|
2728
|
+
const { openSideApp } = useChatUIContext();
|
|
1740
2729
|
const getStyles = () => {
|
|
1741
2730
|
switch (size) {
|
|
1742
2731
|
case "small":
|
|
@@ -1761,14 +2750,11 @@ var AttachmentsCard = ({
|
|
|
1761
2750
|
};
|
|
1762
2751
|
const styles = getStyles();
|
|
1763
2752
|
const handleItemClick = (item) => {
|
|
1764
|
-
|
|
1765
|
-
"
|
|
1766
|
-
{
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
},
|
|
1770
|
-
""
|
|
1771
|
-
);
|
|
2753
|
+
openSideApp({
|
|
2754
|
+
component_key: "attachments",
|
|
2755
|
+
data: { file_id: item.id, message: "\u9884\u89C8\uFF1A" + item.name },
|
|
2756
|
+
message: "\u9884\u89C8\uFF1A" + item.name
|
|
2757
|
+
});
|
|
1772
2758
|
};
|
|
1773
2759
|
const getCardStyle = (item) => {
|
|
1774
2760
|
if (item.is_failure && columns > 1) {
|
|
@@ -1797,7 +2783,7 @@ var AttachmentsCard = ({
|
|
|
1797
2783
|
};
|
|
1798
2784
|
const DownloadButton = ({ item }) => {
|
|
1799
2785
|
if (!showDownloadButton) return null;
|
|
1800
|
-
return /* @__PURE__ */
|
|
2786
|
+
return /* @__PURE__ */ jsx16(
|
|
1801
2787
|
"div",
|
|
1802
2788
|
{
|
|
1803
2789
|
style: {
|
|
@@ -1811,8 +2797,8 @@ var AttachmentsCard = ({
|
|
|
1811
2797
|
}
|
|
1812
2798
|
);
|
|
1813
2799
|
};
|
|
1814
|
-
const renderFileDescription = (item) => /* @__PURE__ */
|
|
1815
|
-
|
|
2800
|
+
const renderFileDescription = (item) => /* @__PURE__ */ jsx16(Space7, { direction: "vertical", size: size === "small" ? 2 : 4, children: /* @__PURE__ */ jsx16(Space7, { children: /* @__PURE__ */ jsx16(
|
|
2801
|
+
Text11,
|
|
1816
2802
|
{
|
|
1817
2803
|
type: "secondary",
|
|
1818
2804
|
style: {
|
|
@@ -1825,34 +2811,30 @@ var AttachmentsCard = ({
|
|
|
1825
2811
|
const displayData2 = data || [];
|
|
1826
2812
|
const shouldShowViewMore2 = displayData2.length > 4;
|
|
1827
2813
|
const visibleData2 = showAll ? displayData2 : displayData2.slice(0, 4);
|
|
1828
|
-
return /* @__PURE__ */
|
|
1829
|
-
/* @__PURE__ */
|
|
2814
|
+
return /* @__PURE__ */ jsxs9(Flex3, { vertical: true, gap: "small", children: [
|
|
2815
|
+
/* @__PURE__ */ jsx16(Row, { gutter: [8, 8], children: visibleData2.map((item) => /* @__PURE__ */ jsx16(Col, { span: 24 / columns, children: /* @__PURE__ */ jsx16(
|
|
1830
2816
|
"div",
|
|
1831
2817
|
{
|
|
1832
2818
|
onClick: (evt) => {
|
|
1833
2819
|
evt.stopPropagation();
|
|
1834
2820
|
handleItemClick(item);
|
|
1835
2821
|
},
|
|
1836
|
-
children: /* @__PURE__ */
|
|
1837
|
-
/* @__PURE__ */
|
|
1838
|
-
/* @__PURE__ */
|
|
1839
|
-
|
|
2822
|
+
children: /* @__PURE__ */ jsxs9(Card4, { size: styles.cardSize, style: getCardStyle(item), children: [
|
|
2823
|
+
/* @__PURE__ */ jsx16(DownloadButton, { item }),
|
|
2824
|
+
/* @__PURE__ */ jsx16(
|
|
2825
|
+
FileCard,
|
|
1840
2826
|
{
|
|
1841
2827
|
style: getFileCardStyle(item),
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
uid: item.id,
|
|
1846
|
-
description: renderFileDescription(item)
|
|
1847
|
-
}
|
|
2828
|
+
name: item.name,
|
|
2829
|
+
byte: item.size,
|
|
2830
|
+
description: renderFileDescription(item)
|
|
1848
2831
|
}
|
|
1849
2832
|
),
|
|
1850
|
-
item.files && /* @__PURE__ */
|
|
2833
|
+
item.files && /* @__PURE__ */ jsx16(
|
|
1851
2834
|
AttachmentsCard,
|
|
1852
2835
|
{
|
|
1853
2836
|
data: item.files,
|
|
1854
2837
|
component_key: `${component_key}_${item.id}`,
|
|
1855
|
-
eventHandler,
|
|
1856
2838
|
size: "small",
|
|
1857
2839
|
columns: 2,
|
|
1858
2840
|
showDownloadButton
|
|
@@ -1861,7 +2843,7 @@ var AttachmentsCard = ({
|
|
|
1861
2843
|
] })
|
|
1862
2844
|
}
|
|
1863
2845
|
) }, item.id)) }),
|
|
1864
|
-
shouldShowViewMore2 && /* @__PURE__ */
|
|
2846
|
+
shouldShowViewMore2 && /* @__PURE__ */ jsx16(
|
|
1865
2847
|
Button4,
|
|
1866
2848
|
{
|
|
1867
2849
|
type: "link",
|
|
@@ -1875,33 +2857,29 @@ var AttachmentsCard = ({
|
|
|
1875
2857
|
const displayData = data || [];
|
|
1876
2858
|
const shouldShowViewMore = displayData.length > 4;
|
|
1877
2859
|
const visibleData = showAll ? displayData : displayData.slice(0, 4);
|
|
1878
|
-
return /* @__PURE__ */
|
|
1879
|
-
visibleData.map((item) => /* @__PURE__ */
|
|
1880
|
-
/* @__PURE__ */
|
|
1881
|
-
/* @__PURE__ */
|
|
1882
|
-
|
|
2860
|
+
return /* @__PURE__ */ jsxs9(Flex3, { vertical: true, gap: size === "small" ? "small" : "middle", children: [
|
|
2861
|
+
visibleData.map((item) => /* @__PURE__ */ jsx16("div", { onClick: () => handleItemClick(item), children: /* @__PURE__ */ jsxs9(Card4, { size: styles.cardSize, style: getCardStyle(item), children: [
|
|
2862
|
+
/* @__PURE__ */ jsx16(DownloadButton, { item }),
|
|
2863
|
+
/* @__PURE__ */ jsx16(
|
|
2864
|
+
FileCard,
|
|
1883
2865
|
{
|
|
1884
2866
|
style: getFileCardStyle(item),
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
uid: item.id,
|
|
1889
|
-
description: renderFileDescription(item)
|
|
1890
|
-
}
|
|
2867
|
+
name: item.name,
|
|
2868
|
+
byte: item.size,
|
|
2869
|
+
description: renderFileDescription(item)
|
|
1891
2870
|
}
|
|
1892
2871
|
),
|
|
1893
|
-
item.files && /* @__PURE__ */
|
|
1894
|
-
/* @__PURE__ */
|
|
2872
|
+
item.files && /* @__PURE__ */ jsxs9("div", { style: { paddingLeft: "12px" }, children: [
|
|
2873
|
+
/* @__PURE__ */ jsxs9(Text11, { type: "secondary", style: { fontSize: "12px" }, children: [
|
|
1895
2874
|
"\u5305\u542B\u6587\u4EF6(",
|
|
1896
2875
|
item.files.length,
|
|
1897
2876
|
")"
|
|
1898
2877
|
] }),
|
|
1899
|
-
/* @__PURE__ */
|
|
2878
|
+
/* @__PURE__ */ jsx16(
|
|
1900
2879
|
AttachmentsCard,
|
|
1901
2880
|
{
|
|
1902
2881
|
data: item.files,
|
|
1903
2882
|
component_key: `${component_key}_${item.id}`,
|
|
1904
|
-
eventHandler,
|
|
1905
2883
|
size: "small",
|
|
1906
2884
|
columns: 2,
|
|
1907
2885
|
showDownloadButton
|
|
@@ -1909,7 +2887,7 @@ var AttachmentsCard = ({
|
|
|
1909
2887
|
)
|
|
1910
2888
|
] })
|
|
1911
2889
|
] }) }, item.id)),
|
|
1912
|
-
shouldShowViewMore && /* @__PURE__ */
|
|
2890
|
+
shouldShowViewMore && /* @__PURE__ */ jsx16(
|
|
1913
2891
|
Button4,
|
|
1914
2892
|
{
|
|
1915
2893
|
type: "link",
|
|
@@ -1927,18 +2905,17 @@ var AttachmentsCard = ({
|
|
|
1927
2905
|
|
|
1928
2906
|
// src/components/GenUI/elements/attachments_viewer_side_app.tsx
|
|
1929
2907
|
import { Button as Button5, Empty as Empty2, Skeleton } from "antd";
|
|
1930
|
-
import { useState as
|
|
1931
|
-
import { Fragment, jsx as
|
|
2908
|
+
import { useState as useState13 } from "react";
|
|
2909
|
+
import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1932
2910
|
function AttachmentsViewerSideApp({
|
|
1933
2911
|
data,
|
|
1934
|
-
eventHandler,
|
|
1935
2912
|
component_key
|
|
1936
2913
|
}) {
|
|
1937
|
-
const [fileUri, setFileUri] =
|
|
1938
|
-
const [loading, setLoading] =
|
|
2914
|
+
const [fileUri, setFileUri] = useState13();
|
|
2915
|
+
const [loading, setLoading] = useState13(true);
|
|
1939
2916
|
const { file_id } = data ?? {};
|
|
1940
2917
|
if (loading) {
|
|
1941
|
-
return /* @__PURE__ */
|
|
2918
|
+
return /* @__PURE__ */ jsx17(Skeleton, { active: true });
|
|
1942
2919
|
}
|
|
1943
2920
|
const canPreviewInIframe = (fileName) => {
|
|
1944
2921
|
if (!fileName) return false;
|
|
@@ -1973,18 +2950,18 @@ function AttachmentsViewerSideApp({
|
|
|
1973
2950
|
return previewableExtensions.includes(extension);
|
|
1974
2951
|
};
|
|
1975
2952
|
const isPreviewable = fileUri?.fileName ? canPreviewInIframe(fileUri.fileName) : false;
|
|
1976
|
-
return isPreviewable ? /* @__PURE__ */
|
|
2953
|
+
return isPreviewable ? /* @__PURE__ */ jsx17(
|
|
1977
2954
|
"iframe",
|
|
1978
2955
|
{
|
|
1979
2956
|
style: { width: "100%", height: "100%", border: 0 },
|
|
1980
2957
|
src: fileUri?.url
|
|
1981
2958
|
}
|
|
1982
|
-
) : /* @__PURE__ */
|
|
2959
|
+
) : /* @__PURE__ */ jsx17(
|
|
1983
2960
|
Empty2,
|
|
1984
2961
|
{
|
|
1985
|
-
description: /* @__PURE__ */
|
|
1986
|
-
/* @__PURE__ */
|
|
1987
|
-
/* @__PURE__ */
|
|
2962
|
+
description: /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
2963
|
+
/* @__PURE__ */ jsx17("div", { children: "\u6682\u65F6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u8BF7\u4E0B\u8F7D\u540E\u67E5\u770B\u3002" }),
|
|
2964
|
+
/* @__PURE__ */ jsxs10(Button5, { type: "link", href: fileUri?.url, download: fileUri?.fileName, children: [
|
|
1988
2965
|
"\u4E0B\u8F7D",
|
|
1989
2966
|
fileUri?.fileName
|
|
1990
2967
|
] })
|
|
@@ -1998,15 +2975,15 @@ function AttachmentsViewerSideApp({
|
|
|
1998
2975
|
import { Button as Button6, Space as Space8, Typography as Typography8 } from "antd";
|
|
1999
2976
|
|
|
2000
2977
|
// src/components/GenUI/elements/ContentPreviewCollapse.tsx
|
|
2001
|
-
import { useRef as
|
|
2978
|
+
import { useRef as useRef6, useState as useState14, useEffect as useEffect9, useCallback as useCallback7 } from "react";
|
|
2002
2979
|
import { Collapse as Collapse4 } from "antd";
|
|
2003
|
-
import { createStyles as
|
|
2980
|
+
import { createStyles as createStyles6 } from "antd-style";
|
|
2004
2981
|
import { DownOutlined as DownOutlined2, UpOutlined } from "@ant-design/icons";
|
|
2005
2982
|
import CollapsePanel3 from "antd/es/collapse/CollapsePanel";
|
|
2006
|
-
import { Fragment as
|
|
2983
|
+
import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2007
2984
|
var DEFAULT_COLLAPSED_MAX_HEIGHT = 180;
|
|
2008
2985
|
var DEFAULT_EXPANDED_MAX_HEIGHT = 500;
|
|
2009
|
-
var
|
|
2986
|
+
var useStyle4 = createStyles6(
|
|
2010
2987
|
({ css }, { showShadow }) => ({
|
|
2011
2988
|
collapse: css`
|
|
2012
2989
|
.ant-collapse-header {
|
|
@@ -2068,18 +3045,18 @@ var ContentPreviewCollapse = ({
|
|
|
2068
3045
|
showAllText = "Show all content",
|
|
2069
3046
|
showLessText = "Show less"
|
|
2070
3047
|
}) => {
|
|
2071
|
-
const [showFullContent, setShowFullContent] =
|
|
2072
|
-
const [isOverflowing, setIsOverflowing] =
|
|
2073
|
-
const contentRef =
|
|
3048
|
+
const [showFullContent, setShowFullContent] = useState14(false);
|
|
3049
|
+
const [isOverflowing, setIsOverflowing] = useState14(false);
|
|
3050
|
+
const contentRef = useRef6(null);
|
|
2074
3051
|
const showShadow = isOverflowing && !showFullContent;
|
|
2075
|
-
const { styles, cx } =
|
|
2076
|
-
const checkOverflow =
|
|
3052
|
+
const { styles, cx } = useStyle4({ showShadow });
|
|
3053
|
+
const checkOverflow = useCallback7(() => {
|
|
2077
3054
|
if (contentRef.current) {
|
|
2078
3055
|
const scrollHeight = contentRef.current.scrollHeight;
|
|
2079
3056
|
setIsOverflowing(scrollHeight > collapsedMaxHeight);
|
|
2080
3057
|
}
|
|
2081
3058
|
}, [collapsedMaxHeight]);
|
|
2082
|
-
|
|
3059
|
+
useEffect9(() => {
|
|
2083
3060
|
const element = contentRef.current;
|
|
2084
3061
|
if (!element) return;
|
|
2085
3062
|
checkOverflow();
|
|
@@ -2095,7 +3072,7 @@ var ContentPreviewCollapse = ({
|
|
|
2095
3072
|
e.stopPropagation();
|
|
2096
3073
|
setShowFullContent(!showFullContent);
|
|
2097
3074
|
};
|
|
2098
|
-
return /* @__PURE__ */
|
|
3075
|
+
return /* @__PURE__ */ jsx18(
|
|
2099
3076
|
Collapse4,
|
|
2100
3077
|
{
|
|
2101
3078
|
className: styles.collapse,
|
|
@@ -2103,29 +3080,29 @@ var ContentPreviewCollapse = ({
|
|
|
2103
3080
|
bordered: false,
|
|
2104
3081
|
defaultActiveKey: defaultExpanded ? [panelKey] : [],
|
|
2105
3082
|
expandIcon,
|
|
2106
|
-
children: /* @__PURE__ */
|
|
3083
|
+
children: /* @__PURE__ */ jsxs11(
|
|
2107
3084
|
CollapsePanel3,
|
|
2108
3085
|
{
|
|
2109
3086
|
header,
|
|
2110
3087
|
extra,
|
|
2111
3088
|
style: { minWidth },
|
|
2112
3089
|
children: [
|
|
2113
|
-
/* @__PURE__ */
|
|
3090
|
+
/* @__PURE__ */ jsx18(
|
|
2114
3091
|
"div",
|
|
2115
3092
|
{
|
|
2116
3093
|
className: cx(styles.contentContainer, showFullContent && "expanded"),
|
|
2117
3094
|
style: {
|
|
2118
3095
|
maxHeight: showFullContent ? expandedMaxHeight : collapsedMaxHeight
|
|
2119
3096
|
},
|
|
2120
|
-
children: /* @__PURE__ */
|
|
3097
|
+
children: /* @__PURE__ */ jsx18("div", { ref: contentRef, className: styles.content, children })
|
|
2121
3098
|
}
|
|
2122
3099
|
),
|
|
2123
|
-
isOverflowing && /* @__PURE__ */
|
|
2124
|
-
/* @__PURE__ */
|
|
2125
|
-
/* @__PURE__ */
|
|
2126
|
-
] }) : /* @__PURE__ */
|
|
2127
|
-
/* @__PURE__ */
|
|
2128
|
-
/* @__PURE__ */
|
|
3100
|
+
isOverflowing && /* @__PURE__ */ jsx18("div", { className: styles.toggleButton, onClick: handleToggleContent, children: showFullContent ? /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
3101
|
+
/* @__PURE__ */ jsx18(UpOutlined, { style: { fontSize: 10 } }),
|
|
3102
|
+
/* @__PURE__ */ jsx18("span", { children: showLessText })
|
|
3103
|
+
] }) : /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
3104
|
+
/* @__PURE__ */ jsx18(DownOutlined2, { style: { fontSize: 10 } }),
|
|
3105
|
+
/* @__PURE__ */ jsx18("span", { children: showAllText })
|
|
2129
3106
|
] }) })
|
|
2130
3107
|
]
|
|
2131
3108
|
},
|
|
@@ -2136,508 +3113,580 @@ var ContentPreviewCollapse = ({
|
|
|
2136
3113
|
};
|
|
2137
3114
|
|
|
2138
3115
|
// src/components/GenUI/elements/WriteFile.tsx
|
|
2139
|
-
import { jsx as
|
|
3116
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2140
3117
|
var { Text: Text6 } = Typography8;
|
|
2141
3118
|
var WriteFile = ({
|
|
2142
3119
|
data,
|
|
2143
3120
|
component_key,
|
|
2144
|
-
eventHandler,
|
|
2145
3121
|
interactive = true
|
|
2146
3122
|
}) => {
|
|
2147
3123
|
const toolCallData = data;
|
|
2148
3124
|
const { file_path, content } = toolCallData?.args || {};
|
|
3125
|
+
const { openSideApp } = useChatUIContext();
|
|
2149
3126
|
if (!toolCallData) {
|
|
2150
3127
|
return null;
|
|
2151
3128
|
}
|
|
2152
3129
|
const expandIcon = () => getFileIcon(file_path);
|
|
2153
|
-
const header = /* @__PURE__ */
|
|
2154
|
-
/* @__PURE__ */
|
|
2155
|
-
/* @__PURE__ */
|
|
3130
|
+
const header = /* @__PURE__ */ jsxs12(Space8, { children: [
|
|
3131
|
+
/* @__PURE__ */ jsx19(Text6, { strong: true, children: "New" }),
|
|
3132
|
+
/* @__PURE__ */ jsx19(Text6, { title: file_path, children: file_path?.split("/")?.pop() || "" })
|
|
2156
3133
|
] });
|
|
2157
3134
|
const handleItemClick = (toolCallData2) => {
|
|
2158
|
-
|
|
2159
|
-
"
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
}
|
|
2167
|
-
},
|
|
2168
|
-
""
|
|
2169
|
-
);
|
|
3135
|
+
openSideApp({
|
|
3136
|
+
component_key: "file_content_diff_view",
|
|
3137
|
+
message: file_path,
|
|
3138
|
+
data: {
|
|
3139
|
+
old_code: "",
|
|
3140
|
+
new_code: content
|
|
3141
|
+
}
|
|
3142
|
+
});
|
|
2170
3143
|
};
|
|
2171
|
-
return /* @__PURE__ */
|
|
3144
|
+
return /* @__PURE__ */ jsx19(
|
|
2172
3145
|
ContentPreviewCollapse,
|
|
2173
3146
|
{
|
|
2174
3147
|
panelKey: toolCallData.id,
|
|
2175
3148
|
header,
|
|
2176
3149
|
expandIcon,
|
|
2177
|
-
extra: /* @__PURE__ */
|
|
3150
|
+
extra: /* @__PURE__ */ jsx19(
|
|
2178
3151
|
Button6,
|
|
2179
3152
|
{
|
|
2180
3153
|
type: "link",
|
|
2181
3154
|
size: "small",
|
|
2182
3155
|
onClick: (evt) => {
|
|
2183
3156
|
evt.stopPropagation();
|
|
2184
|
-
handleItemClick(toolCallData);
|
|
2185
|
-
},
|
|
2186
|
-
children: "Diff View"
|
|
2187
|
-
}
|
|
2188
|
-
),
|
|
2189
|
-
children: /* @__PURE__ */
|
|
2190
|
-
}
|
|
2191
|
-
);
|
|
2192
|
-
};
|
|
2193
|
-
|
|
2194
|
-
// src/components/GenUI/elements/file_content_diff_view.tsx
|
|
2195
|
-
import ReactDiffViewer from "@alexbruf/react-diff-viewer";
|
|
2196
|
-
import "@alexbruf/react-diff-viewer/index.css";
|
|
2197
|
-
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2198
|
-
var FileContentDiffView = ({
|
|
2199
|
-
data,
|
|
2200
|
-
eventHandler,
|
|
2201
|
-
interactive = true,
|
|
2202
|
-
default_open_in_side_app = true
|
|
2203
|
-
}) => {
|
|
2204
|
-
const { old_code, new_code } = data;
|
|
2205
|
-
return /* @__PURE__ */ jsx15(
|
|
2206
|
-
ReactDiffViewer,
|
|
2207
|
-
{
|
|
2208
|
-
oldValue: old_code,
|
|
2209
|
-
newValue: new_code,
|
|
2210
|
-
splitView: false
|
|
2211
|
-
}
|
|
2212
|
-
);
|
|
2213
|
-
};
|
|
2214
|
-
|
|
2215
|
-
// src/components/GenUI/elements/EditFile.tsx
|
|
2216
|
-
import { Button as Button7, Space as Space9, Typography as Typography9 } from "antd";
|
|
2217
|
-
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2218
|
-
var { Text: Text7 } = Typography9;
|
|
2219
|
-
var EditFile = ({
|
|
2220
|
-
data,
|
|
2221
|
-
component_key,
|
|
2222
|
-
eventHandler,
|
|
2223
|
-
interactive = true
|
|
2224
|
-
}) => {
|
|
2225
|
-
const toolCallData = data;
|
|
2226
|
-
const { file_path, new_string, old_string } = toolCallData?.args || {};
|
|
2227
|
-
if (!toolCallData) {
|
|
2228
|
-
return null;
|
|
2229
|
-
}
|
|
2230
|
-
const expandIcon = () => getFileIcon(file_path);
|
|
2231
|
-
const header = /* @__PURE__ */ jsxs12(Space9, { children: [
|
|
2232
|
-
/* @__PURE__ */ jsx16(Text7, { strong: true, children: "Edit" }),
|
|
2233
|
-
/* @__PURE__ */ jsx16(Text7, { title: file_path, children: file_path?.split("/")?.pop() || "" })
|
|
2234
|
-
] });
|
|
2235
|
-
const handleItemClick = (toolCallData2) => {
|
|
2236
|
-
eventHandler?.(
|
|
2237
|
-
"__open_side_app",
|
|
2238
|
-
{
|
|
2239
|
-
component_key: "file_content_diff_view",
|
|
2240
|
-
message: file_path,
|
|
2241
|
-
data: {
|
|
2242
|
-
old_code: old_string,
|
|
2243
|
-
new_code: new_string
|
|
2244
|
-
}
|
|
2245
|
-
},
|
|
2246
|
-
""
|
|
2247
|
-
);
|
|
2248
|
-
};
|
|
2249
|
-
return /* @__PURE__ */ jsx16(
|
|
2250
|
-
ContentPreviewCollapse,
|
|
2251
|
-
{
|
|
2252
|
-
panelKey: toolCallData.id,
|
|
2253
|
-
header,
|
|
2254
|
-
expandIcon,
|
|
2255
|
-
extra: /* @__PURE__ */ jsx16(
|
|
2256
|
-
Button7,
|
|
2257
|
-
{
|
|
2258
|
-
type: "link",
|
|
2259
|
-
size: "small",
|
|
2260
|
-
onClick: (evt) => {
|
|
2261
|
-
evt.stopPropagation();
|
|
2262
|
-
handleItemClick(toolCallData);
|
|
2263
|
-
},
|
|
2264
|
-
children: "Diff View"
|
|
2265
|
-
}
|
|
2266
|
-
),
|
|
2267
|
-
children: /* @__PURE__ */ jsx16(MDResponse, { content: new_string })
|
|
2268
|
-
}
|
|
2269
|
-
);
|
|
2270
|
-
};
|
|
2271
|
-
|
|
2272
|
-
// src/components/GenUI/elements/builtIns.tsx
|
|
2273
|
-
var elements = {
|
|
2274
|
-
action_show_attachments_uploader: {
|
|
2275
|
-
card_view: () => null,
|
|
2276
|
-
action: (data) => {
|
|
2277
|
-
console.log(data);
|
|
2278
|
-
}
|
|
2279
|
-
},
|
|
2280
|
-
generic_data_table: {
|
|
2281
|
-
card_view: GenericDataTable,
|
|
2282
|
-
side_app_view: GenericDataTableSideApp
|
|
2283
|
-
},
|
|
2284
|
-
confirm: {
|
|
2285
|
-
card_view: ConfirmFeedback
|
|
2286
|
-
},
|
|
2287
|
-
tool_call: {
|
|
2288
|
-
card_view: ToolCall
|
|
2289
|
-
},
|
|
2290
|
-
tool_card: {
|
|
2291
|
-
card_view: ToolCard
|
|
2292
|
-
},
|
|
2293
|
-
todo_list: {
|
|
2294
|
-
card_view: Todo
|
|
2295
|
-
},
|
|
2296
|
-
write_todos: {
|
|
2297
|
-
card_view: WriteTodos
|
|
2298
|
-
},
|
|
2299
|
-
write_file: {
|
|
2300
|
-
card_view: WriteFile
|
|
2301
|
-
},
|
|
2302
|
-
edit_file: {
|
|
2303
|
-
card_view: EditFile
|
|
2304
|
-
},
|
|
2305
|
-
file_explorer: {
|
|
2306
|
-
card_view: () => null,
|
|
2307
|
-
side_app_view: FileExplorer
|
|
2308
|
-
},
|
|
2309
|
-
attachments: {
|
|
2310
|
-
card_view: AttachmentsCard,
|
|
2311
|
-
side_app_view: AttachmentsViewerSideApp
|
|
2312
|
-
},
|
|
2313
|
-
file_content_diff_view: {
|
|
2314
|
-
card_view: FileContentDiffView,
|
|
2315
|
-
side_app_view: FileContentDiffView
|
|
2316
|
-
}
|
|
2317
|
-
};
|
|
2318
|
-
|
|
2319
|
-
// src/components/GenUI/elements/index.tsx
|
|
2320
|
-
var getElement = (language) => {
|
|
2321
|
-
if (language && elements[language]) {
|
|
2322
|
-
return elements[language];
|
|
2323
|
-
}
|
|
2324
|
-
return null;
|
|
2325
|
-
};
|
|
2326
|
-
var regsiterElement = (language, ElementMeta) => {
|
|
2327
|
-
console.log("regsiterElement", language, ElementMeta);
|
|
2328
|
-
elements[language] = ElementMeta;
|
|
2329
|
-
return ElementMeta;
|
|
2330
|
-
};
|
|
2331
|
-
|
|
2332
|
-
// src/components/GenUI/MDMermaid.tsx
|
|
2333
|
-
import mermaid from "mermaid";
|
|
2334
|
-
import { useEffect as useEffect7, useRef as useRef4 } from "react";
|
|
2335
|
-
import { v4 } from "uuid";
|
|
2336
|
-
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2337
|
-
var MDMermaid = ({ children = [] }) => {
|
|
2338
|
-
const domId = useRef4(`dom${v4()}`);
|
|
2339
|
-
const code = String(children);
|
|
2340
|
-
const target = useRef4(null);
|
|
2341
|
-
const targetInternal = useRef4(null);
|
|
2342
|
-
useEffect7(() => {
|
|
2343
|
-
if (target.current && code) {
|
|
2344
|
-
mermaid.initialize({
|
|
2345
|
-
startOnLoad: true,
|
|
2346
|
-
theme: "default",
|
|
2347
|
-
securityLevel: "loose",
|
|
2348
|
-
themeCSS: `
|
|
2349
|
-
g.classGroup rect {
|
|
2350
|
-
fill: #282a36;
|
|
2351
|
-
stroke: #6272a4;
|
|
2352
|
-
}
|
|
2353
|
-
g.classGroup text {
|
|
2354
|
-
fill: #f8f8f2;
|
|
2355
|
-
}
|
|
2356
|
-
g.classGroup line {
|
|
2357
|
-
stroke: #f8f8f2;
|
|
2358
|
-
stroke-width: 0.5;
|
|
2359
|
-
}
|
|
2360
|
-
.classLabel .box {
|
|
2361
|
-
stroke: #21222c;
|
|
2362
|
-
stroke-width: 3;
|
|
2363
|
-
fill: #21222c;
|
|
2364
|
-
opacity: 1;
|
|
2365
|
-
}
|
|
2366
|
-
.classLabel .label {
|
|
2367
|
-
fill: #f1fa8c;
|
|
2368
|
-
}
|
|
2369
|
-
.relation {
|
|
2370
|
-
stroke: #ff79c6;
|
|
2371
|
-
stroke-width: 1;
|
|
2372
|
-
}
|
|
2373
|
-
#compositionStart, #compositionEnd {
|
|
2374
|
-
fill: #bd93f9;
|
|
2375
|
-
stroke: #bd93f9;
|
|
2376
|
-
stroke-width: 1;
|
|
2377
|
-
}
|
|
2378
|
-
#aggregationEnd, #aggregationStart {
|
|
2379
|
-
fill: #21222c;
|
|
2380
|
-
stroke: #50fa7b;
|
|
2381
|
-
stroke-width: 1;
|
|
2382
|
-
}
|
|
2383
|
-
#dependencyStart, #dependencyEnd {
|
|
2384
|
-
fill: #00bcd4;
|
|
2385
|
-
stroke: #00bcd4;
|
|
2386
|
-
stroke-width: 1;
|
|
2387
|
-
}
|
|
2388
|
-
#extensionStart, #extensionEnd {
|
|
2389
|
-
fill: #f8f8f2;
|
|
2390
|
-
stroke: #f8f8f2;
|
|
2391
|
-
stroke-width: 1;
|
|
2392
|
-
}
|
|
2393
|
-
`,
|
|
2394
|
-
fontFamily: "Fira Code",
|
|
2395
|
-
sequence: { showSequenceNumbers: true }
|
|
2396
|
-
});
|
|
2397
|
-
mermaid.render(domId.current, code, target.current).then((result) => {
|
|
2398
|
-
target.current.innerHTML = result.svg;
|
|
2399
|
-
}).catch((error) => {
|
|
2400
|
-
console.log(error);
|
|
2401
|
-
});
|
|
3157
|
+
handleItemClick(toolCallData);
|
|
3158
|
+
},
|
|
3159
|
+
children: "Diff View"
|
|
3160
|
+
}
|
|
3161
|
+
),
|
|
3162
|
+
children: /* @__PURE__ */ jsx19(MDResponse, { content })
|
|
2402
3163
|
}
|
|
2403
|
-
|
|
2404
|
-
return /* @__PURE__ */ jsx17("div", { style: { minWidth: 750 }, ref: target, children: /* @__PURE__ */ jsx17("code", { id: domId.current, style: { display: "none" } }) });
|
|
3164
|
+
);
|
|
2405
3165
|
};
|
|
2406
3166
|
|
|
2407
|
-
// src/components/GenUI/
|
|
2408
|
-
import
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
3167
|
+
// src/components/GenUI/elements/file_content_diff_view.tsx
|
|
3168
|
+
import ReactDiffViewer from "@alexbruf/react-diff-viewer";
|
|
3169
|
+
import "@alexbruf/react-diff-viewer/index.css";
|
|
3170
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
3171
|
+
var FileContentDiffView = ({ data, interactive = true, default_open_in_side_app = true }) => {
|
|
3172
|
+
const { old_code, new_code } = data;
|
|
3173
|
+
return /* @__PURE__ */ jsx20(
|
|
3174
|
+
ReactDiffViewer,
|
|
3175
|
+
{
|
|
3176
|
+
oldValue: old_code,
|
|
3177
|
+
newValue: new_code,
|
|
3178
|
+
splitView: false
|
|
3179
|
+
}
|
|
3180
|
+
);
|
|
3181
|
+
};
|
|
3182
|
+
|
|
3183
|
+
// src/components/GenUI/elements/EditFile.tsx
|
|
3184
|
+
import { Button as Button7, Space as Space9, Typography as Typography9 } from "antd";
|
|
3185
|
+
import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3186
|
+
var { Text: Text7 } = Typography9;
|
|
3187
|
+
var EditFile = ({
|
|
3188
|
+
data,
|
|
3189
|
+
component_key,
|
|
3190
|
+
interactive = true
|
|
3191
|
+
}) => {
|
|
3192
|
+
const toolCallData = data;
|
|
3193
|
+
const { file_path, new_string, old_string } = toolCallData?.args || {};
|
|
3194
|
+
const { openSideApp } = useChatUIContext();
|
|
3195
|
+
if (!toolCallData) {
|
|
3196
|
+
return null;
|
|
3197
|
+
}
|
|
3198
|
+
const expandIcon = () => getFileIcon(file_path);
|
|
3199
|
+
const header = /* @__PURE__ */ jsxs13(Space9, { children: [
|
|
3200
|
+
/* @__PURE__ */ jsx21(Text7, { strong: true, children: "Edit" }),
|
|
3201
|
+
/* @__PURE__ */ jsx21(Text7, { title: file_path, children: file_path?.split("/")?.pop() || "" })
|
|
3202
|
+
] });
|
|
3203
|
+
const handleItemClick = (toolCallData2) => {
|
|
3204
|
+
openSideApp({
|
|
3205
|
+
component_key: "file_content_diff_view",
|
|
3206
|
+
message: file_path,
|
|
3207
|
+
data: {
|
|
3208
|
+
old_code: old_string,
|
|
3209
|
+
new_code: new_string
|
|
3210
|
+
}
|
|
3211
|
+
});
|
|
3212
|
+
};
|
|
3213
|
+
return /* @__PURE__ */ jsx21(
|
|
3214
|
+
ContentPreviewCollapse,
|
|
3215
|
+
{
|
|
3216
|
+
panelKey: toolCallData.id,
|
|
3217
|
+
header,
|
|
3218
|
+
expandIcon,
|
|
3219
|
+
extra: /* @__PURE__ */ jsx21(
|
|
3220
|
+
Button7,
|
|
3221
|
+
{
|
|
3222
|
+
type: "link",
|
|
3223
|
+
size: "small",
|
|
3224
|
+
onClick: (evt) => {
|
|
3225
|
+
evt.stopPropagation();
|
|
3226
|
+
handleItemClick(toolCallData);
|
|
3227
|
+
},
|
|
3228
|
+
children: "Diff View"
|
|
3229
|
+
}
|
|
3230
|
+
),
|
|
3231
|
+
children: /* @__PURE__ */ jsx21(MDResponse, { content: new_string })
|
|
3232
|
+
}
|
|
3233
|
+
);
|
|
3234
|
+
};
|
|
3235
|
+
|
|
3236
|
+
// src/components/GenUI/elements/task_card.tsx
|
|
3237
|
+
import { Card as Card5, Typography as Typography10, Tag as Tag3, Avatar } from "antd";
|
|
3238
|
+
import { createStyles as createStyles7 } from "antd-style";
|
|
3239
|
+
import {
|
|
3240
|
+
CheckCircleOutlined as CheckCircleOutlined3,
|
|
3241
|
+
LoadingOutlined as LoadingOutlined2,
|
|
3242
|
+
CloseCircleOutlined,
|
|
3243
|
+
UserOutlined,
|
|
3244
|
+
RightOutlined as RightOutlined2,
|
|
3245
|
+
CarryOutOutlined
|
|
3246
|
+
} from "@ant-design/icons";
|
|
3247
|
+
import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3248
|
+
var { Text: Text8 } = Typography10;
|
|
3249
|
+
var useStyle5 = createStyles7(({ token, css }) => ({
|
|
3250
|
+
card: css`
|
|
3251
|
+
max-width: 600px;
|
|
3252
|
+
background: ${token.colorBgContainer};
|
|
3253
|
+
border: 1px solid ${token.colorBorderSecondary};
|
|
3254
|
+
border-radius: 16px;
|
|
3255
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
3256
|
+
cursor: pointer;
|
|
2420
3257
|
overflow: hidden;
|
|
2421
|
-
|
|
2422
|
-
|
|
3258
|
+
position: relative;
|
|
3259
|
+
&:hover {
|
|
3260
|
+
border-color: ${token.colorPrimary};
|
|
3261
|
+
box-shadow: 0 8px 24px rgba(24, 144, 255, 0.12);
|
|
3262
|
+
transform: translateY(-4px);
|
|
3263
|
+
}
|
|
3264
|
+
&::before {
|
|
3265
|
+
content: "";
|
|
3266
|
+
position: absolute;
|
|
3267
|
+
top: 0;
|
|
3268
|
+
left: 0;
|
|
3269
|
+
right: 0;
|
|
3270
|
+
height: 4px;
|
|
3271
|
+
background: linear-gradient(
|
|
3272
|
+
90deg,
|
|
3273
|
+
${token.colorPrimary} 0%,
|
|
3274
|
+
${token.colorPrimaryHover} 100%
|
|
3275
|
+
);
|
|
3276
|
+
opacity: 0;
|
|
3277
|
+
transition: opacity 0.3s ease;
|
|
3278
|
+
}
|
|
3279
|
+
&:hover::before {
|
|
3280
|
+
opacity: 1;
|
|
3281
|
+
}
|
|
2423
3282
|
`,
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
padding: 12px 16px;
|
|
2427
|
-
text-align: left;
|
|
2428
|
-
font-weight: 600;
|
|
2429
|
-
border-bottom: 1px solid ${token.colorBorder};
|
|
2430
|
-
color: ${token.colorTextHeading};
|
|
2431
|
-
font-size: ${token.fontSize}px;
|
|
3283
|
+
cardBody: css`
|
|
3284
|
+
padding: 20px !important;
|
|
2432
3285
|
`,
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
3286
|
+
header: css`
|
|
3287
|
+
margin-bottom: 16px;
|
|
3288
|
+
`,
|
|
3289
|
+
titleSection: css`
|
|
3290
|
+
display: flex;
|
|
3291
|
+
align-items: center;
|
|
3292
|
+
gap: 12px;
|
|
3293
|
+
flex: 1;
|
|
3294
|
+
`,
|
|
3295
|
+
iconWrapper: css`
|
|
3296
|
+
width: 40px;
|
|
3297
|
+
height: 40px;
|
|
3298
|
+
border-radius: 10px;
|
|
3299
|
+
display: flex;
|
|
3300
|
+
align-items: center;
|
|
3301
|
+
justify-content: center;
|
|
3302
|
+
background: linear-gradient(
|
|
3303
|
+
135deg,
|
|
3304
|
+
rgba(24, 144, 255, 0.1) 0%,
|
|
3305
|
+
rgba(24, 144, 255, 0.05) 100%
|
|
3306
|
+
);
|
|
3307
|
+
flex-shrink: 0;
|
|
3308
|
+
`,
|
|
3309
|
+
titleContent: css`
|
|
3310
|
+
flex: 1;
|
|
3311
|
+
min-width: 0;
|
|
3312
|
+
`,
|
|
3313
|
+
taskType: css`
|
|
3314
|
+
font-size: 12px;
|
|
3315
|
+
font-weight: 500;
|
|
3316
|
+
color: ${token.colorPrimary};
|
|
3317
|
+
text-transform: uppercase;
|
|
3318
|
+
letter-spacing: 0.5px;
|
|
3319
|
+
margin-bottom: 4px;
|
|
3320
|
+
`,
|
|
3321
|
+
description: css`
|
|
2436
3322
|
color: ${token.colorText};
|
|
2437
|
-
font-size:
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
3323
|
+
font-size: 15px;
|
|
3324
|
+
line-height: 1.6;
|
|
3325
|
+
font-weight: 500;
|
|
3326
|
+
margin: 0;
|
|
3327
|
+
word-wrap: break-word;
|
|
3328
|
+
word-break: break-word;
|
|
3329
|
+
white-space: pre-wrap;
|
|
2442
3330
|
`,
|
|
2443
|
-
|
|
3331
|
+
footer: css`
|
|
3332
|
+
display: flex;
|
|
3333
|
+
justify-content: space-between;
|
|
3334
|
+
align-items: center;
|
|
3335
|
+
padding-top: 16px;
|
|
3336
|
+
margin-top: 16px;
|
|
3337
|
+
border-top: 1px solid ${token.colorBorderSecondary};
|
|
3338
|
+
gap: 12px;
|
|
3339
|
+
`,
|
|
3340
|
+
footerLeft: css`
|
|
3341
|
+
display: flex;
|
|
3342
|
+
align-items: center;
|
|
3343
|
+
gap: 12px;
|
|
3344
|
+
flex: 1;
|
|
3345
|
+
`,
|
|
3346
|
+
assigneeContainer: css`
|
|
3347
|
+
display: flex;
|
|
3348
|
+
align-items: center;
|
|
3349
|
+
gap: 10px;
|
|
3350
|
+
padding: 6px 12px;
|
|
3351
|
+
background: ${token.colorFillAlter};
|
|
3352
|
+
border-radius: 20px;
|
|
3353
|
+
transition: all 0.2s ease;
|
|
2444
3354
|
&:hover {
|
|
2445
3355
|
background: ${token.colorFillTertiary};
|
|
2446
3356
|
}
|
|
2447
|
-
|
|
2448
|
-
&:last-child td {
|
|
2449
|
-
border-bottom: none;
|
|
2450
|
-
}
|
|
2451
3357
|
`,
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
3358
|
+
assigneeAvatar: css`
|
|
3359
|
+
background: linear-gradient(
|
|
3360
|
+
135deg,
|
|
3361
|
+
${token.colorPrimary} 0%,
|
|
3362
|
+
${token.colorPrimaryHover} 100%
|
|
3363
|
+
);
|
|
3364
|
+
`,
|
|
3365
|
+
assigneeName: css`
|
|
3366
|
+
color: ${token.colorText};
|
|
3367
|
+
font-size: 13px;
|
|
3368
|
+
font-weight: 500;
|
|
3369
|
+
`,
|
|
3370
|
+
actionIcon: css`
|
|
3371
|
+
color: ${token.colorTextTertiary};
|
|
3372
|
+
font-size: 14px;
|
|
3373
|
+
transition: all 0.2s ease;
|
|
3374
|
+
`
|
|
3375
|
+
}));
|
|
3376
|
+
var TaskCard = ({
|
|
3377
|
+
data,
|
|
3378
|
+
component_key,
|
|
3379
|
+
interactive = true
|
|
3380
|
+
}) => {
|
|
3381
|
+
const { styles } = useStyle5();
|
|
3382
|
+
const toolCallData = data;
|
|
3383
|
+
const { openSideApp } = useChatUIContext();
|
|
3384
|
+
if (!toolCallData) {
|
|
3385
|
+
return null;
|
|
3386
|
+
}
|
|
3387
|
+
const { description, subagent_type, assignee } = toolCallData?.args || {};
|
|
3388
|
+
const status = toolCallData.status || "pending";
|
|
3389
|
+
const { threadId } = useAgentChat();
|
|
3390
|
+
const subagent_thread_id = (threadId || "") + "_" + subagent_type + "_" + toolCallData.id;
|
|
3391
|
+
const getStatusConfig = (status2) => {
|
|
3392
|
+
switch (status2) {
|
|
3393
|
+
case "success":
|
|
3394
|
+
return {
|
|
3395
|
+
icon: /* @__PURE__ */ jsx22(CheckCircleOutlined3, { style: { fontSize: 16 } }),
|
|
3396
|
+
color: "success",
|
|
3397
|
+
text: "Completed",
|
|
3398
|
+
bgColor: "rgba(82, 196, 26, 0.1)"
|
|
3399
|
+
};
|
|
3400
|
+
case "error":
|
|
3401
|
+
return {
|
|
3402
|
+
icon: /* @__PURE__ */ jsx22(CloseCircleOutlined, { style: { fontSize: 16 } }),
|
|
3403
|
+
color: "error",
|
|
3404
|
+
text: "Failed",
|
|
3405
|
+
bgColor: "rgba(255, 77, 79, 0.1)"
|
|
3406
|
+
};
|
|
3407
|
+
case "pending":
|
|
3408
|
+
default:
|
|
3409
|
+
return {
|
|
3410
|
+
icon: /* @__PURE__ */ jsx22(LoadingOutlined2, { style: { fontSize: 16 } }),
|
|
3411
|
+
color: "processing",
|
|
3412
|
+
text: "In Progress",
|
|
3413
|
+
bgColor: "rgba(24, 144, 255, 0.1)"
|
|
3414
|
+
};
|
|
2465
3415
|
}
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
3416
|
+
};
|
|
3417
|
+
const statusConfig = getStatusConfig(status);
|
|
3418
|
+
const handleCardClick = () => {
|
|
3419
|
+
openSideApp({
|
|
3420
|
+
component_key: "task",
|
|
3421
|
+
message: subagent_type,
|
|
3422
|
+
data: {
|
|
3423
|
+
thread_id: subagent_thread_id,
|
|
3424
|
+
description,
|
|
3425
|
+
subagent_type
|
|
3426
|
+
}
|
|
3427
|
+
});
|
|
3428
|
+
};
|
|
3429
|
+
return /* @__PURE__ */ jsx22(
|
|
3430
|
+
Card5,
|
|
3431
|
+
{
|
|
3432
|
+
size: "small",
|
|
3433
|
+
className: styles.card,
|
|
3434
|
+
bordered: false,
|
|
3435
|
+
onClick: handleCardClick,
|
|
3436
|
+
hoverable: interactive,
|
|
3437
|
+
bodyStyle: { padding: 0 },
|
|
3438
|
+
children: /* @__PURE__ */ jsxs14("div", { className: styles.cardBody, children: [
|
|
3439
|
+
/* @__PURE__ */ jsx22("div", { className: styles.header, children: /* @__PURE__ */ jsxs14("div", { className: styles.titleSection, children: [
|
|
3440
|
+
/* @__PURE__ */ jsx22("div", { className: styles.iconWrapper, children: /* @__PURE__ */ jsx22(CarryOutOutlined, { style: { fontSize: 20, color: "#1890ff" } }) }),
|
|
3441
|
+
/* @__PURE__ */ jsxs14("div", { className: styles.titleContent, children: [
|
|
3442
|
+
subagent_type && /* @__PURE__ */ jsx22("div", { className: styles.taskType, children: subagent_type }),
|
|
3443
|
+
description && /* @__PURE__ */ jsx22(Text8, { className: styles.description, children: description })
|
|
3444
|
+
] })
|
|
3445
|
+
] }) }),
|
|
3446
|
+
/* @__PURE__ */ jsxs14("div", { className: styles.footer, children: [
|
|
3447
|
+
/* @__PURE__ */ jsxs14("div", { className: styles.footerLeft, children: [
|
|
3448
|
+
assignee && /* @__PURE__ */ jsxs14("div", { className: styles.assigneeContainer, children: [
|
|
3449
|
+
/* @__PURE__ */ jsx22(
|
|
3450
|
+
Avatar,
|
|
3451
|
+
{
|
|
3452
|
+
size: 24,
|
|
3453
|
+
icon: /* @__PURE__ */ jsx22(UserOutlined, {}),
|
|
3454
|
+
className: styles.assigneeAvatar
|
|
3455
|
+
}
|
|
3456
|
+
),
|
|
3457
|
+
/* @__PURE__ */ jsx22(Text8, { className: styles.assigneeName, children: assignee })
|
|
3458
|
+
] }),
|
|
3459
|
+
/* @__PURE__ */ jsx22(
|
|
3460
|
+
Tag3,
|
|
3461
|
+
{
|
|
3462
|
+
icon: statusConfig.icon,
|
|
3463
|
+
color: statusConfig.color,
|
|
3464
|
+
style: {
|
|
3465
|
+
margin: 0,
|
|
3466
|
+
padding: "4px 12px",
|
|
3467
|
+
borderRadius: "12px",
|
|
3468
|
+
fontSize: "12px",
|
|
3469
|
+
fontWeight: 500,
|
|
3470
|
+
border: "none",
|
|
3471
|
+
background: statusConfig.bgColor
|
|
3472
|
+
},
|
|
3473
|
+
children: statusConfig.text
|
|
3474
|
+
}
|
|
3475
|
+
)
|
|
3476
|
+
] }),
|
|
3477
|
+
interactive && /* @__PURE__ */ jsx22(RightOutlined2, { className: styles.actionIcon })
|
|
3478
|
+
] })
|
|
3479
|
+
] })
|
|
2471
3480
|
}
|
|
3481
|
+
);
|
|
3482
|
+
};
|
|
2472
3483
|
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
3484
|
+
// src/components/GenUI/elements/task_detail.tsx
|
|
3485
|
+
import { Typography as Typography12 } from "antd";
|
|
3486
|
+
|
|
3487
|
+
// src/components/Chat/Chating.tsx
|
|
3488
|
+
import { CloudUploadOutlined, PaperClipOutlined } from "@ant-design/icons";
|
|
3489
|
+
import {
|
|
3490
|
+
Attachments,
|
|
3491
|
+
Bubble as Bubble2,
|
|
3492
|
+
Prompts,
|
|
3493
|
+
Sender
|
|
3494
|
+
} from "@ant-design/x";
|
|
3495
|
+
|
|
3496
|
+
// src/components/Chat/MessageList.tsx
|
|
3497
|
+
import { Bubble } from "@ant-design/x";
|
|
3498
|
+
import { Space as Space10 } from "antd";
|
|
3499
|
+
import ErrorBoundary from "antd/es/alert/ErrorBoundary";
|
|
3500
|
+
import {
|
|
3501
|
+
memo,
|
|
3502
|
+
useCallback as useCallback8,
|
|
3503
|
+
useEffect as useEffect10,
|
|
3504
|
+
useMemo as useMemo4,
|
|
3505
|
+
useRef as useRef7,
|
|
3506
|
+
useState as useState15
|
|
3507
|
+
} from "react";
|
|
3508
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
3509
|
+
var LazyBubble = ({
|
|
3510
|
+
message: message4,
|
|
3511
|
+
renderContent,
|
|
3512
|
+
autoLoadRightPanel
|
|
3513
|
+
}) => {
|
|
3514
|
+
const ref = useRef7(null);
|
|
3515
|
+
const [isVisible, setIsVisible] = useState15(false);
|
|
3516
|
+
const [wasEverVisible, setWasEverVisible] = useState15(false);
|
|
3517
|
+
useEffect10(() => {
|
|
3518
|
+
const observer = new IntersectionObserver(
|
|
3519
|
+
([entry]) => {
|
|
3520
|
+
const visible = entry.isIntersecting;
|
|
3521
|
+
setIsVisible(visible);
|
|
3522
|
+
if (visible && !wasEverVisible) {
|
|
3523
|
+
setWasEverVisible(true);
|
|
3524
|
+
}
|
|
3525
|
+
},
|
|
3526
|
+
{ threshold: 0.1 }
|
|
3527
|
+
);
|
|
3528
|
+
if (ref.current) {
|
|
3529
|
+
observer.observe(ref.current);
|
|
3530
|
+
}
|
|
3531
|
+
return () => {
|
|
3532
|
+
if (ref.current) {
|
|
3533
|
+
observer.unobserve(ref.current);
|
|
3534
|
+
}
|
|
3535
|
+
};
|
|
3536
|
+
}, [wasEverVisible]);
|
|
3537
|
+
useEffect10(() => {
|
|
3538
|
+
autoLoadRightPanel?.();
|
|
3539
|
+
}, []);
|
|
3540
|
+
const getPlaceholder = () => {
|
|
3541
|
+
const estimatedHeight = message4.content ? Math.min(100, message4.content.length / 5) : 100;
|
|
3542
|
+
return /* @__PURE__ */ jsx23("div", { style: { height: `${estimatedHeight}px`, minHeight: "50px" } });
|
|
3543
|
+
};
|
|
3544
|
+
return /* @__PURE__ */ jsx23(ErrorBoundary, { children: /* @__PURE__ */ jsx23("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message4) : getPlaceholder() }) });
|
|
3545
|
+
};
|
|
3546
|
+
var MemoizedBubbleList = memo(
|
|
3547
|
+
({
|
|
3548
|
+
items,
|
|
3549
|
+
role,
|
|
3550
|
+
className
|
|
3551
|
+
}) => /* @__PURE__ */ jsx23(
|
|
3552
|
+
Bubble.List,
|
|
3553
|
+
{
|
|
3554
|
+
autoScroll: true,
|
|
3555
|
+
items,
|
|
3556
|
+
role,
|
|
3557
|
+
className
|
|
3558
|
+
},
|
|
3559
|
+
"messages"
|
|
3560
|
+
)
|
|
3561
|
+
);
|
|
3562
|
+
MemoizedBubbleList.displayName = "MemoizedBubbleList";
|
|
3563
|
+
var MessageList = ({
|
|
3564
|
+
messages,
|
|
3565
|
+
className
|
|
3566
|
+
}) => {
|
|
3567
|
+
const { styles } = useStyle();
|
|
3568
|
+
const { openSideApp } = useChatUIContext();
|
|
3569
|
+
const messageLengthRef = useRef7(messages?.length ?? 0);
|
|
3570
|
+
useEffect10(() => {
|
|
3571
|
+
if (messages?.length) {
|
|
3572
|
+
messageLengthRef.current = messages?.length;
|
|
2479
3573
|
}
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
3574
|
+
}, [messages?.length]);
|
|
3575
|
+
const renderContent = useCallback8((message4) => {
|
|
3576
|
+
const { content } = message4;
|
|
3577
|
+
try {
|
|
3578
|
+
const json = JSON.parse(content);
|
|
3579
|
+
if (json.action && json.message) {
|
|
3580
|
+
return /* @__PURE__ */ jsx23(MDResponse, { content: json.message });
|
|
3581
|
+
}
|
|
3582
|
+
} catch (error) {
|
|
2487
3583
|
}
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
},
|
|
2511
|
-
th({ node, ...props }) {
|
|
2512
|
-
return /* @__PURE__ */ jsx18("th", { className: styles.markdownTh, ...props });
|
|
2513
|
-
},
|
|
2514
|
-
td({ node, ...props }) {
|
|
2515
|
-
return /* @__PURE__ */ jsx18("td", { className: styles.markdownTd, ...props });
|
|
2516
|
-
},
|
|
2517
|
-
tr({ node, ...props }) {
|
|
2518
|
-
return /* @__PURE__ */ jsx18("tr", { className: styles.markdownTr, ...props });
|
|
2519
|
-
},
|
|
2520
|
-
code({ children, className, node, ...rest }) {
|
|
2521
|
-
const match = /language-(\w+)/.exec(className || "");
|
|
2522
|
-
const language = match?.[1];
|
|
2523
|
-
if (language) {
|
|
2524
|
-
const Element = getElement(language)?.card_view;
|
|
2525
|
-
if (Element) {
|
|
2526
|
-
let childrenData;
|
|
3584
|
+
const tool_calls_md = message4.tool_calls?.map((tool_call) => {
|
|
3585
|
+
return `\`\`\`tool_call
|
|
3586
|
+
${JSON.stringify(tool_call)}
|
|
3587
|
+
\`\`\``;
|
|
3588
|
+
}) || [];
|
|
3589
|
+
const content_md = [content, ...tool_calls_md].join("\n");
|
|
3590
|
+
return /* @__PURE__ */ jsx23(Space10, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ jsx23(MDResponse, { content: content_md }) });
|
|
3591
|
+
}, []);
|
|
3592
|
+
const items = useMemo4(
|
|
3593
|
+
() => messages.map((message4, index) => ({
|
|
3594
|
+
key: message4.id,
|
|
3595
|
+
role: message4.role,
|
|
3596
|
+
typing: false,
|
|
3597
|
+
content: /* @__PURE__ */ jsx23(
|
|
3598
|
+
LazyBubble,
|
|
3599
|
+
{
|
|
3600
|
+
message: message4,
|
|
3601
|
+
renderContent,
|
|
3602
|
+
autoLoadRightPanel: () => {
|
|
3603
|
+
const { content, role: role2 } = message4;
|
|
3604
|
+
const isNewAddedMessage = messageLengthRef.current > 1 && messageLengthRef.current + 1 === messages.length;
|
|
3605
|
+
if (index === messages.length - 1 && isNewAddedMessage && role2 === "ai") {
|
|
2527
3606
|
try {
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
{
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
3607
|
+
const match = content?.match(
|
|
3608
|
+
/```([\w_]*)\n({.*?}|[^`]*)\n```/m
|
|
3609
|
+
);
|
|
3610
|
+
const type = match?.[1];
|
|
3611
|
+
const data = match?.[2];
|
|
3612
|
+
const jsonData = data ? JSON.parse(data) : {};
|
|
3613
|
+
if (type) {
|
|
3614
|
+
const element = getElement(type);
|
|
3615
|
+
if (element?.side_app_view) {
|
|
3616
|
+
openSideApp({
|
|
3617
|
+
component_key: type,
|
|
3618
|
+
data: jsonData
|
|
3619
|
+
});
|
|
3620
|
+
} else if (element?.action) {
|
|
3621
|
+
element.action(jsonData);
|
|
2539
3622
|
}
|
|
2540
3623
|
}
|
|
2541
|
-
)
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
case "mermaid":
|
|
2545
|
-
return /* @__PURE__ */ jsx18(MDMermaid, { children });
|
|
2546
|
-
default:
|
|
2547
|
-
return /* @__PURE__ */ jsx18(
|
|
2548
|
-
SyntaxHighlighter,
|
|
2549
|
-
{
|
|
2550
|
-
...rest,
|
|
2551
|
-
PreTag: "div",
|
|
2552
|
-
language,
|
|
2553
|
-
style: dark,
|
|
2554
|
-
children: String(children).replace(/\n$/, "")
|
|
2555
|
-
}
|
|
2556
|
-
);
|
|
3624
|
+
} catch (error) {
|
|
3625
|
+
console.error(error);
|
|
3626
|
+
}
|
|
2557
3627
|
}
|
|
2558
|
-
} else {
|
|
2559
|
-
return /* @__PURE__ */ jsx18("code", { ...rest, className, children });
|
|
2560
3628
|
}
|
|
2561
3629
|
}
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
}),
|
|
2566
|
-
[userData, interactive, embeddedLink, styles]
|
|
3630
|
+
)
|
|
3631
|
+
})),
|
|
3632
|
+
[messages, renderContent]
|
|
2567
3633
|
);
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
if (valid_images.includes(spitedSrc[spitedSrc.length - 1].toLowerCase())) {
|
|
2593
|
-
return /* @__PURE__ */ jsx18("div", { children: /* @__PURE__ */ jsx18("img", { src, style: { width: "100%" } }) });
|
|
2594
|
-
} else {
|
|
2595
|
-
return /* @__PURE__ */ jsx18("div", { children: /* @__PURE__ */ jsx18("a", { href: src, target: "_black", children: src }) });
|
|
3634
|
+
const role = {
|
|
3635
|
+
ai: {
|
|
3636
|
+
placement: "start",
|
|
3637
|
+
typing: false,
|
|
3638
|
+
variant: "filled",
|
|
3639
|
+
styles: {
|
|
3640
|
+
content: {
|
|
3641
|
+
background: "transparent",
|
|
3642
|
+
padding: 0
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3645
|
+
},
|
|
3646
|
+
human: {
|
|
3647
|
+
placement: "end",
|
|
3648
|
+
variant: "filled",
|
|
3649
|
+
styles: {
|
|
3650
|
+
content: {
|
|
3651
|
+
background: "linear-gradient(1777deg, rgba(153, 164, 255, 0.38), rgb(231 243 248 / 38%) 27%)"
|
|
3652
|
+
}
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
};
|
|
3656
|
+
if (items.length === 0) {
|
|
3657
|
+
return /* @__PURE__ */ jsx23("div", { style: { flex: 1 } });
|
|
2596
3658
|
}
|
|
3659
|
+
return /* @__PURE__ */ jsx23(
|
|
3660
|
+
MemoizedBubbleList,
|
|
3661
|
+
{
|
|
3662
|
+
items,
|
|
3663
|
+
role,
|
|
3664
|
+
className: styles.messages || className
|
|
3665
|
+
}
|
|
3666
|
+
);
|
|
2597
3667
|
};
|
|
2598
3668
|
|
|
2599
3669
|
// src/components/Chat/Chating.tsx
|
|
2600
|
-
import {
|
|
2601
|
-
CloudUploadOutlined,
|
|
2602
|
-
PaperClipOutlined,
|
|
2603
|
-
FileTextOutlined as FileTextOutlined3
|
|
2604
|
-
} from "@ant-design/icons";
|
|
2605
|
-
import {
|
|
2606
|
-
Attachments as Attachments2,
|
|
2607
|
-
Bubble,
|
|
2608
|
-
Prompts,
|
|
2609
|
-
Sender,
|
|
2610
|
-
Welcome
|
|
2611
|
-
} from "@ant-design/x";
|
|
2612
3670
|
import {
|
|
2613
3671
|
Alert as Alert2,
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
Flex as Flex5,
|
|
2618
|
-
Space as Space11,
|
|
2619
|
-
message as message2,
|
|
2620
|
-
Tooltip as Tooltip2,
|
|
2621
|
-
Popover,
|
|
2622
|
-
Progress
|
|
3672
|
+
Badge as Badge2,
|
|
3673
|
+
Button as Button10,
|
|
3674
|
+
message as message3
|
|
2623
3675
|
} from "antd";
|
|
2624
|
-
import
|
|
2625
|
-
import React4, {
|
|
2626
|
-
memo,
|
|
2627
|
-
useCallback as useCallback6,
|
|
2628
|
-
useEffect as useEffect8,
|
|
2629
|
-
useMemo as useMemo4,
|
|
2630
|
-
useRef as useRef6,
|
|
2631
|
-
useState as useState12
|
|
2632
|
-
} from "react";
|
|
2633
|
-
import { useTranslation } from "react-i18next";
|
|
3676
|
+
import React6, { useEffect as useEffect11, useRef as useRef8, useState as useState16 } from "react";
|
|
2634
3677
|
|
|
2635
3678
|
// src/components/GenUI/HITLContainer.tsx
|
|
2636
|
-
import {
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
3679
|
+
import {
|
|
3680
|
+
Collapse as Collapse5,
|
|
3681
|
+
Space as Space11,
|
|
3682
|
+
Tag as Tag4,
|
|
3683
|
+
Typography as Typography11
|
|
3684
|
+
} from "antd";
|
|
3685
|
+
import { createStyles as createStyles8 } from "antd-style";
|
|
3686
|
+
import CollapsePanel4 from "antd/es/collapse/CollapsePanel";
|
|
3687
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
3688
|
+
var { Text: Text9 } = Typography11;
|
|
3689
|
+
var useStyle6 = createStyles8(({ token, css }) => ({
|
|
2641
3690
|
card: css`
|
|
2642
3691
|
max-width: 1200px;
|
|
2643
3692
|
margin: 8px 20px;
|
|
@@ -2648,127 +3697,216 @@ var useStyle4 = createStyles6(({ token, css }) => ({
|
|
|
2648
3697
|
);
|
|
2649
3698
|
`
|
|
2650
3699
|
}));
|
|
2651
|
-
var HITLContainer = ({
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
3700
|
+
var HITLContainer = () => {
|
|
3701
|
+
const { styles } = useStyle6();
|
|
3702
|
+
const { interrupts } = useAgentChat();
|
|
3703
|
+
return interrupts && interrupts.length > 0 ? /* @__PURE__ */ jsx24(
|
|
3704
|
+
Collapse5,
|
|
3705
|
+
{
|
|
3706
|
+
className: styles.card,
|
|
3707
|
+
size: "small",
|
|
3708
|
+
bordered: false,
|
|
3709
|
+
defaultActiveKey: ["hitl"],
|
|
3710
|
+
children: /* @__PURE__ */ jsx24(
|
|
3711
|
+
CollapsePanel4,
|
|
3712
|
+
{
|
|
3713
|
+
showArrow: false,
|
|
3714
|
+
header: /* @__PURE__ */ jsx24(
|
|
3715
|
+
Tag4,
|
|
3716
|
+
{
|
|
3717
|
+
bordered: false,
|
|
3718
|
+
color: "orange",
|
|
3719
|
+
style: {
|
|
3720
|
+
fontSize: 14,
|
|
3721
|
+
fontWeight: "bold",
|
|
3722
|
+
background: "#ffffff8f",
|
|
3723
|
+
padding: 4,
|
|
3724
|
+
borderRadius: 8
|
|
3725
|
+
},
|
|
3726
|
+
children: "\u7B49\u5F85\u53CD\u9988"
|
|
3727
|
+
}
|
|
3728
|
+
),
|
|
3729
|
+
children: /* @__PURE__ */ jsx24(Space11, { direction: "vertical", style: { width: "100%" }, children: interrupts.map((interrupt) => /* @__PURE__ */ jsx24(MDResponse, { content: interrupt.value }, interrupt.id)) })
|
|
2668
3730
|
},
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
MDResponse,
|
|
2674
|
-
{
|
|
2675
|
-
content: interrupt.value,
|
|
2676
|
-
eventHandler
|
|
2677
|
-
},
|
|
2678
|
-
interrupt.id
|
|
2679
|
-
))
|
|
2680
|
-
] }) }) : null;
|
|
3731
|
+
"hitl"
|
|
3732
|
+
)
|
|
3733
|
+
}
|
|
3734
|
+
) : null;
|
|
2681
3735
|
};
|
|
2682
3736
|
|
|
2683
|
-
// src/components/Chat/
|
|
2684
|
-
import {
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
}) => {
|
|
2690
|
-
const
|
|
2691
|
-
const
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
3737
|
+
// src/components/Chat/AgentHeader.tsx
|
|
3738
|
+
import { Avatar as Avatar2, Space as Space12 } from "antd";
|
|
3739
|
+
|
|
3740
|
+
// src/components/Chat/TodoProgress.tsx
|
|
3741
|
+
import { Popover, Tooltip as Tooltip2, Progress } from "antd";
|
|
3742
|
+
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3743
|
+
var TodoProgress = ({}) => {
|
|
3744
|
+
const { openSideApp } = useChatUIContext();
|
|
3745
|
+
const { todos } = useAgentChat();
|
|
3746
|
+
if (!todos || todos.length === 0) {
|
|
3747
|
+
return null;
|
|
3748
|
+
}
|
|
3749
|
+
const completedCount = todos.filter(
|
|
3750
|
+
(item) => item.status === "completed"
|
|
3751
|
+
).length;
|
|
3752
|
+
const totalCount = todos.length;
|
|
3753
|
+
const hasInProgress = todos.some((item) => item.status === "in_progress");
|
|
3754
|
+
const percent = Math.round(completedCount / totalCount * 100);
|
|
3755
|
+
return /* @__PURE__ */ jsx25(
|
|
3756
|
+
Popover,
|
|
3757
|
+
{
|
|
3758
|
+
content: /* @__PURE__ */ jsx25("div", { style: { width: 400 }, children: /* @__PURE__ */ jsx25(Todo, { data: todos, component_key: "header_todos" }) }),
|
|
3759
|
+
title: "Todos",
|
|
3760
|
+
trigger: "click",
|
|
3761
|
+
placement: "bottomRight",
|
|
3762
|
+
children: /* @__PURE__ */ jsx25(Tooltip2, { title: `${completedCount} / ${totalCount} tasks completed`, children: /* @__PURE__ */ jsx25("div", { style: { cursor: "pointer", display: "inline-flex" }, children: /* @__PURE__ */ jsx25(
|
|
3763
|
+
Progress,
|
|
3764
|
+
{
|
|
3765
|
+
type: "circle",
|
|
3766
|
+
strokeColor: {
|
|
3767
|
+
"0%": "#91caff",
|
|
3768
|
+
"100%": "#003eb3"
|
|
3769
|
+
},
|
|
3770
|
+
percent,
|
|
3771
|
+
status: hasInProgress ? "active" : "normal",
|
|
3772
|
+
width: 30,
|
|
3773
|
+
format: () => /* @__PURE__ */ jsx25(
|
|
3774
|
+
"div",
|
|
3775
|
+
{
|
|
3776
|
+
style: {
|
|
3777
|
+
display: "flex",
|
|
3778
|
+
flexDirection: "column",
|
|
3779
|
+
alignItems: "center",
|
|
3780
|
+
lineHeight: 1
|
|
3781
|
+
},
|
|
3782
|
+
children: /* @__PURE__ */ jsxs15("span", { style: { fontSize: 8 }, children: [
|
|
3783
|
+
completedCount,
|
|
3784
|
+
"/",
|
|
3785
|
+
totalCount
|
|
3786
|
+
] })
|
|
3787
|
+
}
|
|
3788
|
+
)
|
|
2700
3789
|
}
|
|
2701
|
-
}
|
|
2702
|
-
{ threshold: 0.1 }
|
|
2703
|
-
);
|
|
2704
|
-
if (ref.current) {
|
|
2705
|
-
observer.observe(ref.current);
|
|
3790
|
+
) }) })
|
|
2706
3791
|
}
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
3792
|
+
);
|
|
3793
|
+
};
|
|
3794
|
+
|
|
3795
|
+
// src/components/Chat/FileExplorerButton.tsx
|
|
3796
|
+
import { Tooltip as Tooltip3, Badge, Button as Button9 } from "antd";
|
|
3797
|
+
import { FileTextOutlined as FileTextOutlined4 } from "@ant-design/icons";
|
|
3798
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
3799
|
+
var FileExplorerButton = ({}) => {
|
|
3800
|
+
const { agentState } = useAgentChat();
|
|
3801
|
+
const { openSideApp } = useChatUIContext();
|
|
3802
|
+
const files = agentState?.values?.files || [];
|
|
3803
|
+
if (!files || Object.keys(files).length === 0) {
|
|
3804
|
+
return null;
|
|
3805
|
+
}
|
|
3806
|
+
const fileCount = Object.keys(files).length;
|
|
3807
|
+
return /* @__PURE__ */ jsx26(Tooltip3, { title: "File Explorer", children: /* @__PURE__ */ jsx26(Badge, { count: fileCount, size: "small", color: "blue", children: /* @__PURE__ */ jsx26(
|
|
3808
|
+
Button9,
|
|
3809
|
+
{
|
|
3810
|
+
type: "text",
|
|
3811
|
+
icon: /* @__PURE__ */ jsx26(FileTextOutlined4, {}),
|
|
3812
|
+
onClick: () => openSideApp({
|
|
3813
|
+
component_key: "file_explorer",
|
|
3814
|
+
message: "File Explorer",
|
|
3815
|
+
data: { files }
|
|
3816
|
+
})
|
|
3817
|
+
}
|
|
3818
|
+
) }) });
|
|
3819
|
+
};
|
|
3820
|
+
|
|
3821
|
+
// src/components/Chat/AgentHeader.tsx
|
|
3822
|
+
import { Welcome } from "@ant-design/x";
|
|
3823
|
+
import { useMemo as useMemo5 } from "react";
|
|
3824
|
+
import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3825
|
+
var AgentHeader = (props) => {
|
|
3826
|
+
const { description, avatar, name, extra, extraMeta } = props;
|
|
3827
|
+
const extraMetaComponents = useMemo5(() => {
|
|
3828
|
+
if (extraMeta && extraMeta.length > 0) {
|
|
3829
|
+
return extraMeta.map((meta) => {
|
|
3830
|
+
const Element = getElement(meta.id)?.card_view;
|
|
3831
|
+
if (Element) {
|
|
3832
|
+
let childrenData;
|
|
3833
|
+
try {
|
|
3834
|
+
} catch (error) {
|
|
3835
|
+
}
|
|
3836
|
+
return /* @__PURE__ */ jsx27(
|
|
3837
|
+
Element,
|
|
3838
|
+
{
|
|
3839
|
+
component_key: meta.id,
|
|
3840
|
+
data: childrenData
|
|
3841
|
+
},
|
|
3842
|
+
meta.id
|
|
3843
|
+
);
|
|
3844
|
+
}
|
|
3845
|
+
});
|
|
3846
|
+
}
|
|
3847
|
+
return void 0;
|
|
3848
|
+
}, [extraMeta]);
|
|
3849
|
+
return /* @__PURE__ */ jsxs16("div", { children: [
|
|
3850
|
+
/* @__PURE__ */ jsx27(
|
|
3851
|
+
Welcome,
|
|
3852
|
+
{
|
|
3853
|
+
style: { padding: 8 },
|
|
3854
|
+
variant: "borderless",
|
|
3855
|
+
description,
|
|
3856
|
+
icon: /* @__PURE__ */ jsx27(Avatar2, { src: avatar || "/images/avatar.jpeg", size: 48 }),
|
|
3857
|
+
title: name || "Fina",
|
|
3858
|
+
extra: /* @__PURE__ */ jsxs16(Space12, { children: [
|
|
3859
|
+
extra,
|
|
3860
|
+
/* @__PURE__ */ jsx27(TodoProgress, {}),
|
|
3861
|
+
/* @__PURE__ */ jsx27(FileExplorerButton, {}),
|
|
3862
|
+
extraMetaComponents && /* @__PURE__ */ jsx27(Space12, { align: "center", style: { marginRight: 16 }, children: extraMetaComponents })
|
|
3863
|
+
] })
|
|
3864
|
+
}
|
|
3865
|
+
),
|
|
3866
|
+
/* @__PURE__ */ jsx27(
|
|
3867
|
+
"div",
|
|
3868
|
+
{
|
|
3869
|
+
style: {
|
|
3870
|
+
background: "linear-gradient(rgba(41, 42, 45, .8) 0%, rgba(41, 42, 45, 0) 100%)"
|
|
3871
|
+
}
|
|
2710
3872
|
}
|
|
2711
|
-
|
|
2712
|
-
}
|
|
2713
|
-
useEffect8(() => {
|
|
2714
|
-
autoLoadRightPanel?.();
|
|
2715
|
-
}, []);
|
|
2716
|
-
const getPlaceholder = () => {
|
|
2717
|
-
const estimatedHeight = message3.content ? Math.min(100, message3.content.length / 5) : 100;
|
|
2718
|
-
return /* @__PURE__ */ jsx20("div", { style: { height: `${estimatedHeight}px`, minHeight: "50px" } });
|
|
2719
|
-
};
|
|
2720
|
-
return /* @__PURE__ */ jsx20(ErrorBoundary, { children: /* @__PURE__ */ jsx20("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message3) : getPlaceholder() }) });
|
|
3873
|
+
)
|
|
3874
|
+
] });
|
|
2721
3875
|
};
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
roles,
|
|
2726
|
-
className
|
|
2727
|
-
}) => /* @__PURE__ */ jsx20(
|
|
2728
|
-
Bubble.List,
|
|
2729
|
-
{
|
|
2730
|
-
autoScroll: true,
|
|
2731
|
-
items,
|
|
2732
|
-
roles,
|
|
2733
|
-
className
|
|
2734
|
-
},
|
|
2735
|
-
"messages"
|
|
2736
|
-
)
|
|
2737
|
-
);
|
|
2738
|
-
MemoizedBubbleList.displayName = "MemoizedBubbleList";
|
|
3876
|
+
|
|
3877
|
+
// src/components/Chat/Chating.tsx
|
|
3878
|
+
import { Fragment as Fragment4, jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2739
3879
|
var Chating = ({
|
|
2740
3880
|
avatar,
|
|
2741
3881
|
name,
|
|
2742
|
-
interrupts,
|
|
2743
3882
|
description,
|
|
2744
3883
|
default_submit_message,
|
|
2745
|
-
tenant_id,
|
|
2746
|
-
messages,
|
|
2747
|
-
isLoading,
|
|
2748
|
-
error,
|
|
2749
|
-
sendMessage,
|
|
2750
|
-
stopStreaming,
|
|
2751
|
-
onOpenSidePanel,
|
|
2752
|
-
onReminderClick,
|
|
2753
|
-
onClearError,
|
|
2754
|
-
styles,
|
|
2755
|
-
reminderCount,
|
|
2756
|
-
handleMDResponseEvent,
|
|
2757
3884
|
senderPromptsItems,
|
|
2758
3885
|
extra,
|
|
2759
3886
|
attachment_placeholder,
|
|
2760
3887
|
extraMeta = [],
|
|
2761
3888
|
uploadAction = "/api/file_storage/upload?path=temp",
|
|
2762
|
-
|
|
2763
|
-
|
|
3889
|
+
showHeader = true,
|
|
3890
|
+
showSender = true,
|
|
3891
|
+
showHITL = true
|
|
2764
3892
|
}) => {
|
|
2765
|
-
const
|
|
2766
|
-
const [
|
|
2767
|
-
const
|
|
2768
|
-
const [headerOpen, setHeaderOpen] =
|
|
2769
|
-
const attachmentsRef =
|
|
2770
|
-
const senderRef =
|
|
2771
|
-
|
|
3893
|
+
const [content, setContent] = useState16("");
|
|
3894
|
+
const [attachedFiles, setAttachedFiles] = useState16([]);
|
|
3895
|
+
const { styles } = useStyle();
|
|
3896
|
+
const [headerOpen, setHeaderOpen] = useState16(false);
|
|
3897
|
+
const attachmentsRef = useRef8(null);
|
|
3898
|
+
const senderRef = React6.useRef(null);
|
|
3899
|
+
const {
|
|
3900
|
+
messages,
|
|
3901
|
+
sendMessage,
|
|
3902
|
+
stopStreaming,
|
|
3903
|
+
isLoading,
|
|
3904
|
+
error,
|
|
3905
|
+
interrupts,
|
|
3906
|
+
tenantId,
|
|
3907
|
+
clearError
|
|
3908
|
+
} = useAgentChat();
|
|
3909
|
+
useEffect11(() => {
|
|
2772
3910
|
regsiterElement("action_show_attachments_uploader", {
|
|
2773
3911
|
card_view: () => null,
|
|
2774
3912
|
action: (data) => {
|
|
@@ -2777,86 +3915,6 @@ var Chating = ({
|
|
|
2777
3915
|
}
|
|
2778
3916
|
});
|
|
2779
3917
|
}, []);
|
|
2780
|
-
const messageLengthRef = useRef6(messages?.length ?? 0);
|
|
2781
|
-
useEffect8(() => {
|
|
2782
|
-
if (messages?.length) {
|
|
2783
|
-
messageLengthRef.current = messages?.length;
|
|
2784
|
-
}
|
|
2785
|
-
}, [messages?.length]);
|
|
2786
|
-
const renderContent = useCallback6(
|
|
2787
|
-
(message3) => {
|
|
2788
|
-
const { content: content2, files: files2, id } = message3;
|
|
2789
|
-
try {
|
|
2790
|
-
const json = JSON.parse(content2);
|
|
2791
|
-
if (json.action && json.message) {
|
|
2792
|
-
return /* @__PURE__ */ jsx20(
|
|
2793
|
-
MDResponse,
|
|
2794
|
-
{
|
|
2795
|
-
content: json.message,
|
|
2796
|
-
eventHandler: handleMDResponseEvent
|
|
2797
|
-
}
|
|
2798
|
-
);
|
|
2799
|
-
}
|
|
2800
|
-
} catch (error2) {
|
|
2801
|
-
}
|
|
2802
|
-
const tool_calls_md = message3.tool_calls?.map((tool_call) => {
|
|
2803
|
-
return `\`\`\`tool_call
|
|
2804
|
-
${JSON.stringify(tool_call)}
|
|
2805
|
-
\`\`\``;
|
|
2806
|
-
}) || [];
|
|
2807
|
-
const content_md = [content2, ...tool_calls_md].join("\n");
|
|
2808
|
-
return /* @__PURE__ */ jsx20(Space11, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ jsx20(
|
|
2809
|
-
MDResponse,
|
|
2810
|
-
{
|
|
2811
|
-
content: content_md,
|
|
2812
|
-
eventHandler: handleMDResponseEvent
|
|
2813
|
-
}
|
|
2814
|
-
) });
|
|
2815
|
-
},
|
|
2816
|
-
[handleMDResponseEvent]
|
|
2817
|
-
);
|
|
2818
|
-
const items = useMemo4(
|
|
2819
|
-
() => messages.map((message3, index) => ({
|
|
2820
|
-
key: message3.id,
|
|
2821
|
-
role: message3.role,
|
|
2822
|
-
typing: false,
|
|
2823
|
-
content: /* @__PURE__ */ jsx20(
|
|
2824
|
-
LazyBubble,
|
|
2825
|
-
{
|
|
2826
|
-
message: message3,
|
|
2827
|
-
renderContent,
|
|
2828
|
-
autoLoadRightPanel: () => {
|
|
2829
|
-
const { content: content2, role } = message3;
|
|
2830
|
-
const isNewAddedMessage = messageLengthRef.current > 1 && messageLengthRef.current + 1 === messages.length;
|
|
2831
|
-
if (index === messages.length - 1 && isNewAddedMessage && role === "ai") {
|
|
2832
|
-
try {
|
|
2833
|
-
const match = content2?.match(
|
|
2834
|
-
/```([\w_]*)\n({.*?}|[^`]*)\n```/m
|
|
2835
|
-
);
|
|
2836
|
-
const type = match?.[1];
|
|
2837
|
-
const data = match?.[2];
|
|
2838
|
-
const jsonData = data ? JSON.parse(data) : {};
|
|
2839
|
-
if (type) {
|
|
2840
|
-
const element = getElement(type);
|
|
2841
|
-
if (element?.side_app_view) {
|
|
2842
|
-
onOpenSidePanel({
|
|
2843
|
-
component_key: type,
|
|
2844
|
-
data: jsonData
|
|
2845
|
-
});
|
|
2846
|
-
} else if (element?.action) {
|
|
2847
|
-
element.action(jsonData);
|
|
2848
|
-
}
|
|
2849
|
-
}
|
|
2850
|
-
} catch (error2) {
|
|
2851
|
-
console.error(error2);
|
|
2852
|
-
}
|
|
2853
|
-
}
|
|
2854
|
-
}
|
|
2855
|
-
}
|
|
2856
|
-
)
|
|
2857
|
-
})),
|
|
2858
|
-
[messages, renderContent, onOpenSidePanel]
|
|
2859
|
-
);
|
|
2860
3918
|
const isArchiveFile = (file) => {
|
|
2861
3919
|
const zipMimeTypes = ["application/zip"];
|
|
2862
3920
|
const rarMimeTypes = [
|
|
@@ -2870,13 +3928,13 @@ ${JSON.stringify(tool_call)}
|
|
|
2870
3928
|
const onSubmit = (nextContent) => {
|
|
2871
3929
|
if (!nextContent && attachedFiles.length === 0) return;
|
|
2872
3930
|
if (attachedFiles.filter((f) => f.status !== "done").length > 0) {
|
|
2873
|
-
|
|
3931
|
+
message3.warning("\u6587\u4EF6\u8FD8\u5728\u4E0A\u4F20\u4E2D...");
|
|
2874
3932
|
return;
|
|
2875
3933
|
}
|
|
2876
3934
|
if (!nextContent && attachedFiles.length > 0) {
|
|
2877
|
-
nextContent = default_submit_message || "
|
|
3935
|
+
nextContent = default_submit_message || "";
|
|
2878
3936
|
}
|
|
2879
|
-
const
|
|
3937
|
+
const files = attachedFiles.map(
|
|
2880
3938
|
(file) => isArchiveFile(file) ? {
|
|
2881
3939
|
name: file.response.zipFileName || file.response.rarFileName,
|
|
2882
3940
|
id: file.response.zipFileId || file.response.rarFileId,
|
|
@@ -2894,14 +3952,14 @@ ${JSON.stringify(tool_call)}
|
|
|
2894
3952
|
id: file.response.id
|
|
2895
3953
|
}
|
|
2896
3954
|
);
|
|
2897
|
-
const files_md =
|
|
3955
|
+
const files_md = files.length > 0 ? [
|
|
2898
3956
|
"",
|
|
2899
3957
|
"\u6211\u5DF2\u7ECF\u63D0\u4EA4\u4E86\u4EE5\u4E0B\u6587\u4EF6\uFF1A",
|
|
2900
3958
|
"```attachments",
|
|
2901
|
-
JSON.stringify(
|
|
3959
|
+
JSON.stringify(files),
|
|
2902
3960
|
"```"
|
|
2903
3961
|
].join("\n") : "";
|
|
2904
|
-
sendMessage({ input: { message: nextContent + files_md, files
|
|
3962
|
+
sendMessage({ input: { message: nextContent + files_md, files } });
|
|
2905
3963
|
setContent("");
|
|
2906
3964
|
setAttachedFiles([]);
|
|
2907
3965
|
setHeaderOpen(false);
|
|
@@ -2914,7 +3972,7 @@ ${JSON.stringify(tool_call)}
|
|
|
2914
3972
|
setHeaderOpen(true);
|
|
2915
3973
|
}
|
|
2916
3974
|
if (info.file?.response?.error || info.file.status === "error") {
|
|
2917
|
-
|
|
3975
|
+
message3.error(
|
|
2918
3976
|
`${info.file.name} file upload failed.${info.file?.response?.message}`
|
|
2919
3977
|
);
|
|
2920
3978
|
}
|
|
@@ -2926,22 +3984,22 @@ ${JSON.stringify(tool_call)}
|
|
|
2926
3984
|
const beforeUpload = (file) => {
|
|
2927
3985
|
const isLessThan20MB = file.size / 1024 / 1024 < 20;
|
|
2928
3986
|
if (!isLessThan20MB) {
|
|
2929
|
-
|
|
3987
|
+
message3.error(
|
|
2930
3988
|
`File must be smaller than 20MB! ${file.name} is too large.`
|
|
2931
3989
|
);
|
|
2932
3990
|
return false;
|
|
2933
3991
|
}
|
|
2934
3992
|
return true;
|
|
2935
3993
|
};
|
|
2936
|
-
const attachmentsNode = /* @__PURE__ */
|
|
2937
|
-
|
|
3994
|
+
const attachmentsNode = /* @__PURE__ */ jsx28(Badge2, { dot: attachedFiles.length > 0 && !headerOpen, children: /* @__PURE__ */ jsx28(
|
|
3995
|
+
Button10,
|
|
2938
3996
|
{
|
|
2939
3997
|
type: "text",
|
|
2940
|
-
icon: /* @__PURE__ */
|
|
3998
|
+
icon: /* @__PURE__ */ jsx28(PaperClipOutlined, {}),
|
|
2941
3999
|
onClick: () => setHeaderOpen(!headerOpen)
|
|
2942
4000
|
}
|
|
2943
4001
|
) });
|
|
2944
|
-
const senderHeader = /* @__PURE__ */
|
|
4002
|
+
const senderHeader = /* @__PURE__ */ jsx28(
|
|
2945
4003
|
Sender.Header,
|
|
2946
4004
|
{
|
|
2947
4005
|
title: "Attachments",
|
|
@@ -2953,14 +4011,14 @@ ${JSON.stringify(tool_call)}
|
|
|
2953
4011
|
}
|
|
2954
4012
|
},
|
|
2955
4013
|
forceRender: true,
|
|
2956
|
-
children: /* @__PURE__ */
|
|
2957
|
-
|
|
4014
|
+
children: /* @__PURE__ */ jsx28(
|
|
4015
|
+
Attachments,
|
|
2958
4016
|
{
|
|
2959
4017
|
ref: attachmentsRef,
|
|
2960
4018
|
items: attachedFiles,
|
|
2961
4019
|
action: uploadAction,
|
|
2962
4020
|
headers: {
|
|
2963
|
-
"x-tenant-id":
|
|
4021
|
+
"x-tenant-id": tenantId || ""
|
|
2964
4022
|
},
|
|
2965
4023
|
getDropContainer: () => {
|
|
2966
4024
|
const dropContainer = document.querySelector(".fina_chat");
|
|
@@ -2975,7 +4033,7 @@ ${JSON.stringify(tool_call)}
|
|
|
2975
4033
|
multiple: true,
|
|
2976
4034
|
maxCount: 10,
|
|
2977
4035
|
placeholder: (type) => ({
|
|
2978
|
-
icon: /* @__PURE__ */
|
|
4036
|
+
icon: /* @__PURE__ */ jsx28(CloudUploadOutlined, {}),
|
|
2979
4037
|
title: "\u4E0A\u4F20\u6587\u4EF6",
|
|
2980
4038
|
description: attachment_placeholder
|
|
2981
4039
|
})
|
|
@@ -2983,186 +4041,35 @@ ${JSON.stringify(tool_call)}
|
|
|
2983
4041
|
)
|
|
2984
4042
|
}
|
|
2985
4043
|
);
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
typing: false,
|
|
2990
|
-
variant: "filled",
|
|
2991
|
-
styles: {
|
|
2992
|
-
content: {
|
|
2993
|
-
background: "transparent",
|
|
2994
|
-
padding: 0
|
|
2995
|
-
// "linear-gradient(149deg, rgb(160 17 2170 / 18%), rgb(226 176 176 / 18%) 43%)",
|
|
2996
|
-
}
|
|
2997
|
-
}
|
|
2998
|
-
},
|
|
2999
|
-
human: {
|
|
3000
|
-
placement: "end",
|
|
3001
|
-
variant: "filled",
|
|
3002
|
-
styles: {
|
|
3003
|
-
content: {
|
|
3004
|
-
maxWidth: "70%",
|
|
3005
|
-
background: "linear-gradient(1777deg, rgba(153, 164, 255, 0.38), rgb(231 243 248 / 38%) 27%)"
|
|
3006
|
-
}
|
|
3007
|
-
}
|
|
3008
|
-
}
|
|
3009
|
-
};
|
|
3010
|
-
const extraMetaComponents = useMemo4(() => {
|
|
3011
|
-
if (extraMeta?.length > 0) {
|
|
3012
|
-
return extraMeta.map((meta) => {
|
|
3013
|
-
const Element = getElement(meta.id)?.card_view;
|
|
3014
|
-
if (Element) {
|
|
3015
|
-
let childrenData;
|
|
3016
|
-
try {
|
|
3017
|
-
} catch (error2) {
|
|
3018
|
-
}
|
|
3019
|
-
return /* @__PURE__ */ jsx20(
|
|
3020
|
-
Element,
|
|
3021
|
-
{
|
|
3022
|
-
component_key: meta.id,
|
|
3023
|
-
data: childrenData,
|
|
3024
|
-
eventHandler: (e, data, message3, agent) => {
|
|
3025
|
-
handleMDResponseEvent?.(e, data, message3, agent);
|
|
3026
|
-
}
|
|
3027
|
-
},
|
|
3028
|
-
meta.id
|
|
3029
|
-
);
|
|
3030
|
-
}
|
|
3031
|
-
});
|
|
3032
|
-
}
|
|
3033
|
-
return void 0;
|
|
3034
|
-
}, [extraMeta]);
|
|
3035
|
-
return /* @__PURE__ */ jsxs14(Fragment3, { children: [
|
|
3036
|
-
/* @__PURE__ */ jsxs14("div", { children: [
|
|
3037
|
-
/* @__PURE__ */ jsx20(
|
|
3038
|
-
Welcome,
|
|
3039
|
-
{
|
|
3040
|
-
style: { padding: 8 },
|
|
3041
|
-
variant: "borderless",
|
|
3042
|
-
description,
|
|
3043
|
-
icon: /* @__PURE__ */ jsx20(Avatar, { src: avatar || "/images/avatar.jpeg", size: 48 }),
|
|
3044
|
-
title: name || "Fina",
|
|
3045
|
-
extra: /* @__PURE__ */ jsxs14(Space11, { children: [
|
|
3046
|
-
extra,
|
|
3047
|
-
todos && todos.length > 0 && /* @__PURE__ */ jsx20(
|
|
3048
|
-
Popover,
|
|
3049
|
-
{
|
|
3050
|
-
content: /* @__PURE__ */ jsx20("div", { style: { width: 400 }, children: /* @__PURE__ */ jsx20(
|
|
3051
|
-
Todo,
|
|
3052
|
-
{
|
|
3053
|
-
data: todos,
|
|
3054
|
-
component_key: "header_todos",
|
|
3055
|
-
eventHandler: handleMDResponseEvent
|
|
3056
|
-
}
|
|
3057
|
-
) }),
|
|
3058
|
-
title: "Todos",
|
|
3059
|
-
trigger: "click",
|
|
3060
|
-
placement: "bottomRight",
|
|
3061
|
-
children: /* @__PURE__ */ jsx20(
|
|
3062
|
-
Tooltip2,
|
|
3063
|
-
{
|
|
3064
|
-
title: `${todos.filter((item) => item.status === "completed").length} / ${todos.length} tasks completed`,
|
|
3065
|
-
children: /* @__PURE__ */ jsx20("div", { style: { cursor: "pointer", display: "inline-flex" }, children: /* @__PURE__ */ jsx20(
|
|
3066
|
-
Progress,
|
|
3067
|
-
{
|
|
3068
|
-
type: "circle",
|
|
3069
|
-
strokeColor: {
|
|
3070
|
-
"0%": "#91caff",
|
|
3071
|
-
"100%": "#003eb3"
|
|
3072
|
-
},
|
|
3073
|
-
percent: Math.round(
|
|
3074
|
-
todos.filter((item) => item.status === "completed").length / todos.length * 100
|
|
3075
|
-
),
|
|
3076
|
-
status: todos.some((item) => item.status === "in_progress") ? "active" : "normal",
|
|
3077
|
-
width: 30,
|
|
3078
|
-
format: () => /* @__PURE__ */ jsx20(
|
|
3079
|
-
"div",
|
|
3080
|
-
{
|
|
3081
|
-
style: {
|
|
3082
|
-
display: "flex",
|
|
3083
|
-
flexDirection: "column",
|
|
3084
|
-
alignItems: "center",
|
|
3085
|
-
lineHeight: 1
|
|
3086
|
-
},
|
|
3087
|
-
children: /* @__PURE__ */ jsxs14("span", { style: { fontSize: 8 }, children: [
|
|
3088
|
-
todos.filter(
|
|
3089
|
-
(item) => item.status === "completed"
|
|
3090
|
-
).length,
|
|
3091
|
-
"/",
|
|
3092
|
-
todos.length
|
|
3093
|
-
] })
|
|
3094
|
-
}
|
|
3095
|
-
)
|
|
3096
|
-
}
|
|
3097
|
-
) })
|
|
3098
|
-
}
|
|
3099
|
-
)
|
|
3100
|
-
}
|
|
3101
|
-
),
|
|
3102
|
-
files && Object.keys(files).length > 0 && /* @__PURE__ */ jsx20(Tooltip2, { title: "File Explorer", children: /* @__PURE__ */ jsx20(
|
|
3103
|
-
Badge,
|
|
3104
|
-
{
|
|
3105
|
-
count: Object.keys(files).length,
|
|
3106
|
-
size: "small",
|
|
3107
|
-
color: "blue",
|
|
3108
|
-
children: /* @__PURE__ */ jsx20(
|
|
3109
|
-
Button9,
|
|
3110
|
-
{
|
|
3111
|
-
type: "text",
|
|
3112
|
-
icon: /* @__PURE__ */ jsx20(FileTextOutlined3, {}),
|
|
3113
|
-
onClick: () => onOpenSidePanel({
|
|
3114
|
-
component_key: "file_explorer",
|
|
3115
|
-
message: "File Explorer",
|
|
3116
|
-
data: { files }
|
|
3117
|
-
})
|
|
3118
|
-
}
|
|
3119
|
-
)
|
|
3120
|
-
}
|
|
3121
|
-
) }),
|
|
3122
|
-
extraMetaComponents && /* @__PURE__ */ jsx20(Space11, { align: "center", style: { marginRight: 16 }, children: extraMetaComponents })
|
|
3123
|
-
] })
|
|
3124
|
-
}
|
|
3125
|
-
),
|
|
3126
|
-
/* @__PURE__ */ jsx20(
|
|
3127
|
-
"div",
|
|
3128
|
-
{
|
|
3129
|
-
style: {
|
|
3130
|
-
background: "linear-gradient(rgba(41, 42, 45, .8) 0%, rgba(41, 42, 45, 0) 100%)"
|
|
3131
|
-
}
|
|
3132
|
-
}
|
|
3133
|
-
)
|
|
3134
|
-
] }),
|
|
3135
|
-
items.length > 0 ? /* @__PURE__ */ jsx20(
|
|
3136
|
-
MemoizedBubbleList,
|
|
4044
|
+
return /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
4045
|
+
/* @__PURE__ */ jsx28("div", { children: showHeader && /* @__PURE__ */ jsx28(
|
|
4046
|
+
AgentHeader,
|
|
3137
4047
|
{
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
4048
|
+
description,
|
|
4049
|
+
avatar,
|
|
4050
|
+
name,
|
|
4051
|
+
extra,
|
|
4052
|
+
extraMeta
|
|
3141
4053
|
}
|
|
3142
|
-
)
|
|
3143
|
-
|
|
3144
|
-
|
|
4054
|
+
) }),
|
|
4055
|
+
/* @__PURE__ */ jsx28(MessageList, { messages, className: styles.messages }),
|
|
4056
|
+
isLoading ? /* @__PURE__ */ jsx28("div", { children: /* @__PURE__ */ jsx28(Bubble2, { loading: isLoading, variant: "borderless", content: "" }) }) : /* @__PURE__ */ jsx28(Prompts, { items: senderPromptsItems, onItemClick: onPromptsItemClick }),
|
|
4057
|
+
error && /* @__PURE__ */ jsx28("div", { style: { padding: "0 16px 8px" }, children: /* @__PURE__ */ jsx28(
|
|
3145
4058
|
Alert2,
|
|
3146
4059
|
{
|
|
3147
4060
|
type: "error",
|
|
3148
4061
|
banner: true,
|
|
3149
4062
|
closable: true,
|
|
3150
|
-
onClose: () =>
|
|
4063
|
+
onClose: () => clearError(),
|
|
3151
4064
|
message: `${error.message}`
|
|
3152
4065
|
}
|
|
3153
4066
|
) }),
|
|
3154
|
-
/* @__PURE__ */
|
|
3155
|
-
|
|
3156
|
-
{
|
|
3157
|
-
interrupts,
|
|
3158
|
-
eventHandler: handleMDResponseEvent
|
|
3159
|
-
}
|
|
3160
|
-
),
|
|
3161
|
-
/* @__PURE__ */ jsx20(
|
|
4067
|
+
showHITL && /* @__PURE__ */ jsx28(HITLContainer, {}),
|
|
4068
|
+
showSender && /* @__PURE__ */ jsx28(
|
|
3162
4069
|
Sender,
|
|
3163
4070
|
{
|
|
3164
4071
|
disabled: interrupts && interrupts.length > 0,
|
|
3165
|
-
allowSpeech:
|
|
4072
|
+
allowSpeech: false,
|
|
3166
4073
|
ref: senderRef,
|
|
3167
4074
|
value: content,
|
|
3168
4075
|
header: senderHeader,
|
|
@@ -3172,19 +4079,8 @@ ${JSON.stringify(tool_call)}
|
|
|
3172
4079
|
prefix: attachmentsNode,
|
|
3173
4080
|
loading: isLoading,
|
|
3174
4081
|
className: styles.sender,
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
return /* @__PURE__ */ jsx20(Flex5, { justify: "space-between", align: "center", children: isLoading ? /* @__PURE__ */ jsx20(LoadingButton, { type: "default" }) : /* @__PURE__ */ jsx20(
|
|
3178
|
-
SendButton,
|
|
3179
|
-
{
|
|
3180
|
-
type: "primary",
|
|
3181
|
-
disabled: !content && attachedFiles.length === 0,
|
|
3182
|
-
onClick: () => onSubmit(content)
|
|
3183
|
-
}
|
|
3184
|
-
) });
|
|
3185
|
-
},
|
|
3186
|
-
onPasteFile: (_, files2) => {
|
|
3187
|
-
Array.from(files2).forEach((file) => {
|
|
4082
|
+
onPasteFile: (files) => {
|
|
4083
|
+
Array.from(files).forEach((file) => {
|
|
3188
4084
|
attachmentsRef.current?.upload(file);
|
|
3189
4085
|
});
|
|
3190
4086
|
setHeaderOpen(true);
|
|
@@ -3194,72 +4090,105 @@ ${JSON.stringify(tool_call)}
|
|
|
3194
4090
|
] });
|
|
3195
4091
|
};
|
|
3196
4092
|
|
|
3197
|
-
// src/components/
|
|
3198
|
-
import {
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
ThoughtChain
|
|
3205
|
-
} from "@ant-design/x";
|
|
3206
|
-
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3207
|
-
function getStatusIcon2(status) {
|
|
3208
|
-
switch (status) {
|
|
3209
|
-
case "success":
|
|
3210
|
-
return /* @__PURE__ */ jsx21(CheckCircleOutlined3, {});
|
|
3211
|
-
case "error":
|
|
3212
|
-
return /* @__PURE__ */ jsx21(InfoCircleOutlined2, {});
|
|
3213
|
-
case "pending":
|
|
3214
|
-
return /* @__PURE__ */ jsx21(LoadingOutlined3, {});
|
|
3215
|
-
default:
|
|
3216
|
-
return /* @__PURE__ */ jsx21(CheckCircleOutlined3, {});
|
|
3217
|
-
}
|
|
3218
|
-
}
|
|
3219
|
-
var ThinkingChain = ({ message: message3 }) => {
|
|
3220
|
-
const title = message3.name || message3.content.split("\n")[0];
|
|
3221
|
-
const items = [
|
|
3222
|
-
{
|
|
3223
|
-
key: message3.id,
|
|
3224
|
-
title,
|
|
3225
|
-
content: /* @__PURE__ */ jsx21(MDResponse, { content: message3.content }),
|
|
3226
|
-
status: message3.status,
|
|
3227
|
-
icon: getStatusIcon2(message3.status)
|
|
3228
|
-
}
|
|
3229
|
-
];
|
|
3230
|
-
return /* @__PURE__ */ jsx21(
|
|
3231
|
-
ThoughtChain,
|
|
4093
|
+
// src/components/GenUI/elements/task_detail.tsx
|
|
4094
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
4095
|
+
var { Text: Text10 } = Typography12;
|
|
4096
|
+
var TaskDetail = ({ data, component_key, interactive = true }) => {
|
|
4097
|
+
const { description, subagent_type, thread_id } = data || {};
|
|
4098
|
+
return /* @__PURE__ */ jsx29(
|
|
4099
|
+
AgentThreadProvider,
|
|
3232
4100
|
{
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
4101
|
+
threadId: thread_id,
|
|
4102
|
+
assistantId: subagent_type,
|
|
4103
|
+
options: {
|
|
4104
|
+
streaming: true,
|
|
4105
|
+
enableReturnStateWhenStreamCompleted: true,
|
|
4106
|
+
enableResumeStream: true
|
|
4107
|
+
},
|
|
4108
|
+
children: /* @__PURE__ */ jsx29("div", { style: { overflow: "hidden" }, children: /* @__PURE__ */ jsx29(
|
|
4109
|
+
Chating,
|
|
4110
|
+
{
|
|
4111
|
+
description,
|
|
4112
|
+
name: subagent_type,
|
|
4113
|
+
showHeader: true,
|
|
4114
|
+
showSender: false,
|
|
4115
|
+
showHITL: false
|
|
4116
|
+
}
|
|
4117
|
+
) })
|
|
3236
4118
|
}
|
|
3237
4119
|
);
|
|
3238
4120
|
};
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
}
|
|
3248
|
-
|
|
4121
|
+
|
|
4122
|
+
// src/components/GenUI/elements/builtIns.tsx
|
|
4123
|
+
var elements = {
|
|
4124
|
+
action_show_attachments_uploader: {
|
|
4125
|
+
card_view: () => null,
|
|
4126
|
+
action: (data) => {
|
|
4127
|
+
console.log(data);
|
|
4128
|
+
}
|
|
4129
|
+
},
|
|
4130
|
+
generic_data_table: {
|
|
4131
|
+
card_view: GenericDataTable,
|
|
4132
|
+
side_app_view: GenericDataTableSideApp
|
|
4133
|
+
},
|
|
4134
|
+
confirm: {
|
|
4135
|
+
card_view: ConfirmFeedback
|
|
4136
|
+
},
|
|
4137
|
+
tool_call: {
|
|
4138
|
+
card_view: ToolCall
|
|
4139
|
+
},
|
|
4140
|
+
tool_card: {
|
|
4141
|
+
card_view: ToolCard
|
|
4142
|
+
},
|
|
4143
|
+
todo_list: {
|
|
4144
|
+
card_view: Todo
|
|
4145
|
+
},
|
|
4146
|
+
write_todos: {
|
|
4147
|
+
card_view: WriteTodos
|
|
4148
|
+
},
|
|
4149
|
+
write_file: {
|
|
4150
|
+
card_view: WriteFile
|
|
4151
|
+
},
|
|
4152
|
+
edit_file: {
|
|
4153
|
+
card_view: EditFile
|
|
4154
|
+
},
|
|
4155
|
+
file_explorer: {
|
|
4156
|
+
card_view: () => null,
|
|
4157
|
+
side_app_view: FileExplorer
|
|
4158
|
+
},
|
|
4159
|
+
attachments: {
|
|
4160
|
+
card_view: AttachmentsCard,
|
|
4161
|
+
side_app_view: AttachmentsViewerSideApp
|
|
4162
|
+
},
|
|
4163
|
+
file_content_diff_view: {
|
|
4164
|
+
card_view: FileContentDiffView,
|
|
4165
|
+
side_app_view: FileContentDiffView
|
|
4166
|
+
},
|
|
4167
|
+
task: {
|
|
4168
|
+
card_view: TaskCard,
|
|
4169
|
+
side_app_view: TaskDetail
|
|
4170
|
+
}
|
|
4171
|
+
};
|
|
4172
|
+
|
|
4173
|
+
// src/components/GenUI/elements/index.tsx
|
|
4174
|
+
var getElement = (language) => {
|
|
4175
|
+
if (language && elements[language]) {
|
|
4176
|
+
return elements[language];
|
|
4177
|
+
}
|
|
4178
|
+
return null;
|
|
4179
|
+
};
|
|
4180
|
+
var regsiterElement = (language, ElementMeta) => {
|
|
4181
|
+
console.log("regsiterElement", language, ElementMeta);
|
|
4182
|
+
elements[language] = ElementMeta;
|
|
4183
|
+
return ElementMeta;
|
|
3249
4184
|
};
|
|
3250
4185
|
|
|
3251
4186
|
// src/components/Chat/SideAppViewBrowser.tsx
|
|
3252
|
-
import {
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
} from "@ant-design/icons";
|
|
3258
|
-
import { Button as Button10, Tabs } from "antd";
|
|
3259
|
-
import { createStyles as createStyles7 } from "antd-style";
|
|
3260
|
-
import { useEffect as useEffect9, useState as useState13 } from "react";
|
|
3261
|
-
import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3262
|
-
var useStyle5 = createStyles7(({ token, css }) => {
|
|
4187
|
+
import { Button as Button11, Tabs } from "antd";
|
|
4188
|
+
import { createStyles as createStyles9 } from "antd-style";
|
|
4189
|
+
import { useEffect as useEffect12, useState as useState17 } from "react";
|
|
4190
|
+
import { jsx as jsx30, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4191
|
+
var useStyle7 = createStyles9(({ token, css }) => {
|
|
3263
4192
|
return {
|
|
3264
4193
|
tabContainer: css`
|
|
3265
4194
|
.ant-tabs-content-holder {
|
|
@@ -3278,21 +4207,24 @@ var useStyle5 = createStyles7(({ token, css }) => {
|
|
|
3278
4207
|
};
|
|
3279
4208
|
});
|
|
3280
4209
|
var EmptySideAppView = ({ component_key, data }) => {
|
|
3281
|
-
return /* @__PURE__ */
|
|
3282
|
-
/* @__PURE__ */
|
|
3283
|
-
/* @__PURE__ */
|
|
4210
|
+
return /* @__PURE__ */ jsxs18("div", { children: [
|
|
4211
|
+
/* @__PURE__ */ jsx30("p", { children: "\u672A\u627E\u5230\u5BF9\u5E94\u7684\u7EC4\u4EF6\u89C6\u56FE" }),
|
|
4212
|
+
/* @__PURE__ */ jsx30("pre", { children: JSON.stringify({ component_key, data }, null, 2) })
|
|
3284
4213
|
] });
|
|
3285
4214
|
};
|
|
3286
|
-
var SideAppViewBrowser = ({
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
const [
|
|
4215
|
+
var SideAppViewBrowser = () => {
|
|
4216
|
+
const { styles } = useStyle7();
|
|
4217
|
+
const {
|
|
4218
|
+
sideAppSize,
|
|
4219
|
+
sideAppSelectedCard,
|
|
4220
|
+
setSideAppSize,
|
|
4221
|
+
openSideApp,
|
|
4222
|
+
closeSideApp
|
|
4223
|
+
} = useChatUIContext();
|
|
4224
|
+
const [activeKey, setActiveKey] = useState17(
|
|
4225
|
+
JSON.stringify(sideAppSelectedCard)
|
|
4226
|
+
);
|
|
4227
|
+
const [items, setItems] = useState17([]);
|
|
3296
4228
|
const add = (key, label, children) => {
|
|
3297
4229
|
const newActiveKey = key;
|
|
3298
4230
|
const newPanes = [...items];
|
|
@@ -3317,7 +4249,7 @@ var SideAppViewBrowser = ({
|
|
|
3317
4249
|
}
|
|
3318
4250
|
}
|
|
3319
4251
|
if (newPanes.length === 0) {
|
|
3320
|
-
|
|
4252
|
+
closeSideApp();
|
|
3321
4253
|
return;
|
|
3322
4254
|
}
|
|
3323
4255
|
setItems(newPanes);
|
|
@@ -3328,31 +4260,25 @@ var SideAppViewBrowser = ({
|
|
|
3328
4260
|
remove(targetKey);
|
|
3329
4261
|
}
|
|
3330
4262
|
};
|
|
3331
|
-
|
|
3332
|
-
const SideAppView = getElement(
|
|
3333
|
-
const key = JSON.stringify(
|
|
4263
|
+
useEffect12(() => {
|
|
4264
|
+
const SideAppView = getElement(sideAppSelectedCard?.component_key).side_app_view || EmptySideAppView;
|
|
4265
|
+
const key = JSON.stringify(sideAppSelectedCard);
|
|
3334
4266
|
if (items.find((item) => item.key === key)) {
|
|
3335
4267
|
setActiveKey(key);
|
|
3336
4268
|
return;
|
|
3337
4269
|
}
|
|
3338
4270
|
add(
|
|
3339
4271
|
key,
|
|
3340
|
-
|
|
3341
|
-
/* @__PURE__ */
|
|
4272
|
+
sideAppSelectedCard?.message || sideAppSelectedCard?.data.message || "\u672A\u547D\u540D",
|
|
4273
|
+
/* @__PURE__ */ jsx30(
|
|
3342
4274
|
SideAppView,
|
|
3343
4275
|
{
|
|
3344
|
-
component_key:
|
|
3345
|
-
data:
|
|
3346
|
-
eventHandler
|
|
4276
|
+
component_key: sideAppSelectedCard?.component_key || "",
|
|
4277
|
+
data: sideAppSelectedCard?.data
|
|
3347
4278
|
}
|
|
3348
4279
|
)
|
|
3349
4280
|
);
|
|
3350
|
-
}, [
|
|
3351
|
-
useEffect9(() => {
|
|
3352
|
-
if (open_uri.size && open_uri.size !== currentSize) {
|
|
3353
|
-
setCurrentSize(open_uri.size);
|
|
3354
|
-
}
|
|
3355
|
-
}, [open_uri.size]);
|
|
4281
|
+
}, [sideAppSelectedCard]);
|
|
3356
4282
|
const onChange = (newActiveKey) => {
|
|
3357
4283
|
setActiveKey(newActiveKey);
|
|
3358
4284
|
};
|
|
@@ -3364,10 +4290,9 @@ var SideAppViewBrowser = ({
|
|
|
3364
4290
|
"large",
|
|
3365
4291
|
"full"
|
|
3366
4292
|
];
|
|
3367
|
-
const currentIndex = sizeOrder.indexOf(
|
|
4293
|
+
const currentIndex = sizeOrder.indexOf(sideAppSize);
|
|
3368
4294
|
const nextSize = sizeOrder[(currentIndex + 1) % sizeOrder.length];
|
|
3369
|
-
|
|
3370
|
-
onChangeSize(nextSize);
|
|
4295
|
+
setSideAppSize(nextSize);
|
|
3371
4296
|
};
|
|
3372
4297
|
const getSizeLabel = (size) => {
|
|
3373
4298
|
switch (size) {
|
|
@@ -3386,16 +4311,16 @@ var SideAppViewBrowser = ({
|
|
|
3386
4311
|
const getSizeIcon = (size) => {
|
|
3387
4312
|
switch (size) {
|
|
3388
4313
|
case "middle":
|
|
3389
|
-
return /* @__PURE__ */
|
|
4314
|
+
return /* @__PURE__ */ jsx30(CompressOutlined, {});
|
|
3390
4315
|
case "large":
|
|
3391
|
-
return /* @__PURE__ */
|
|
4316
|
+
return /* @__PURE__ */ jsx30(ExpandOutlined, {});
|
|
3392
4317
|
case "full":
|
|
3393
|
-
return /* @__PURE__ */
|
|
4318
|
+
return /* @__PURE__ */ jsx30(FullscreenOutlined, {});
|
|
3394
4319
|
default:
|
|
3395
|
-
return /* @__PURE__ */
|
|
4320
|
+
return /* @__PURE__ */ jsx30(ExpandOutlined, {});
|
|
3396
4321
|
}
|
|
3397
4322
|
};
|
|
3398
|
-
return /* @__PURE__ */
|
|
4323
|
+
return /* @__PURE__ */ jsx30(
|
|
3399
4324
|
Tabs,
|
|
3400
4325
|
{
|
|
3401
4326
|
className: styles.tabContainer,
|
|
@@ -3403,27 +4328,27 @@ var SideAppViewBrowser = ({
|
|
|
3403
4328
|
style: { height: "100%" },
|
|
3404
4329
|
hideAdd: true,
|
|
3405
4330
|
tabBarExtraContent: {
|
|
3406
|
-
right: /* @__PURE__ */
|
|
3407
|
-
/* @__PURE__ */
|
|
3408
|
-
|
|
4331
|
+
right: /* @__PURE__ */ jsxs18("div", { style: { display: "flex", gap: "4px" }, children: [
|
|
4332
|
+
/* @__PURE__ */ jsx30(
|
|
4333
|
+
Button11,
|
|
3409
4334
|
{
|
|
3410
4335
|
style: { margin: "8px 0" },
|
|
3411
4336
|
size: "large",
|
|
3412
4337
|
type: "text",
|
|
3413
|
-
icon: getSizeIcon(
|
|
4338
|
+
icon: getSizeIcon(sideAppSize),
|
|
3414
4339
|
onClick: handleSizeChange,
|
|
3415
|
-
title: `\u5F53\u524D\u5C3A\u5BF8: ${getSizeLabel(
|
|
4340
|
+
title: `\u5F53\u524D\u5C3A\u5BF8: ${getSizeLabel(sideAppSize)}, \u70B9\u51FB\u5207\u6362`
|
|
3416
4341
|
}
|
|
3417
4342
|
),
|
|
3418
|
-
/* @__PURE__ */
|
|
3419
|
-
|
|
4343
|
+
/* @__PURE__ */ jsx30(
|
|
4344
|
+
Button11,
|
|
3420
4345
|
{
|
|
3421
4346
|
style: { margin: "8px 0" },
|
|
3422
4347
|
size: "large",
|
|
3423
4348
|
type: "text",
|
|
3424
|
-
icon: /* @__PURE__ */
|
|
4349
|
+
icon: /* @__PURE__ */ jsx30(CloseOutlined, {}),
|
|
3425
4350
|
onClick: () => {
|
|
3426
|
-
|
|
4351
|
+
closeSideApp();
|
|
3427
4352
|
}
|
|
3428
4353
|
}
|
|
3429
4354
|
)
|
|
@@ -3437,29 +4362,51 @@ var SideAppViewBrowser = ({
|
|
|
3437
4362
|
);
|
|
3438
4363
|
};
|
|
3439
4364
|
|
|
3440
|
-
// src/components/Chat/
|
|
3441
|
-
import {
|
|
3442
|
-
var
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
4365
|
+
// src/components/Chat/LatticeChat.tsx
|
|
4366
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
4367
|
+
var LatticeChat = (props) => {
|
|
4368
|
+
const { assistant_id, thread_id, ...chatingProps } = props;
|
|
4369
|
+
return /* @__PURE__ */ jsx31(
|
|
4370
|
+
AgentThreadProvider,
|
|
4371
|
+
{
|
|
4372
|
+
assistantId: assistant_id,
|
|
4373
|
+
threadId: thread_id,
|
|
4374
|
+
options: {
|
|
4375
|
+
streaming: true,
|
|
4376
|
+
enableReturnStateWhenStreamCompleted: true,
|
|
4377
|
+
enableResumeStream: true
|
|
4378
|
+
},
|
|
4379
|
+
children: /* @__PURE__ */ jsx31(ChatUIContextProvider, { children: /* @__PURE__ */ jsx31(
|
|
4380
|
+
ColumnLayout,
|
|
4381
|
+
{
|
|
4382
|
+
left: /* @__PURE__ */ jsx31(Chating, { ...chatingProps }),
|
|
4383
|
+
right: /* @__PURE__ */ jsx31(SideAppViewBrowser, {})
|
|
4384
|
+
}
|
|
4385
|
+
) })
|
|
4386
|
+
}
|
|
4387
|
+
);
|
|
4388
|
+
};
|
|
3446
4389
|
export {
|
|
4390
|
+
AgentThreadProvider,
|
|
3447
4391
|
AxiomLatticeProvider,
|
|
4392
|
+
ChatUIContext,
|
|
4393
|
+
ChatUIContextProvider,
|
|
3448
4394
|
Chating,
|
|
3449
4395
|
FileExplorer,
|
|
4396
|
+
LatticeChat,
|
|
3450
4397
|
MDMermaid,
|
|
3451
4398
|
MDResponse,
|
|
3452
4399
|
MDViewFormItem,
|
|
3453
4400
|
SideAppViewBrowser,
|
|
3454
|
-
ThinkingChain,
|
|
3455
|
-
ThinkingChainGroup,
|
|
3456
|
-
chatContext,
|
|
3457
4401
|
getElement,
|
|
3458
4402
|
regsiterElement,
|
|
4403
|
+
useAgentChat,
|
|
3459
4404
|
useAgentGraph,
|
|
3460
4405
|
useAgentState,
|
|
4406
|
+
useAgentThreadContext,
|
|
3461
4407
|
useAxiomLattice,
|
|
3462
4408
|
useChat,
|
|
4409
|
+
useChatUIContext,
|
|
3463
4410
|
useThread
|
|
3464
4411
|
};
|
|
3465
4412
|
//# sourceMappingURL=index.mjs.map
|