Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(agent): Recent conversations styling issues (#14148)

Ben Bachem5283301c899b
diff --git a/web/src/components/nav/in-app-ai-agent-button.tsx b/web/src/components/nav/in-app-ai-agent-button.tsx
index 60d3a94965..65b2a6f0d8 100644
--- a/web/src/components/nav/in-app-ai-agent-button.tsx
+++ b/web/src/components/nav/in-app-ai-agent-button.tsx
@@ -26,6 +26,8 @@ import { useQueryProjectOrOrganization } from "@/src/features/projects/hooks";
import { useSupportDrawer } from "@/src/features/support-chat/SupportDrawerProvider";
import { cn } from "@/src/utils/tailwind";
+const IN_APP_AI_AGENT_WINDOW_Z_INDEX = 51;
+
export const InAppAiAgentButton = () => {
const { organization } = useQueryProjectOrOrganization();
const { isAvailable, open, setOpen, isExpanded, setIsExpanded } =
@@ -129,14 +131,19 @@ export const InAppAiAgentButton = () => {
ref={panelRef}
data-ignore-outside-interaction
className={cn(
- "fixed z-51 origin-top-left",
+ "fixed origin-top-left",
isExpanded
? "inset-x-3 top-[calc(var(--banner-offset)+0.75rem)] bottom-3"
: "bottom-2",
)}
- style={isExpanded ? undefined : anchorStyle}
+ style={
+ isExpanded
+ ? { zIndex: IN_APP_AI_AGENT_WINDOW_Z_INDEX }
+ : { ...anchorStyle, zIndex: IN_APP_AI_AGENT_WINDOW_Z_INDEX }
+ }
>
<ControlledInAppAgentWindow
+ zIndex={IN_APP_AI_AGENT_WINDOW_Z_INDEX}
isExpanded={isExpanded}
onExpandedChange={(nextIsExpanded) => {
previousPanelRectRef.current =
diff --git a/web/src/ee/features/in-app-agent/components/ControlledInAppAgentWindow.tsx b/web/src/ee/features/in-app-agent/components/ControlledInAppAgentWindow.tsx
index 899e4e4ca7..f1867e8733 100644
--- a/web/src/ee/features/in-app-agent/components/ControlledInAppAgentWindow.tsx
+++ b/web/src/ee/features/in-app-agent/components/ControlledInAppAgentWindow.tsx
@@ -13,19 +13,23 @@ import {
type AgUiMessage,
} from "@/src/ee/features/in-app-agent/schema";
-type ControlledInAppAgentWindowProps =
- | {
- isExpanded: boolean;
- showCloseButton: false;
- onExpandedChange: (isExpanded: boolean) => void;
- onClose?: () => void;
- }
- | {
- isExpanded: boolean;
- showCloseButton?: true;
- onExpandedChange: (isExpanded: boolean) => void;
- onClose: () => void;
- };
+type ControlledInAppAgentWindowBaseProps = {
+ zIndex?: number;
+ isExpanded: boolean;
+ onExpandedChange: (isExpanded: boolean) => void;
+};
+
+type ControlledInAppAgentWindowProps = ControlledInAppAgentWindowBaseProps &
+ (
+ | {
+ showCloseButton: false;
+ onClose?: () => void;
+ }
+ | {
+ showCloseButton?: true;
+ onClose: () => void;
+ }
+ );
export function ControlledInAppAgentWindow(
props: ControlledInAppAgentWindowProps,
@@ -223,6 +227,7 @@ export function ControlledInAppAgentWindow(
messages={drawerMessages}
conversations={conversations}
hasMoreConversations={hasMoreConversations}
+ zIndex={props.zIndex}
isLoadingMoreConversations={isLoadingMoreConversations}
selectedConversationId={selectedConversationId}
onLoadMoreConversations={loadMoreConversations}
diff --git a/web/src/ee/features/in-app-agent/components/InAppAgentWindow.tsx b/web/src/ee/features/in-app-agent/components/InAppAgentWindow.tsx
index e5fbc27296..1842b1e715 100644
--- a/web/src/ee/features/in-app-agent/components/InAppAgentWindow.tsx
+++ b/web/src/ee/features/in-app-agent/components/InAppAgentWindow.tsx
@@ -64,6 +64,7 @@ export type InAppAgentWindowProps = {
onSelectConversation: (conversationId: string) => void;
onSubmit: (input: string) => boolean | Promise<boolean>;
selectedConversationId: string | undefined;
+ zIndex?: number;
} & InAppAgentWindowCloseButtonProps;
export function InAppAgentWindow(props: InAppAgentWindowProps) {
@@ -81,6 +82,7 @@ export function InAppAgentWindow(props: InAppAgentWindowProps) {
onSelectConversation,
onSubmit,
selectedConversationId,
+ zIndex,
} = props;
const viewportRef = useRef<HTMLDivElement>(null);
const scrollPositionRef = useRef<{
@@ -170,7 +172,13 @@ export function InAppAgentWindow(props: InAppAgentWindowProps) {
<History className="size-3" />
</Button>
</DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="w-64">
+ <DropdownMenuContent
+ align="end"
+ className="max-h-80 w-64 overflow-y-auto"
+ style={
+ typeof zIndex === "number" ? { zIndex: zIndex + 1 } : undefined
+ }
+ >
<DropdownMenuLabel>Recent conversations</DropdownMenuLabel>
<DropdownMenuSeparator />
{conversations.length === 0 ? (
diff --git a/web/src/ee/features/in-app-agent/components/InAppAiAgentProvider.tsx b/web/src/ee/features/in-app-agent/components/InAppAiAgentProvider.tsx
index b4f39477d7..9f2c637d62 100644
--- a/web/src/ee/features/in-app-agent/components/InAppAiAgentProvider.tsx
+++ b/web/src/ee/features/in-app-agent/components/InAppAiAgentProvider.tsx
@@ -402,12 +402,16 @@ function InAppAiAgentProviderInner({
const selectConversation = useCallback(
(conversationId: string | null) => {
+ if (isRunning || conversationId === selectedConversationId) {
+ return;
+ }
+
setError(null);
resetAgent();
setMessages([]);
setSelectedConversationId(conversationId);
},
- [resetAgent, setSelectedConversationId],
+ [isRunning, resetAgent, selectedConversationId, setSelectedConversationId],
);
const submit = useCallback(