@mastra/playground-ui 5.0.2-alpha.0 → 5.0.2-alpha.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.
|
@@ -2,5 +2,9 @@ import { ToolCallContentPartComponent } from '@assistant-ui/react';
|
|
|
2
2
|
|
|
3
3
|
export interface ThreadProps {
|
|
4
4
|
ToolFallback?: ToolCallContentPartComponent;
|
|
5
|
+
agentName?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const Thread: ({ ToolFallback, agentName }: ThreadProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export interface ThreadWelcomeProps {
|
|
9
|
+
agentName?: string;
|
|
5
10
|
}
|
|
6
|
-
export declare const Thread: ({ ToolFallback }: ThreadProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/index.cjs.js
CHANGED
|
@@ -3948,7 +3948,7 @@ const useAutoscroll = (ref, { enabled = true }) => {
|
|
|
3948
3948
|
}, [enabled, ref]);
|
|
3949
3949
|
};
|
|
3950
3950
|
|
|
3951
|
-
const Thread = ({ ToolFallback }) => {
|
|
3951
|
+
const Thread = ({ ToolFallback, agentName }) => {
|
|
3952
3952
|
const areaRef = React.useRef(null);
|
|
3953
3953
|
useAutoscroll(areaRef, { enabled: true });
|
|
3954
3954
|
const WrappedAssistantMessage = (props) => {
|
|
@@ -3957,7 +3957,7 @@ const Thread = ({ ToolFallback }) => {
|
|
|
3957
3957
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Root, { className: "max-w-[568px] w-full mx-auto h-[calc(100%-100px)] px-4", children: [
|
|
3958
3958
|
/* @__PURE__ */ jsxRuntime.jsxs(react.ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
|
|
3959
3959
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3960
|
-
/* @__PURE__ */ jsxRuntime.jsx(ThreadWelcome, {}),
|
|
3960
|
+
/* @__PURE__ */ jsxRuntime.jsx(ThreadWelcome, { agentName }),
|
|
3961
3961
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3962
3962
|
react.ThreadPrimitive.Messages,
|
|
3963
3963
|
{
|
|
@@ -3974,9 +3974,19 @@ const Thread = ({ ToolFallback }) => {
|
|
|
3974
3974
|
/* @__PURE__ */ jsxRuntime.jsx(Composer, {})
|
|
3975
3975
|
] });
|
|
3976
3976
|
};
|
|
3977
|
-
const ThreadWelcome = () => {
|
|
3977
|
+
const ThreadWelcome = ({ agentName }) => {
|
|
3978
|
+
const safeAgentName = agentName ?? "";
|
|
3979
|
+
const words = safeAgentName.split(" ") ?? [];
|
|
3980
|
+
let initials = "A";
|
|
3981
|
+
if (words.length === 2) {
|
|
3982
|
+
initials = `${words[0][0]}${words[1][0]}`;
|
|
3983
|
+
} else if (safeAgentName.length > 0) {
|
|
3984
|
+
initials = `${safeAgentName[0]}`;
|
|
3985
|
+
} else {
|
|
3986
|
+
initials = "A";
|
|
3987
|
+
}
|
|
3978
3988
|
return /* @__PURE__ */ jsxRuntime.jsx(react.ThreadPrimitive.Empty, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-grow flex-col items-center justify-center", children: [
|
|
3979
|
-
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { children:
|
|
3989
|
+
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { children: initials }) }),
|
|
3980
3990
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
|
|
3981
3991
|
] }) });
|
|
3982
3992
|
};
|
|
@@ -4367,7 +4377,7 @@ const AgentChat = ({
|
|
|
4367
4377
|
refreshThreadList,
|
|
4368
4378
|
modelSettings,
|
|
4369
4379
|
chatWithGenerate,
|
|
4370
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4", children: /* @__PURE__ */ jsxRuntime.jsx(Thread, {}) })
|
|
4380
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full pb-4", children: /* @__PURE__ */ jsxRuntime.jsx(Thread, { agentName: agentName ?? "" }) })
|
|
4371
4381
|
}
|
|
4372
4382
|
);
|
|
4373
4383
|
};
|