@hef2024/llmasaservice-ui 0.20.0 → 0.20.1
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/AICHATPANEL-PORT-INVENTORY.md +1 -0
- package/DEBUG-ERROR-HANDLING.md +1 -0
- package/FIX-APPLIED.md +1 -0
- package/IMPLEMENTATION-COMPLETE.md +1 -0
- package/dist/index.css +445 -0
- package/dist/index.d.mts +36 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +1042 -438
- package/dist/index.mjs +873 -269
- package/docs/CHANGELOG-ERROR-HANDLING.md +1 -0
- package/docs/CONVERSATION-HISTORY.md +1 -0
- package/docs/ERROR-HANDLING-413.md +1 -0
- package/docs/ERROR-HANDLING-SUMMARY.md +1 -0
- package/package.json +2 -2
- package/src/AIAgentPanel.tsx +97 -1
- package/src/AIChatPanel.css +536 -0
- package/src/AIChatPanel.tsx +641 -32
- package/src/AgentPanel.tsx +3 -1
- package/src/ChatPanel.tsx +69 -29
- package/src/components/ui/Button.tsx +1 -0
- package/src/components/ui/Dialog.tsx +1 -0
- package/src/components/ui/Input.tsx +1 -0
- package/src/components/ui/Select.tsx +1 -0
- package/src/components/ui/ToolInfoModal.tsx +66 -0
- package/src/components/ui/Tooltip.tsx +1 -0
- package/src/components/ui/index.ts +1 -0
- package/src/hooks/useAgentRegistry.ts +1 -0
package/src/AgentPanel.tsx
CHANGED
|
@@ -159,7 +159,9 @@ const AgentPanel: React.FC<AgentPanelProps & ExtraProps> = ({
|
|
|
159
159
|
useEffect(() => {
|
|
160
160
|
const fetchAgentData = async () => {
|
|
161
161
|
try {
|
|
162
|
-
const fetchUrl =
|
|
162
|
+
const fetchUrl = url.endsWith("dev")
|
|
163
|
+
? `https://8ftw8droff.execute-api.us-east-1.amazonaws.com/dev/agents/${agent}`
|
|
164
|
+
: `https://api.llmasaservice.io/agents/${agent}`;
|
|
163
165
|
|
|
164
166
|
const response = await fetch(fetchUrl, {
|
|
165
167
|
method: "GET",
|
package/src/ChatPanel.tsx
CHANGED
|
@@ -2467,15 +2467,23 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
|
|
|
2467
2467
|
};
|
|
2468
2468
|
|
|
2469
2469
|
const convertMarkdownToHTML = (markdown: string): string => {
|
|
2470
|
-
const
|
|
2470
|
+
const markdownContent = (
|
|
2471
2471
|
<ReactMarkdown
|
|
2472
|
-
className={markdownClass}
|
|
2473
2472
|
remarkPlugins={[remarkGfm]}
|
|
2474
2473
|
rehypePlugins={[rehypeRaw]}
|
|
2475
2474
|
>
|
|
2476
2475
|
{markdown}
|
|
2477
2476
|
</ReactMarkdown>
|
|
2478
2477
|
);
|
|
2478
|
+
const html = ReactDOMServer.renderToStaticMarkup(
|
|
2479
|
+
markdownClass ? (
|
|
2480
|
+
<div className={markdownClass}>
|
|
2481
|
+
{markdownContent}
|
|
2482
|
+
</div>
|
|
2483
|
+
) : (
|
|
2484
|
+
markdownContent
|
|
2485
|
+
)
|
|
2486
|
+
);
|
|
2479
2487
|
return html;
|
|
2480
2488
|
};
|
|
2481
2489
|
|
|
@@ -2796,13 +2804,23 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
|
|
|
2796
2804
|
{initialMessage && initialMessage !== "" ? (
|
|
2797
2805
|
<div className="history-entry">
|
|
2798
2806
|
<div className="response">
|
|
2799
|
-
|
|
2800
|
-
className={markdownClass}
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2807
|
+
{markdownClass ? (
|
|
2808
|
+
<div className={markdownClass}>
|
|
2809
|
+
<ReactMarkdown
|
|
2810
|
+
remarkPlugins={[remarkGfm]}
|
|
2811
|
+
rehypePlugins={[rehypeRaw]}
|
|
2812
|
+
>
|
|
2813
|
+
{initialMessage}
|
|
2814
|
+
</ReactMarkdown>
|
|
2815
|
+
</div>
|
|
2816
|
+
) : (
|
|
2817
|
+
<ReactMarkdown
|
|
2818
|
+
remarkPlugins={[remarkGfm]}
|
|
2819
|
+
rehypePlugins={[rehypeRaw]}
|
|
2820
|
+
>
|
|
2821
|
+
{initialMessage}
|
|
2822
|
+
</ReactMarkdown>
|
|
2823
|
+
)}
|
|
2806
2824
|
</div>
|
|
2807
2825
|
</div>
|
|
2808
2826
|
) : null}
|
|
@@ -2877,9 +2895,8 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
|
|
|
2877
2895
|
// Get the processed content that includes action buttons from history
|
|
2878
2896
|
// During streaming, use the most recent history entry if it exists
|
|
2879
2897
|
if (lastKey && history[lastKey] && history[lastKey].content) {
|
|
2880
|
-
|
|
2898
|
+
const content = (
|
|
2881
2899
|
<ReactMarkdown
|
|
2882
|
-
className={markdownClass}
|
|
2883
2900
|
remarkPlugins={[remarkGfm]}
|
|
2884
2901
|
rehypePlugins={[rehypeRaw]}
|
|
2885
2902
|
components={{ /*a: CustomLink,*/ code: CodeBlock }}
|
|
@@ -2887,22 +2904,34 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
|
|
|
2887
2904
|
{history[lastKey].content}
|
|
2888
2905
|
</ReactMarkdown>
|
|
2889
2906
|
);
|
|
2907
|
+
return markdownClass ? (
|
|
2908
|
+
<div className={markdownClass}>{content}</div>
|
|
2909
|
+
) : (
|
|
2910
|
+
content
|
|
2911
|
+
);
|
|
2890
2912
|
}
|
|
2891
2913
|
|
|
2892
2914
|
// Fallback to cleaned text if no processed history exists yet
|
|
2893
2915
|
const { cleanedText } = processThinkingTags(
|
|
2894
2916
|
response || ""
|
|
2895
2917
|
);
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2918
|
+
if (cleanedText && cleanedText.length > 0) {
|
|
2919
|
+
const content = (
|
|
2920
|
+
<ReactMarkdown
|
|
2921
|
+
remarkPlugins={[remarkGfm]}
|
|
2922
|
+
rehypePlugins={[rehypeRaw]}
|
|
2923
|
+
components={{ /*a: CustomLink,*/ code: CodeBlock }}
|
|
2924
|
+
>
|
|
2925
|
+
{cleanedText}
|
|
2926
|
+
</ReactMarkdown>
|
|
2927
|
+
);
|
|
2928
|
+
return markdownClass ? (
|
|
2929
|
+
<div className={markdownClass}>{content}</div>
|
|
2930
|
+
) : (
|
|
2931
|
+
content
|
|
2932
|
+
);
|
|
2933
|
+
}
|
|
2934
|
+
return null;
|
|
2906
2935
|
})()}
|
|
2907
2936
|
</div>
|
|
2908
2937
|
) : (
|
|
@@ -2913,14 +2942,25 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
|
|
|
2913
2942
|
renderThinkingBlocks()}
|
|
2914
2943
|
|
|
2915
2944
|
{/* Show the main content (cleaned of thinking tags) */}
|
|
2916
|
-
|
|
2917
|
-
className={markdownClass}
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2945
|
+
{markdownClass ? (
|
|
2946
|
+
<div className={markdownClass}>
|
|
2947
|
+
<ReactMarkdown
|
|
2948
|
+
remarkPlugins={[remarkGfm]}
|
|
2949
|
+
rehypePlugins={[rehypeRaw]}
|
|
2950
|
+
components={{ /*a: CustomLink,*/ code: CodeBlock }}
|
|
2951
|
+
>
|
|
2952
|
+
{processThinkingTags(historyEntry.content).cleanedText}
|
|
2953
|
+
</ReactMarkdown>
|
|
2954
|
+
</div>
|
|
2955
|
+
) : (
|
|
2956
|
+
<ReactMarkdown
|
|
2957
|
+
remarkPlugins={[remarkGfm]}
|
|
2958
|
+
rehypePlugins={[rehypeRaw]}
|
|
2959
|
+
components={{ /*a: CustomLink,*/ code: CodeBlock }}
|
|
2960
|
+
>
|
|
2961
|
+
{processThinkingTags(historyEntry.content).cleanedText}
|
|
2962
|
+
</ReactMarkdown>
|
|
2963
|
+
)}
|
|
2924
2964
|
</div>
|
|
2925
2965
|
)}
|
|
2926
2966
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface ToolInfoModalProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
data: { calls: any[]; responses: any[] } | null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const ToolInfoModal: React.FC<ToolInfoModalProps> = ({
|
|
10
|
+
isOpen,
|
|
11
|
+
onClose,
|
|
12
|
+
data,
|
|
13
|
+
}) => {
|
|
14
|
+
if (!isOpen || !data) return null;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div className="ai-chat-modal-overlay" onClick={onClose}>
|
|
18
|
+
<div
|
|
19
|
+
className="ai-chat-modal-content ai-chat-tool-info-modal"
|
|
20
|
+
onClick={(e) => e.stopPropagation()}
|
|
21
|
+
>
|
|
22
|
+
<div className="ai-chat-modal-header">
|
|
23
|
+
<h3>Tool Information</h3>
|
|
24
|
+
<button
|
|
25
|
+
className="ai-chat-modal-close"
|
|
26
|
+
onClick={onClose}
|
|
27
|
+
aria-label="Close"
|
|
28
|
+
>
|
|
29
|
+
×
|
|
30
|
+
</button>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div className="ai-chat-modal-body ai-chat-tool-info-container">
|
|
34
|
+
<div className="ai-chat-tool-info-section">
|
|
35
|
+
<h4>Tool Calls</h4>
|
|
36
|
+
<textarea
|
|
37
|
+
className="ai-chat-tool-info-json"
|
|
38
|
+
readOnly
|
|
39
|
+
value={JSON.stringify(data.calls, null, 2)}
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
<div className="ai-chat-tool-info-section">
|
|
43
|
+
<h4>Tool Responses</h4>
|
|
44
|
+
<textarea
|
|
45
|
+
className="ai-chat-tool-info-json"
|
|
46
|
+
readOnly
|
|
47
|
+
value={JSON.stringify(data.responses, null, 2)}
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div className="ai-chat-modal-footer">
|
|
53
|
+
<button
|
|
54
|
+
className="ai-chat-modal-button ai-chat-modal-button--primary"
|
|
55
|
+
onClick={onClose}
|
|
56
|
+
>
|
|
57
|
+
Close
|
|
58
|
+
</button>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default ToolInfoModal;
|
|
66
|
+
|