UNPKG

@assistant-ui/react

Version:

Open-source TypeScript/React library for building production-grade AI chat experiences

33 lines (32 loc) • 1.33 kB
"use client"; import { createActionButton } from "../../utils/createActionButton.js"; import { useActionBarResume } from "@assistant-ui/core/react"; // src/primitives/actionBar/ActionBarResume.ts const useActionBarResume$1 = () => { const { disabled, resume } = useActionBarResume(); if (disabled) return null; return resume; }; /** * A button that answers again in place of an assistant message whose run * stopped before it wrote anything (its tab closed or lost its connection). * It deletes the empty reply and its stored row, then runs again from the * reply's parent, so no branch is left beside it; a runtime that cannot * delete messages starts a new branch instead. It renders disabled unless the * message is the last one on its branch and its run went `staleAfter` * without a heartbeat. A reply that wrote content before its run stopped is a * regular error, answered again with Regenerate. * * @example * ```tsx * <MessagePrimitive.Error> * <ErrorPrimitive.Root> * <ErrorPrimitive.Message /> * <ActionBarPrimitive.Resume>Resume</ActionBarPrimitive.Resume> * </ErrorPrimitive.Root> * </MessagePrimitive.Error> * ``` */ const ActionBarPrimitiveResume = createActionButton("ActionBarPrimitive.Resume", useActionBarResume$1); export { ActionBarPrimitiveResume }; //# sourceMappingURL=ActionBarResume.js.map