diff --git a/apps/web/components/brain-home/brain-home-view.tsx b/apps/web/components/brain-home/brain-home-view.tsx index 7cce0e27..3be036fc 100644 --- a/apps/web/components/brain-home/brain-home-view.tsx +++ b/apps/web/components/brain-home/brain-home-view.tsx @@ -23,6 +23,7 @@ type RecentDoc = { id?: string title?: string | null createdAt?: string | Date | null + updatedAt?: string | Date | null } function useBrainOverview() { @@ -52,6 +53,27 @@ function useBrainOverview() { enabled, }) + const lastUpdated = useQuery({ + queryKey: ["brain-last-updated", org?.id], + queryFn: async () => { + const res = await $fetch("@post/documents/documents", { + body: { + page: 1, + limit: 1, + sort: "updatedAt", + order: "desc", + containerTags: [], + }, + disableValidation: true, + }) + if (res.error) return null + const docs = (res.data as { documents?: RecentDoc[] })?.documents + return docs?.[0]?.updatedAt ?? null + }, + staleTime: 60_000, + enabled, + }) + const connectors = useQuery({ queryKey: ["brain-home", "connectors"], queryFn: async () => { @@ -112,6 +134,7 @@ function useBrainOverview() { return { loading: docs.isPending, recentDocs: docs.data?.documents ?? [], + lastUpdatedAt: lastUpdated.data ?? null, memoriesCount, connectedCount, membersCount: org?.members?.length ?? 0, @@ -127,6 +150,7 @@ export function BrainHomeView() { const stepsDone = [o.hasSource, o.hasAgent, o.hasMemory].filter( Boolean, ).length + const showGettingStarted = !o.loading && stepsDone < 3 return (