"use client"; import type { DefaultReactSuggestionItem, SuggestionMenuProps } from "@blocknote/react"; import { Sparkles } from "lucide-react"; import { useTranslations } from "next-intl"; import type React from "react"; import { RoundPageContainer } from "../../../../components/containers/RoundPageContainer"; import type { MentionResolveFn } from "../../../../components/editors/BlockNoteEditorMentionInlineContent"; import type { MentionItem } from "../../../../components/editors/BlockNoteEditorSuggestionMenuController"; import { SectionHeader } from "../../../../components/typography"; import { Modules } from "../../../../core"; import type { ApprovalActionRenderer, MentionRenderer } from "../../../assistant-message/components/MessageItem"; import { useAssistantContext } from "../../contexts/AssistantContext"; import { AssistantBlockNoteComposer } from "../parts/AssistantBlockNoteComposer"; import { AssistantSidebar } from "../parts/AssistantSidebar"; import { AssistantThread } from "../parts/AssistantThread"; import { AssistantThreadHeader } from "../parts/AssistantThreadHeader"; interface Props { renderApprovalAction?: ApprovalActionRenderer; renderMention?: MentionRenderer; mentionSearchFn?: (query: string, params?: Record) => Promise; mentionSearchParams?: Record; mentionResolveFn?: MentionResolveFn; /** * Custom mention menu for the composer. Without one BlockNote renders its * default menu, which keys rows on the item title — duplicate entity names * then collide. */ suggestionMenuComponent?: React.FC>; /** Rendered inside the sidebar's details panel above the thread list. */ detailsTitle: string; detailsIcon: React.ReactNode; /** * Disables the composer for a reason external to this component (e.g. the * consuming app's credit gate) — ORed with the in-flight `ctx.sending` * disable, never replacing it. */ disabled?: boolean; } /** * Full-page assistant: the thread list lives in the page's details panel and * the conversation fills the card. Unlike `AssistantContainer` the composer is * the BlockNote one, so the very first message of a thread can carry mentions. */ export function AssistantPageContainer({ renderApprovalAction, renderMention, mentionSearchFn, mentionSearchParams, mentionResolveFn, suggestionMenuComponent, detailsTitle, detailsIcon, disabled, }: Props) { const t = useTranslations(); const ctx = useAssistantContext(); const showThread = !!ctx.assistant || ctx.sending || ctx.messages.length > 0; return ( } >
{showThread ? ( <> {ctx.assistant ? ( ctx.renameThread(ctx.assistant!.id, title)} onDelete={() => ctx.deleteThread(ctx.assistant!.id)} /> ) : (
)} ) : (
{t("features.assistant.empty_state.title")}

{t("features.assistant.empty_state.subtitle")}

)} ctx.sendMessage(content, { contentBlocks: opts.contentBlocks })} disabled={ctx.sending || disabled} mentionSearchFn={mentionSearchFn} mentionSearchParams={mentionSearchParams} mentionResolveFn={mentionResolveFn} suggestionMenuComponent={suggestionMenuComponent} />
); }