diff --git a/frontend-web/src/components/workspace/messages/message-list-item.tsx b/frontend-web/src/components/workspace/messages/message-list-item.tsx index 48ad91e0..5d46e258 100644 --- a/frontend-web/src/components/workspace/messages/message-list-item.tsx +++ b/frontend-web/src/components/workspace/messages/message-list-item.tsx @@ -1,13 +1,13 @@ import type { Message } from "@langchain/langgraph-sdk"; import { ClockIcon, FileIcon, Loader2Icon } from "lucide-react"; -import { - memo, - useCallback, - useContext, - useMemo, - type AnchorHTMLAttributes, - type ImgHTMLAttributes, -} from "react"; +import { + memo, + useCallback, + useContext, + useMemo, + type AnchorHTMLAttributes, + type ImgHTMLAttributes, +} from "react"; import rehypeKatex from "rehype-katex"; import { Loader } from "@/components/ai-elements/loader"; @@ -116,19 +116,21 @@ function useArtifactResolver(threadId: string): (path: string) => string { ); } -export function MessageListItem({ - className, - message, - isLoading, - threadId, - tokenUsageEnabled = false, +export function MessageListItem({ + className, + fitRowToContent = false, + message, + isLoading, + threadId, + tokenUsageEnabled = false, displaySources = [], extraRehypePlugins, -}: { - className?: string; - message: Message; - isLoading?: boolean; - threadId: string; +}: { + className?: string; + fitRowToContent?: boolean; + message: Message; + isLoading?: boolean; + threadId: string; tokenUsageEnabled?: boolean; displaySources?: RuntimeDisplaySource[]; extraRehypePlugins?: ReturnType; @@ -138,11 +140,16 @@ export function MessageListItem({ extractContentFromMessage(message) ?? extractReasoningContentFromMessage(message) ?? ""; - return ( - + return ( + ) : null; return ( -
+
{filesList} - {parsedHumanContent.pageContext ? ( - - ) : null} {messageResponse && ( - + {messageResponse} )} - -
- ); - } + {parsedHumanContent.pageContext ? ( + + ) : null} + +
+ ); + } return ( @@ -388,33 +395,22 @@ function EmbeddedPageContextCard({ }: { pageContext: EmbeddedPageContext; }) { + const previewText = [pageContext.title, pageContext.url, pageContext.content] + .filter(Boolean) + .join(" | "); + return ( -
- {pageContext.title ? ( -
- {pageContext.title} -
- ) : null} - {pageContext.url ? ( - - {pageContext.url} - - ) : null} - {pageContext.content ? ( -
- {pageContext.content} -
- ) : null} +
+
+ {previewText} +
); } - + /** * Format a wall-clock message time as ``YYYY-MM-DD HH:mm`` for display, plus a * full localized string for the hover title. Returns ``null`` when no/invalid @@ -506,7 +502,7 @@ function isImageFile(filename: string): boolean { * Format bytes to human-readable size string */ function formatBytes(bytes: number): string { - if (bytes === 0) return "—"; + if (bytes === 0) return "0 B"; const kb = bytes / 1024; if (kb < 1024) return `${kb.toFixed(1)} KB`; return `${(kb / 1024).toFixed(1)} MB`; @@ -795,3 +791,4 @@ function groupDisplaySources(sources: RuntimeDisplaySource[]) { function normalizeName(name: string) { return name.toLowerCase().replace(/[^a-z0-9]+/g, ""); } + diff --git a/frontend-web/src/components/workspace/messages/message-list.tsx b/frontend-web/src/components/workspace/messages/message-list.tsx index 33463bf9..e1d8527b 100644 --- a/frontend-web/src/components/workspace/messages/message-list.tsx +++ b/frontend-web/src/components/workspace/messages/message-list.tsx @@ -50,22 +50,26 @@ import { SubtaskCard } from "./subtask-card"; export const MESSAGE_LIST_DEFAULT_PADDING_BOTTOM = 160; export const MESSAGE_LIST_FOLLOWUPS_EXTRA_PADDING_BOTTOM = 80; -export function MessageList({ - className, - threadId, - thread, - paddingBottom = MESSAGE_LIST_DEFAULT_PADDING_BOTTOM, - tokenUsageEnabled = false, +export function MessageList({ + className, + contentClassName, + fitMessageRowsToContent = false, + threadId, + thread, + paddingBottom = MESSAGE_LIST_DEFAULT_PADDING_BOTTOM, + tokenUsageEnabled = false, extraRehypePlugins, onClarificationSubmit, onSetupAgentApprove, onSetupAgentReject, -}: { - className?: string; - threadId: string; - thread: BaseStream; - paddingBottom?: number; - tokenUsageEnabled?: boolean; +}: { + className?: string; + contentClassName?: string; + fitMessageRowsToContent?: boolean; + threadId: string; + thread: BaseStream; + paddingBottom?: number; + tokenUsageEnabled?: boolean; extraRehypePlugins?: ReturnType; onClarificationSubmit?: (answer: string) => void | Promise; onSetupAgentApprove?: (payload: SetupAgentApprovalPayload) => void | Promise; @@ -213,12 +217,17 @@ export function MessageList({ if (thread.isThreadLoading && messages.length === 0) { return ; } - return ( - - - + return ( + + + {groupMessages(messages, (group) => { if (group.type === "human" || group.type === "assistant") { return group.messages.map((msg) => { @@ -233,11 +242,12 @@ export function MessageList({ }) : []; return ( -
-
+
{!isLandingState && (
diff --git a/frontend-web/src/pages/WorkspaceRoutes.tsx b/frontend-web/src/pages/WorkspaceRoutes.tsx index caf4c509..21a384f4 100644 --- a/frontend-web/src/pages/WorkspaceRoutes.tsx +++ b/frontend-web/src/pages/WorkspaceRoutes.tsx @@ -43,6 +43,14 @@ import RoundtablePlanningPage from '@/roundtable-planning/pages/RoundtablePlanni import '@/roundtable-planning/styles/roundtable-planning.css'; import { cn } from '@/lib/utils'; +function isInIframe(): boolean { + try { + return window.self !== window.top; + } catch { + return true; + } +} + export function WorkspaceLayout({ children, pageSidebarCollapsed, @@ -116,6 +124,30 @@ export function ChatRuntime({ children }: { children: ReactNode }) { ); } +function NewChatEntryRoute({ + layoutProps, +}: { + layoutProps: { + pageSidebarCollapsed: boolean; + pageSidebarHidden: boolean; + headerHidden: boolean; + compactWorkspaceSidebar: boolean; + pageSidebarDark: boolean; + }; +}) { + if (isInIframe()) { + return ; + } + + return ( + + + + + + ); +} + export default function WorkspaceRoutes({ pageSidebarCollapsed = false, pageSidebarHidden = false, @@ -149,6 +181,10 @@ export default function WorkspaceRoutes({ } /> + } + />