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