@dbx-tools/ui-mastra 0.9.178 → 0.9.181
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/index.react.ts +1 -1
- package/index.ts +1 -1
- package/package.json +7 -7
- package/src/react/bubbles.tsx +8 -8
- package/src/react/chat-feedback.ts +11 -0
- package/src/react/chat-thread-layout.tsx +12 -1
- package/src/react/chat-transcript.tsx +5 -2
- package/src/react/feedback-controls.tsx +6 -4
- package/src/react/thread-tabs.tsx +2 -2
package/index.react.ts
CHANGED
|
@@ -28,7 +28,7 @@ export * as types from "./src/react/types.ts";
|
|
|
28
28
|
export { AssistantBubble, UserBubble } from "./src/react/bubbles.tsx";
|
|
29
29
|
export { resolveApprovalContinuation, useChatApprovals } from "./src/react/chat-approvals.ts";
|
|
30
30
|
export { ChatComposer } from "./src/react/chat-composer.tsx";
|
|
31
|
-
export { genieFeedbackTarget, messageFeedbackDestination, useChatFeedback } from "./src/react/chat-feedback.ts";
|
|
31
|
+
export { genieFeedbackTarget, messageFeedbackDestination, mlflowTraceUrl, useChatFeedback } from "./src/react/chat-feedback.ts";
|
|
32
32
|
export type { GenieFeedbackTarget, MessageFeedbackDestination } from "./src/react/chat-feedback.ts";
|
|
33
33
|
export { useChatHistory } from "./src/react/chat-history.ts";
|
|
34
34
|
export { useChatSessions } from "./src/react/chat-sessions.ts";
|
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@databricks/appkit-ui": "0.81.0",
|
|
35
|
-
"@dbx-tools/shared-auth": "^0.9.
|
|
36
|
-
"@dbx-tools/shared-core": "^0.9.
|
|
37
|
-
"@dbx-tools/shared-genie": "^0.9.
|
|
38
|
-
"@dbx-tools/shared-mastra": "^0.9.
|
|
39
|
-
"@dbx-tools/shared-model": "^0.9.
|
|
40
|
-
"@dbx-tools/ui": "^0.9.
|
|
35
|
+
"@dbx-tools/shared-auth": "^0.9.181",
|
|
36
|
+
"@dbx-tools/shared-core": "^0.9.181",
|
|
37
|
+
"@dbx-tools/shared-genie": "^0.9.181",
|
|
38
|
+
"@dbx-tools/shared-mastra": "^0.9.181",
|
|
39
|
+
"@dbx-tools/shared-model": "^0.9.181",
|
|
40
|
+
"@dbx-tools/ui": "^0.9.181",
|
|
41
41
|
"@mastra/client-js": "1.50.0",
|
|
42
42
|
"@mastra/core": "1.71.0",
|
|
43
43
|
"@tanstack/react-table": "^8.21.3",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"version": "0.9.
|
|
58
|
+
"version": "0.9.181",
|
|
59
59
|
"types": "index.ts",
|
|
60
60
|
"dbxToolsConfig": {
|
|
61
61
|
"tags": [
|
package/src/react/bubbles.tsx
CHANGED
|
@@ -339,8 +339,8 @@ type AssistantBubbleProps = {
|
|
|
339
339
|
feedbackRequest?: string;
|
|
340
340
|
/** Last thumbs the user left on this message, for highlighting. */
|
|
341
341
|
feedbackValue?: FeedbackValue;
|
|
342
|
-
/** MLflow
|
|
343
|
-
|
|
342
|
+
/** MLflow trace link shown only to viewers with `CAN_MANAGE`. */
|
|
343
|
+
mlflowTraceUrl?: string;
|
|
344
344
|
};
|
|
345
345
|
|
|
346
346
|
/** Render one assistant message with tool progress, actions, and optional feedback. */
|
|
@@ -357,7 +357,7 @@ export const AssistantBubble = ({
|
|
|
357
357
|
feedbackMode,
|
|
358
358
|
feedbackRequest,
|
|
359
359
|
feedbackValue,
|
|
360
|
-
|
|
360
|
+
mlflowTraceUrl,
|
|
361
361
|
}: AssistantBubbleProps) => {
|
|
362
362
|
const pendingApprovals = mergePendingApprovals(
|
|
363
363
|
collectPendingApprovals(message.parts),
|
|
@@ -398,7 +398,7 @@ export const AssistantBubble = ({
|
|
|
398
398
|
hasText || activityItems.length > 0 || pendingApprovals.length > 0,
|
|
399
399
|
);
|
|
400
400
|
const hasFooterActions =
|
|
401
|
-
hasText && (isLast || Boolean(onExport) || Boolean(onFeedback) || Boolean(
|
|
401
|
+
hasText && (isLast || Boolean(onExport) || Boolean(onFeedback) || Boolean(mlflowTraceUrl));
|
|
402
402
|
const showFooter = showResponseStatus || hasFooterActions;
|
|
403
403
|
// Charts and tables are placed at inline marker positions in
|
|
404
404
|
// the assistant's prose. `prepare_chart` / `render_data` mint
|
|
@@ -499,21 +499,21 @@ export const AssistantBubble = ({
|
|
|
499
499
|
{...(feedbackValue ? { value: feedbackValue } : {})}
|
|
500
500
|
/>
|
|
501
501
|
)}
|
|
502
|
-
{hasText &&
|
|
502
|
+
{hasText && mlflowTraceUrl && (
|
|
503
503
|
<Tooltip>
|
|
504
504
|
<TooltipTrigger asChild>
|
|
505
505
|
<Button asChild type="button" size="icon" variant="ghost" className="size-7">
|
|
506
506
|
<a
|
|
507
|
-
href={
|
|
507
|
+
href={mlflowTraceUrl}
|
|
508
508
|
target="_blank"
|
|
509
509
|
rel="noreferrer"
|
|
510
|
-
aria-label="Open MLflow
|
|
510
|
+
aria-label="Open MLflow trace"
|
|
511
511
|
>
|
|
512
512
|
<BugIcon className="size-3" />
|
|
513
513
|
</a>
|
|
514
514
|
</Button>
|
|
515
515
|
</TooltipTrigger>
|
|
516
|
-
<TooltipContent>Open MLflow
|
|
516
|
+
<TooltipContent>Open MLflow trace</TooltipContent>
|
|
517
517
|
</Tooltip>
|
|
518
518
|
)}
|
|
519
519
|
{showResponseStatus && (
|
|
@@ -65,6 +65,17 @@ export function messageFeedbackDestination(
|
|
|
65
65
|
return undefined;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
/** Build the Databricks MLflow detail URL for one captured trace. */
|
|
69
|
+
export function mlflowTraceUrl(experimentUrl: string, traceId?: string): string | undefined {
|
|
70
|
+
const resolvedTraceId = traceId?.trim();
|
|
71
|
+
if (!resolvedTraceId) return undefined;
|
|
72
|
+
const url = new URL(experimentUrl);
|
|
73
|
+
url.pathname = `${url.pathname.replace(/\/+$/, "")}/traces/${encodeURIComponent(resolvedTraceId)}`;
|
|
74
|
+
url.search = "";
|
|
75
|
+
url.hash = "";
|
|
76
|
+
return url.toString();
|
|
77
|
+
}
|
|
78
|
+
|
|
68
79
|
/** Submit feedback to the destination selected for the assistant message. */
|
|
69
80
|
export function useChatFeedback({
|
|
70
81
|
activeKey,
|
|
@@ -150,6 +150,17 @@ export const ChatThreadLayout = ({
|
|
|
150
150
|
...(onCancelThread ? { onCancel: onCancelThread } : {}),
|
|
151
151
|
...(threadSidebarHeaderActions ? { headerActions: threadSidebarHeaderActions } : {}),
|
|
152
152
|
};
|
|
153
|
+
const threadTabListProps: Omit<ThreadSidebarProps, "onHide" | "side" | "className"> = {
|
|
154
|
+
threads: threadListProps.threads,
|
|
155
|
+
...(threadListProps.activeThreadId ? { activeThreadId: threadListProps.activeThreadId } : {}),
|
|
156
|
+
streamingThreadIds: threadListProps.streamingThreadIds,
|
|
157
|
+
isLoading: threadListProps.isLoading,
|
|
158
|
+
onSelect: threadListProps.onSelect,
|
|
159
|
+
...(threadListProps.onNew ? { onNew: threadListProps.onNew } : {}),
|
|
160
|
+
...(threadListProps.onDelete ? { onDelete: threadListProps.onDelete } : {}),
|
|
161
|
+
...(threadListProps.onRename ? { onRename: threadListProps.onRename } : {}),
|
|
162
|
+
...(threadListProps.onCancel ? { onCancel: threadListProps.onCancel } : {}),
|
|
163
|
+
};
|
|
153
164
|
|
|
154
165
|
const [openTabIds, setOpenTabIds] = useState<string[]>([]);
|
|
155
166
|
const tabsSeededRef = useRef(false);
|
|
@@ -200,7 +211,7 @@ export const ChatThreadLayout = ({
|
|
|
200
211
|
<div className="flex h-full min-w-0 flex-1 flex-col">
|
|
201
212
|
{tabbedThreads && (
|
|
202
213
|
<ThreadTabs
|
|
203
|
-
{...
|
|
214
|
+
{...threadTabListProps}
|
|
204
215
|
openThreadIds={openTabIds}
|
|
205
216
|
onCloseTab={closeTab}
|
|
206
217
|
actions={threadBarActions}
|
|
@@ -15,7 +15,7 @@ import { isToolUIPart } from "ai";
|
|
|
15
15
|
import { ArrowDownIcon, MessageSquareIcon, RefreshCwIcon, TriangleAlertIcon } from "lucide-react";
|
|
16
16
|
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
17
17
|
import { AssistantBubble, UserBubble } from "./bubbles.tsx";
|
|
18
|
-
import { messageFeedbackDestination } from "./chat-feedback.ts";
|
|
18
|
+
import { messageFeedbackDestination, mlflowTraceUrl } from "./chat-feedback.ts";
|
|
19
19
|
import { SuggestionPills } from "./suggestion-pills.tsx";
|
|
20
20
|
import { isRespondingChatStatus, type ChatViewProps } from "./types.ts";
|
|
21
21
|
import { messageText } from "../support/export.ts";
|
|
@@ -241,6 +241,9 @@ export const ChatTranscript = ({
|
|
|
241
241
|
feedbackModes,
|
|
242
242
|
messageFeedback?.traceId,
|
|
243
243
|
);
|
|
244
|
+
const traceUrl = mlflowExperimentUrl
|
|
245
|
+
? mlflowTraceUrl(mlflowExperimentUrl, messageFeedback?.traceId)
|
|
246
|
+
: undefined;
|
|
244
247
|
const requestMessage = [...messages.slice(0, index)]
|
|
245
248
|
.reverse()
|
|
246
249
|
.find((candidate) => candidate.role === "user");
|
|
@@ -268,7 +271,7 @@ export const ChatTranscript = ({
|
|
|
268
271
|
: {}),
|
|
269
272
|
}
|
|
270
273
|
: {})}
|
|
271
|
-
{...(
|
|
274
|
+
{...(traceUrl ? { mlflowTraceUrl: traceUrl } : {})}
|
|
272
275
|
/>
|
|
273
276
|
);
|
|
274
277
|
}
|
|
@@ -113,11 +113,13 @@ export const FeedbackControls = ({
|
|
|
113
113
|
</Button>
|
|
114
114
|
</DialogTrigger>
|
|
115
115
|
</TooltipTrigger>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
{!open && (
|
|
117
|
+
<TooltipContent>
|
|
118
|
+
{canComment ? "Leave written feedback" : "Rate the response first"}
|
|
119
|
+
</TooltipContent>
|
|
120
|
+
)}
|
|
119
121
|
</Tooltip>
|
|
120
|
-
<DialogContent className="sm:max-w-md">
|
|
122
|
+
<DialogContent className="max-h-[calc(100dvh-1rem)] w-[calc(100vw-1rem)] overflow-y-auto sm:max-w-md">
|
|
121
123
|
<DialogHeader>
|
|
122
124
|
<DialogTitle>Share feedback</DialogTitle>
|
|
123
125
|
</DialogHeader>
|
|
@@ -109,7 +109,7 @@ export const ThreadActions = ({
|
|
|
109
109
|
<PopoverContent
|
|
110
110
|
align="end"
|
|
111
111
|
aria-label="Conversation history"
|
|
112
|
-
className="w-72 p-0"
|
|
112
|
+
className="max-h-[calc(100dvh-1rem)] w-72 max-w-[calc(100vw-1rem)] overflow-hidden p-0"
|
|
113
113
|
onOpenAutoFocus={(event) => event.preventDefault()}
|
|
114
114
|
onCloseAutoFocus={(event) => event.preventDefault()}
|
|
115
115
|
onFocusOutside={(event) => event.preventDefault()}
|
|
@@ -137,7 +137,7 @@ export const ThreadActions = ({
|
|
|
137
137
|
},
|
|
138
138
|
}
|
|
139
139
|
: {})}
|
|
140
|
-
className="h-96 w-full border-none"
|
|
140
|
+
className="h-96 max-h-[calc(100dvh-1rem)] w-full border-none"
|
|
141
141
|
/>
|
|
142
142
|
</PopoverContent>
|
|
143
143
|
</Popover>
|