@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.
package/dist/index.es.js
CHANGED
|
@@ -3916,7 +3916,7 @@ const useAutoscroll = (ref, { enabled = true }) => {
|
|
|
3916
3916
|
}, [enabled, ref]);
|
|
3917
3917
|
};
|
|
3918
3918
|
|
|
3919
|
-
const Thread = ({ ToolFallback }) => {
|
|
3919
|
+
const Thread = ({ ToolFallback, agentName }) => {
|
|
3920
3920
|
const areaRef = useRef(null);
|
|
3921
3921
|
useAutoscroll(areaRef, { enabled: true });
|
|
3922
3922
|
const WrappedAssistantMessage = (props) => {
|
|
@@ -3925,7 +3925,7 @@ const Thread = ({ ToolFallback }) => {
|
|
|
3925
3925
|
return /* @__PURE__ */ jsxs(ThreadPrimitive.Root, { className: "max-w-[568px] w-full mx-auto h-[calc(100%-100px)] px-4", children: [
|
|
3926
3926
|
/* @__PURE__ */ jsxs(ThreadPrimitive.Viewport, { className: "py-10 overflow-y-auto scroll-smooth h-full", ref: areaRef, autoScroll: false, children: [
|
|
3927
3927
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
3928
|
-
/* @__PURE__ */ jsx(ThreadWelcome, {}),
|
|
3928
|
+
/* @__PURE__ */ jsx(ThreadWelcome, { agentName }),
|
|
3929
3929
|
/* @__PURE__ */ jsx(
|
|
3930
3930
|
ThreadPrimitive.Messages,
|
|
3931
3931
|
{
|
|
@@ -3942,9 +3942,19 @@ const Thread = ({ ToolFallback }) => {
|
|
|
3942
3942
|
/* @__PURE__ */ jsx(Composer, {})
|
|
3943
3943
|
] });
|
|
3944
3944
|
};
|
|
3945
|
-
const ThreadWelcome = () => {
|
|
3945
|
+
const ThreadWelcome = ({ agentName }) => {
|
|
3946
|
+
const safeAgentName = agentName ?? "";
|
|
3947
|
+
const words = safeAgentName.split(" ") ?? [];
|
|
3948
|
+
let initials = "A";
|
|
3949
|
+
if (words.length === 2) {
|
|
3950
|
+
initials = `${words[0][0]}${words[1][0]}`;
|
|
3951
|
+
} else if (safeAgentName.length > 0) {
|
|
3952
|
+
initials = `${safeAgentName[0]}`;
|
|
3953
|
+
} else {
|
|
3954
|
+
initials = "A";
|
|
3955
|
+
}
|
|
3946
3956
|
return /* @__PURE__ */ jsx(ThreadPrimitive.Empty, { children: /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-grow flex-col items-center justify-center", children: [
|
|
3947
|
-
/* @__PURE__ */ jsx(Avatar, { children: /* @__PURE__ */ jsx(AvatarFallback, { children:
|
|
3957
|
+
/* @__PURE__ */ jsx(Avatar, { children: /* @__PURE__ */ jsx(AvatarFallback, { children: initials }) }),
|
|
3948
3958
|
/* @__PURE__ */ jsx("p", { className: "mt-4 font-medium", children: "How can I help you today?" })
|
|
3949
3959
|
] }) });
|
|
3950
3960
|
};
|
|
@@ -4335,7 +4345,7 @@ const AgentChat = ({
|
|
|
4335
4345
|
refreshThreadList,
|
|
4336
4346
|
modelSettings,
|
|
4337
4347
|
chatWithGenerate,
|
|
4338
|
-
children: /* @__PURE__ */ jsx("div", { className: "h-full pb-4", children: /* @__PURE__ */ jsx(Thread, {}) })
|
|
4348
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-full pb-4", children: /* @__PURE__ */ jsx(Thread, { agentName: agentName ?? "" }) })
|
|
4339
4349
|
}
|
|
4340
4350
|
);
|
|
4341
4351
|
};
|