@carto/ps-react-ui 4.4.0-chat-ui.1 → 4.4.0-chat-ui.3
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/chat.js +1123 -393
- package/dist/chat.js.map +1 -1
- package/dist/components.js +141 -159
- package/dist/components.js.map +1 -1
- package/dist/copy-button-DGL1tyli.js +26 -0
- package/dist/copy-button-DGL1tyli.js.map +1 -0
- package/dist/index-BnyeR7Qx.js +6601 -0
- package/dist/index-BnyeR7Qx.js.map +1 -0
- package/dist/types/chat/const.d.ts +1 -0
- package/dist/types/chat/containers/styles.d.ts +6 -0
- package/dist/types/chat/feedback/chat-tool-code-area.d.ts +4 -0
- package/dist/types/chat/feedback/chat-tool-full-view-dialog.d.ts +2 -0
- package/dist/types/chat/feedback/chat-tool-group.d.ts +2 -0
- package/dist/types/chat/feedback/chat-tool-trace.d.ts +3 -0
- package/dist/types/chat/feedback/get-tool-label.d.ts +2 -0
- package/dist/types/chat/feedback/index.d.ts +4 -1
- package/dist/types/chat/feedback/styles.d.ts +149 -3
- package/dist/types/chat/index.d.ts +6 -3
- package/dist/types/chat/types.d.ts +58 -5
- package/dist/widgets/toolbar-actions.js +101 -6693
- package/dist/widgets/toolbar-actions.js.map +1 -1
- package/package.json +1 -1
- package/src/chat/bubbles/styles.ts +42 -0
- package/src/chat/const.ts +1 -0
- package/src/chat/containers/styles.ts +6 -0
- package/src/chat/feedback/chat-tool-code-area.test.tsx +23 -0
- package/src/chat/feedback/chat-tool-code-area.tsx +71 -0
- package/src/chat/feedback/chat-tool-full-view-dialog.test.tsx +39 -0
- package/src/chat/feedback/chat-tool-full-view-dialog.tsx +121 -0
- package/src/chat/feedback/chat-tool-group.test.tsx +84 -0
- package/src/chat/feedback/chat-tool-group.tsx +156 -0
- package/src/chat/feedback/chat-tool-trace.test.tsx +81 -0
- package/src/chat/feedback/chat-tool-trace.tsx +187 -0
- package/src/chat/feedback/get-tool-label.test.tsx +91 -0
- package/src/chat/feedback/get-tool-label.ts +13 -0
- package/src/chat/feedback/index.ts +4 -1
- package/src/chat/feedback/styles.ts +153 -4
- package/src/chat/index.ts +14 -3
- package/src/chat/types.ts +64 -5
- package/dist/types/chat/feedback/chat-tools.d.ts +0 -2
- package/src/chat/feedback/chat-tools.test.tsx +0 -23
- package/src/chat/feedback/chat-tools.tsx +0 -54
|
@@ -29,6 +29,12 @@ export declare const styles: {
|
|
|
29
29
|
footer: {
|
|
30
30
|
maxWidth: number;
|
|
31
31
|
margin: string;
|
|
32
|
+
'& textarea': {
|
|
33
|
+
resize: "none";
|
|
34
|
+
maxHeight: string;
|
|
35
|
+
overflowY: "auto !important";
|
|
36
|
+
paddingRight: ({ spacing }: Theme) => string;
|
|
37
|
+
};
|
|
32
38
|
};
|
|
33
39
|
footerCaption: {
|
|
34
40
|
textAlign: "center";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ChatToolGroupProps } from '../types';
|
|
2
|
+
export declare function ChatToolGroup({ tools, expanded: _expanded, onExpandedChange: _setExpanded, expandedTools: _expandedTools, onToolExpandedChange: _setExpandedTools, labels, sx, }: ChatToolGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ChatToolTraceProps } from '../types';
|
|
2
|
+
export declare function ChatToolTraceDetails({ tool, labels, }: Pick<ChatToolTraceProps, 'tool' | 'labels'>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function ChatToolTrace({ tool, expanded, onExpandedChange, labels, sx, }: ChatToolTraceProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,4 +2,7 @@ export { ChatThinking } from './chat-thinking';
|
|
|
2
2
|
export { ChatLoader } from './chat-loader';
|
|
3
3
|
export { ChatActionsContainer } from './chat-actions-container';
|
|
4
4
|
export { ChatRatingAction } from './chat-rating-action';
|
|
5
|
-
export {
|
|
5
|
+
export { ChatToolTrace } from './chat-tool-trace';
|
|
6
|
+
export { ChatToolCodeArea } from './chat-tool-code-area';
|
|
7
|
+
export { ChatToolFullViewDialog } from './chat-tool-full-view-dialog';
|
|
8
|
+
export { ChatToolGroup } from './chat-tool-group';
|
|
@@ -50,16 +50,162 @@ export declare const styles: {
|
|
|
50
50
|
toString: () => string;
|
|
51
51
|
} & string} 1s ease-in-out infinite`;
|
|
52
52
|
};
|
|
53
|
-
|
|
53
|
+
traceHeader: {
|
|
54
|
+
display: "flex";
|
|
55
|
+
alignItems: "center";
|
|
56
|
+
padding: number;
|
|
57
|
+
paddingLeft: ({ spacing }: Theme) => string;
|
|
58
|
+
borderRadius: ({ spacing }: Theme) => string;
|
|
54
59
|
width: string;
|
|
60
|
+
color: ({ palette }: Theme) => string;
|
|
61
|
+
'&:hover': {
|
|
62
|
+
backgroundColor: ({ palette }: Theme) => string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
traceChevron: {
|
|
66
|
+
color: ({ palette }: Theme) => string;
|
|
67
|
+
transition: "transform 0.2s";
|
|
68
|
+
};
|
|
69
|
+
traceDetailsWrapper: {
|
|
70
|
+
marginTop: ({ spacing }: Theme) => string;
|
|
71
|
+
padding: ({ spacing }: Theme) => string;
|
|
72
|
+
border: "1px solid";
|
|
73
|
+
borderColor: "divider";
|
|
74
|
+
borderRadius: ({ spacing }: Theme) => string;
|
|
75
|
+
};
|
|
76
|
+
traceField: {
|
|
77
|
+
display: "flex";
|
|
78
|
+
alignItems: "flex-start";
|
|
79
|
+
gap: ({ spacing }: Theme) => string;
|
|
80
|
+
};
|
|
81
|
+
traceFieldLabel: {
|
|
82
|
+
flexShrink: number;
|
|
55
83
|
};
|
|
56
|
-
|
|
84
|
+
traceReference: {
|
|
85
|
+
display: "flex";
|
|
86
|
+
borderRadius: ({ spacing }: Theme) => string;
|
|
87
|
+
padding: ({ spacing }: Theme) => string;
|
|
88
|
+
gap: ({ spacing }: Theme) => string;
|
|
89
|
+
backgroundColor: ({ palette }: Theme) => string;
|
|
90
|
+
color: ({ palette }: Theme) => string;
|
|
91
|
+
};
|
|
92
|
+
traceStatusSuccess: {
|
|
93
|
+
color: ({ palette }: Theme) => string;
|
|
94
|
+
};
|
|
95
|
+
traceStatusError: {
|
|
96
|
+
color: ({ palette }: Theme) => string;
|
|
97
|
+
};
|
|
98
|
+
codeArea: {
|
|
99
|
+
position: "relative";
|
|
100
|
+
width: string;
|
|
101
|
+
};
|
|
102
|
+
codeAreaPre: {
|
|
103
|
+
margin: number;
|
|
104
|
+
padding: ({ spacing }: Theme) => string;
|
|
105
|
+
borderRadius: ({ spacing }: Theme) => string;
|
|
106
|
+
backgroundColor: ({ palette }: Theme) => string;
|
|
107
|
+
fontSize: string;
|
|
108
|
+
fontFamily: "monospace";
|
|
109
|
+
whiteSpace: "pre-wrap";
|
|
110
|
+
wordBreak: "break-word";
|
|
111
|
+
overflowY: "auto";
|
|
112
|
+
};
|
|
113
|
+
codeAreaPreError: {
|
|
114
|
+
borderLeft: ({ palette }: Theme) => string;
|
|
115
|
+
backgroundColor: ({ palette }: Theme) => string;
|
|
116
|
+
};
|
|
117
|
+
codeAreaFullViewButton: {
|
|
118
|
+
position: "absolute";
|
|
119
|
+
top: ({ spacing }: Theme) => string;
|
|
120
|
+
right: ({ spacing }: Theme) => string;
|
|
121
|
+
};
|
|
122
|
+
fullViewDialog: {
|
|
123
|
+
margin: ({ spacing }: Theme) => string;
|
|
124
|
+
};
|
|
125
|
+
fullViewPaper: {
|
|
126
|
+
borderRadius: number;
|
|
127
|
+
};
|
|
128
|
+
fullViewTitle: {
|
|
57
129
|
display: "flex";
|
|
58
130
|
alignItems: "center";
|
|
131
|
+
justifyContent: "space-between";
|
|
132
|
+
padding: ({ spacing }: Theme) => string;
|
|
133
|
+
borderBottom: string;
|
|
134
|
+
borderBottomColor: "divider";
|
|
135
|
+
};
|
|
136
|
+
fullViewDialogContent: {
|
|
137
|
+
padding: number;
|
|
138
|
+
'&:first-of-type': {
|
|
139
|
+
paddingTop: number;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
fullViewPre: {
|
|
143
|
+
margin: number;
|
|
144
|
+
padding: ({ spacing }: Theme) => string;
|
|
145
|
+
background: ({ palette, spacing }: Theme) => string;
|
|
146
|
+
fontFamily: "monospace";
|
|
147
|
+
fontSize: string;
|
|
148
|
+
whiteSpace: "pre-wrap";
|
|
149
|
+
wordBreak: "break-word";
|
|
150
|
+
lineHeight: number;
|
|
151
|
+
counterReset: "line";
|
|
152
|
+
};
|
|
153
|
+
fullViewLine: {
|
|
154
|
+
display: "block";
|
|
155
|
+
'&::before': {
|
|
156
|
+
counterIncrement: "line";
|
|
157
|
+
content: "counter(line)";
|
|
158
|
+
display: "inline-block";
|
|
159
|
+
width: string;
|
|
160
|
+
marginRight: string;
|
|
161
|
+
textAlign: "right";
|
|
162
|
+
color: ({ palette }: Theme) => string;
|
|
163
|
+
userSelect: "none";
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
groupHeader: {
|
|
167
|
+
textAlign: "left";
|
|
168
|
+
display: "flex";
|
|
169
|
+
alignItems: "center";
|
|
170
|
+
borderRadius: number;
|
|
59
171
|
gap: ({ spacing }: Theme) => string;
|
|
60
172
|
};
|
|
61
|
-
|
|
173
|
+
errorBadge: {
|
|
174
|
+
color: ({ palette }: Theme) => string;
|
|
175
|
+
fontWeight: number;
|
|
62
176
|
display: "flex";
|
|
63
177
|
alignItems: "center";
|
|
178
|
+
gap: ({ spacing }: Theme) => string;
|
|
179
|
+
};
|
|
180
|
+
syntaxToken_key: {
|
|
181
|
+
color: "#881280";
|
|
182
|
+
};
|
|
183
|
+
syntaxToken_string: {
|
|
184
|
+
color: "#c41a16";
|
|
185
|
+
};
|
|
186
|
+
syntaxToken_number: {
|
|
187
|
+
color: "#1c00cf";
|
|
188
|
+
};
|
|
189
|
+
syntaxToken_boolean: {
|
|
190
|
+
color: "#1c00cf";
|
|
191
|
+
};
|
|
192
|
+
syntaxToken_null: {
|
|
193
|
+
color: "#808080";
|
|
194
|
+
};
|
|
195
|
+
syntaxToken_punctuation: {
|
|
196
|
+
color: ({ palette }: Theme) => string;
|
|
197
|
+
};
|
|
198
|
+
groupListItem: {
|
|
199
|
+
borderBottom: string;
|
|
200
|
+
borderColor: "divider";
|
|
201
|
+
'&:first-of-type .MuiButton-root': {
|
|
202
|
+
borderRadius: ({ spacing }: Theme) => string;
|
|
203
|
+
};
|
|
204
|
+
'&:last-of-type:not([aria-expanded=true]) .MuiButton-root': {
|
|
205
|
+
borderRadius: ({ spacing }: Theme) => string;
|
|
206
|
+
};
|
|
207
|
+
'&:last-of-type': {
|
|
208
|
+
borderBottomWidth: number;
|
|
209
|
+
};
|
|
64
210
|
};
|
|
65
211
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { ChatSxProps, ChatErrorAction, ChatUserMessageProps, ChatAgentMessageProps, ChatErrorMessageProps, ChatSuggestionButtonProps, ChatThinkingProps, ChatLoaderProps, ChatContentProps, ChatHeaderProps, ChatFooterProps, ChatStarterItem, ChatStarterProps, ChatActionsContainerProps, ChatRatingActionProps, ChatToolItem,
|
|
2
|
-
export { CHAT_MAX_WIDTH, CHAT_SCROLL_DELAY, CHAT_DIVIDER_DELAY } from './const';
|
|
1
|
+
export type { ChatSxProps, ChatErrorAction, ChatUserMessageProps, ChatAgentMessageProps, ChatErrorMessageProps, ChatSuggestionButtonProps, ChatThinkingProps, ChatLoaderProps, ChatContentProps, ChatHeaderProps, ChatFooterProps, ChatStarterItem, ChatStarterProps, ChatActionsContainerProps, ChatRatingActionProps, ChatToolItem, ChatToolTraceProps, ChatToolCodeAreaProps, ChatToolFullViewDialogProps, ChatToolGroupProps, } from './types';
|
|
2
|
+
export { CHAT_MAX_WIDTH, CHAT_SCROLL_DELAY, CHAT_DIVIDER_DELAY, CHAT_TOOL_CODE_AREA_MAX_HEIGHT, } from './const';
|
|
3
3
|
export { ChatUserMessage } from './bubbles/chat-user-message';
|
|
4
4
|
export { ChatAgentMessage } from './bubbles/chat-agent-message';
|
|
5
5
|
export { ChatErrorMessage } from './bubbles/chat-error-message';
|
|
@@ -13,4 +13,7 @@ export { ChatFooter } from './containers/chat-footer';
|
|
|
13
13
|
export { ChatStarter } from './containers/chat-starter';
|
|
14
14
|
export { ChatActionsContainer } from './feedback/chat-actions-container';
|
|
15
15
|
export { ChatRatingAction } from './feedback/chat-rating-action';
|
|
16
|
-
export {
|
|
16
|
+
export { ChatToolTrace } from './feedback/chat-tool-trace';
|
|
17
|
+
export { ChatToolCodeArea } from './feedback/chat-tool-code-area';
|
|
18
|
+
export { ChatToolFullViewDialog } from './feedback/chat-tool-full-view-dialog';
|
|
19
|
+
export { ChatToolGroup } from './feedback/chat-tool-group';
|
|
@@ -88,12 +88,65 @@ export interface ChatRatingActionProps {
|
|
|
88
88
|
export interface ChatToolItem {
|
|
89
89
|
id: string;
|
|
90
90
|
name: string;
|
|
91
|
-
status: '
|
|
92
|
-
|
|
91
|
+
status: 'running' | 'complete' | 'error';
|
|
92
|
+
/** Display label shown while status is 'running'. Falls back to a capitalized `name`. */
|
|
93
|
+
runningLabel?: string;
|
|
94
|
+
/** Display label shown for non-running statuses. Falls back to a capitalized `name`. */
|
|
95
|
+
label?: string;
|
|
96
|
+
/** Friendly reference name for the tool (e.g. "add_marker"). Displayed with icon. */
|
|
97
|
+
reference?: string;
|
|
98
|
+
/** Execution duration in seconds (e.g. 1.8) */
|
|
99
|
+
duration?: number;
|
|
100
|
+
/** Input arguments as a JSON string or plain text */
|
|
101
|
+
inputArguments?: string;
|
|
102
|
+
/** Output as a JSON string or plain text */
|
|
103
|
+
output?: string;
|
|
104
|
+
}
|
|
105
|
+
export interface ChatToolTraceProps extends ChatSxProps {
|
|
106
|
+
tool: ChatToolItem;
|
|
107
|
+
/** Whether the trace accordion is expanded */
|
|
108
|
+
expanded?: boolean;
|
|
109
|
+
/** Callback when accordion expansion state changes */
|
|
110
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
111
|
+
labels?: {
|
|
112
|
+
toolExecuted?: string;
|
|
113
|
+
reference?: string;
|
|
114
|
+
duration?: string;
|
|
115
|
+
status?: string;
|
|
116
|
+
inputArguments?: string;
|
|
117
|
+
output?: string;
|
|
118
|
+
fullView?: string;
|
|
119
|
+
success?: string;
|
|
120
|
+
error?: string;
|
|
121
|
+
running?: string;
|
|
122
|
+
};
|
|
93
123
|
}
|
|
94
|
-
export interface
|
|
95
|
-
|
|
124
|
+
export interface ChatToolCodeAreaProps extends ChatSxProps {
|
|
125
|
+
/** Code content to display */
|
|
126
|
+
content: string;
|
|
127
|
+
/** Label for the full view dialog title */
|
|
128
|
+
title?: string;
|
|
96
129
|
labels?: {
|
|
97
|
-
|
|
130
|
+
fullView?: string;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
export interface ChatToolFullViewDialogProps {
|
|
134
|
+
open: boolean;
|
|
135
|
+
onClose: () => void;
|
|
136
|
+
title: string;
|
|
137
|
+
content: string;
|
|
138
|
+
}
|
|
139
|
+
export interface ChatToolGroupProps extends ChatSxProps {
|
|
140
|
+
tools: ChatToolItem[];
|
|
141
|
+
/** Whether the group accordion is expanded */
|
|
142
|
+
expanded?: boolean;
|
|
143
|
+
/** Callback when group expansion state changes */
|
|
144
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
145
|
+
/** Map of tool IDs to their individual expanded state. Used to preserve expansion state during grouping. */
|
|
146
|
+
expandedTools?: Record<string, boolean>;
|
|
147
|
+
/** Callback when an individual tool's expansion state changes */
|
|
148
|
+
onToolExpandedChange?: (value: Record<string, boolean>, toolId?: string) => void;
|
|
149
|
+
labels?: ChatToolTraceProps['labels'] & {
|
|
150
|
+
toolsUsed?: string;
|
|
98
151
|
};
|
|
99
152
|
}
|