@hef2024/llmasaservice-ui 0.20.0 → 0.20.2

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.
@@ -159,7 +159,9 @@ const AgentPanel: React.FC<AgentPanelProps & ExtraProps> = ({
159
159
  useEffect(() => {
160
160
  const fetchAgentData = async () => {
161
161
  try {
162
- const fetchUrl = `https://api.llmasaservice.io/agents/${agent}`;
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 html = ReactDOMServer.renderToStaticMarkup(
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
- <ReactMarkdown
2800
- className={markdownClass}
2801
- remarkPlugins={[remarkGfm]}
2802
- rehypePlugins={[rehypeRaw]}
2803
- >
2804
- {initialMessage}
2805
- </ReactMarkdown>
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
- return (
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
- return cleanedText && cleanedText.length > 0 ? (
2897
- <ReactMarkdown
2898
- className={markdownClass}
2899
- remarkPlugins={[remarkGfm]}
2900
- rehypePlugins={[rehypeRaw]}
2901
- components={{ /*a: CustomLink,*/ code: CodeBlock }}
2902
- >
2903
- {cleanedText}
2904
- </ReactMarkdown>
2905
- ) : null;
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
- <ReactMarkdown
2917
- className={markdownClass}
2918
- remarkPlugins={[remarkGfm]}
2919
- rehypePlugins={[rehypeRaw]}
2920
- components={{ /*a: CustomLink,*/ code: CodeBlock }}
2921
- >
2922
- {processThinkingTags(historyEntry.content).cleanedText}
2923
- </ReactMarkdown>
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
 
@@ -59,3 +59,4 @@ export default Button;
59
59
 
60
60
 
61
61
 
62
+
@@ -155,3 +155,4 @@ export default Dialog;
155
155
 
156
156
 
157
157
 
158
+
@@ -35,3 +35,4 @@ export default Input;
35
35
 
36
36
 
37
37
 
38
+
@@ -158,3 +158,4 @@ export default Select;
158
158
 
159
159
 
160
160
 
161
+
@@ -0,0 +1,69 @@
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
+
67
+
68
+
69
+
@@ -75,3 +75,4 @@ export default Tooltip;
75
75
 
76
76
 
77
77
 
78
+
@@ -22,3 +22,4 @@ export type { DialogProps, DialogFooterProps } from './Dialog';
22
22
 
23
23
 
24
24
 
25
+