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