"use client"; import { RoundPageContainer } from "../../../../components/containers/RoundPageContainer"; import { Modules } from "../../../../core"; import type { ApprovalActionRenderer } from "../../../assistant-message/components/MessageItem"; import { useAssistantContext } from "../../contexts/AssistantContext"; import { AssistantSidebar } from "../parts/AssistantSidebar"; import { AssistantEmptyState } from "../parts/AssistantEmptyState"; import { AssistantThreadHeader } from "../parts/AssistantThreadHeader"; import { AssistantThread } from "../parts/AssistantThread"; import { AssistantComposer } from "../parts/AssistantComposer"; interface Props { /** * Optional renderer for `approval-request` messages (operator engine). The * approval card component lives in the consuming app, which registers the * AssistantAction module; without this prop those messages fall back to the * plain markdown bubble. */ renderApprovalAction?: ApprovalActionRenderer; } export function AssistantContainer({ renderApprovalAction }: Props = {}) { 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)} /> ) : (
)} )}
); }